94 keys = geom0.dt.keys()
96 elif muSystem ==
"CSC":
97 keys = geom0.csc.keys()
101 nkeys, nkeysr, nkeyspass, nmoved, nnotmoved = 0,0,0,0,0
102 nfail_toideal, nfail_deltafinal, nfail_lowstat, nfail_nsigma = 0,0,0,0
103 nok_toideal, nok_deltafinal, nok_lowstat, nok_nsigma = 0,0,0,0
108 if len(key) != 3: is_ch =
False
112 ch_g1 = geom0.dt[ch_key]
113 ch_g2 = geomN.dt[ch_key]
115 if len(key) != 4: is_ch =
False
119 ch_g1 = geom0.csc[ch_key]
120 ch_g2 = geomN.csc[ch_key]
124 if ch_key
in movedChamberKeys:
127 if g1.relativeto != g2.relativeto:
128 print(
"%s %s relativeto=\"%s\" versus relativeto=\"%s\"" % (muSystem,
str(key), g1.relativeto, g2.relativeto))
133 if r.postal_address[1:] == ch_key:
138 if is_ch:
print(muSystem,
str(key),
"not found in the report. Continue...")
142 if rep.status !=
"PASS":
143 if is_ch:
print(muSystem,
str(key),
"status is not PASS: %s Continue..." % rep.status)
146 if is_ch: nkeyspass+=1
153 if muSystem ==
"DT" and chWasntMoved:
156 if abs(ch_g2.x) > 2.
or abs(ch_g2.y) > 2.
or abs(ch_g2.phiy) > 0.02
or abs(ch_g2.phiz) > 0.02:
160 print(
"Warning!!!", muSystem,
str(key), \
161 "moved too much with respect to ideal: dx=%.2f mm dy=%.2f mm dphiy=%.2f mrad dphiz=%.2f mrad skipping..." % (ch_g2.x*10, ch_g2.y*10, ch_g2.phiy*1000, ch_g2.phiz*1000))
162 if is_ch
and ok: nok_toideal +=1
167 if abs(rep.deltax.value) > 0.03
or abs(rep.deltay.value) > 0.03
or abs(rep.deltaphiy.value) > 0.0003
or abs(rep.deltaphiz.value) > 0.0006:
170 nfail_deltafinal += 1
171 print(
"Warning!!!", muSystem,
str(key), \
172 "moved too much at final iteration: dx=%.2f mm dy=%.2f mm dphiy=%.2f mrad dphiz=%.2f mrad skipping..." % \
173 (rep.deltax.value*10, rep.deltay.value*10, rep.deltaphiy.value*1000, rep.deltaphiz.value*1000))
175 if abs(rep.deltax.value) > 0.03
or abs(rep.deltaphiy.value) > 0.0003
or abs(rep.deltaphiz.value) > 0.0006:
178 nfail_deltafinal += 1
179 print(
"Warning!!!", muSystem,
str(key), \
180 "moved too much at final iteration: dx=%.2f mm dphiy=%.2f mrad dphiz=%.2f mrad skipping..." % \
181 (rep.deltax.value*10, rep.deltaphiy.value*1000, rep.deltaphiz.value*1000))
182 if is_ch
and ok: nok_deltafinal +=1
185 if rep.deltax.error > 0.5:
189 print(
"Warning!!!", muSystem,
str(key),
"low statistics chamber with too big dx.error = %.2f mm skipping..." % (rep.deltax.error*10.))
190 if is_ch
and ok: nok_lowstat +=1
195 if abs(ch_g1.x - ch_g2.x) < theNSigma * math.sqrt ( rep.deltax.error*rep.deltax.error + 0.02*0.02 ) :
199 print(muSystem,
str(key),
"not moved: xN-x0 = %.3f - %.3f = %.3f < %.3f mm" % \
200 ( ch_g2.x*10., ch_g1.x*10., (ch_g2.x-ch_g1.x)*10., theNSigma * math.sqrt ( rep.deltax.error*rep.deltax.error + 0.02*0.02 )*10.))
202 if ok: chWasntMoved =
False
204 if not ok
or chWasntMoved:
continue
209 movedChamberKeys.append(ch_key)
214 geom0.dt[key] = copy.copy(geomN.dt[key])
216 geom0.csc[key] = copy.copy(geomN.csc[key])
218 nnotmoved = nkeys - nmoved
219 nsig = int(theNSigma)
221 %(muSystem)s REPORT for %(nsig)d sigma policy:
223 %(nkeys)d\t chambers in geometry
224 %(nkeysr)d\t chambers in report
225 %(nkeyspass)d\t have PASS status
226 %(nok_toideal)d\t pass big shift with respect to ideal check
227 %(nok_deltafinal)d\t pass big deltas during final iteration
228 %(nok_lowstat)d\t pass low statistics (or big deltax.error) check
231 %(nnotmoved)d\t chambers not moved
232 Numbers of chambers were not moved due to:
233 %(nfail_toideal)d\t big shift with respect to ideal
234 %(nfail_deltafinal)d\t big deltas during final iteration
235 %(nfail_lowstat)d\t low statistics (or big deltax.error)
236 %(nfail_nsigma)d\t |x_final - x_initial| < nsigma