Belle II Software development
SVDROIDQMModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/modules/roiFinding/svd/SVDROIDQMModule.h>
10#include <svd/dataobjects/SVDShaperDigit.h>
11#include <svd/dataobjects/SVDRecoDigit.h>
12#include <svd/dataobjects/SVDCluster.h>
13#include <tracking/dataobjects/ROIid.h>
14#include <tracking/dataobjects/SVDIntercept.h>
15
16#include <TDirectory.h>
17#include <TH2F.h>
18
19using namespace Belle2;
20
21//-----------------------------------------------------------------
22// Register the Module
23//-----------------------------------------------------------------
24REG_MODULE(SVDROIDQM);
25
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
31 : HistoModule()
32 , m_InterDir(nullptr)
33 , m_ROIDir(nullptr)
34 , hInterDictionary(172, [](const Belle2::VxdID & vxdid) {return (size_t)vxdid.getID(); })
35, hROIDictionary(172, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
36, hROIDictionaryEvt(172, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
37, m_numModules(0)
38, hnROIs(nullptr)
39, hnInter(nullptr)
40, harea(nullptr)
41, hredFactor(nullptr)
42, hCellU(nullptr)
43, hCellV(nullptr)
44, n_events(0)
45{
46 //Set module properties
47 setDescription("Monitor of the ROIs creation on HLT");
48 setPropertyFlags(c_ParallelProcessingCertified);
49
50 addParam("SVDShaperDigitsName", m_SVDShaperDigitsName,
51 "name of the list of SVDShaperDigits", std::string(""));
52 addParam("SVDRecoDigitsName", m_SVDRecoDigitsName,
53 "name of the list of SVDRecoDigits", std::string(""));
54 addParam("SVDClustersName", m_SVDClustersName,
55 "name of the list of SVDClusters", std::string(""));
56
57 addParam("InterceptsName", m_InterceptsName,
58 "name of the list of interceptions", std::string(""));
59
60 addParam("ROIsName", m_ROIsName,
61 "name of the list of ROIs", std::string(""));
62
63 addParam("specificLayer", m_specificLayer,
64 "Layer number, if you want the plots only for a specific SVD layer. If it is not a SVD layer (3, 4, 5, 6) than the plots for all SVD layers are produced. Default is (-1), i.e. plots for all SVD layers are produced.",
65 m_specificLayer);
66
67 addParam("plotRecoDigits", m_plotRecoDigits,
68 "Set true to produce the plots for RecoDigits (false by default)", m_plotRecoDigits);
69
70}
71
73{
74
75 // Create a separate histogram directory and cd into it.
76 TDirectory* oldDir = gDirectory;
77 TDirectory* roiDir = oldDir->mkdir("SVDROIs");
78 m_InterDir = roiDir->mkdir("intercept");
79 m_ROIDir = roiDir->mkdir("roi");
80
81 hCellU = new TH1F("hCellU", "CellID U", 769, -0.5, 768.5);
82 hCellU->GetXaxis()->SetTitle("U cell ID");
83 hCellV = new TH1F("hCellV", "CellID V", 769, -0.5, 768.5);
84 hCellV->GetXaxis()->SetTitle("V cell ID");
85
86 m_InterDir->cd();
87 hnInter = new TH1F("hnInter", "number of intercepts", 100, 0, 100);
88
89 m_ROIDir->cd();
90 hnROIs = new TH1F("hnROIs", "number of ROIs", 100, 0, 100);
91 harea = new TH1F("harea", "ROIs area", 100, 0, 100000);
92 hredFactor = new TH1F("hredFactor", "ROI reduction factor", 1000, 0, 1);
93
94
96
97 oldDir->cd();
98
99}
100
102{
103 REG_HISTOGRAM
104
108 m_ROIs.isRequired(m_ROIsName);
109 m_Intercepts.isRequired(m_InterceptsName);
110
111 n_events = 0;
112
113
114}
115
117{
118
119 n_events++;
120
121 for (auto& it : m_SVDShaperDigits)
122 if (it.isUStrip())
123 hCellU->Fill(it.getCellID());
124 else
125 hCellV->Fill(it.getCellID());
126
127 hnInter->Fill(m_Intercepts.getEntries());
128
129 for (auto& it : m_Intercepts)
131
132
133 for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it)
134 (it->second).value = 0;
135
136 int ROIarea = 0;
137 double redFactor = 0;
138
139 for (auto& it : m_ROIs) {
140
142
143 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
144 const int nPixelsU = aSensorInfo.getUCells();
145 const int nPixelsV = aSensorInfo.getVCells();
146
147 int minU = it.getMinUid();
148 int minV = it.getMinVid();
149 int maxU = it.getMaxUid();
150 int maxV = it.getMaxVid();
151
152 int tmpROIarea = (maxU - minU) * (maxV - minV);
153 ROIarea += tmpROIarea;
154 redFactor += (double)tmpROIarea / (nPixelsU * nPixelsV * m_numModules);
155
156 }
157
158 hnROIs->Fill(m_ROIs.getEntries());
159
160 harea->Fill((double)ROIarea);
161
162 hredFactor->Fill((double)redFactor);
163
164
165 for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it) {
166 ROIHistoAccumulateAndFill aROIHistoAccumulateAndFill = it->second;
167 aROIHistoAccumulateAndFill.fill(aROIHistoAccumulateAndFill.hPtr, aROIHistoAccumulateAndFill.value);
168 }
169
170}
171
173{
174
175 // VXD::GeoCache& aGeometry = VXD::GeoCache::getInstance();
176
177 std::string name; //name of the histogram
178 std::string title; //title of the histogram
179 TH2F* tmp2D; //temporary 2D histo used to set axis title
180 TH1F* tmp1D; //temporary 1D histo used to set axis title
181
182 m_numModules = 0;
183
184 std::set<Belle2::VxdID> svdLayers = m_geoCache.getLayers(VXD::SensorInfoBase::SVD);
185 std::set<Belle2::VxdID>::iterator itSvdLayers = svdLayers.begin();
186
187 if (m_specificLayer >= 3 && m_specificLayer <= 6) {
188 B2INFO("Producing plots for layer: " << m_specificLayer);
189 svdLayers.clear();
190 svdLayers.insert(Belle2::VxdID(m_specificLayer, 0, 0));
191 itSvdLayers = svdLayers.begin();
192 } else {
193 B2INFO("No specific SVD layer (3,4,5,6) selected (m_specificLayer = " << m_specificLayer <<
194 "). Producing plots for all SVD layers.");
195 }
196
197 while (itSvdLayers != svdLayers.end()) {
198
199 std::set<Belle2::VxdID> svdLadders = m_geoCache.getLadders(*itSvdLayers);
200 std::set<Belle2::VxdID>::iterator itSvdLadders = svdLadders.begin();
201
202 while (itSvdLadders != svdLadders.end()) {
203
204 std::set<Belle2::VxdID> svdSensors = m_geoCache.getSensors(*itSvdLadders);
205 std::set<Belle2::VxdID>::iterator itSvdSensors = svdSensors.begin();
206
207 while (itSvdSensors != svdSensors.end()) {
208
209 m_numModules++; //counting the total number of modules
210
211 const VXD::SensorInfoBase& wSensorInfo = m_geoCache.getSensorInfo(*itSvdSensors);
212
213 const int nPixelsU = wSensorInfo.getUCells();
214 const int nPixelsV = wSensorInfo.getVCells();
215 std::string sensorid = std::to_string(itSvdSensors->getLayerNumber()) + "_" + std::to_string(
216 itSvdSensors->getLadderNumber()) + "_" +
217 std::to_string(itSvdSensors->getSensorNumber());
218
219
220 // ------ HISTOGRAMS WITH AN ACCUMULATE PER ROI AND A FILL PER EVENT -------
221 m_ROIDir->cd();
222
223 name = "hNROIs_" + sensorid;
224 title = "number of ROIs for sensor " + sensorid;
225 double value = 0;
227 new TH1F(name.c_str(), title.c_str(), 25, 0, 25),
228 [](const ROIid*, double & val) {val++;},
229 [](TH1 * hPtr, double & val) { hPtr->Fill(val); },
230 value
231 };
232 hROIDictionaryEvt.insert(std::pair< Belle2::VxdID, ROIHistoAccumulateAndFill& > ((Belle2::VxdID)*itSvdSensors, *aHAAF));
233
234
235
236
237 // ------ HISTOGRAMS WITH A FILL PER INTERCEPT -------
238 m_InterDir->cd();
239
240 // coor U and V
241 name = "hCoorU_" + sensorid;
242 title = "U coordinate of the extrapolation in U for sensor " + sensorid;
243 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
244 (
245 (Belle2::VxdID)*itSvdSensors,
247 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
248 [](TH1 * hPtr, const SVDIntercept * inter) { hPtr->Fill(inter->getCoorU()); }
249 )
250 )
251 );
252
253 name = "hCoorV_" + sensorid;
254 title = "V coordinate of the extrapolation in V for sensor " + sensorid;
255 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
256 (
257 (Belle2::VxdID)*itSvdSensors,
259 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
260 [](TH1 * hPtr, const SVDIntercept * inter) { hPtr->Fill(inter->getCoorV()); }
261 )
262 )
263 );
264
265 // Intercept U vs V coordinate
266 name = "hCoorU_vs_CoorV_" + sensorid;
267 title = "U vs V intercept (cm) " + sensorid;
268 tmp2D = new TH2F(name.c_str(), title.c_str(), 100, -5, 5, 100, -5, 5);
269 tmp2D->GetXaxis()->SetTitle("intercept U coor (cm)");
270 tmp2D->GetYaxis()->SetTitle("intercept V coor (cm)");
271 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
272 (
273 (Belle2::VxdID)*itSvdSensors,
275 tmp2D,
276 [](TH1 * hPtr, const SVDIntercept * inter) { hPtr->Fill(inter->getCoorU(), inter->getCoorV()); }
277 )
278 )
279 );
280
281
282 // sigma U and V
283 name = "hStatErrU_" + sensorid;
284 title = "stat error of the extrapolation in U for sensor " + sensorid;
285 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
286 (
287 (Belle2::VxdID)*itSvdSensors,
289 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
290 [](TH1 * hPtr, const SVDIntercept * inter) { hPtr->Fill(inter->getSigmaU()); }
291 )
292 )
293 );
294 name = "hStatErrV_" + sensorid;
295 title = "stat error of the extrapolation in V for sensor " + sensorid;
296 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
297 (
298 (Belle2::VxdID)*itSvdSensors,
300 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
301 [](TH1 * hPtr, const SVDIntercept * inter) { hPtr->Fill(inter->getSigmaV()); }
302 )
303 )
304 );
305
306 //1D residuals
307 name = "hResidU_" + sensorid;
308 title = "U residuals = intercept - digit, for sensor " + sensorid;
309 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
310 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
311 (
312 (Belle2::VxdID)*itSvdSensors,
314 tmp1D,
315 [this](TH1 * hPtr, const SVDIntercept * inter) {
316
317 for (auto& it : this->m_SVDShaperDigits)
318 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
319 if (it.isUStrip()) {
320 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
321 hPtr->Fill(inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID()));
322 }
323 }
324 }
325 )
326 )
327 );
328
329 name = "hResidV_" + sensorid;
330 title = "V residuals = intercept - digit, for sensor " + sensorid;
331 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
332 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
333 (
334 (Belle2::VxdID)*itSvdSensors,
336 tmp1D,
337 [this](TH1 * hPtr, const SVDIntercept * inter) {
338
339 for (auto& it : this->m_SVDShaperDigits)
340 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
341 if (!it.isUStrip()) {
342 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
343 hPtr->Fill(inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID()));
344 }
345 }
346 }
347 )
348 )
349 );
350
351
352 //residual U,V vs coordinate U,V
353 name = "hResidU_vs_CoorU_" + sensorid;
354 title = "U residual (cm) vs coor U (cm) " + sensorid;
355 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
356 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
357 tmp2D->GetXaxis()->SetTitle("U coor (cm)");
358 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
359 (
360 (Belle2::VxdID)*itSvdSensors,
362 tmp2D,
363 [this](TH1 * hPtr, const SVDIntercept * inter) {
364
365 for (auto& it : this->m_SVDShaperDigits)
366 if (((int)it.getSensorID() == (int)inter->getSensorID()) && it.isUStrip()) {
367 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
368 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID());
369 hPtr->Fill(inter->getCoorU(), resid);
370 }
371 }
372 )
373 )
374 );
375
376 name = "hResidV_vs_CoorV_" + sensorid;
377 title = "V residual (cm) vs coor V (cm) " + sensorid;
378 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
379 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
380 tmp2D->GetXaxis()->SetTitle("V coor (cm)");
381 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
382 (
383 (Belle2::VxdID)*itSvdSensors,
385 tmp2D,
386 [this](TH1 * hPtr, const SVDIntercept * inter) {
387
388 for (auto& it : this->m_SVDShaperDigits)
389 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUStrip())) {
390 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
391 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID());
392 hPtr->Fill(inter->getCoorV(), resid);
393 }
394 }
395 )
396 )
397 );
398
399
400 // RecoDigits
401 //residual vs charge
402 if (m_plotRecoDigits) {
403 name = "hResidU_vs_charge_" + sensorid;
404 title = "U residual (cm) vs charge " + sensorid;
405 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
406 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
407 tmp2D->GetXaxis()->SetTitle("charge");
408 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
409 (
410 (Belle2::VxdID)*itSvdSensors,
412 tmp2D,
413 [this](TH1 * hPtr, const SVDIntercept * inter) {
414
415 for (auto& it : this->m_SVDRecoDigits)
416 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (it.isUStrip())) {
417 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
418 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID());
419 hPtr->Fill(it.getCharge(), resid);
420 }
421 }
422 )
423 )
424 );
425
426 name = "hResidV_vs_charge_" + sensorid;
427 title = "V residual (cm) vs charge " + sensorid;
428 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
429 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
430 tmp2D->GetXaxis()->SetTitle("charge");
431 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
432 (
433 (Belle2::VxdID)*itSvdSensors,
435 tmp2D,
436 [this](TH1 * hPtr, const SVDIntercept * inter) {
437
438 for (auto& it : this->m_SVDRecoDigits)
439 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUStrip())) {
440 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
441 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID());
442 hPtr->Fill(it.getCharge(), resid);
443 }
444 }
445 )
446 )
447 );
448 }
449
450 // 1D residual for clusters
451 name = "hClusterResidU_" + sensorid;
452 title = "Cluster U residuals = intercept - cluster, for sensor " + sensorid;
453 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
454 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
455 (
456 (Belle2::VxdID)*itSvdSensors,
458 tmp1D,
459 [this](TH1 * hPtr, const SVDIntercept * inter) {
460
461 for (auto& it : this->m_SVDClusters)
462 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
463 if (it.isUCluster()) {
464 hPtr->Fill(inter->getCoorU() - it.getPosition(inter->getCoorV()));
465 }
466 }
467 }
468 )
469 )
470 );
471
472 name = "hClusterResidV_" + sensorid;
473 title = "Cluster V residuals = intercept - cluster, for sensor " + sensorid;
474 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
475 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
476 (
477 (Belle2::VxdID)*itSvdSensors,
479 tmp1D,
480 [this](TH1 * hPtr, const SVDIntercept * inter) {
481
482 for (auto& it : this->m_SVDClusters)
483 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
484 if (!it.isUCluster()) {
485 hPtr->Fill(inter->getCoorV() - it.getPosition());
486 }
487 }
488 }
489 )
490 )
491 );
492
493 //residual U,V vs coordinate U,V for clusters
494 name = "hClusterResidU_vs_CoorU_" + sensorid;
495 title = "Cluster U residual (cm) vs coor U (cm) " + sensorid;
496 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
497 tmp2D->GetYaxis()->SetTitle("Cluster U resid (cm)");
498 tmp2D->GetXaxis()->SetTitle("U coor (cm)");
499 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
500 (
501 (Belle2::VxdID)*itSvdSensors,
502 InterHistoAndFill(
503 tmp2D,
504 [this](TH1 * hPtr, const SVDIntercept * inter) {
505
506 for (auto& it : this->m_SVDClusters)
507 if (((int)it.getSensorID() == (int)inter->getSensorID()) && it.isUCluster()) {
508 double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
509 hPtr->Fill(inter->getCoorU(), resid);
510 }
511 }
512 )
513 )
514 );
515
516 name = "hClusterResidV_vs_CoorV_" + sensorid;
517 title = "Cluster V residual (cm) vs coor V (cm) " + sensorid;
518 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
519 tmp2D->GetYaxis()->SetTitle("Cluster V resid (cm)");
520 tmp2D->GetXaxis()->SetTitle("V coor (cm)");
521 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
522 (
523 (Belle2::VxdID)*itSvdSensors,
524 InterHistoAndFill(
525 tmp2D,
526 [this](TH1 * hPtr, const SVDIntercept * inter) {
527
528 for (auto& it : this->m_SVDClusters)
529 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUCluster())) {
530 double resid = inter->getCoorV() - it.getPosition();
531 hPtr->Fill(inter->getCoorV(), resid);
532 }
533 }
534 )
535 )
536 );
537
538
539 //residual vs charge for clusters
540 name = "hClusterResidU_vs_charge_" + sensorid;
541 title = "Cluster U residual (cm) vs charge " + sensorid;
542 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
543 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
544 tmp2D->GetXaxis()->SetTitle("charge (ke-)");
545 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
546 (
547 (Belle2::VxdID)*itSvdSensors,
548 InterHistoAndFill(
549 tmp2D,
550 [this](TH1 * hPtr, const SVDIntercept * inter) {
551
552 for (auto& it : this->m_SVDClusters)
553 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (it.isUCluster())) {
554 double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
555 hPtr->Fill(it.getCharge() / 1000., resid);
556 }
557 }
558 )
559 )
560 );
561
562 name = "hClusterResidV_vs_charge_" + sensorid;
563 title = "Cluster V residual (cm) vs charge " + sensorid;
564 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
565 tmp2D->GetYaxis()->SetTitle("Cluster V resid (cm)");
566 tmp2D->GetXaxis()->SetTitle("charge (ke-)");
567 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
568 (
569 (Belle2::VxdID)*itSvdSensors,
570 InterHistoAndFill(
571 tmp2D,
572 [this](TH1 * hPtr, const SVDIntercept * inter) {
573
574 for (auto& it : this->m_SVDClusters)
575 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUCluster())) {
576 double resid = inter->getCoorV() - it.getPosition();
577 hPtr->Fill(it.getCharge() / 1000., resid);
578 }
579 }
580 )
581 )
582 );
583
584 // residual vs time for clusters
585 name = "hClusterResidU_vs_time_" + sensorid;
586 title = "Cluster U residual (cm) vs time " + sensorid;
587 tmp2D = new TH2F(name.c_str(), title.c_str(), 400, -200, 200, 100, -5, 5);
588 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
589 tmp2D->GetXaxis()->SetTitle("time (ns)");
590 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
591 (
592 (Belle2::VxdID)*itSvdSensors,
593 InterHistoAndFill(
594 tmp2D,
595 [this](TH1 * hPtr, const SVDIntercept * inter) {
596
597 for (auto& it : this->m_SVDClusters)
598 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (it.isUCluster())) {
599 double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
600 hPtr->Fill(it.getClsTime(), resid);
601 }
602 }
603 )
604 )
605 );
606
607 name = "hClusterResidV_vs_time_" + sensorid;
608 title = "Cluster V residual (cm) vs time " + sensorid;
609 tmp2D = new TH2F(name.c_str(), title.c_str(), 400, -200, 200, 100, -5, 5);
610 tmp2D->GetYaxis()->SetTitle("Cluster V resid (cm)");
611 tmp2D->GetXaxis()->SetTitle("time (ns)");
612 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
613 (
614 (Belle2::VxdID)*itSvdSensors,
615 InterHistoAndFill(
616 tmp2D,
617 [this](TH1 * hPtr, const SVDIntercept * inter) {
618
619 for (auto& it : this->m_SVDClusters)
620 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUCluster())) {
621 double resid = inter->getCoorV() - it.getPosition();
622 hPtr->Fill(it.getClsTime(), resid);
623 }
624 }
625 )
626 )
627 );
628
629 // scatter plot: U,V intercept in cm VS U,V cell position
630 name = "hCoorU_vs_UDigit_" + sensorid;
631 title = "U intercept (cm) vs U Digit (ID) " + sensorid;
632 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
633 tmp2D->GetXaxis()->SetTitle("intercept U coor (cm)");
634 tmp2D->GetYaxis()->SetTitle("digit U coor (cm)");
635 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
636 (
637 (Belle2::VxdID)*itSvdSensors,
638 InterHistoAndFill(
639 tmp2D,
640 [this](TH1 * hPtr, const SVDIntercept * inter) {
641
642 for (auto& it : this->m_SVDShaperDigits)
643 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (it.isUStrip())) {
644 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
645 hPtr->Fill(inter->getCoorU(), aSensorInfo.getUCellPosition(it.getCellID()));
646 // hPtr->Fill( inter->getCoorU(), it.getVCellID()*75e-4 );
647 }
648 }
649 )
650 )
651 );
652
653 name = "hCoorV_vs_VDigit_" + sensorid;
654 title = "V intercept (cm) vs V Digit (ID) " + sensorid;
655 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
656 tmp2D->GetXaxis()->SetTitle("intercept V coor (cm)");
657 tmp2D->GetYaxis()->SetTitle("digi V coor (cm)");
658 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
659 (
660 (Belle2::VxdID)*itSvdSensors,
661 InterHistoAndFill(
662 tmp2D,
663 [this](TH1 * hPtr, const SVDIntercept * inter) {
664
665 for (auto& it : this->m_SVDShaperDigits) {
666 if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUStrip())) {
667 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
668 hPtr->Fill(inter->getCoorV(), aSensorInfo.getVCellPosition(it.getCellID()));
669 // hPtr->Fill( inter->getCoorV(), it.getUCellID()*50e-4 );
670 }
671 }
672 }
673 )
674 )
675 );
676
677
678
679
680
681
682 // ------ HISTOGRAMS WITH A FILL PER ROI -------
683 m_ROIDir->cd();
684
685 // MIN in U and V
686 name = "hminU_" + sensorid;
687 title = "ROI min in U for sensor " + sensorid;
688 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
689 (
690 (Belle2::VxdID)*itSvdSensors,
691 ROIHistoAndFill(
692 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
693 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinUid()); }
694 )
695 )
696 );
697 name = "hminV_" + sensorid;
698 title = "ROI min in V for sensor " + sensorid;
699 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
700 (
701 (Belle2::VxdID)*itSvdSensors,
702 ROIHistoAndFill(
703 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
704 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinVid()); }
705 )
706 )
707 );
708 //--------------------------
709 // MAX in U and V
710 name = "hmaxU_" + sensorid;
711 title = "ROI max in U for sensor " + sensorid;
712 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
713 (
714 (Belle2::VxdID)*itSvdSensors,
715 ROIHistoAndFill(
716 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
717 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid()); }
718 )
719 )
720 );
721 name = "hmaxV_" + sensorid;
722 title = "ROI max in V for sensor " + sensorid;
723 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
724 (
725 (Belle2::VxdID)*itSvdSensors,
726 ROIHistoAndFill(
727 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
728 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid()); }
729 )
730 )
731 );
732 //--------------------------
733
734 // WIDTH in U and V
735 name = "hwidthU_" + sensorid;
736 title = "ROI width in U for sensor " + sensorid;
737 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
738 (
739 (Belle2::VxdID)*itSvdSensors,
740 ROIHistoAndFill(
741 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
742 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid() - roi->getMinUid()); }
743 )
744 )
745 );
746 name = "hwidthV_" + sensorid;
747 title = "ROI width in V for sensor " + sensorid;
748 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
749 (
750 (Belle2::VxdID)*itSvdSensors,
751 ROIHistoAndFill(
752 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
753 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid() - roi->getMinVid()); }
754 )
755 )
756 );
757
758 // ROI center
759 name = "hROIcenter_" + sensorid;
760 title = "ROI center " + sensorid;
761 tmp2D = new TH2F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU, nPixelsV, 0, nPixelsV);
762 tmp2D->GetXaxis()->SetTitle(" U (ID)");
763 tmp2D->GetYaxis()->SetTitle(" V (ID)");
764 hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
765 (
766 (Belle2::VxdID)*itSvdSensors,
767 ROIHistoAndFill(
768 tmp2D,
769 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill((roi->getMaxUid() + roi->getMinUid()) / 2, (roi->getMaxVid() + roi->getMinVid()) / 2); }
770 )
771 )
772 );
773
774 //--------------------------
775
776 ++itSvdSensors;
777 }
778 ++itSvdLadders;
779 }
780 ++itSvdLayers;
781 }
782
783}
784
786{
787
788 auto its = hInterDictionary.equal_range(inter->getSensorID());
789
790 for (auto it = its.first; it != its.second; ++it) {
791 InterHistoAndFill aInterHistoAndFill = it->second;
792 aInterHistoAndFill.second(aInterHistoAndFill.first, inter);
793 }
794
795}
796
798{
799
800 auto its = hROIDictionary.equal_range(roi->getSensorID());
801
802 for (auto it = its.first; it != its.second; ++it) {
803 ROIHistoAndFill aROIHistoAndFill = it->second;
804 aROIHistoAndFill.second(aROIHistoAndFill.first, roi);
805 }
806
807 auto itsEvt = hROIDictionaryEvt.equal_range(roi->getSensorID());
808 for (auto it = itsEvt.first; it != itsEvt.second; ++it)
809 (it->second).accumulate(roi, (it->second).value);
810}
811
813{
814
815 hCellU->Scale((double)1 / n_events);
816 hCellV->Scale((double)1 / n_events);
817
818 for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it)
819 delete &(it->second);
820}
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
Definition: ROIid.h:25
SVDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an SVD ...
Definition: SVDIntercept.h:22
std::unordered_multimap< Belle2::VxdID, ROIHistoAccumulateAndFill &, std::function< size_t(const Belle2::VxdID &) > > hROIDictionaryEvt
map of histograms to be filled once per event
int m_numModules
number of hardware modules
std::unordered_multimap< Belle2::VxdID, InterHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > hInterDictionary
map of histograms to be filled once per intercept
std::pair< TH1 *, std::function< void(TH1 *, const SVDIntercept *) > > InterHistoAndFill
typedef: histograms to be filled once per intercept + filling function
std::string m_InterceptsName
Name of the SVDIntercept StoreArray.
StoreArray< SVDCluster > m_SVDClusters
svd cluster store array
bool m_plotRecoDigits
Produce plots for SVDRecoDigits when True.
VXD::GeoCache & m_geoCache
the geo cache instance
TH1F * hnROIs
number of ROIs
int n_events
number of events
void initialize() override
register histograms
TDirectory * m_ROIDir
ROI directory in the root file.
void fillSensorInterHistos(const SVDIntercept *inter)
fill histograms per sensor, filled once per intercept
void createHistosDictionaries()
create the dictionary
std::string m_SVDRecoDigitsName
reco digit list name
std::string m_SVDClustersName
cluster list name
void fillSensorROIHistos(const ROIid *roi)
fill histograms per sensor, filled once per ROI
void event() override
fill per-event histograms
void endRun() override
fill per-run histograms
SVDROIDQMModule()
Constructor defining the parameters.
int m_specificLayer
specific layer selected for which to produce the plots.
std::pair< TH1 *, std::function< void(TH1 *, const ROIid *) > > ROIHistoAndFill
typedef: histograms to be filled once per roi + filling function
TH1F * hredFactor
reduction factor
StoreArray< SVDShaperDigit > m_SVDShaperDigits
shaper digit store array
StoreArray< SVDRecoDigit > m_SVDRecoDigits
reco digit store array
std::string m_ROIsName
Name of the ROIid StoreArray.
TH1F * hnInter
number of intercpets
TDirectory * m_InterDir
intercepts directory in the root file
std::unordered_multimap< Belle2::VxdID, ROIHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > hROIDictionary
map of histograms to be filled once per roi
TH1F * harea
ROis area.
StoreArray< SVDIntercept > m_Intercepts
SVDIntercept Store Arrays.
std::string m_SVDShaperDigitsName
shaper digit list name
void defineHisto() override
define histograms
StoreArray< ROIid > m_ROIs
ROis store array.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
double getCoorV() const
return the V coordinate of the intercept
Definition: VXDIntercept.h:60
VxdID::baseType getSensorID() const
return the sensor ID
Definition: VXDIntercept.h:68
double getCoorU() const
return the U coordinate of the intercept
Definition: VXDIntercept.h:59
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
Definition: GeoCache.cc:176
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
const std::set< Belle2::VxdID > & getSensors(Belle2::VxdID ladder) const
Return a set of all sensor IDs belonging to a given ladder.
Definition: GeoCache.cc:204
const std::set< Belle2::VxdID > & getLadders(Belle2::VxdID layer) const
Return a set of all ladder IDs belonging to a given layer.
Definition: GeoCache.cc:193
Base class to provide Sensor Information for PXD and SVD.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
struct: histograms to be filled once per event + filling function + accumulate function
std::function< void(TH1 *, double &) > fill
fill function