ATLAS Offline Software
Loading...
Searching...
No Matches
python.TileCalibTools.TileASCIIParser3 Class Reference
Inheritance diagram for python.TileCalibTools.TileASCIIParser3:
Collaboration diagram for python.TileCalibTools.TileASCIIParser3:

Public Member Functions

 __init__ (self, fileName, calibId)
 getData (self, ros, drawer)
 getDict (self)

Private Attributes

dict __dataDict = {}

Detailed Description

This is a class capable of parsing TileCal conditions data stored in
ASCII files.

Definition at line 1570 of file TileCalibTools.py.

Constructor & Destructor Documentation

◆ __init__()

python.TileCalibTools.TileASCIIParser3.__init__ ( self,
fileName,
calibId )
Input:
- fileName          : input file name
- calibId           : like Trip, ...

Definition at line 1577 of file TileCalibTools.py.

1577 def __init__(self, fileName, calibId):
1578 """
1579 Input:
1580 - fileName : input file name
1581 - calibId : like Trip, ...
1582 """
1583
1584 TileCalibLogger.__init__(self,"TileASCIIParser3")
1585 self.__dataDict = {}
1586 try:
1587 lines = open(fileName,"r").readlines()
1588 except Exception as e:
1589 self.log().error( "TileCalibASCIIParser3::ERROR: Problem opening input file:" )
1590 self.log().error( e )
1591 return
1592
1593 for line in lines:
1594 fields = line.strip().split()
1595 #=== ignore empty and comment lines
1596 if not len(fields) :
1597 continue
1598 if fields[0].startswith("#"):
1599 continue
1600
1601 #=== read in fields
1602 type = fields[0]
1603 frag = fields[1]
1604 data = fields[2:]
1605
1606 #=== check for correct calibId
1607 if type != calibId:
1608 raise Exception("%s is not calibId=%s" % (type, calibId))
1609
1610 #=== decode fragment
1611 if not (frag.startswith('0x') or frag.startswith('-0x')):
1612 raise Exception("Misformated fragment %s" % frag)
1613
1614 frg = int(frag,16)
1615 ros = frg>>8
1616 if frg<0:
1617 mod = (-frg)&255
1618 else:
1619 mod = frg&255
1620
1621 #=== fill dictionary
1622 dictKey = (ros, mod)
1623 self.__dataDict[dictKey] = data
1624
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

Member Function Documentation

◆ getData()

python.TileCalibTools.TileASCIIParser3.getData ( self,
ros,
drawer )

Definition at line 1626 of file TileCalibTools.py.

1626 def getData(self, ros, drawer):
1627 dictKey = (int(ros), int(drawer))
1628 data = self.__dataDict.get(dictKey,[])
1629 return data
1630
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ getDict()

python.TileCalibTools.TileASCIIParser3.getDict ( self)

Definition at line 1632 of file TileCalibTools.py.

1632 def getDict(self):
1633 import copy
1634 return copy.deepcopy(self.__dataDict)

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict = {}
private

Definition at line 1585 of file TileCalibTools.py.


The documentation for this class was generated from the following file: