1509 def __init__(self, fileName, calibId):
1510 """
1511 Input:
1512 - fileName : input file name
1513 - calibId : like Trip, ...
1514 """
1515
1516 TileCalibLogger.__init__(self,"TileASCIIParser3")
1517 self.__dataDict = {}
1518 try:
1519 lines = open(fileName,"r").readlines()
1520 except Exception as e:
1521 self.log().
error(
"TileCalibASCIIParser3::ERROR: Problem opening input file:" )
1522 self.log().
error( e )
1523 return
1524
1525 for line in lines:
1526 fields = line.strip().
split()
1527
1528 if not len(fields) :
1529 continue
1530 if fields[0].startswith("#"):
1531 continue
1532
1533
1534 type = fields[0]
1535 frag = fields[1]
1536 data = fields[2:]
1537
1538
1539 if type != calibId:
1540 raise Exception("%s is not calibId=%s" % (type, calibId))
1541
1542
1543 if not (frag.startswith('0x') or frag.startswith('-0x')):
1544 raise Exception("Misformated fragment %s" % frag)
1545
1546 frg = int(frag,16)
1547 ros = frg>>8
1548 if frg<0:
1549 mod = (-frg)&255
1550 else:
1551 mod = frg&255
1552
1553
1554 dictKey = (ros, mod)
1555 self.__dataDict[dictKey] = data
1556
std::vector< std::string > split(const std::string &s, const std::string &t=":")