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
1609 if not len(fields) :
1610 continue
1611 if fields[0].startswith("#"):
1612 continue
1613
1614
1615 type = fields[0]
1616 frag = fields[1]
1617 data = fields[2:]
1618
1619
1620 if type != calibId:
1621 raise Exception("%s is not calibId=%s" % (type, calibId))
1622
1623
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
1635 dictKey = (ros, mod)
1636 self.__dataDict[dictKey] = data
1637
std::vector< std::string > split(const std::string &s, const std::string &t=":")