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