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 1583 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 1590 of file TileCalibTools.py.

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

Member Function Documentation

◆ getData()

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

Definition at line 1639 of file TileCalibTools.py.

1639 def getData(self, ros, drawer):
1640 dictKey = (int(ros), int(drawer))
1641 data = self.__dataDict.get(dictKey,[])
1642 return data
1643
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132

◆ getDict()

python.TileCalibTools.TileASCIIParser3.getDict ( self)

Definition at line 1645 of file TileCalibTools.py.

1645 def getDict(self):
1646 import copy
1647 return copy.deepcopy(self.__dataDict)

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict = {}
private

Definition at line 1598 of file TileCalibTools.py.


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