Belle II Software  release-08-01-10
SVDLocalCalibrationsCheckModule.h
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 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <vxd/dataobjects/VxdID.h>
13 
14 #include <svd/dataobjects/SVDHistograms.h>
15 #include <svd/dataobjects/SVDAPVHistograms.h>
16 #include <svd/dataobjects/SVDSummaryPlots.h>
17 
18 #include <string>
19 #include <TFile.h>
20 #include <TTree.h>
21 #include <TBranch.h>
22 #include <TH1F.h>
23 #include <TH2F.h>
24 #include <TList.h>
25 #include <TLegend.h>
26 
27 namespace Belle2 {
39 
40  public:
41 
46 
48  virtual void beginRun() override;
49 
51  virtual void event() override;
52 
53  /* ROOT file related parameters */
54  TFile* m_rootFilePtrREF = nullptr;
55  TFile* m_rootFilePtrCHECK = nullptr;
56  TTree* m_treeREF = nullptr;
57  TTree* m_treeCHECK = nullptr;
59  //branches REF
60  TBranch* b_runREF = nullptr;
61  TBranch* b_ladderREF = nullptr;
62  TBranch* b_layerREF = nullptr;
63  TBranch* b_sensorREF = nullptr;
64  TBranch* b_sideREF = nullptr;
65  TBranch* b_stripREF = nullptr;
66  TBranch* b_maskREF = nullptr;
67  TBranch* b_pedestalREF = nullptr;
68  TBranch* b_gainREF = nullptr;
69  TBranch* b_noiseREF = nullptr;
70  TBranch* b_noiseElREF = nullptr;
71  TBranch* b_calPeakADCREF = nullptr;
72  TBranch* b_calPeakTimeREF = nullptr;
73  TBranch* b_pulseWidthREF = nullptr;
75  //branches CHECK
76  TBranch* b_runCHECK = nullptr;
77  TBranch* b_ladderCHECK = nullptr;
78  TBranch* b_layerCHECK = nullptr;
79  TBranch* b_sensorCHECK = nullptr;
80  TBranch* b_sideCHECK = nullptr;
81  TBranch* b_stripCHECK = nullptr;
82  TBranch* b_maskCHECK = nullptr;
83  TBranch* b_pedestalCHECK = nullptr;
84  TBranch* b_gainCHECK = nullptr;
85  TBranch* b_noiseCHECK = nullptr;
86  TBranch* b_noiseElCHECK = nullptr;
87  TBranch* b_calPeakTimeCHECK = nullptr;
88  TBranch* b_calPeakADCCHECK = nullptr;
89  TBranch* b_pulseWidthCHECK = nullptr;
92  //branch variables
93  UInt_t m_runREF = -1;
94  UInt_t m_layerREF = -1;
95  UInt_t m_ladderREF = -1;
96  UInt_t m_sensorREF = -1;
97  UInt_t m_sideREF = -1;
98  UInt_t m_stripREF = -1;
99  float m_maskREF = -1;
100  float m_noiseREF = -1;
101  float m_noiseElREF = -1;
102  float m_pedestalREF = -1;
103  float m_gainREF = -1;
104  float m_calPeakTimeREF = -1;
105  float m_calPeakADCREF = -1;
106  float m_pulseWidthREF = -1;
109  //branch variables
110  UInt_t m_runCHECK = -1;
111  UInt_t m_layerCHECK = -1;
112  UInt_t m_ladderCHECK = -1;
113  UInt_t m_sensorCHECK = -1;
114  UInt_t m_sideCHECK = -1;
115  UInt_t m_stripCHECK = -1;
116  float m_maskCHECK = -1;
117  float m_noiseCHECK = -1;
118  float m_noiseElCHECK = -1;
119  float m_pedestalCHECK = -1;
120  float m_gainCHECK = -1;
121  float m_calPeakTimeCHECK = -1;
122  float m_calPeakADCCHECK = -1;
123  float m_pulseWidthCHECK = -1;
125  std::string m_rootFileNameREF = "SVDLocalCalibrationMonitor_experiment5_run92.root";
126  std::string m_rootFileNameCHECK = "SVDLocalCalibrationMonitor_experiment5_run408.root";
128  std::string m_idFileNameREF = "refID";
129  std::string m_idFileNameCHECK = "checkID";
131  std::string m_outputPdfName = "SVDLocalCalibrationCheck.pdf";
133  bool m_plotGoodAPVs = false;
135  //analsyis parameters
136  int m_cutN_out = -1;
137  float m_cutNoise_ave = -1;
138  float m_cutNoise_out = -1;
139  float m_cutCalpeakADC_ave = -1;
140  float m_cutCalpeakADC_out = -1;
141  float m_cutPedestal_ave = -1;
142  float m_cutPedestal_out = -1;
144  private:
145 
146  void printConfiguration();
148  const int m_apvColors[6] = { 1, 2, 8, kBlue, 6, 28};
149  void setAPVHistoStyles(SVDAPVHistograms<TH1F>* m_APVhistos);
151  void createLegends();
152  TLegend* m_leg2D = nullptr;
153  TLegend* m_legU = nullptr;
154  TLegend* m_legV = nullptr;
156  void printFirstPage();
157  void printLayerPage(int layer);
158  void printPage(VxdID theVxdID, TList* listUBAD, TList* listVBAD, TList* listUGOOD, TList* listVGOOD, TString variable,
159  bool isL3);
160  void printSummaryPages();
161  void printLastPage();
163  int hasAnyProblem(TH1F* h, float cutAve, float cutCOUNT);
189  };
191 }
192 
Base class for Modules.
Definition: Module.h:72
Module to produce a list of histogram showing the uploaded local calibration constants.
SVDHistograms< TH2F > * m_h2CalpeakADCREF
CALPEAKS ADC.
void printSummaryPages()
summary page with 2D summary plot
SVDSummaryPlots * m_hCalpeakADCSummary
calpeakADC summary histo
TFile * m_rootFilePtrCHECK
pointer at the CHECK root file
SVDHistograms< TH2F > * m_h2CalpeakTimeCHECK
calpeakTime VS strip 2D histo
void printPage(VxdID theVxdID, TList *listUBAD, TList *listVBAD, TList *listUGOOD, TList *listVGOOD, TString variable, bool isL3)
print the page relative to a sensor with problematic APVs
int m_cutN_out
maximum number of allowed outliers
SVDAPVHistograms< TH1F > * m_hCalpeakTimeDIFF
calpeakTime histo
SVDLocalCalibrationsCheckModule()
Constructor: Sets the description, the properties and the parameters of the module.
TBranch * b_calPeakADCCHECK
strip calPeakADC (ADC of max pulse)
SVDHistograms< TH2F > * m_h2CalpeakADCCHECK
calpeakADC VS strip 2D histo
virtual void event() override
perform analysis and Draw pdf Canvas
TBranch * b_calPeakADCREF
strip calPeakADC (ADC of max pulse)
float m_cutPedestal_ave
maximum relative deviation APV-average (pedestal)
TFile * m_rootFilePtrREF
pointer at the REFERENCE root file
float m_cutCalpeakADC_ave
maximum relative deviation APV-average (calpeakADC)
void printLayerPage(int layer)
print layer-number page
SVDSummaryPlots * m_hCalpeakTimeSummary
calpeakTime summary histo
float m_cutCalpeakADC_out
maximum relative deviation strip (calpeakADC)
std::string m_idFileNameCHECK
ID of the xml file name CHECK.
SVDHistograms< TH2F > * m_h2NoiseCHECK
noise VS strip 2D histo
SVDAPVHistograms< TH1F > * m_hPedestalDIFF
pedestal histo
bool m_plotGoodAPVs
if true also the good APVs are plotted on the DIFF canvas
float m_cutNoise_ave
maximum relative deviation APV-average (noise)
TBranch * b_calPeakTimeCHECK
strip calPeakTime (time of max pulse)
virtual void beginRun() override
initialize the TTrees and create SVDHistograms and SVDAPVHistograms
float m_cutNoise_out
maximum relative deviation strip (noise)
void printConfiguration()
print the configuration of the check of the calibration VS a reference calibration
int hasAnyProblem(TH1F *h, float cutAve, float cutCOUNT)
return True if the APV has a problem, given a variable
std::string m_rootFileNameREF
root file name REFERENCE
std::string m_idFileNameREF
ID of the xml file name REFERENCE.
SVDAPVHistograms< TH1F > * m_hCalpeakADCDIFF
calpeakADC histo
SVDHistograms< TH2F > * m_h2PedestalCHECK
pedestal VS strip 2D histo
TBranch * b_calPeakTimeREF
strip calPeakTime (time of max pulse)
void printFirstPage()
print the first page of the output pdf
void createLegends()
create the TLegends for the plot
SVDAPVHistograms< TH1F > * m_hNoiseDIFF
noise histo
SVDSummaryPlots * m_hPedestalSummary
pedestal summary histo
SVDSummaryPlots * m_hNoiseSummary
noise summary histo
void setAPVHistoStyles(SVDAPVHistograms< TH1F > *m_APVhistos)
set style of APV histograms
SVDHistograms< TH2F > * m_h2CalpeakTimeREF
CALPEAKS TIME.
float m_cutPedestal_out
maximum relative deviation strip (pedestal)
class to summarize SVD quantities per sensor and side
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.