Belle II Software development
DQMHistAnalysisCDCEpics.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/database/DBArray.h>
12#include <framework/database/DBObjPtr.h>
13#include <dqm/core/DQMHistAnalysis.h>
14
15#include <TROOT.h>
16#include <TLine.h>
17#include <TH2Poly.h>
18#include <TH2F.h>
19#include <TH1F.h>
20#include <TStyle.h>
21#include <TLine.h>
22#include <TEllipse.h>
23#include <TLatex.h>
24#include <TPad.h>
25#include <numeric>
26#include <iostream>
27#include <cdc/geometry/CDCGeometryPar.h>
28#include <cdc/geometry/CDCGeometryParConstants.h>
29
30namespace Belle2 {
35
36
40 constexpr unsigned kNumLayers = c_maxNFieldLayers;
41 constexpr unsigned kNumBoards = c_nBoards;
42 constexpr std::array<int, 9> slindex = { 8, 14, 20, 26, 32, 38, 44, 50, 56 };
43
48
49 public:
50
55
60
64 void initialize() override final;
65
69 void beginRun() override final;
70
74 void event() override final;
75
79 void endRun() override final;
80
84 void terminate() override final;
85
89 void getHistStyle(TH1F*& htemp, std::string label, double max) const
90 {
91 gStyle->SetOptStat("ne");
92 if (strcmp(label.data(), "adc") == 0)htemp->GetYaxis()->SetRangeUser(max * 0.25, max * 2.25);
93 else if (strcmp(label.data(), "tdc") == 0)htemp->GetYaxis()->SetRangeUser(max * 0.90, max * 1.10);
94 htemp->Sumw2(0);
95 };
96
100 float getHistMedian(TH1D* h) const;
101
105 TH2Poly* createEffiTH2Poly(const TString& name, const TString& title) ;
106
110 void fillEffiTH2Poly(TH2F* hist, TH2Poly* attached, TH2Poly* expected, TH2Poly* efficiency) ;
111
115 void fillEffiTH2(TH2F* hist, TH2F* attached, TH2F* expected, TH2F* efficiency) ;
116
117 protected:
118
119 //Canvas for DQM analysis IR plots
120 TCanvas* c_histmd_ladc = nullptr;
121 TH1F* m_histmd_ladc = nullptr;
122
123 TCanvas* c_hist_adc = nullptr;
124 TH1F* m_hist_adc = nullptr;
125
126 TCanvas* c_hist_tdc = nullptr;
127 TH1F* m_hist_tdc = nullptr;
128
129 TCanvas* c_hist_crphi = nullptr;
130 TH1D* m_hist_crphi = nullptr;
131
132 TCanvas* c_hist_hitsphi = nullptr;
133
134 TCanvas* c_hist_effphi = nullptr;
135 TH1D* m_hist_effphi = nullptr;
136
137 TCanvas* c_hist_skimphi[8] = {nullptr};
138 TH1D* m_hist_skimphi[8] = {nullptr};
139
140 TCanvas* c_hist_attach_eff[4] = {nullptr};
141 TH2F* m_hist_attach_eff[3] = {nullptr};
142 TH2Poly* m_hist_attach_eff_Poly[3] = {nullptr};
144 double m_lbinEdges[kNumLayers + 1] = {0.0};
145
146 TLine* m_line_ladc_sl01 = nullptr;
147 TLine* m_line_hadc_sl01 = nullptr;
148 TLine* m_line_ltdc_sl01 = nullptr;
149 TLine* m_line_htdc_sl01 = nullptr;
150
151 TLine* m_line_ladc_sl28 = nullptr;
152 TLine* m_line_hadc_sl28 = nullptr;
153 TLine* m_line_ltdc_sl28 = nullptr;
154 TLine* m_line_htdc_sl28 = nullptr;
155
156 std::string m_name_dir = "";
157 std::string m_name_refdir = "";
158 std::string m_name_pvpfx = "";
159 std::string m_fname_refphi = "";
160 std::string m_hname_ladc = "";
161 std::string m_hname_badc = "";
162 std::string m_hname_btdc = "";
163 std::string m_hname_idxphi = "";
164 std::string m_hname_effphi = "";
165 std::string m_hname_hitsphi = "";
166 std::string m_histoTrackingWireEff = "";
168 double m_firstEffBoundary = 0.08;
169 double m_secondEffBoundary = 0.72;
170
172
173 TFile* m_fileRefPhi = nullptr;
174 TH2F* m_histref_phiindex = nullptr;
175 TH1D* m_hist_refphi = nullptr;
176
179
180 double m_minadc_sl01 = 20.0;
181 double m_maxadc_sl01 = 40.0;
182 double m_mintdc_sl01 = 4700.0;
183 double m_maxtdc_sl01 = 5200.0;
184
185 double m_minadc_sl28 = 40.0;
186 double m_maxadc_sl28 = 180.0;
187 double m_mintdc_sl28 = 4600.0;
188 double m_maxtdc_sl28 = 5000.0;
189
190 double m_phistop;
191 double m_phiwarn = 0.05;
192 double m_phialarm = 0.15;
193 std::vector<TLine*> m_lines;
194
198 };
199
200} // Belle2 namespace
TCanvas * c_hist_adc
canvas for adc board median
TCanvas * c_hist_skimphi[8]
canvas for various phi distribution
TLine * m_line_ltdc_sl28
line for lower TDC window for SL2-8
double m_maxtdc_sl28
max tdc median threshold accepted for SL2-8
void initialize() override final
Initialize the Module.
TCanvas * c_histmd_ladc
canvas for adc layer median
double m_secondEffBoundary
The second boundary of the efficiency range.
int m_minevt
min events for single intra-run point
TCanvas * c_hist_effphi
canvas for tracking efficiency
std::string m_hname_idxphi
Phi Inedx histogram names.
void fillEffiTH2Poly(TH2F *hist, TH2Poly *attached, TH2Poly *expected, TH2Poly *efficiency)
Populate the efficiency histograms.
TH1D * m_hists_bADC[kNumBoards]
ADC histograms with track associated hits for each board (0-299)
double m_mintdc_sl01
min tdc median threshold accepted for SL0-1
TH2Poly * createEffiTH2Poly(const TString &name, const TString &title)
Convenient function to create a TH2Poly based on CDC geometry.
double m_maxadc_sl28
max adc median threshold accepted for SL2-8
std::string m_hname_hitsphi
Phi Hits histogram names.
double m_phiwarn
5% warn thershold for phi differences
TLine * m_line_ladc_sl01
line for lower ADC window for SL0-1
std::string m_histoTrackingWireEff
Wire Eff histogram names.
TFile * m_fileRefPhi
reference histogram file point
double m_mintdc_sl28
min tdc median threshold accepted for SL2-8
double m_phialarm
15% alarm thershold for phi differences
TLine * m_line_ltdc_sl01
line for lower TDC window for SL0-1
std::string m_hname_effphi
Phi Eff histogram names.
double m_maxadc_sl01
max adc median threshold accepted for SL0-1
TLine * m_line_hadc_sl01
line for higher ADC window for SL0-1
double m_lbinEdges[kNumLayers+1]
vector for radius edge 56
void getHistStyle(TH1F *&htemp, std::string label, double max) const
get histogram styles
MonitoringObject * m_monObj
monitoring object
TCanvas * c_hist_crphi
canvas for control shifter phi
double m_minadc_sl28
min adc median threshold accepted for SL2-8
TLine * m_line_htdc_sl01
line for higher TDC window for SL0-1
std::string m_fname_refphi
reference file of phi histogram
void terminate() override final
Termination action.
void event() override final
intra-run actions (EPICC PVs).
std::vector< TLine * > m_lines
number of CDC layer lines
TCanvas * c_hist_tdc
canvas for tdc board median
std::string m_hname_ladc
Layer ADC histogram names.
TH1D * m_hists_lADC[kNumLayers]
ADC histograms with track associated hits for each board (0-299)
double m_phistop
stop thershold for phi differences
bool m_doTH2PolyTrackingWireEff
If true, creates TH2Poly instead of TH2F for TrackingWireEff Histos.
TCanvas * c_hist_hitsphi
expert canvas for hits vs phi
double m_minphibinsfrac
min phi diff fraction for alarms
TCanvas * c_hist_attach_eff[4]
canvas for layer efficiency
double m_firstEffBoundary
The first boundary of the efficiency range.
double m_maxtdc_sl01
max tdc median threshold accepted for SL0-1
std::string m_name_refdir
reference histogram dir
void endRun() override final
End-of-run action.
void beginRun() override final
Called when entering a new run.
TLine * m_line_htdc_sl28
line for higher TDC window for SL2-8
TH1D * m_hists_bTDC[kNumBoards]
TDC histograms with track associated hits for each board (0-299)
double m_minadc_sl01
min adc median threshold accepted for SL0-1
TLine * m_line_hadc_sl28
line for higher ADC window for SL2-8
float getHistMedian(TH1D *h) const
Get median of given histogram.
TLine * m_line_ladc_sl28
line for lower ADC window for SL2-8
std::string m_hname_btdc
Board TDC histogram names.
std::string m_hname_badc
Board ADC histogram names.
void fillEffiTH2(TH2F *hist, TH2F *attached, TH2F *expected, TH2F *efficiency)
Populate the efficiency histograms.
DQMHistAnalysisModule()
Constructor / Destructor.
MonitoringObject is a basic object to hold data for the run-dependency monitoring Run summary TCanvas...
constexpr unsigned kNumLayers
const CDC numbers for layers, boards and super layers
constexpr unsigned kNumBoards
Total number of CDC Boards.
constexpr std::array< int, 9 > slindex
Index (layer number) of the 9 super-layers in the CDC.
Abstract base class for different kinds of events.