Belle II Software development
ROIDQMModule.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/pxd/ROIDQMModule.h>
10
11#include <tracking/dataobjects/ROIid.h>
12#include <tracking/dataobjects/PXDIntercept.h>
13#include <pxd/dataobjects/PXDDigit.h>
14#include <vxd/geometry/GeoCache.h>
15
16#include <TDirectory.h>
17#include <TH2F.h>
18
19using namespace Belle2;
20
21//-----------------------------------------------------------------
22// Register the Module
23//-----------------------------------------------------------------
24REG_MODULE(ROIDQM);
25
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
30ROIDQMModule::ROIDQMModule()
31 : HistoModule()
32 , m_InterDir(nullptr)
33 , m_ROIDir(nullptr)
34 , m_hInterDictionary(40, [](const Belle2::VxdID & vxdid) {return (size_t)vxdid.getID(); })
35, m_hROIDictionary(40, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
36, m_hROIDictionaryEvt(40, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
37, m_numModules(0)
38, m_hnROIs(nullptr)
39, m_hnInter(nullptr)
40, m_harea(nullptr)
41, m_hredFactor(nullptr)
42{
43 //Set module properties
44 setDescription("Monitor of the ROI creation on HLT");
45 setPropertyFlags(c_ParallelProcessingCertified);
46
47 addParam("PXDDigitsName", m_PXDDigitsName,
48 "name of the list of PXDDigits", std::string(""));
49
50 addParam("InterceptsName", m_InterceptsName,
51 "name of the list of Interceptions", std::string(""));
52
53 addParam("ROIsName", m_ROIsName,
54 "name of the list of ROIs", std::string(""));
55
56}
57
59{
60
61 // Create a separate histogram directory and cd into it.
62 TDirectory* oldDir = gDirectory;
63 oldDir->mkdir("intercept");
64 oldDir->cd("intercept");
65 m_InterDir = gDirectory;
66 oldDir->mkdir("roi");
67 oldDir->cd("roi");
68 m_ROIDir = gDirectory;
69
70 m_InterDir->cd();
71 m_hnInter = new TH1F("hnInter", "number of intercepts", 100, 0, 100);
72
73 m_ROIDir->cd();
74 m_hnROIs = new TH1F("hnROIs", "number of ROIs", 100, 0, 100);
75 m_harea = new TH1F("harea", "ROI area", 100, 0, 100000);
76 m_hredFactor = new TH1F("hredFactor", "ROI reduction factor", 1000, 0, 1);
77
79
80 oldDir->cd();
81
82}
83
85{
86 REG_HISTOGRAM
87
88 m_pxdDigits.isOptional();
89 m_roiIDs.isRequired(m_ROIsName);
91
92}
93
95{
96
97 m_hnInter->Fill(m_pxdIntercept.getEntries());
98
99 for (auto& it : m_pxdIntercept)
101
102
103 for (auto it = m_hROIDictionaryEvt.begin(); it != m_hROIDictionaryEvt.end(); ++it)
104 (it->second).value = 0;
105
106 int ROIarea = 0;
107 double redFactor = 0;
108
109 for (auto& it : m_roiIDs) {
111
112 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
113 const int nPixelsU = aSensorInfo.getUCells();
114 const int nPixelsV = aSensorInfo.getVCells();
115
116 const int minU = it.getMinUid();
117 const int minV = it.getMinVid();
118 const int maxU = it.getMaxUid();
119 const int maxV = it.getMaxVid();
120
121 int tmpROIarea = (maxU - minU) * (maxV - minV);
122 ROIarea += tmpROIarea;
123 redFactor += (double)tmpROIarea / (nPixelsU * nPixelsV * m_numModules);
124
125 }
126
127 m_hnROIs->Fill(m_roiIDs.getEntries());
128
129 m_harea->Fill((double)ROIarea);
130
131 m_hredFactor->Fill((double)redFactor);
132
133
134 for (auto it = m_hROIDictionaryEvt.begin(); it != m_hROIDictionaryEvt.end(); ++it) {
135 ROIHistoAccumulateAndFill aROIHistoAccumulateAndFill = it->second;
136 aROIHistoAccumulateAndFill.fill(aROIHistoAccumulateAndFill.hPtr, aROIHistoAccumulateAndFill.value);
137 }
138
139}
140
142{
143
144 // VXD::GeoCache& aGeometry = VXD::GeoCache::getInstance();
145
146 std::string name; //name of the histogram
147 std::string title; //title of the histogram
148 TH2F* tmp2D; //temporary 2D histo used to set axis title
149 TH1F* tmp1D; //temporary 1D histo used to set axis title
150
151 m_numModules = 0;
152
153 std::set<Belle2::VxdID> pxdLayers = m_aGeometry.getLayers(VXD::SensorInfoBase::PXD);
154 std::set<Belle2::VxdID>::iterator itPxdLayers = pxdLayers.begin();
155
156 while (itPxdLayers != pxdLayers.end()) {
157
158 std::set<Belle2::VxdID> pxdLadders = m_aGeometry.getLadders(*itPxdLayers);
159 std::set<Belle2::VxdID>::iterator itPxdLadders = pxdLadders.begin();
160
161 while (itPxdLadders != pxdLadders.end()) {
162
163 std::set<Belle2::VxdID> pxdSensors = m_aGeometry.getSensors(*itPxdLadders);
164 std::set<Belle2::VxdID>::iterator itPxdSensors = pxdSensors.begin();
165
166 while (itPxdSensors != pxdSensors.end()) {
167
168 m_numModules++; //counting the total number of modules
169
170 const VXD::SensorInfoBase& wSensorInfo = m_aGeometry.getSensorInfo(*itPxdSensors);
171
172 const int nPixelsU = wSensorInfo.getUCells();
173 const int nPixelsV = wSensorInfo.getVCells();
174 std::string sensorid = std::to_string(itPxdSensors->getLayerNumber()) + "_" + std::to_string(
175 itPxdSensors->getLadderNumber()) + "_" +
176 std::to_string(itPxdSensors->getSensorNumber());
177
178
179 // ------ HISTOGRAMS WITH AN ACCUMULATE PER ROI AND A FILL PER EVENT -------
180 m_ROIDir->cd();
181
182 name = "hNROIs_" + sensorid;
183 title = "number of m_roiIDs for sensor " + sensorid;
184 double value = 0;
186 new TH1F(name.c_str(), title.c_str(), 25, 0, 25),
187 [](const ROIid*, double & val) {val++;},
188 [](TH1 * hPtr, double & val) { hPtr->Fill(val); },
189 value
190 };
191 m_hROIDictionaryEvt.insert(std::pair< Belle2::VxdID, ROIHistoAccumulateAndFill& > ((Belle2::VxdID)*itPxdSensors, *aHAAF));
192
193
194
195
196 // ------ HISTOGRAMS WITH A FILL PER INTERCEPT -------
197 m_InterDir->cd();
198
199 // coor U and V
200 name = "hCoorU_" + sensorid;
201 title = "U coordinate of the extrapolation in U for sensor " + sensorid;
202 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
203 (
204 (Belle2::VxdID)*itPxdSensors,
206 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
207 [](TH1 * hPtr, const PXDIntercept * inter) { hPtr->Fill(inter->getCoorU()); }
208 )
209 )
210 );
211
212 name = "hCoorV_" + sensorid;
213 title = "V coordinate of the extrapolation in V for sensor " + sensorid;
214 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
215 (
216 (Belle2::VxdID)*itPxdSensors,
218 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
219 [](TH1 * hPtr, const PXDIntercept * inter) { hPtr->Fill(inter->getCoorV()); }
220 )
221 )
222 );
223
224 // Intercept U vs V coordinate
225 name = "hCoorU_vs_CoorV_" + sensorid;
226 title = "U vs V intercept (cm) " + sensorid;
227 tmp2D = new TH2F(name.c_str(), title.c_str(), 100, -5, 5, 100, -5, 5);
228 tmp2D->GetXaxis()->SetTitle("intercept U coor (cm)");
229 tmp2D->GetYaxis()->SetTitle("intercept V coor (cm)");
230 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
231 (
232 (Belle2::VxdID)*itPxdSensors,
234 tmp2D,
235 [](TH1 * hPtr, const PXDIntercept * inter) { hPtr->Fill(inter->getCoorU(), inter->getCoorV()); }
236 )
237 )
238 );
239
240
241 // sigma U and V
242 name = "hStatErrU_" + sensorid;
243 title = "stat error of the extrapolation in U for sensor " + sensorid;
244 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
245 (
246 (Belle2::VxdID)*itPxdSensors,
248 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
249 [](TH1 * hPtr, const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaU()); }
250 )
251 )
252 );
253 name = "hStatErrV_" + sensorid;
254 title = "stat error of the extrapolation in V for sensor " + sensorid;
255 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
256 (
257 (Belle2::VxdID)*itPxdSensors,
259 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
260 [](TH1 * hPtr, const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaV()); }
261 )
262 )
263 );
264
265 //1D residuals
266 name = "hResidU_" + sensorid;
267 title = "U residuals = intercept - digit, for sensor " + sensorid;
268 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
269 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
270 (
271 (Belle2::VxdID)*itPxdSensors,
273 tmp1D,
274 [this](TH1 * hPtr, const PXDIntercept * inter) {
275 for (auto& it : m_pxdDigits)
276 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
277 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
278 hPtr->Fill(inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
279 }
280 }
281 )
282 )
283 );
284
285 name = "hResidV_" + sensorid;
286 title = "V residuals = intercept - digit, for sensor " + sensorid;
287 tmp1D = new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
288 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
289 (
290 (Belle2::VxdID)*itPxdSensors,
292 tmp1D,
293 [this](TH1 * hPtr, const PXDIntercept * inter) {
294 for (auto& it : m_pxdDigits)
295 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
296 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
297 hPtr->Fill(inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID()));
298 }
299 }
300 )
301 )
302 );
303
304 name = "hResidV_vs_ResidU_" + sensorid;
305 title = "V vs U residuals = intercept - digit, for sensor " + sensorid;
306 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
307 tmp2D->GetXaxis()->SetTitle("U resid (cm)");
308 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
309 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
310 (
311 (Belle2::VxdID)*itPxdSensors,
313 tmp2D,
314 [this](TH1 * hPtr, const PXDIntercept * inter) {
315 for (auto& it : m_pxdDigits)
316 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
317 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
318 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
319 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
320 hPtr->Fill(residU, residV);
321 }
322 }
323 )
324 )
325 );
326
327 name = "hResidVm_vs_ResidU_" + sensorid;
328 title = "V vs U residuals = intercept - digit, for sensor " + sensorid;
329 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
330 tmp2D->GetXaxis()->SetTitle("U resid (cm)");
331 tmp2D->GetYaxis()->SetTitle("V* resid (cm)");
332 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
333 (
334 (Belle2::VxdID)*itPxdSensors,
336 tmp2D,
337 [this](TH1 * hPtr, const PXDIntercept * inter) {
338 for (auto& it : m_pxdDigits)
339 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
340 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
341 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
342 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
343 hPtr->Fill(residU, residV);
344 }
345 }
346 )
347 )
348 );
349
350 name = "hResidV_vs_ResidUm_" + sensorid;
351 title = "V vs U residuals = intercept - digit, for sensor " + sensorid;
352 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
353 tmp2D->GetXaxis()->SetTitle("U* resid (cm)");
354 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
355 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
356 (
357 (Belle2::VxdID)*itPxdSensors,
359 tmp2D,
360 [this](TH1 * hPtr, const PXDIntercept * inter) {
361 for (auto& it : m_pxdDigits)
362 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
363 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
364 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
365 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
366 hPtr->Fill(residU, residV);
367 }
368 }
369 )
370 )
371 );
372
373 name = "hResidVm_vs_ResidUm_" + sensorid;
374 title = "V vs U residuals = intercept - digit, for sensor " + sensorid;
375 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
376 tmp2D->GetXaxis()->SetTitle("U* resid (cm)");
377 tmp2D->GetYaxis()->SetTitle("V* resid (cm)");
378 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
379 (
380 (Belle2::VxdID)*itPxdSensors,
382 tmp2D,
383 [this](TH1 * hPtr, const PXDIntercept * inter) {
384 for (auto& it : m_pxdDigits)
385 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
386 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
387 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
388 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
389 hPtr->Fill(residU, residV);
390 }
391 }
392 )
393 )
394 );
395
396 //residual U,V vs coordinate U,V
397 name = "hResidU_vs_CoorU_" + sensorid;
398 title = "U residual (cm) vs coor U (cm) " + sensorid;
399 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
400 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
401 tmp2D->GetXaxis()->SetTitle("U coor (cm)");
402 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
403 (
404 (Belle2::VxdID)*itPxdSensors,
406 tmp2D,
407 [this](TH1 * hPtr, const PXDIntercept * inter) {
408 for (auto& it : m_pxdDigits)
409 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
410 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
411 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
412 hPtr->Fill(inter->getCoorU(), resid);
413 }
414 }
415 )
416 )
417 );
418
419 name = "hResidV_vs_CoorV_" + sensorid;
420 title = "V residual (cm) vs coor V (cm) " + sensorid;
421 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
422 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
423 tmp2D->GetXaxis()->SetTitle("V coor (cm)");
424 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
425 (
426 (Belle2::VxdID)*itPxdSensors,
428 tmp2D,
429 [this](TH1 * hPtr, const PXDIntercept * inter) {
430 for (auto& it : m_pxdDigits)
431 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
432 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
433 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
434 hPtr->Fill(inter->getCoorV(), resid);
435 }
436 }
437 )
438 )
439 );
440
441 //residual U,V vs coordinate V,U
442 name = "hResidU_vs_CoorV_" + sensorid;
443 title = "U residual (cm) vs coor V (cm) " + sensorid;
444 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
445 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
446 tmp2D->GetXaxis()->SetTitle("V coor (cm)");
447 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
448 (
449 (Belle2::VxdID)*itPxdSensors,
451 tmp2D,
452 [this](TH1 * hPtr, const PXDIntercept * inter) {
453 for (auto& it : m_pxdDigits)
454 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
455 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
456 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
457 hPtr->Fill(inter->getCoorV(), resid);
458 }
459 }
460 )
461 )
462 );
463
464 name = "hResidV_vs_CoorU_" + sensorid;
465 title = "V residual (cm) vs coor U (cm) " + sensorid;
466 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
467 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
468 tmp2D->GetXaxis()->SetTitle("U coor (cm)");
469 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
470 (
471 (Belle2::VxdID)*itPxdSensors,
473 tmp2D,
474 [this](TH1 * hPtr, const PXDIntercept * inter) {
475 for (auto& it : m_pxdDigits)
476 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
477 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
478 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
479 hPtr->Fill(inter->getCoorU(), resid);
480 }
481 }
482 )
483 )
484 );
485
486
487
488 //residual vs charge
489 name = "hResidU_vs_charge_" + sensorid;
490 title = "U residual (cm) vs charge " + sensorid;
491 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
492 tmp2D->GetYaxis()->SetTitle("U resid (cm)");
493 tmp2D->GetXaxis()->SetTitle("charge");
494 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
495 (
496 (Belle2::VxdID)*itPxdSensors,
498 tmp2D,
499 [this](TH1 * hPtr, const PXDIntercept * inter) {
500 for (auto& it : m_pxdDigits)
501 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
502 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
503 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
504 hPtr->Fill(it.getCharge(), resid);
505 }
506 }
507 )
508 )
509 );
510
511 name = "hResidV_vs_charge_" + sensorid;
512 title = "V residual (cm) vs charge " + sensorid;
513 tmp2D = new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
514 tmp2D->GetYaxis()->SetTitle("V resid (cm)");
515 tmp2D->GetXaxis()->SetTitle("charge");
516 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
517 (
518 (Belle2::VxdID)*itPxdSensors,
520 tmp2D,
521 [this](TH1 * hPtr, const PXDIntercept * inter) {
522 for (auto& it : m_pxdDigits)
523 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
524 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
525 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
526 hPtr->Fill(it.getCharge(), resid);
527 }
528 }
529 )
530 )
531 );
532
533
534 // scatter plot: U,V intercept in cm VS U,V cell position
535 name = "hCoorU_vs_UDigit_" + sensorid;
536 title = "U intercept (cm) vs U Digit (ID) " + sensorid;
537 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
538 tmp2D->GetXaxis()->SetTitle("intercept U coor (cm)");
539 tmp2D->GetYaxis()->SetTitle("digit U coor (cm)");
540 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
541 (
542 (Belle2::VxdID)*itPxdSensors,
544 tmp2D,
545 [this](TH1 * hPtr, const PXDIntercept * inter) {
546 for (auto& it : m_pxdDigits)
547 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
548 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
549 hPtr->Fill(inter->getCoorU(), aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
550 // hPtr->Fill( inter->getCoorU(), it.getVCellID()*75e-4 );
551 }
552 }
553 )
554 )
555 );
556
557 name = "hCoorV_vs_VDigit_" + sensorid;
558 title = "V intercept (cm) vs V Digit (ID) " + sensorid;
559 tmp2D = new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
560 tmp2D->GetXaxis()->SetTitle("intercept V coor (cm)");
561 tmp2D->GetYaxis()->SetTitle("digi V coor (cm)");
562 m_hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
563 (
564 (Belle2::VxdID)*itPxdSensors,
566 tmp2D,
567 [this](TH1 * hPtr, const PXDIntercept * inter) {
568 for (auto& it : m_pxdDigits) {
569 if ((int)it.getSensorID() == (int)inter->getSensorID()) {
570 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
571 hPtr->Fill(inter->getCoorV(), aSensorInfo.getVCellPosition(it.getVCellID()));
572 // hPtr->Fill( inter->getCoorV(), it.getUCellID()*50e-4 );
573 }
574 }
575 }
576 )
577 )
578 );
579
580
581
582 // ------ HISTOGRAMS WITH A FILL PER ROI -------
583 m_ROIDir->cd();
584
585 // MIN in U and V
586 name = "hminU_" + sensorid;
587 title = "ROI min in U for sensor " + sensorid;
588 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
589 (
590 (Belle2::VxdID)*itPxdSensors,
592 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
593 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinUid()); }
594 )
595 )
596 );
597 name = "hminV_" + sensorid;
598 title = "ROI min in V for sensor " + sensorid;
599 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
600 (
601 (Belle2::VxdID)*itPxdSensors,
603 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
604 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinVid()); }
605 )
606 )
607 );
608 //--------------------------
609 // MAX in U and V
610 name = "hmaxU_" + sensorid;
611 title = "ROI max in U for sensor " + sensorid;
612 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
613 (
614 (Belle2::VxdID)*itPxdSensors,
616 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
617 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid()); }
618 )
619 )
620 );
621 name = "hmaxV_" + sensorid;
622 title = "ROI max in V for sensor " + sensorid;
623 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
624 (
625 (Belle2::VxdID)*itPxdSensors,
627 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
628 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid()); }
629 )
630 )
631 );
632 //--------------------------
633
634 // WIDTH in U and V
635 name = "hwidthU_" + sensorid;
636 title = "ROI width in U for sensor " + sensorid;
637 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
638 (
639 (Belle2::VxdID)*itPxdSensors,
641 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
642 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid() - roi->getMinUid()); }
643 )
644 )
645 );
646 name = "hwidthV_" + sensorid;
647 title = "ROI width in V for sensor " + sensorid;
648 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
649 (
650 (Belle2::VxdID)*itPxdSensors,
652 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
653 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid() - roi->getMinVid()); }
654 )
655 )
656 );
657
658 // ROI center
659 name = "hROIcenter_" + sensorid;
660 title = "ROI center " + sensorid;
661 tmp2D = new TH2F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU, nPixelsV, 0, nPixelsV);
662 tmp2D->GetXaxis()->SetTitle(" U (ID)");
663 tmp2D->GetYaxis()->SetTitle(" V (ID)");
664 m_hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
665 (
666 (Belle2::VxdID)*itPxdSensors,
668 tmp2D,
669 [](TH1 * hPtr, const ROIid * roi) { hPtr->Fill((roi->getMaxUid() + roi->getMinUid()) / 2, (roi->getMaxVid() + roi->getMinVid()) / 2); }
670 )
671 )
672 );
673
674 //--------------------------
675
676 ++itPxdSensors;
677 }
678 ++itPxdLadders;
679 }
680 ++itPxdLayers;
681 }
682
683}
684
686{
687
688 auto its = m_hInterDictionary.equal_range(inter->getSensorID());
689
690 for (auto it = its.first; it != its.second; ++it) {
691 InterHistoAndFill aInterHistoAndFill = it->second;
692 aInterHistoAndFill.second(aInterHistoAndFill.first, inter);
693 }
694
695}
696
698{
699
700 auto its = m_hROIDictionary.equal_range(roi->getSensorID());
701
702 for (auto it = its.first; it != its.second; ++it) {
703 ROIHistoAndFill aROIHistoAndFill = it->second;
704 aROIHistoAndFill.second(aROIHistoAndFill.first, roi);
705 }
706
707 auto itsEvt = m_hROIDictionaryEvt.equal_range(roi->getSensorID());
708 for (auto it = itsEvt.first; it != itsEvt.second; ++it)
709 (it->second).accumulate(roi, (it->second).value);
710}
711
713{
714 for (auto it = m_hROIDictionaryEvt.begin(); it != m_hROIDictionaryEvt.end(); ++it)
715 delete &(it->second);
716}
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
PXDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an PXD ...
Definition: PXDIntercept.h:22
void terminate(void) override final
This method is called at the end of the event processing.
int m_numModules
number of modules
Definition: ROIDQMModule.h:82
StoreArray< PXDIntercept > m_pxdIntercept
the PXDIntercepts dataobjects collection
Definition: ROIDQMModule.h:45
std::string m_InterceptsName
Name of the PXDIntercept StoreArray.
Definition: ROIDQMModule.h:52
VXD::GeoCache & m_aGeometry
the geometry
Definition: ROIDQMModule.h:49
TDirectory * m_ROIDir
ROI directory in the root file.
Definition: ROIDQMModule.h:55
void fillSensorInterHistos(const PXDIntercept *inter)
fill histograms per sensor, filled once per intercept
void createHistosDictionaries()
create the dictionary
void initialize(void) override final
Initializer.
Definition: ROIDQMModule.cc:84
void fillSensorROIHistos(const ROIid *roi)
fill histograms per sensor, filled once per ROI
std::unordered_multimap< Belle2::VxdID, ROIHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > m_hROIDictionary
map of histograms to be filled once per roi
Definition: ROIDQMModule.h:65
void defineHisto() override final
define histograms
Definition: ROIDQMModule.cc:58
std::pair< TH1 *, std::function< void(TH1 *, const PXDIntercept *) > > InterHistoAndFill
typedef: histograms to be filled once per intercept + filling function
Definition: ROIDQMModule.h:58
TH1F * m_harea
ROis area.
Definition: ROIDQMModule.h:86
std::pair< TH1 *, std::function< void(TH1 *, const ROIid *) > > ROIHistoAndFill
typedef: histograms to be filled once per roi + filling function
Definition: ROIDQMModule.h:63
TH1F * m_hnROIs
number of ROIs
Definition: ROIDQMModule.h:84
std::string m_ROIsName
Name of the ROIid StoreArray.
Definition: ROIDQMModule.h:51
StoreArray< ROIid > m_roiIDs
the ROIids dataobjects collection
Definition: ROIDQMModule.h:44
TH1F * m_hredFactor
reduction factor
Definition: ROIDQMModule.h:87
std::unordered_multimap< Belle2::VxdID, InterHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > m_hInterDictionary
map of histograms to be filled once per intercept
Definition: ROIDQMModule.h:60
TDirectory * m_InterDir
intercepts directory in the root file
Definition: ROIDQMModule.h:54
std::unordered_multimap< Belle2::VxdID, ROIHistoAccumulateAndFill &, std::function< size_t(const Belle2::VxdID &) > > m_hROIDictionaryEvt
map of histograms to be filled once per event
Definition: ROIDQMModule.h:76
TH1F * m_hnInter
number of intercpets
Definition: ROIDQMModule.h:85
StoreArray< PXDDigit > m_pxdDigits
the PXDDigits dataobjects collection
Definition: ROIDQMModule.h:43
void event(void) override final
This method is called for each event.
Definition: ROIDQMModule.cc:94
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
Definition: ROIid.h:25
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 fucntion + accumulate function
Definition: ROIDQMModule.h:68
std::function< void(TH1 *, double &) > fill
fill function
Definition: ROIDQMModule.h:71