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 1571 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 1578 of file TileCalibTools.py.

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

1627 def getData(self, ros, drawer):
1628 dictKey = (int(ros), int(drawer))
1629 data = self.__dataDict.get(dictKey,[])
1630 return data
1631
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 1633 of file TileCalibTools.py.

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

Member Data Documentation

◆ __dataDict

python.TileCalibTools.TileASCIIParser3.__dataDict = {}
private

Definition at line 1586 of file TileCalibTools.py.


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