84 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):
85 """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."""
86
87
88 if(layerID==-1
and alignType==
"None"):
89 print ("cannot save payload, got layerID=%d and alignType=%s; one of them has to be specified" % layerID, alignType)
90 sys.exit(1)
91 elif(layerID!=-1 and alignType!="None"):
92 print ("cannot save payload, got layerID=%d and alignType=%s; one of them should not be specified" % layerID, alignType)
93 sys.exit(1)
94
95 if(stationID<0
or stationID>=4):
96 print ("cannot save payload, got stationID=%d, unknown" % stationID)
97 sys.exit(1)
98
99 channel=0
100
101
102 if(alignType!=
"None"):
103 channel=stationID*4
104 if(alignType==
"tracker"):
105 channel+=0
106 elif(alignType=="beam"):
107 channel+=1
108 elif(alignType=="RP"):
109 channel+=2
110 elif(alignType=="correction"):
111 channel+=3
112 else:
113 print ("cannot save payload, got alignType=%s, unknown" % alignType)
114 sys.exit(1)
115
116
117 self.mydict["data"][channel]['alignType']=alignType
118
119
121 channel=stationID*4
122 if(0<=layerID
and layerID<4):
123 channel+=layerID
124 else:
125 print ("cannot save payload, got layerID=%d, unknown" % layerID)
126 sys.exit(1)
127
128
129 self.mydict["data"][channel]['layerID']=layerID
130
131
132 mydict_helper=self.mydict["data"][channel]
133 mydict_helper['shiftX'], mydict_helper['shiftY'], mydict_helper['shiftZ'] = shiftX, shiftY, shiftZ
134 mydict_helper['alpha'], mydict_helper['beta'], mydict_helper['gamma'] = alpha, beta, gamma
135 mydict_helper['stationID']=stationID
136
137