85 def append(self, stationID, layerID=-1, alignType="None", shiftX=0.0, shiftY=0.0, shiftZ=0.0, alpha=0.0, beta=0.0, gamma=0.0):
86 """A function that overwrites one slice of the alignment constants in the dictionary. Local constants have to have layerID defined, while alignType is undefined. Global constants have to have alignType defined (tracker/RP/beam/correction) and layerID undefined."""
87
88
89 if(layerID==-1
and alignType==
"None"):
90 print ("cannot save payload, got layerID=%d and alignType=%s; one of them has to be specified" % layerID, alignType)
91 sys.exit(1)
92 elif(layerID!=-1 and alignType!="None"):
93 print ("cannot save payload, got layerID=%d and alignType=%s; one of them should not be specified" % layerID, alignType)
94 sys.exit(1)
95
96 if(stationID<0
or stationID>=4):
97 print ("cannot save payload, got stationID=%d, unknown" % stationID)
98 sys.exit(1)
99
100 channel=0
101
102
103 if(alignType!=
"None"):
104 channel=stationID*4
105 if(alignType==
"tracker"):
106 channel+=0
107 elif(alignType=="beam"):
108 channel+=1
109 elif(alignType=="RP"):
110 channel+=2
111 elif(alignType=="correction"):
112 channel+=3
113 else:
114 print ("cannot save payload, got alignType=%s, unknown" % alignType)
115 sys.exit(1)
116
117
118 self.mydict["data"][channel]['alignType']=alignType
119
120
122 channel=stationID*4
123 if(0<=layerID
and layerID<4):
124 channel+=layerID
125 else:
126 print ("cannot save payload, got layerID=%d, unknown" % layerID)
127 sys.exit(1)
128
129
130 self.mydict["data"][channel]['layerID']=layerID
131
132
133 mydict_helper=self.mydict["data"][channel]
134 mydict_helper['shiftX'], mydict_helper['shiftY'], mydict_helper['shiftZ'] = shiftX, shiftY, shiftZ
135 mydict_helper['alpha'], mydict_helper['beta'], mydict_helper['gamma'] = alpha, beta, gamma
136 mydict_helper['stationID']=stationID
137
138