Belle II Software development
CDCDedx1DCellAlgorithm.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 <TH1D.h>
12#include <TH2D.h>
13
14#include <cdc/dbobjects/CDCDedx1DCell.h>
15#include <calibration/CalibrationAlgorithm.h>
16#include <framework/database/DBObjPtr.h>
17
18namespace Belle2 {
23
29
30 public:
31
36
41
45 void setSuffix(const std::string& value) {m_suffix = value;}
46
50 void setVariableBins(bool value) {isVarBins = value;}
51
55 void setLayerTrunc(bool value = false) {isFixTrunc = value;}
56
61 void setMergePayload(bool value) { isMerge = value;}
62
66 void setSplitFactor(int value) {m_binSplit = value;}
67
71 void setRotSymmetry(bool value) {isRotSymm = value;}
72
76 void setTrucationBins(double lowedge, double upedge)
77 {
78 m_truncMin = lowedge; m_truncMax = upedge ;
79 }
80
84 void enableExtraPlots(bool value = false) {isMakePlots = value;}
85
89 void setPtLimit(double value) {m_ptMax = value;}
90
94 void setCosLimit(double value) {m_cosMax = value;}
95
100 void setBaselineFactor(double charge, double factor)
101 {
102
103 m_adjustFac = factor;
104 if (charge < 0)m_chargeType = -1.0;
105 else if (charge > 0)m_chargeType = 1.0;
106 else if (charge == 0)m_chargeType = 0.0;
107 else
108 B2FATAL("Choose charge value either +/-1 or 0");
109 }
110
114 int rotationalBin(int nbin, int ibin)
115 {
116 if (nbin % 4 != 0)return ibin;
117 int jbin = ibin;
118 if (ibin < nbin / 4) jbin = ibin + nbin / 2 ;
119 else if (ibin >= 3 * nbin / 4) jbin = ibin - nbin / 2 ;
120 return jbin;
121 }
122
126 void getExpRunInfo();
127
131 void CreateBinMapping();
132
136 void defineHisto(std::vector<TH1D*> hdedxhit[2], TH1D* hdedxlay[2], TH1D* hentalay[2]);
137
141 void getTruncatedBins(TH1D* hist, int& binlow, int& binhigh);
142
146 double getTruncationMean(TH1D* hist, int binlow, int binhigh);
147
151 void createPayload();
152
156 void plotMergeFactor(std::map<int, std::vector<double>> bounds, const std::array<int, 2> nDev,
157 std::map<int, std::vector<int>> steps);
158
162 void plotdedxHist(std::vector<TH1D*> hdedxhit[2]);
163
167 void plotLayerDist(TH1D* hdedxL[2]);
168
172 void plotQaPars(TH1D* hentalay[2], TH2D* hptcosth);
173
177 void plotRelConst(std::vector<double>tempconst, std::vector<double>layerconst, int il);
178
182 void plotConstants();
183
187 void plotEventStats();
188
189 protected:
193 virtual EResult calibrate() override;
194
195
196 private:
197
198 double m_eaMin;
199 double m_eaMax;
200 double m_eaBW;
202 int m_eaB;
203
204 double m_dedxMin;
205 double m_dedxMax;
207
208 double m_ptMax;
209 double m_cosMax;
210
211 double m_truncMin;
212 double m_truncMax;
213
215
218
224 bool isMerge;
225
226 std::string m_suffix;
227 std::string m_runExp;
228 std::string m_label[2] = {"IL", "OL"};
229
230 std::vector<int> m_eaBinLocal;
231 std::array<std::vector<int>, 2> m_binIndex;
232 std::array<std::vector<double>, 2>m_binValue;
233
234 std::vector<std::vector<double>> m_onedcors;
235
237
238
239 };
240
241} // namespace Belle2
void setSplitFactor(int value)
set bin split factor for all range
CDCDedx1DCellAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
std::string m_label[2]
add inner/outer layer label
double m_eaMax
upper edge of entrance angle
void plotMergeFactor(std::map< int, std::vector< double > > bounds, const std::array< int, 2 > nDev, std::map< int, std::vector< int > > steps)
function to plot merging factor
double m_truncMax
upper threshold on truncation
int m_binSplit
multiply nbins by this factor in full range
std::array< std::vector< int >, 2 > m_binIndex
symm/Var bin numbers
double m_truncMin
lower threshold on truncation
double m_adjustFac
factor with that one what to adjust baseline
void setBaselineFactor(double charge, double factor)
adjust baseline based on charge or global overall works for only single charge or both
void setSuffix(const std::string &value)
adding suffix to control plots
void enableExtraPlots(bool value=false)
function to set flag active for plotting
void getTruncatedBins(TH1D *hist, int &binlow, int &binhigh)
function to get bins of truncation from histogram
void CreateBinMapping()
class function to create vectors for bin mapping (Var->symm)
double m_chargeType
charge type for baseline adj
void getExpRunInfo()
function to get extract calibration run/exp
DBObjPtr< CDCDedx1DCell > m_DBOneDCell
One cell correction DB object.
double m_cosMax
a limit on cos theta
bool isPrintLog
print more debug information
std::array< std::vector< double >, 2 > m_binValue
enta Var bin values
virtual ~CDCDedx1DCellAlgorithm()
Destructor.
std::string m_suffix
add suffix to all plot name
int m_eaB
reset # of bins for entrance angle for each experiment
double getTruncationMean(TH1D *hist, int binlow, int binhigh)
function to get truncated mean
double m_ptMax
a limit on transverse momentum
void setLayerTrunc(bool value=false)
function to set truncation method (local vs global)
void plotConstants()
function to draw the old/new final constants
void setMergePayload(bool value)
set false if generating absolute (not relative) payload
bool isFixTrunc
true = fix window for all out/inner layers
bool isVarBins
true: if variable bin size is requested
void plotdedxHist(std::vector< TH1D * > hdedxhit[2])
function to draw the dE/dx histogram in enta bins
void setPtLimit(double value)
function to set pt limit
void defineHisto(std::vector< TH1D * > hdedxhit[2], TH1D *hdedxlay[2], TH1D *hentalay[2])
function to define histograms
double m_eaBW
binwdith of entrance angle bin
bool isRotSymm
if rotation symmetry requested
std::string m_runExp
add suffix to all plot name
void setVariableBins(bool value)
Set Var bins flag to on or off.
void plotEventStats()
function to draw the stats plots
int rotationalBin(int nbin, int ibin)
class function to set rotation symmetry
virtual EResult calibrate() override
1D cell algorithm
void setRotSymmetry(bool value)
set rotation sys to copy constants from one region to other
void plotQaPars(TH1D *hentalay[2], TH2D *hptcosth)
function to draw pt vs costh and entrance angle distribution for Inner/Outer layer
double m_dedxMax
upper edge of dedxhit
void createPayload()
function to generate final constants
void setTrucationBins(double lowedge, double upedge)
function to set bins of truncation from histogram
bool isMakePlots
produce plots for status
void plotRelConst(std::vector< double >tempconst, std::vector< double >layerconst, int il)
function to draw symm/Var layer constant
std::vector< std::vector< double > > m_onedcors
final vectors of calibration
bool isMerge
print more debug information
void setCosLimit(double value)
function to set cos limit
double m_dedxMin
lower edge of dedxhit
void plotLayerDist(TH1D *hdedxL[2])
function to draw dedx dist.
double m_eaMin
lower edge of entrance angle
EResult
The result of calibration.
CalibrationAlgorithm(const std::string &collectorModuleName)
Constructor - sets the prefix for collected objects (won't be accesses until execute(....
Class for accessing objects in the database.
Definition DBObjPtr.h:21
Abstract base class for different kinds of events.