107 """Fill the residual and pull histograms"""
112 for truehit
in truehits:
115 clusters = truehit.getRelationsFrom(
"PXDClusters")
118 for j, cls
in enumerate(clusters):
121 if clusters.weight(j) < 100:
124 mom = truehit.getMomentum()
125 abs_momentum = mom.R()
126 tu = mom.X() / mom.Z()
127 tv = mom.Y() / mom.Z()
128 thetaU = math.atan(tu) * 180 / math.pi
129 thetaV = math.atan(tv) * 180 / math.pi
133 clusterkind = cls.getKind()
138 if clusterkind <= 3
and abs_momentum > 0.02:
156 pull_u = (truehit.getU() - cls.getU()) / cls.getUSigma()
157 pull_v = (truehit.getV() - cls.getV()) / cls.getVSigma()
171 shape_likelyhood = PositionEstimator.getShapeLikelyhood(cls, tu, tv)
172 if shape_likelyhood > 0:
175 offset = PositionEstimator.getClusterOffset(cls, tu, tv)
182 shiftU = sensor_info.getUCellPosition(cls.getUStart())
183 shiftV = sensor_info.getVCellPosition(cls.getVStart())
187 pull_u = (truehit.getU() - shiftU - offset.getU()) / (math.sqrt(offset.getUSigma2()))
188 pull_v = (truehit.getV() - shiftV - offset.getV()) / (math.sqrt(offset.getVSigma2()))
190 self.
hist_map_residual_u[(clusterkind, mode)].Fill(truehit.getU() - shiftU - offset.getU())
191 self.
hist_map_residual_v[(clusterkind, mode)].Fill(truehit.getV() - shiftV - offset.getV())
197 truehit.getV() - shiftV - offset.getV())
200 truehit.getV() - shiftV - offset.getV())
203 truehit.getV() - shiftV - offset.getV())
207 self.
hist_map_residual_u[(clusterkind, mode)].Fill(truehit.getU() - shiftU - offset.getU())
208 self.
hist_map_residual_v[(clusterkind, mode)].Fill(truehit.getV() - shiftV - offset.getV())
214 truehit.getV() - shiftV - offset.getV())
217 truehit.getV() - shiftV - offset.getV())
220 truehit.getV() - shiftV - offset.getV())
226 pull_u = (truehit.getU() - cls.getU()) / cls.getUSigma()
227 pull_v = (truehit.getV() - cls.getV()) / cls.getVSigma()
243 Format and write all histograms and plot them
246 for kind
in range(5):
263 for kind
in range(4):
264 for mode
in range(3):
286 hcoverage = ROOT.TH1F(
"hist_coverage",
'Coverage of corrections', 2, 1, 2)
289 hcoverage.SetLineWidth(2)
290 hcoverage.SetYTitle(
'coverage / %')
291 hcoverage.SetTitle(
'Coverage of cluster shape corrections')
293 print(f
"Coverage of cluster shape corrections is {100.0 * float(self.nfound_offset / self.nclusters):.2f}% ")
294 print(f
"Coverage of cluster shape likelyhoods is {100.0 * float(self.nfound_shapes / self.nclusters):.2f}% ")