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
1597 if not len(fields) :
1598 continue
1599 if fields[0].startswith("#"):
1600 continue
1601
1602
1603 type = fields[0]
1604 frag = fields[1]
1605 data = fields[2:]
1606
1607
1608 if type != calibId:
1609 raise Exception("%s is not calibId=%s" % (type, calibId))
1610
1611
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
1623 dictKey = (ros, mod)
1624 self.__dataDict[dictKey] = data
1625
std::vector< std::string > split(const std::string &s, const std::string &t=":")