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