80 def append(self, stationID, trainID=-1, barID=-1, barWeight=1.0, barTimeOffset=0.0, timeGlobalOffset=0.0, timeOffset=(0.,0.,0.,0.), timeSlope=(0.,0.,0.,0.), trainEdge=(0.,0.,0.,0.,0.)):
81 """A function that overwrites one slice of the ToF parameters in the dictionary. Local ToF parameters have to have both trainID and barID defined, Vertex ToF parameters neither."""
82
83
84 if(stationID!=0
and stationID!=3):
85 print ("cannot save payload, got stationID=%d, unknown" % stationID)
86 sys.exit(1)
87
88 trainValid=True if 0<=trainID and trainID<4 else False
89 barValid = True if 0<=barID and barID<4 else False
90 if(trainValid!=barValid):
91
92 print ("cannot save payload, got trainID=%d, barID=%d" % (trainID,barID))
93 sys.exit(1)
94
95 if trainValid:
96
97
98
99
100 channel=(stationID//3)*16+trainID*4+barID
101
102
103 mydict_helper=self.mydict["data"][channel]
104 mydict_helper['stationID'], mydict_helper['trainID'], mydict_helper['barID'] = stationID, trainID, barID
105 mydict_helper['barWeight'], mydict_helper['barTimeOffset'] = barWeight, barTimeOffset
106 else:
107
108
109 channel=stationID//3
110
111
112 mydict_helper=self.mydict["data"][channel]
113 mydict_helper['stationID']=stationID
114 mydict_helper['timeGlobalOffset'], mydict_helper['timeOffset'] = timeGlobalOffset, timeOffset
115 mydict_helper['timeSlope'], mydict_helper['trainEdge'] = timeSlope, trainEdge
116
117