12 from simulation
import add_simulation
15 from svd
import add_svd_reconstruction
16 from ROOT
import Belle2, TH1F, TH2F, TFile
22 simulateJitter =
False
25 b2.set_random_seed(1234)
32 ''' quick check of cluster reconstruction'''
35 '''define histograms'''
40 self.size = TH1F(
"cl_size",
"Cluster Size", 20, 0, 20)
41 self.sizeNew = TH1F(
"clNew_size",
"New Cluster Size", 20, 0, 20)
42 self.time = TH1F(
"cl_time",
"Cluster Time", 300, -100, 200)
43 self.timeNew = TH1F(
"clNew_time",
"New Cluster Time", 300, -100, 200)
44 self.ff = TH1F(
"cl_ff",
"Cluster FirstFrame", 4, -0.4, 3.5)
45 self.ffNew = TH1F(
"clNew_ff",
"New Cluster FirstFrame", 4, -0.4, 3.5)
46 self.charge = TH1F(
"cl_charge",
"Cluster Charge", 300, 0, 100)
47 self.chargeNew = TH1F(
"clNew_charge",
"New Cluster Charge", 300, 0, 100)
48 self.SNR = TH1F(
"cl_SNR",
"Cluster SNR", 100, 0, 100)
49 self.SNRNew = TH1F(
"clNew_SNR",
"New Cluster SNR", 100, 0, 100)
50 self.position = TH1F(
"cl_position",
"Cluster Position", 300, -6, 6)
51 self.positionNew = TH1F(
"clNew_position",
"New Cluster Position", 300, -6, 6)
52 self.positionSigma = TH1F(
"cl_positionSigma",
"Cluster Position Error", 300, 0, 100)
53 self.positionSigmaNew = TH1F(
"clNew_positionSigma",
"New Cluster Position Error", 300, 0, 100)
54 self.positionS1 = TH1F(
"cl_positionS1",
"Cluster Position Size 1", 300, -6, 6)
55 self.positionS1New = TH1F(
"clNew_positionS1",
"New Cluster Position Size 1", 300, -6, 6)
56 self.positionS1Sigma = TH1F(
"cl_positionS1Sigma",
"Cluster Position Error Size 1", 300, 0, 100)
57 self.positionS1SigmaNew = TH1F(
"clNew_positionS1Sigma",
"New Cluster Position Error Size 1", 300, 0, 100)
58 self.positionS2 = TH1F(
"cl_positionS2",
"Cluster Position Size 2", 300, -6, 6)
59 self.positionS2New = TH1F(
"clNew_positionS2",
"New Cluster Position Size 2", 300, -6, 6)
60 self.positionS2Sigma = TH1F(
"cl_positionS2Sigma",
"Cluster Position Size Error 2", 300, 0, 100)
61 self.positionS2SigmaNew = TH1F(
"clNew_positionS2Sigma",
"New Cluster Position Error Size 2", 300, 0, 100)
62 self.positionS3 = TH1F(
"cl_positionS3",
"Cluster Position Size >2", 300, -6, 6)
63 self.positionS3New = TH1F(
"clNew_positionS3",
"New Cluster Position Size >2", 300, -6, 6)
64 self.positionS3Sigma = TH1F(
"cl_positionS3Sigma",
"Cluster Position Error Size >2", 300, 0, 100)
65 self.positionS3SigmaNew = TH1F(
"clNew_positionS3Sigma",
"New Cluster Position Error Size >2", 300, 0, 100)
66 self.positionPull = TH1F(
"cl_positionPull",
"Cluster Position Pull", 200, -10, 10)
67 self.positionPullNew = TH1F(
"clNew_positionPull",
"New Cluster Position Pull", 200, -10, 10)
68 self.positionPull1 = TH1F(
"cl_positionPull1",
"Cluster Position Pull Size 1", 200, -10, 10)
69 self.positionPull1New = TH1F(
"clNew_positionPull1",
"New Cluster Position Pull Size 1", 200, -10, 10)
70 self.positionPull2 = TH1F(
"cl_positionPull2",
"Cluster Position Pull Size 2", 200, -10, 10)
71 self.positionPull2New = TH1F(
"clNew_positionPull2",
"New Cluster Position Pull Size 2", 200, -10, 10)
72 self.positionPull3 = TH1F(
"cl_positionPull3",
"Cluster Position Pull Size >2", 200, -10, 10)
73 self.positionPull3New = TH1F(
"clNew_positionPull3",
"New Cluster Position Pull Size >2", 200, -10, 10)
81 for layer
in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
82 layerNumber = layer.getLayerNumber()
84 for ladder
in geoCache.getLadders(layer):
87 for sensor
in geoCache.getSensors(ladder):
89 self.test.append(TH2F(
"cl_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
90 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
91 self.testNew.append(TH2F(
"clNew_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
92 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
97 ''' look at cluster and new clusters'''
101 print(
"number of clusters = " + str(clusterList.getEntries()) +
" (old) VS " + str(clusterListNew.getEntries()) +
" (new)")
103 for d
in clusterList:
104 trueList = d.getRelationsTo(
'SVDTrueHits')
108 truePos = trueList[0].getU()
110 truePos = trueList[0].getV()
112 self.size.Fill(d.getSize())
113 self.time.Fill(d.getClsTime())
114 self.ff.Fill(d.getFirstFrame())
115 self.charge.Fill(d.getCharge() / 1000)
116 self.SNR.Fill(d.getSNR())
117 self.position.Fill(d.getPosition())
118 self.positionSigma.Fill(d.getPositionSigma() * 1e4)
120 self.positionS1.Fill(d.getPosition())
121 self.positionS1Sigma.Fill(d.getPositionSigma() * 1e4)
122 self.positionPull1.Fill((d.getPosition() - truePos) / d.getPositionSigma())
124 self.positionS2.Fill(d.getPosition())
125 self.positionS2Sigma.Fill(d.getPositionSigma() * 1e4)
126 self.positionPull2.Fill((d.getPosition() - truePos) / d.getPositionSigma())
128 self.positionS3.Fill(d.getPosition())
129 self.positionS3Sigma.Fill(d.getPositionSigma() * 1e4)
130 self.positionPull3.Fill((d.getPosition() - truePos) / d.getPositionSigma())
132 self.test[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
133 d.getSensorID().getSensorNumber() + isU)
134 self.positionPull.Fill((d.getPosition() - truePos) / d.getPositionSigma())
136 for d
in clusterListNew:
139 trueListNew = d.getRelationsTo(
'SVDTrueHits')
142 truePos = trueListNew[0].getU()
144 truePos = trueListNew[0].getV()
146 self.sizeNew.Fill(d.getSize())
147 self.timeNew.Fill(d.getClsTime())
148 self.ffNew.Fill(d.getFirstFrame())
149 self.chargeNew.Fill(d.getCharge() / 1000)
150 self.SNRNew.Fill(d.getSNR())
151 self.positionNew.Fill(d.getPosition())
152 self.positionSigmaNew.Fill(d.getPositionSigma() * 1e4)
154 self.positionS1New.Fill(d.getPosition())
155 self.positionS1SigmaNew.Fill(d.getPositionSigma() * 1e4)
156 self.positionPull1New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
158 self.positionS2New.Fill(d.getPosition())
159 self.positionS2SigmaNew.Fill(d.getPositionSigma() * 1e4)
160 self.positionPull2New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
162 self.positionS3New.Fill(d.getPosition())
163 self.positionS3SigmaNew.Fill(d.getPositionSigma() * 1e4)
164 self.positionPull3New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
166 self.testNew[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
167 d.getSensorID().getSensorNumber() + isU)
168 self.positionPullNew.Fill((d.getPosition() - truePos) / d.getPositionSigma())
173 f = TFile(
"quicktestSVDClusterOldDefault.root",
"RECREATE")
174 for hist
in self.test:
175 hist.GetXaxis().SetTitle(
"ladder #")
176 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
178 for hist
in self.testNew:
179 hist.GetXaxis().SetTitle(
"ladder #")
180 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
183 self.size.GetXaxis().SetTitle(
"cluster size")
185 self.sizeNew.GetXaxis().SetTitle(
"cluster size")
188 self.time.GetXaxis().SetTitle(
"cluster time (ns)")
190 self.timeNew.GetXaxis().SetTitle(
"cluster time (ns)")
193 self.ff.GetXaxis().SetTitle(
"cluster firstFrame")
195 self.ffNew.GetXaxis().SetTitle(
"cluster firstFrame")
198 self.charge.GetXaxis().SetTitle(
"cluster charge (ke-)")
200 self.chargeNew.GetXaxis().SetTitle(
"cluster charge (ke-)")
201 self.chargeNew.Write()
203 self.SNR.GetXaxis().SetTitle(
"cluster SNR")
205 self.SNRNew.GetXaxis().SetTitle(
"cluster SNR")
208 self.position.GetXaxis().SetTitle(
"cluster position (cm)")
209 self.position.Write()
210 self.positionNew.GetXaxis().SetTitle(
"cluster position (cm)")
211 self.positionNew.Write()
213 self.positionSigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
214 self.positionSigma.Write()
215 self.positionSigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
216 self.positionSigmaNew.Write()
218 self.positionS1.GetXaxis().SetTitle(
"cluster position (cm)")
219 self.positionS1.Write()
220 self.positionS1New.GetXaxis().SetTitle(
"cluster position (cm)")
221 self.positionS1New.Write()
223 self.positionS1Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
224 self.positionS1Sigma.Write()
225 self.positionS1SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
226 self.positionS1SigmaNew.Write()
228 self.positionS2.GetXaxis().SetTitle(
"cluster position (cm)")
229 self.positionS2.Write()
230 self.positionS2New.GetXaxis().SetTitle(
"cluster position (cm)")
231 self.positionS2New.Write()
233 self.positionS2Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
234 self.positionS2Sigma.Write()
235 self.positionS2SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
236 self.positionS2SigmaNew.Write()
238 self.positionS3.GetXaxis().SetTitle(
"cluster position (cm)")
239 self.positionS3.Write()
240 self.positionS3New.GetXaxis().SetTitle(
"cluster position (cm)")
241 self.positionS3New.Write()
243 self.positionS3Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
244 self.positionS3Sigma.Write()
245 self.positionS3SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
246 self.positionS3SigmaNew.Write()
248 self.positionPull.GetXaxis().SetTitle(
"cluster position pull")
249 self.positionPull.Write()
250 self.positionPullNew.GetXaxis().SetTitle(
"cluster position pull")
251 self.positionPullNew.Write()
252 self.positionPull1.GetXaxis().SetTitle(
"cluster position pull")
253 self.positionPull1.Write()
254 self.positionPull1New.GetXaxis().SetTitle(
"cluster position pull")
255 self.positionPull1New.Write()
256 self.positionPull2.GetXaxis().SetTitle(
"cluster position pull")
257 self.positionPull2.Write()
258 self.positionPull2New.GetXaxis().SetTitle(
"cluster position pull")
259 self.positionPull2New.Write()
260 self.positionPull3.GetXaxis().SetTitle(
"cluster position pull")
261 self.positionPull3.Write()
262 self.positionPull3New.GetXaxis().SetTitle(
"cluster position pull")
263 self.positionPull3New.Write()
269 '''quick check of SVDRecoDigits'''
272 '''define histograms'''
277 self.time = TH1F(
"rd_time",
"RecoDigit Time", 300, -100, 200)
278 self.timeNew = TH1F(
"rdNew_time",
"New RecoDigit Time", 300, -100, 200)
279 self.charge = TH1F(
"rd_charge",
"RecoDigit Charge", 300, 0, 100000)
280 self.chargeNew = TH1F(
"rdNew_charge",
"New RecoDigit Charge", 300, 0, 100000)
288 for layer
in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
289 layerNumber = layer.getLayerNumber()
291 for ladder
in geoCache.getLadders(layer):
292 ladderN = ladderN + 1
294 for sensor
in geoCache.getSensors(ladder):
295 sensorN = sensorN + 1
296 self.test.append(TH2F(
"rd_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
297 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
298 self.testNew.append(TH2F(
"rdNew_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
299 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
304 '''look at old and new reco digits'''
309 print(
"number of recodigits = " + str(recodigitList.getEntries()) +
310 " (old) VS " + str(recodigitListNew.getEntries()) +
" (new)")
312 for d
in recodigitList:
313 self.time.Fill(d.getTime())
314 self.charge.Fill(d.getCharge())
318 self.test[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
319 d.getSensorID().getSensorNumber() + isU)
321 for d
in recodigitListNew:
322 self.timeNew.Fill(d.getTime())
323 self.chargeNew.Fill(d.getCharge())
327 self.testNew[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
328 d.getSensorID().getSensorNumber() + isU)
333 f = TFile(
"quicktestSVDRecoDigitOldDefault.root",
"RECREATE")
334 for hist
in self.test:
335 hist.GetXaxis().SetTitle(
"ladder #")
336 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
338 for hist
in self.testNew:
339 hist.GetXaxis().SetTitle(
"ladder #")
340 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
343 self.time.GetXaxis().SetTitle(
"recodigit time (ns)")
345 self.timeNew.GetXaxis().SetTitle(
"recodigit time (ns)")
348 self.charge.GetXaxis().SetTitle(
"recodigit charge (ke-)")
350 self.chargeNew.GetXaxis().SetTitle(
"recodigit charge (ke-)")
351 self.chargeNew.Write()
358 main = b2.create_path()
360 eventinfosetter = b2.register_module(
'EventInfoSetter')
361 eventinfosetter.param(
'expList', expList)
362 eventinfosetter.param(
'runList', [0])
363 eventinfosetter.param(
'evtNumList', [numEvents])
364 main.add_module(eventinfosetter)
365 main.add_module(
'EventInfoPrinter')
366 main.add_module(
'EvtGenInput')
371 usePXDDataReduction=ROIfinding,
372 simulateT0jitter=simulateJitter)
374 add_svd_reconstruction(main)
375 for mod
in main.modules():
376 if(mod.name() ==
"SVDSimpleClusterizer"):
377 mod.param(
"timeAlgorithm", 0)
378 mod.param(
"HeadTailSize", 3)
380 clusterizer = b2.register_module(
'SVDClusterizer')
381 clusterizer.param(
'timeAlgorithm6Samples',
"CoG6")
382 clusterizer.param(
'timeAlgorithm3Samples',
"CoG6")
383 clusterizer.param(
'chargeAlgorithm6Samples',
"MaxSample")
384 clusterizer.param(
'chargeAlgorithm3Samples',
"MaxSample")
385 clusterizer.param(
'positionAlgorithm6Samples',
"OldDefault")
386 clusterizer.param(
'positionAlgorithm3Samples',
"OldDefault")
387 clusterizer.param(
'stripTimeAlgorithm6Samples',
"dontdo")
388 clusterizer.param(
'stripTimeAlgorithm3Samples',
"dontdo")
389 clusterizer.param(
'stripChargeAlgorithm6Samples',
"MaxSample")
390 clusterizer.param(
'stripChargeAlgorithm3Samples',
"MaxSample")
391 clusterizer.param(
'Clusters',
"SVDNewClusters")
392 clusterizer.param(
'useDB',
False)
393 main.add_module(clusterizer)
395 recoDigitCreator = b2.register_module(
'SVDRecoDigitCreator')
396 recoDigitCreator.param(
'timeAlgorithm6Samples',
"CoG6")
397 recoDigitCreator.param(
'timeAlgorithm3Samples',
"CoG6")
398 recoDigitCreator.param(
'chargeAlgorithm6Samples',
"MaxSample")
399 recoDigitCreator.param(
'chargeAlgorithm3Samples',
"MaxSample")
400 recoDigitCreator.param(
'RecoDigits',
"SVDNewRecoDigits")
401 recoDigitCreator.param(
'useDB',
False)
402 main.add_module(recoDigitCreator)
409 main.add_module(
'Progress')
A (simplified) python wrapper for StoreArray.
static GeoCache & getInstance()
Return a reference to the singleton instance.