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 <numeric>
24#include <iostream>
25#include <cdc/geometry/CDCGeometryPar.h>
26#include <cdc/geometry/CDCGeometryParConstants.h>
27
28namespace Belle2 {
33
34
38 constexpr unsigned kNumLayers = c_maxNFieldLayers;
39 constexpr unsigned kNumBoards = c_nBoards;
40 constexpr std::array<int, 9> slindex = { 8, 14, 20, 26, 32, 38, 44, 50, 56 };
41
46
47 public:
48
53
58
62 void initialize() override final;
63
67 void beginRun() override final;
68
72 void event() override final;
73
77 void endRun() override final;
78
82 void terminate() override final;
83
87 void getHistStyle(TH1F*& htemp, std::string label, double max) const
88 {
89 gStyle->SetOptStat("ne");
90 if (strcmp(label.data(), "adc") == 0)htemp->GetYaxis()->SetRangeUser(max * 0.25, max * 2.25);
91 else if (strcmp(label.data(), "tdc") == 0)htemp->GetYaxis()->SetRangeUser(max * 0.90, max * 1.10);
92 htemp->Sumw2(0);
93 };
94
98 float getHistMedian(TH1D* h) const;
99
103 TH2Poly* createEffiTH2Poly(const TString& name, const TString& title) ;
104
108 void fillEffiTH2Poly(TH2F* hist, TH2Poly* attached, TH2Poly* expected, TH2Poly* efficiency) ;
109
113 void fillEffiTH2(TH2F* hist, TH2F* attached, TH2F* expected, TH2F* efficiency) ;
114
115 protected:
116
117 //Canvas for DQM analysis IR plots
118 TCanvas* c_histmd_ladc = nullptr;
119 TH1F* m_histmd_ladc = nullptr;
120
121 TCanvas* c_hist_adc = nullptr;
122 TH1F* m_hist_adc = nullptr;
123
124 TCanvas* c_hist_tdc = nullptr;
125 TH1F* m_hist_tdc = nullptr;
126
127 TCanvas* c_hist_crphi = nullptr;
128 TH1D* m_hist_crphi = nullptr;
129
130 TCanvas* c_hist_hitsphi = nullptr;
131
132 TCanvas* c_hist_effphi = nullptr;
133 TH1D* m_hist_effphi = nullptr;
134
135 TCanvas* c_hist_skimphi[8] = {nullptr};
136 TH1D* m_hist_skimphi[8] = {nullptr};
137
138 TCanvas* c_hist_attach_eff[4] = {nullptr};
139 TH2F* m_hist_attach_eff[3] = {nullptr};
140 TH2Poly* m_hist_attach_eff_Poly[3] = {nullptr};
142 double lbinEdges[kNumLayers] = {0.0};
143
144 TLine* m_line_ladc = nullptr;
145 TLine* m_line_hadc = nullptr;
146 TLine* m_line_ltdc = nullptr;
147 TLine* m_line_htdc = nullptr;
148
149 std::string m_name_dir = "";
150 std::string m_name_refdir = "";
151 std::string m_name_pvpfx = "";
152 std::string m_fname_refphi = "";
153 std::string m_hname_ladc = "";
154 std::string m_hname_badc = "";
155 std::string m_hname_btdc = "";
156 std::string m_hname_idxphi = "";
157 std::string m_hname_effphi = "";
158 std::string m_hname_hitsphi = "";
159 std::string m_histoTrackingWireEff = "";
161 double m_firstEffBoundary = 0.08;
162 double m_secondEffBoundary = 0.72;
163
165
166 TFile* m_fileRefPhi = nullptr;
167 TH2F* m_histref_phiindex = nullptr;
168 TH1D* m_hist_refphi = nullptr;
169
171 double m_minadc;
172 double m_maxadc;
173 double m_mintdc;
174 double m_maxtdc;
175 double m_phistop;
177 double m_phiwarn;
178 std::vector<TLine*> m_lines;
179
183 };
184
185} // Belle2 namespace
TCanvas * c_hist_adc
canvas for adc board median
TCanvas * c_hist_skimphi[8]
canvas for various phi distribution
void initialize() override final
Initialize the Module.
double m_minadc
min adc median thershold accepted
TCanvas * c_histmd_ladc
canvas for adc layer median
double m_secondEffBoundary
The second boundary of the efficiency range.
TLine * m_line_hadc
line for higher ADC window
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)
TH2Poly * createEffiTH2Poly(const TString &name, const TString &title)
Convenient function to create a TH2Poly based on CDC geometry.
std::string m_hname_hitsphi
Phi Hits histogram names.
double m_phiwarn
warn thershold for phi differences
std::string m_histoTrackingWireEff
Wire Eff histogram names.
TFile * m_fileRefPhi
reference histogram file point
TLine * m_line_htdc
line for higher TDC window
double m_phialarm
alarm thershold for phi differences
double m_maxadc
max adc median thershold accepted
std::string m_hname_effphi
Phi Eff histogram names.
double m_maxtdc
max tdc median thershold accepted
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
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 lbinEdges[kNumLayers]
vector for radius edge 56
TCanvas * c_hist_attach_eff[4]
canvas for layer efficiency
double m_firstEffBoundary
The first boundary of the efficiency range.
std::string m_name_refdir
reference histogram dir
void endRun() override final
End-of-run action.
TLine * m_line_ltdc
line for lower TDC window
TLine * m_line_ladc
line for lower ADC window
void beginRun() override final
Called when entering a new run.
TH1D * m_hists_bTDC[kNumBoards]
TDC histograms with track associated hits for each board (0-299)
float getHistMedian(TH1D *h) const
Get median of given histogram.
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.
double m_mintdc
min tdc median thershold accepted
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.