Belle II Software  release-08-01-10
DQMHistAnalysisPXDER.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 <dqm/analysis/modules/DQMHistAnalysisPXDER.h>
10 
11 #include <pxd/geometry/SensorInfo.h>
12 #include <vxd/geometry/SensorInfoBase.h>
13 #include <vxd/geometry/GeoCache.h>
14 
15 #include <boost/format.hpp>
16 
17 #include <TROOT.h>
18 
19 using namespace std;
20 using boost::format;
21 using namespace Belle2;
22 
23 //-----------------------------------------------------------------
24 // Register the Module
25 //-----------------------------------------------------------------
26 REG_MODULE(DQMHistAnalysisPXDER);
27 
28 
29 //-----------------------------------------------------------------
30 // Implementation
31 //-----------------------------------------------------------------
32 
33 DQMHistAnalysisPXDERModule::DQMHistAnalysisPXDERModule() : DQMHistAnalysisModule()
34 {
35  // This module CAN NOT be run in parallel!
36  setDescription("PXD DQM analysis module for Express Reco ");
37 
38  // Set module properties
39  addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms were placed",
40  std::string("PXDER"));
41  addParam("RefHistoFile", m_refFileName, "Reference histrogram file name", std::string("refHisto.root"));
42 }
43 
44 
46 {
47 }
48 
50 {
51  m_refFile = NULL;
52  if (m_refFileName != "") {
53  m_refFile = new TFile(m_refFileName.data());// default is read only
54  }
55 
56  gROOT->cd(); // this seems to be important, or strange things happen
57  // basic constants presets:
59  c_nVXDLayers = geo.getLayers().size();
60  c_firstVXDLayer = 1; // counting start from 1...
62  c_nPXDLayers = geo.getLayers(VXD::SensorInfoBase::SensorType::PXD).size();
65  c_nSVDLayers = geo.getLayers(VXD::SensorInfoBase::SensorType::SVD).size();
68 
69  c_nPXDSensors = 0;
70  for (VxdID layer : geo.getLayers()) {
71  for (VxdID ladder : geo.getLadders(layer)) {
72  if (layer.getLayerNumber() <= c_lastPXDLayer) { // PXD
73  c_nPXDSensors += geo.getLadders(layer).size() * geo.getSensors(ladder).size();
74  }
75  break;
76  }
77  }
78 
79 // m_hitMapCounts = "DQMER_PXD_PixelHitmapCounts";
80 // m_hitMapClCounts = "DQMER_PXD_ClusterHitmapCounts";
81 
82  for (int i = 0; i < c_nPXDSensors; i++) {
83  int iLayer = 0;
84  int iLadder = 0;
85  int iSensor = 0;
86  getIDsFromIndex(i, iLayer, iLadder, iSensor);
87  VxdID sensorID(iLayer, iLadder, iSensor);
88  PXD::SensorInfo SensorInfo = dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID));
89  string sensorDescr = str(format("%1%_%2%_%3%") % iLayer % iLadder % iSensor);
90  //----------------------------------------------------------------
91  // Number of fired pixels per frame
92  //----------------------------------------------------------------
93  m_fired.emplace_back(str(format("DQMER_PXD_%1%_Fired") % sensorDescr));
94  m_ref_fired.emplace_back(m_fired.back());
95  //----------------------------------------------------------------
96  // Number of clusters per frame
97  //----------------------------------------------------------------
98  m_clusters.emplace_back(str(format("DQMER_PXD_%1%_Clusters") % sensorDescr));
99  m_ref_clusters.emplace_back(m_clusters.back());
100  //----------------------------------------------------------------
101  // Start row distribution
102  //----------------------------------------------------------------
103  m_startRow.emplace_back(str(format("DQMER_PXD_%1%_StartRow") % sensorDescr));
104  m_ref_startRow.emplace_back(m_startRow.back());
105  //----------------------------------------------------------------
106  // Cluster seed charge by distance from the start row
107  //----------------------------------------------------------------
108  m_chargStartRow.emplace_back(str(format("DQMER_PXD_%1%_AverageSeedByStartRow") % sensorDescr));
109  m_ref_chargStartRow.emplace_back(m_chargStartRow.back());
110 
111 
112  m_startRowCount.emplace_back(str(format("DQMER_PXD_%1%_SeedCountsByStartRow") % sensorDescr));
113  m_ref_startRowCount.emplace_back(m_startRowCount.back());
114  //----------------------------------------------------------------
115  // Cluster Charge
116  //----------------------------------------------------------------
117  m_clusterCharge.emplace_back(str(format("DQMER_PXD_%1%_ClusterCharge") % sensorDescr));
118  m_ref_clusterCharge.emplace_back(m_clusterCharge.back());
119  //----------------------------------------------------------------
120  // Pixel Signal
121  //----------------------------------------------------------------
122  m_pixelSignal.emplace_back(str(format("DQMER_PXD_%1%_PixelSignal") % sensorDescr));
123  m_ref_pixelSignal.emplace_back(m_pixelSignal.back());
124  //----------------------------------------------------------------
125  // Cluster Size in U
126  //----------------------------------------------------------------
127  m_clusterSizeU.emplace_back(str(format("DQMER_PXD_%1%_ClusterSizeU") % sensorDescr));
128  m_ref_clusterSizeU.emplace_back(m_clusterSizeU.back());
129  //----------------------------------------------------------------
130  // Cluster Size in V
131  //----------------------------------------------------------------
132  m_clusterSizeV.emplace_back(str(format("DQMER_PXD_%1%_ClusterSizeV") % sensorDescr));
133  m_ref_clusterSizeV.emplace_back(m_clusterSizeV.back());
134  //----------------------------------------------------------------
135  // Cluster Size in U+V
136  //----------------------------------------------------------------
137  m_clusterSizeUV.emplace_back(str(format("DQMER_PXD_%1%_ClusterSizeUV") % sensorDescr));
138  m_ref_clusterSizeUV.emplace_back(m_clusterSizeUV.back());
139  }
140 // m_fHitMapCountsFlag = NULL;
141 // m_fHitMapClCountsFlag = NULL;
142 // m_hitMapCounts = NULL;
143 // m_hitMapClCounts = NULL;
144 
145 // Create flag histograms:
146 // DirPXDFlags->cd();
147  m_fFiredFlag = new TH1I("DQMER_PXD_FiredFlag", "DQM ER PXD Fired Flag",
149  m_fFiredFlag->GetXaxis()->SetTitle("Sensor ID");
150  m_fFiredFlag->GetYaxis()->SetTitle("flag");
151  m_fClustersFlag = new TH1I("DQMER_PXD_ClustersFlag", "DQM ER PXD Clusters Flag",
153  m_fClustersFlag->GetXaxis()->SetTitle("Sensor ID");
154  m_fClustersFlag->GetYaxis()->SetTitle("flag");
155  m_fStartRowFlag = new TH1I("DQMER_PXD_StartRowFlag", "DQM ER PXD Start Row Flag",
157  m_fStartRowFlag->GetXaxis()->SetTitle("Sensor ID");
158  m_fStartRowFlag->GetYaxis()->SetTitle("flag");
159  m_fChargStartRowFlag = new TH1I("DQMER_PXD_ChargStartRowFlag", "DQM ER PXD Charg Start Row Flag",
161  m_fChargStartRowFlag->GetXaxis()->SetTitle("Sensor ID");
162  m_fChargStartRowFlag->GetYaxis()->SetTitle("flag");
163  m_fStartRowCountFlag = new TH1I("DQMER_PXD_StartRowCountFlag", "DQM ER PXD Row Count Flag",
165  m_fStartRowCountFlag->GetXaxis()->SetTitle("Sensor ID");
166  m_fStartRowCountFlag->GetYaxis()->SetTitle("flag");
167 // m_fHitMapCountsFlag = new TH1I("DQMER_PXD_PixelHitmapCountsFlag", "DQM ER PXD Pixel Hitmaps Counts Flag",
168 // c_nPXDSensors, 0, c_nPXDSensors);
169 // m_fHitMapCountsFlag->GetXaxis()->SetTitle("Sensor ID");
170 // m_fHitMapCountsFlag->GetYaxis()->SetTitle("flag");
171 // m_fHitMapClCountsFlag = new TH1I("DQMER_PXD_ClusterHitmapCountsFlag", "DQM ER PXD Cluster Hitmaps Counts Flag",
172 // c_nPXDSensors, 0, c_nPXDSensors);
173 // m_fHitMapClCountsFlag->GetXaxis()->SetTitle("Sensor ID");
174 // m_fHitMapClCountsFlag->GetYaxis()->SetTitle("flag");
175  m_fClusterChargeFlag = new TH1I("DQMER_PXD_ClusterChargeFlag", "DQM ER PXD Cluster Charge Flag",
177  m_fClusterChargeFlag->GetXaxis()->SetTitle("Sensor ID");
178  m_fClusterChargeFlag->GetYaxis()->SetTitle("flag");
179  m_fPixelSignalFlag = new TH1I("DQMER_PXD_PixelSignalFlag", "DQM ER PXD Pixel Signal Flag",
181  m_fPixelSignalFlag->GetXaxis()->SetTitle("Sensor ID");
182  m_fPixelSignalFlag->GetYaxis()->SetTitle("flag");
183  m_fClusterSizeUFlag = new TH1I("DQMER_PXD_ClasterSizeUFlag", "DQM ER PXD Cluster Size U Flag",
185  m_fClusterSizeUFlag->GetXaxis()->SetTitle("Sensor ID");
186  m_fClusterSizeUFlag->GetYaxis()->SetTitle("flag");
187  m_fClusterSizeVFlag = new TH1I("DQMER_PXD_ClasterSizeVFlag", "DQM ER PXD Cluster Size V Flag",
189  m_fClusterSizeVFlag->GetXaxis()->SetTitle("Sensor ID");
190  m_fClusterSizeVFlag->GetYaxis()->SetTitle("flag");
191  m_fClusterSizeUVFlag = new TH1I("DQMER_PXD_ClasterSizeUVFlag", "DQM ER PXD Cluster Size UV Flag",
193  m_fClusterSizeUVFlag->GetXaxis()->SetTitle("Sensor ID");
194  m_fClusterSizeUVFlag->GetYaxis()->SetTitle("flag");
195 
196  for (int i = 0; i < c_nPXDSensors; i++) {
197  int iLayer = 0;
198  int iLadder = 0;
199  int iSensor = 0;
200  getIDsFromIndex(i, iLayer, iLadder, iSensor);
201  TString AxisTicks = Form("%i_%i_%i", iLayer, iLadder, iSensor);
202 // m_hitMapCounts->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
203 // m_hitMapClCounts->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
204  m_fFiredFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
205  m_fClustersFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
206  m_fStartRowFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
207  m_fChargStartRowFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
208  m_fStartRowCountFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
209 // m_fHitMapCountsFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
210 // m_fHitMapClCountsFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
211  m_fClusterChargeFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
212  m_fPixelSignalFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
213  m_fClusterSizeUFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
214  m_fClusterSizeVFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
215  m_fClusterSizeUVFlag->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
216  }
217 // m_oldDir->cd();
218 }
219 
221 {
222  // Just to make sure, reset all the histograms.
223 // if (m_fHitMapCountsFlag != NULL) m_fHitMapCountsFlag->Reset();
224 // if (m_fHitMapClCountsFlag != NULL) m_fHitMapClCountsFlag->Reset();
225  if (m_fFiredFlag != NULL) m_fFiredFlag->Reset();
226  if (m_fClustersFlag != NULL) m_fClustersFlag->Reset();
227  if (m_fStartRowFlag != NULL) m_fStartRowFlag->Reset();
228  if (m_fChargStartRowFlag != NULL) m_fChargStartRowFlag->Reset();
229  if (m_fStartRowCountFlag != NULL) m_fStartRowCountFlag->Reset();
230  if (m_fClusterChargeFlag != NULL) m_fClusterChargeFlag->Reset();
231  if (m_fPixelSignalFlag != NULL) m_fPixelSignalFlag->Reset();
232  if (m_fClusterSizeUFlag != NULL) m_fClusterSizeUFlag->Reset();
233  if (m_fClusterSizeVFlag != NULL) m_fClusterSizeVFlag->Reset();
234  if (m_fClusterSizeUVFlag != NULL) m_fClusterSizeUVFlag->Reset();
235 
236 // if (m_hitMapCounts != NULL) m_hitMapCounts->Reset();
237 // if (m_hitMapClCounts != NULL) m_hitMapClCounts->Reset();
238 
239 }
240 
241 
243 {
244 
245  // Dont sum up!
246 // if (m_fHitMapCountsFlag != NULL) m_fHitMapCountsFlag->Reset();
247 // if (m_fHitMapClCountsFlag != NULL) m_fHitMapClCountsFlag->Reset();
248  if (m_fFiredFlag != NULL) m_fFiredFlag->Reset();
249  if (m_fClustersFlag != NULL) m_fClustersFlag->Reset();
250  if (m_fStartRowFlag != NULL) m_fStartRowFlag->Reset();
251  if (m_fChargStartRowFlag != NULL) m_fChargStartRowFlag->Reset();
252  if (m_fStartRowCountFlag != NULL) m_fStartRowCountFlag->Reset();
253  if (m_fClusterChargeFlag != NULL) m_fClusterChargeFlag->Reset();
254  if (m_fPixelSignalFlag != NULL) m_fPixelSignalFlag->Reset();
255  if (m_fClusterSizeUFlag != NULL) m_fClusterSizeUFlag->Reset();
256  if (m_fClusterSizeVFlag != NULL) m_fClusterSizeVFlag->Reset();
257  if (m_fClusterSizeUVFlag != NULL) m_fClusterSizeUVFlag->Reset();
258 
259  // Compare histograms with reference histograms and create flags:
260  for (int i = 0; i < c_nPXDSensors; i++) {
261  double pars[2];
262  pars[0] = 0.01;// Probabilty value error?
263  pars[1] = 0.05;// Probabilty value warning?
264 
265  double m_NoOfEvents = 1., m_NoOfEventsRef = 1.; // workaround
266 
267 // SetFlag(9, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
268 // m_hitMapCounts, r_hitMapCounts, m_fHitMapCountsFlag);
269 // SetFlag(9, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
270 // m_hitMapClCounts, r_hitMapClCounts, m_fHitMapClCountsFlag);
271  SetFlag(2, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
272  m_fired.at(i), m_ref_fired.at(i), m_fFiredFlag);
273  SetFlag(2, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
275  SetFlag(100, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
277  SetFlag(100, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
279  SetFlag(100, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
281  SetFlag(5, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
283  SetFlag(5, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
285  SetFlag(2, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
287  SetFlag(2, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
289  SetFlag(2, i, pars, (double)m_NoOfEvents / m_NoOfEventsRef,
291 
292  }
293 }
294 
295 
296 void DQMHistAnalysisPXDERModule::getIDsFromIndex(const int Index, int& Layer, int& Ladder, int& Sensor) const
297 {
299  int tempcounter = 0;
300  for (VxdID layer : geo.getLayers()) {
301  if (layer.getLayerNumber() > c_lastPXDLayer) continue; // need PXD
302  for (VxdID ladder : geo.getLadders(layer)) {
303  for (VxdID sensor : geo.getSensors(ladder)) {
304  if (tempcounter == Index) {
305  Layer = layer.getLayerNumber();
306  Ladder = ladder.getLadderNumber();
307  Sensor = sensor.getSensorNumber();
308  return;
309  }
310  tempcounter++;
311  }
312  }
313  }
314 }
315 
316 int DQMHistAnalysisPXDERModule::SetFlag(int Type, int bin, const double* pars, double ratio, const std::string& name_hist,
317  const std::string& name_refhist, TH1I* flaghist)
318 {
319  int iret = 0;
320  float WarningLevel = 6.0;
321  float ErrorLevel = 10.0;
322 
323  TH1* hist = nullptr, *refhist = nullptr;
324 
325  hist = findHist(m_histogramDirectoryName, name_hist);
326  if (!hist) return -1;
327  // assumes that ref file has no sub dirs
328  refhist = findHistInFile(m_refFile, name_refhist);
329  if (!refhist) return -1;
330 
331  // What happens if they are TH1I, TH1D and not TH1F
332 
333  auto temp = std::unique_ptr<TH1F>(new TH1F("temp", "temp", hist->GetNbinsX(), hist->GetXaxis()->GetXmin(),
334  hist->GetXaxis()->GetXmax()));
335  double NEvents = 0;
336  double flagInt = 0;
337  double flagrInt = 0;
338  for (int j = 0; j < hist->GetNbinsX(); j++) {
339  double val = hist->GetBinContent(j + 1);
340  NEvents += val;
341  val = val / ratio;
342  temp->SetBinContent(j + 1, val);
343  flagInt += temp->GetBinContent(j + 1);
344  flagrInt += refhist->GetBinContent(j + 1);
345  }
346  if (NEvents < 100) { // not enough information for comparition
347  iret = -1;
348  flaghist->SetBinContent(bin + 1, -1);
349  return iret;
350  }
351  double flag = temp->GetMean();
352  double flagErr = temp->GetMeanError();
353  double flagRMS = temp->GetRMS();
354  double flagRMSErr = temp->GetRMSError();
355  double flagr = refhist->GetMean();
356  double flagrErr = refhist->GetMeanError();
357  double flagrRMS = refhist->GetRMS();
358  double flagrRMSErr = refhist->GetRMSError();
359  TString strDebugInfo = Form("Conditions for Flag--->\n source %f %f+-%f %f+-%f\n referen %f %f+-%f %f+-%f\n",
360  flagInt, flag, flagErr, flagRMS, flagRMSErr,
361  flagrInt, flagr, flagrErr, flagrRMS, flagrRMSErr
362  );
363  B2DEBUG(130, strDebugInfo.Data());
364  if (Type == 1) { // counts+mean+RMS use
365  if ((fabs(flag - flagr) > ErrorLevel * (flagErr + flagrErr)) ||
366  (fabs(flagRMS - flagrRMS) > ErrorLevel * (flagRMSErr + flagrRMSErr)) ||
367  (fabs(flagInt - flagrInt) > ErrorLevel * (sqrt(flagInt) + sqrt(flagrInt)))
368  ) {
369  flaghist->SetBinContent(bin + 1, 2);
370  } else if ((fabs(flag - flagr) > WarningLevel * (flagErr + flagrErr)) ||
371  (fabs(flagRMS - flagrRMS) > WarningLevel * (flagRMSErr + flagrRMSErr)) ||
372  (fabs(flagInt - flagrInt) > WarningLevel * (sqrt(flagInt) + sqrt(flagrInt)))
373  ) {
374  flaghist->SetBinContent(bin + 1, 1);
375  } else {
376  flaghist->SetBinContent(bin + 1, 0);
377  }
378  iret = 1;
379  } else if (Type == 2) { // counts use
380  if (fabs(flagInt - flagrInt) > ErrorLevel * (sqrt(flagInt) + sqrt(flagrInt))) {
381  flaghist->SetBinContent(bin + 1, 2);
382  } else if (fabs(flagInt - flagrInt) > WarningLevel * (sqrt(flagInt) + sqrt(flagrInt))) {
383  flaghist->SetBinContent(bin + 1, 1);
384  } else {
385  flaghist->SetBinContent(bin + 1, 0);
386  }
387  iret = 1;
388  } else if (Type == 3) { // mean use
389  if (fabs(flag - flagr) > ErrorLevel * (flagErr + flagrErr)) {
390  flaghist->SetBinContent(bin + 1, 2);
391  } else if (fabs(flag - flagr) > WarningLevel * (flagErr + flagrErr)) {
392  flaghist->SetBinContent(bin + 1, 1);
393  } else {
394  flaghist->SetBinContent(bin + 1, 0);
395  }
396  iret = 1;
397  } else if (Type == 4) { // RMS use
398  if (fabs(flagRMS - flagrRMS) > ErrorLevel * (flagRMSErr + flagrRMSErr)) {
399  flaghist->SetBinContent(bin + 1, 2);
400  } else if (fabs(flagRMS - flagrRMS) > WarningLevel * (flagRMSErr + flagrRMSErr)) {
401  flaghist->SetBinContent(bin + 1, 1);
402  } else {
403  flaghist->SetBinContent(bin + 1, 0);
404  }
405  iret = 1;
406  } else if (Type == 5) { // counts+mean use
407  if ((fabs(flag - flagr) > ErrorLevel * (flagErr + flagrErr)) ||
408  (fabs(flagInt - flagrInt) > ErrorLevel * (sqrt(flagInt) + sqrt(flagrInt)))
409  ) {
410  flaghist->SetBinContent(bin + 1, 2);
411  } else if ((fabs(flag - flagr) > WarningLevel * (flagErr + flagrErr)) ||
412  (fabs(flagInt - flagrInt) > WarningLevel * (sqrt(flagInt) + sqrt(flagrInt)))
413  ) {
414  flaghist->SetBinContent(bin + 1, 1);
415  } else {
416  flaghist->SetBinContent(bin + 1, 0);
417  }
418  iret = 1;
419  } else if (Type == 9) { // bin content use
420  flagInt = temp->GetBinContent(bin + 1);
421  flagrInt = refhist->GetBinContent(bin + 1);
422  if (fabs(flagInt - flagrInt) > ErrorLevel * (sqrt(flagInt) + sqrt(flagrInt))) {
423  flaghist->SetBinContent(bin + 1, 2);
424  } else if (fabs(flagInt - flagrInt) > WarningLevel * (sqrt(flagInt) + sqrt(flagrInt))) {
425  flaghist->SetBinContent(bin + 1, 1);
426  } else {
427  flaghist->SetBinContent(bin + 1, 0);
428  }
429  iret = 1;
430  } else if (Type == 10) {
431  float flag2 = refhist->Chi2Test(temp.get());
432  flaghist->SetBinContent(bin + 1, 0);
433  if (flag2 > pars[1])
434  flaghist->SetBinContent(bin + 1, 2);
435  if (flag2 > pars[0])
436  flaghist->SetBinContent(bin + 1, 1);
437  iret = 1;
438  } else if (Type == 100) {
439  flaghist->SetBinContent(bin + 1, 0);
440  iret = 1;
441  } else {
442  flaghist->SetBinContent(bin + 1, -3);
443  iret = -1;
444  }
445  strDebugInfo = Form("SetFlag---> %f, type %i\n", flaghist->GetBinContent(bin + 1), Type);
446  B2DEBUG(130, strDebugInfo.Data());
447  return iret;
448 }
449 
450 // int DQMHistAnalysisPXDERModule::SetFlag(int Type, int bin, double* pars, double ratio, std::string name_hist, std::string name_refhist, TH1I* flaghist)
451 // {
452 //
453 // TH1F* histF = new TH1F("histF", "histF", hist->GetNbinsX(), hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
454 // TH1F* refhistF = new TH1F("refhistF", "refhistF", refhist->GetNbinsX(), refhist->GetXaxis()->GetXmin(),
455 // refhist->GetXaxis()->GetXmax());
456 // for (int j = 0; j < hist->GetNbinsX(); j++) {
457 // histF->SetBinContent(j + 1, hist->GetBinContent(j + 1));
458 // refhistF->SetBinContent(j + 1, refhist->GetBinContent(j + 1));
459 // }
460 // int ret = SetFlag(Type, bin, pars, ratio, histF, refhistF, flaghist);
461 // delete histF;
462 // delete refhistF;
463 // return ret;
464 // }
The base class for the histogram analysis module.
static TH1 * findHistInFile(TFile *file, const std::string &histname)
Find histogram in specific TFile (e.g.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
int c_nPXDLayers
Number of PXD layers on Belle II.
std::string m_refFileName
Reference Histogram Root file name.
void initialize() override final
Initializer.
std::vector< std::string > m_chargStartRow
Cluster seed charge by distance from the start row.
std::vector< std::string > m_startRow
Start row distribution.
std::vector< std::string > m_ref_clusterCharge
Charge of clusters.
TH1I * m_fClusterSizeUFlag
Flags of u cluster size.
int c_firstVXDLayer
First VXD layer on Belle II.
std::vector< std::string > m_ref_clusterSizeV
v cluster size
int c_lastVXDLayer
Last VXD layer on Belle II.
std::vector< std::string > m_clusterSizeU
u cluster size
TH1I * m_fPixelSignalFlag
Flags of Charge of pixels.
std::vector< std::string > m_ref_startRow
Start row distribution.
int c_lastPXDLayer
Last PXD layer on Belle II.
std::vector< std::string > m_ref_clusterSizeU
u cluster size
std::vector< std::string > m_clusters
Clusters per event.
std::vector< std::string > m_ref_startRowCount
counter for Cluster seed charge by distance from the start row
TH1I * m_fStartRowFlag
Flags of Start row distribution.
TH1I * m_fClusterSizeUVFlag
Flags of Cluster size.
std::vector< std::string > m_clusterSizeUV
Cluster size.
int c_firstPXDLayer
First PXD layer on Belle II.
TH1I * m_fStartRowCountFlag
Flags of counter for Cluster seed charge by distance from the start row.
TH1I * m_fChargStartRowFlag
Flags of Cluster seed charge by distance from the start row.
void event() override final
This method is called for each event.
TH1I * m_fClusterSizeVFlag
Flags of v cluster size.
TH1I * m_fClustersFlag
Flags of Clusters per event.
std::vector< std::string > m_startRowCount
counter for Cluster seed charge by distance from the start row
std::string m_histogramDirectoryName
Function return flag histogram filled based on condition from TH1I source.
std::vector< std::string > m_clusterSizeV
v cluster size
std::vector< std::string > m_pixelSignal
Charge of pixels.
std::vector< std::string > m_ref_clusterSizeUV
Cluster size.
std::vector< std::string > m_ref_clusters
Clusters per event.
void beginRun() override final
Called when entering a new run.
TH1I * m_fClusterChargeFlag
Flags of Charge of clusters.
int SetFlag(int Type, int bin, const double *pars, double ratio, const std::string &name_hist, const std::string &name_refhist, TH1I *flaghist)
Function return flag histogram filled based on condition from TH1F source.
std::vector< std::string > m_fired
Hitmaps of Digits.
TH1I * m_fFiredFlag
Basic Directory in output file.
std::vector< std::string > m_ref_chargStartRow
Cluster seed charge by distance from the start row.
std::vector< std::string > m_ref_pixelSignal
Charge of pixels.
int c_nPXDSensors
Number of PXD sensors on Belle II.
std::vector< std::string > m_clusterCharge
Charge of clusters.
void getIDsFromIndex(const int Index, int &Layer, int &Ladder, int &Sensor) const
Function return index of sensor in plots.
int c_nVXDLayers
Number of pixels on PXD v direction.
std::vector< std::string > m_ref_fired
Fired pixels per event.
int c_firstSVDLayer
First SVD layer on Belle II.
int c_nSVDLayers
Number of SVD layers on Belle II.
int c_lastSVDLayer
Last SVD layer on Belle II.
TFile * m_refFile
The pointer to the reference file.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:23
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:39
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
Definition: GeoCache.cc:176
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
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Definition: GeoCache.h:139
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
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.