11from simulation
import add_simulation
14from svd
import add_svd_reconstruction
15from ROOT
import Belle2, TH1F, TH2F, TFile
24b2.set_random_seed(1234)
31 ''' quick check of cluster reconstruction'''
34 '''define histograms'''
39 self.size = TH1F(
"cl_size",
"Cluster Size", 20, 0, 20)
40 self.sizeNew = TH1F(
"clNew_size",
"New Cluster Size", 20, 0, 20)
41 self.time = TH1F(
"cl_time",
"Cluster Time", 300, -100, 200)
42 self.timeNew = TH1F(
"clNew_time",
"New Cluster Time", 300, -100, 200)
43 self.ff = TH1F(
"cl_ff",
"Cluster FirstFrame", 4, -0.4, 3.5)
44 self.ffNew = TH1F(
"clNew_ff",
"New Cluster FirstFrame", 4, -0.4, 3.5)
45 self.charge = TH1F(
"cl_charge",
"Cluster Charge", 300, 0, 100)
46 self.chargeNew = TH1F(
"clNew_charge",
"New Cluster Charge", 300, 0, 100)
47 self.SNR = TH1F(
"cl_SNR",
"Cluster SNR", 100, 0, 100)
48 self.SNRNew = TH1F(
"clNew_SNR",
"New Cluster SNR", 100, 0, 100)
49 self.position = TH1F(
"cl_position",
"Cluster Position", 300, -6, 6)
50 self.positionNew = TH1F(
"clNew_position",
"New Cluster Position", 300, -6, 6)
51 self.positionSigma = TH1F(
"cl_positionSigma",
"Cluster Position Error", 300, 0, 100)
52 self.positionSigmaNew = TH1F(
"clNew_positionSigma",
"New Cluster Position Error", 300, 0, 100)
53 self.positionS1 = TH1F(
"cl_positionS1",
"Cluster Position Size 1", 300, -6, 6)
54 self.positionS1New = TH1F(
"clNew_positionS1",
"New Cluster Position Size 1", 300, -6, 6)
55 self.positionS1Sigma = TH1F(
"cl_positionS1Sigma",
"Cluster Position Error Size 1", 300, 0, 100)
56 self.positionS1SigmaNew = TH1F(
"clNew_positionS1Sigma",
"New Cluster Position Error Size 1", 300, 0, 100)
57 self.positionS2 = TH1F(
"cl_positionS2",
"Cluster Position Size 2", 300, -6, 6)
58 self.positionS2New = TH1F(
"clNew_positionS2",
"New Cluster Position Size 2", 300, -6, 6)
59 self.positionS2Sigma = TH1F(
"cl_positionS2Sigma",
"Cluster Position Size Error 2", 300, 0, 100)
60 self.positionS2SigmaNew = TH1F(
"clNew_positionS2Sigma",
"New Cluster Position Error Size 2", 300, 0, 100)
61 self.positionS3 = TH1F(
"cl_positionS3",
"Cluster Position Size >2", 300, -6, 6)
62 self.positionS3New = TH1F(
"clNew_positionS3",
"New Cluster Position Size >2", 300, -6, 6)
63 self.positionS3Sigma = TH1F(
"cl_positionS3Sigma",
"Cluster Position Error Size >2", 300, 0, 100)
64 self.positionS3SigmaNew = TH1F(
"clNew_positionS3Sigma",
"New Cluster Position Error Size >2", 300, 0, 100)
65 self.positionPull = TH1F(
"cl_positionPull",
"Cluster Position Pull", 200, -10, 10)
66 self.positionPullNew = TH1F(
"clNew_positionPull",
"New Cluster Position Pull", 200, -10, 10)
67 self.positionPull1 = TH1F(
"cl_positionPull1",
"Cluster Position Pull Size 1", 200, -10, 10)
68 self.positionPull1New = TH1F(
"clNew_positionPull1",
"New Cluster Position Pull Size 1", 200, -10, 10)
69 self.positionPull2 = TH1F(
"cl_positionPull2",
"Cluster Position Pull Size 2", 200, -10, 10)
70 self.positionPull2New = TH1F(
"clNew_positionPull2",
"New Cluster Position Pull Size 2", 200, -10, 10)
71 self.positionPull3 = TH1F(
"cl_positionPull3",
"Cluster Position Pull Size >2", 200, -10, 10)
72 self.positionPull3New = TH1F(
"clNew_positionPull3",
"New Cluster Position Pull Size >2", 200, -10, 10)
80 for layer
in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
81 layerNumber = layer.getLayerNumber()
83 for ladder
in geoCache.getLadders(layer):
86 for sensor
in geoCache.getSensors(ladder):
88 self.test.append(TH2F(
"cl_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
89 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
90 self.testNew.append(TH2F(
"clNew_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
91 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
96 ''' look at cluster and new clusters'''
100 print(
"number of clusters = " + str(clusterList.getEntries()) +
" (old) VS " + str(clusterListNew.getEntries()) +
" (new)")
102 for d
in clusterList:
103 trueList = d.getRelationsTo(
'SVDTrueHits')
107 truePos = trueList[0].getU()
109 truePos = trueList[0].getV()
111 self.size.Fill(d.getSize())
112 self.time.Fill(d.getClsTime())
113 self.ff.Fill(d.getFirstFrame())
114 self.charge.Fill(d.getCharge() / 1000)
115 self.SNR.Fill(d.getSNR())
116 self.position.Fill(d.getPosition())
117 self.positionSigma.Fill(d.getPositionSigma() * 1e4)
119 self.positionS1.Fill(d.getPosition())
120 self.positionS1Sigma.Fill(d.getPositionSigma() * 1e4)
121 self.positionPull1.Fill((d.getPosition() - truePos) / d.getPositionSigma())
123 self.positionS2.Fill(d.getPosition())
124 self.positionS2Sigma.Fill(d.getPositionSigma() * 1e4)
125 self.positionPull2.Fill((d.getPosition() - truePos) / d.getPositionSigma())
127 self.positionS3.Fill(d.getPosition())
128 self.positionS3Sigma.Fill(d.getPositionSigma() * 1e4)
129 self.positionPull3.Fill((d.getPosition() - truePos) / d.getPositionSigma())
131 self.test[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
132 d.getSensorID().getSensorNumber() + isU)
133 self.positionPull.Fill((d.getPosition() - truePos) / d.getPositionSigma())
135 for d
in clusterListNew:
138 trueListNew = d.getRelationsTo(
'SVDTrueHits')
141 truePos = trueListNew[0].getU()
143 truePos = trueListNew[0].getV()
145 self.sizeNew.Fill(d.getSize())
146 self.timeNew.Fill(d.getClsTime())
147 self.ffNew.Fill(d.getFirstFrame())
148 self.chargeNew.Fill(d.getCharge() / 1000)
149 self.SNRNew.Fill(d.getSNR())
150 self.positionNew.Fill(d.getPosition())
151 self.positionSigmaNew.Fill(d.getPositionSigma() * 1e4)
153 self.positionS1New.Fill(d.getPosition())
154 self.positionS1SigmaNew.Fill(d.getPositionSigma() * 1e4)
155 self.positionPull1New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
157 self.positionS2New.Fill(d.getPosition())
158 self.positionS2SigmaNew.Fill(d.getPositionSigma() * 1e4)
159 self.positionPull2New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
161 self.positionS3New.Fill(d.getPosition())
162 self.positionS3SigmaNew.Fill(d.getPositionSigma() * 1e4)
163 self.positionPull3New.Fill((d.getPosition() - truePos) / d.getPositionSigma())
165 self.testNew[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
166 d.getSensorID().getSensorNumber() + isU)
167 self.positionPullNew.Fill((d.getPosition() - truePos) / d.getPositionSigma())
172 f = TFile(
"quicktestSVDClusterOldDefault.root",
"RECREATE")
173 for hist
in self.test:
174 hist.GetXaxis().SetTitle(
"ladder #")
175 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
177 for hist
in self.testNew:
178 hist.GetXaxis().SetTitle(
"ladder #")
179 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
182 self.size.GetXaxis().SetTitle(
"cluster size")
184 self.sizeNew.GetXaxis().SetTitle(
"cluster size")
187 self.time.GetXaxis().SetTitle(
"cluster time (ns)")
189 self.timeNew.GetXaxis().SetTitle(
"cluster time (ns)")
192 self.ff.GetXaxis().SetTitle(
"cluster firstFrame")
194 self.ffNew.GetXaxis().SetTitle(
"cluster firstFrame")
197 self.charge.GetXaxis().SetTitle(
"cluster charge (ke-)")
199 self.chargeNew.GetXaxis().SetTitle(
"cluster charge (ke-)")
200 self.chargeNew.Write()
202 self.SNR.GetXaxis().SetTitle(
"cluster SNR")
204 self.SNRNew.GetXaxis().SetTitle(
"cluster SNR")
207 self.position.GetXaxis().SetTitle(
"cluster position (cm)")
208 self.position.Write()
209 self.positionNew.GetXaxis().SetTitle(
"cluster position (cm)")
210 self.positionNew.Write()
212 self.positionSigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
213 self.positionSigma.Write()
214 self.positionSigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
215 self.positionSigmaNew.Write()
217 self.positionS1.GetXaxis().SetTitle(
"cluster position (cm)")
218 self.positionS1.Write()
219 self.positionS1New.GetXaxis().SetTitle(
"cluster position (cm)")
220 self.positionS1New.Write()
222 self.positionS1Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
223 self.positionS1Sigma.Write()
224 self.positionS1SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
225 self.positionS1SigmaNew.Write()
227 self.positionS2.GetXaxis().SetTitle(
"cluster position (cm)")
228 self.positionS2.Write()
229 self.positionS2New.GetXaxis().SetTitle(
"cluster position (cm)")
230 self.positionS2New.Write()
232 self.positionS2Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
233 self.positionS2Sigma.Write()
234 self.positionS2SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
235 self.positionS2SigmaNew.Write()
237 self.positionS3.GetXaxis().SetTitle(
"cluster position (cm)")
238 self.positionS3.Write()
239 self.positionS3New.GetXaxis().SetTitle(
"cluster position (cm)")
240 self.positionS3New.Write()
242 self.positionS3Sigma.GetXaxis().SetTitle(
"cluster position error (#mum)")
243 self.positionS3Sigma.Write()
244 self.positionS3SigmaNew.GetXaxis().SetTitle(
"cluster position error (#mum)")
245 self.positionS3SigmaNew.Write()
247 self.positionPull.GetXaxis().SetTitle(
"cluster position pull")
248 self.positionPull.Write()
249 self.positionPullNew.GetXaxis().SetTitle(
"cluster position pull")
250 self.positionPullNew.Write()
251 self.positionPull1.GetXaxis().SetTitle(
"cluster position pull")
252 self.positionPull1.Write()
253 self.positionPull1New.GetXaxis().SetTitle(
"cluster position pull")
254 self.positionPull1New.Write()
255 self.positionPull2.GetXaxis().SetTitle(
"cluster position pull")
256 self.positionPull2.Write()
257 self.positionPull2New.GetXaxis().SetTitle(
"cluster position pull")
258 self.positionPull2New.Write()
259 self.positionPull3.GetXaxis().SetTitle(
"cluster position pull")
260 self.positionPull3.Write()
261 self.positionPull3New.GetXaxis().SetTitle(
"cluster position pull")
262 self.positionPull3New.Write()
268 '''quick check of SVDRecoDigits'''
271 '''define histograms'''
276 self.time = TH1F(
"rd_time",
"RecoDigit Time", 300, -100, 200)
277 self.timeNew = TH1F(
"rdNew_time",
"New RecoDigit Time", 300, -100, 200)
278 self.charge = TH1F(
"rd_charge",
"RecoDigit Charge", 300, 0, 100000)
279 self.chargeNew = TH1F(
"rdNew_charge",
"New RecoDigit Charge", 300, 0, 100000)
287 for layer
in geoCache.getLayers(Belle2.VXD.SensorInfoBase.SVD):
288 layerNumber = layer.getLayerNumber()
290 for ladder
in geoCache.getLadders(layer):
291 ladderN = ladderN + 1
293 for sensor
in geoCache.getSensors(ladder):
294 sensorN = sensorN + 1
295 self.test.append(TH2F(
"rd_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
296 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
297 self.testNew.append(TH2F(
"rdNew_layer" + str(layerNumber),
"Layer " + str(layerNumber) +
298 " Ladder VS Sensor.Side", ladderN, 0.5, ladderN + 0.5, 2 * sensorN, +0.75, sensorN + 0.75))
303 '''look at old and new reco digits'''
308 print(
"number of recodigits = " + str(recodigitList.getEntries()) +
309 " (old) VS " + str(recodigitListNew.getEntries()) +
" (new)")
311 for d
in recodigitList:
312 self.time.Fill(d.getTime())
313 self.charge.Fill(d.getCharge())
317 self.test[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
318 d.getSensorID().getSensorNumber() + isU)
320 for d
in recodigitListNew:
321 self.timeNew.Fill(d.getTime())
322 self.chargeNew.Fill(d.getCharge())
326 self.testNew[d.getSensorID().getLayerNumber() - 3].Fill(d.getSensorID().getLadderNumber(),
327 d.getSensorID().getSensorNumber() + isU)
332 f = TFile(
"quicktestSVDRecoDigitOldDefault.root",
"RECREATE")
333 for hist
in self.test:
334 hist.GetXaxis().SetTitle(
"ladder #")
335 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
337 for hist
in self.testNew:
338 hist.GetXaxis().SetTitle(
"ladder #")
339 hist.GetYaxis().SetTitle(
"sensor # + 0.5 is isU")
342 self.time.GetXaxis().SetTitle(
"recodigit time (ns)")
344 self.timeNew.GetXaxis().SetTitle(
"recodigit time (ns)")
347 self.charge.GetXaxis().SetTitle(
"recodigit charge (ke-)")
349 self.chargeNew.GetXaxis().SetTitle(
"recodigit charge (ke-)")
350 self.chargeNew.Write()
357main = b2.create_path()
359eventinfosetter = b2.register_module(
'EventInfoSetter')
360eventinfosetter.param(
'expList', expList)
361eventinfosetter.param(
'runList', [0])
362eventinfosetter.param(
'evtNumList', [numEvents])
363main.add_module(eventinfosetter)
364main.add_module(
'EventInfoPrinter')
365main.add_module(
'EvtGenInput')
370 usePXDDataReduction=ROIfinding,
371 simulateT0jitter=simulateJitter)
373add_svd_reconstruction(main)
374for mod
in main.modules():
375 if(mod.name() ==
"SVDSimpleClusterizer"):
376 mod.param(
"timeAlgorithm", 0)
377 mod.param(
"HeadTailSize", 3)
379clusterizer = b2.register_module(
'SVDClusterizer')
380clusterizer.param(
'timeAlgorithm6Samples',
"CoG6")
381clusterizer.param(
'timeAlgorithm3Samples',
"CoG6")
382clusterizer.param(
'chargeAlgorithm6Samples',
"MaxSample")
383clusterizer.param(
'chargeAlgorithm3Samples',
"MaxSample")
384clusterizer.param(
'positionAlgorithm6Samples',
"OldDefault")
385clusterizer.param(
'positionAlgorithm3Samples',
"OldDefault")
386clusterizer.param(
'stripTimeAlgorithm6Samples',
"dontdo")
387clusterizer.param(
'stripTimeAlgorithm3Samples',
"dontdo")
388clusterizer.param(
'stripChargeAlgorithm6Samples',
"MaxSample")
389clusterizer.param(
'stripChargeAlgorithm3Samples',
"MaxSample")
390clusterizer.param(
'Clusters',
"SVDNewClusters")
391clusterizer.param(
'useDB',
False)
392main.add_module(clusterizer)
394recoDigitCreator = b2.register_module(
'SVDRecoDigitCreator')
395recoDigitCreator.param(
'timeAlgorithm6Samples',
"CoG6")
396recoDigitCreator.param(
'timeAlgorithm3Samples',
"CoG6")
397recoDigitCreator.param(
'chargeAlgorithm6Samples',
"MaxSample")
398recoDigitCreator.param(
'chargeAlgorithm3Samples',
"MaxSample")
399recoDigitCreator.param(
'RecoDigits',
"SVDNewRecoDigits")
400recoDigitCreator.param(
'useDB',
False)
401main.add_module(recoDigitCreator)
408main.add_module(
'Progress')
A (simplified) python wrapper for StoreArray.
static GeoCache & getInstance()
Return a reference to the singleton instance.