78 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.)):
79 """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."""
80
81
82 if(stationID!=0
and stationID!=3):
83 print ("cannot save payload, got stationID=%d, unknown" % stationID)
84 sys.exit(1)
85
86 trainValid=True if 0<=trainID and trainID<4 else False
87 barValid = True if 0<=barID and barID<4 else False
88 if(trainValid!=barValid):
89
90 print ("cannot save payload, got trainID=%d, barID=%d" % (trainID,barID))
91 sys.exit(1)
92
93 if trainValid:
94
95
96
97
98 channel=(stationID//3)*16+trainID*4+barID
99
100
101 mydict_helper=self.mydict["data"][channel]
102 mydict_helper['stationID'], mydict_helper['trainID'], mydict_helper['barID'] = stationID, trainID, barID
103 mydict_helper['barWeight'], mydict_helper['barTimeOffset'] = barWeight, barTimeOffset
104 else:
105
106
107 channel=stationID//3
108
109
110 mydict_helper=self.mydict["data"][channel]
111 mydict_helper['stationID']=stationID
112 mydict_helper['timeGlobalOffset'], mydict_helper['timeOffset'] = timeGlobalOffset, timeOffset
113 mydict_helper['timeSlope'], mydict_helper['trainEdge'] = timeSlope, trainEdge
114
115