Belle II Software development
CDCDedxCosEdgeAlgorithm.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 <TPaveText.h>
13
14#include<map>
15#include<vector>
16
17#include <reconstruction/dbobjects/CDCDedxCosineEdge.h>
18#include <calibration/CalibrationAlgorithm.h>
19#include <framework/database/DBObjPtr.h>
20
21enum fitstatus {FitOK, FitFailed, LowStats};
22
23namespace Belle2 {
33
34 public:
35
40
45
49 void setMergePayload(bool value = true) {m_isMerge = value;}
50
54 void setMonitoringPlots(bool value = false) {m_isMakePlots = value;}
55
59 void setFitWidth(double value = 2.5) {m_sigLim = value;}
60
64 void setCosineBins(unsigned int value) {m_npBins = value;}
65
69 void setNegCosRange(double min, double max) {m_negMin = min; m_negMax = max;}
70
74 void setPosCosRange(double min, double max) {m_posMin = min; m_posMax = max;}
75
79 void setDedxHistPars(int value, double min, double max)
80 {
81 m_dedxBins = value;
82 m_dedxMin = min;
83 m_dedxMax = max;
84 }
85
89 void getExpRunInfo();
90
94 void fitGaussianWRange(TH1D*& temphist, fitstatus& status);
95
99 void createPayload(std::vector<std::vector<double>>& vfinalconst);
100
104 void plotHist(std::vector<TH1D*>& hdedx, std::map<int, std::vector<double>>& fPars, std::string type);
105
109 void plotFitPars(std::map<int, std::vector<double>>& fPars_Neg, std::map<int, std::vector<double>>& fPars_Pos);
110
114 void plotConstants(std::vector<std::vector<double>>& vfinalconst);
115
119 void plotStats();
120
124 void setTextCosmetics(TPaveText* pt, double size)
125 {
126 pt->SetTextAlign(11);
127 pt->SetFillStyle(3001);
128 pt->SetLineColor(2);
129 pt->SetTextFont(82);
130 pt->SetTextSize(size);
131 }
132
136 void setHistCosmetics(TH1D& hist, Color_t color, double min, double max, double size)
137 {
138 hist.SetMarkerStyle(20);
139 hist.SetMarkerSize(0.60);
140 hist.SetMarkerColor(color);
141 hist.SetLineColor(color);
142 hist.SetStats(0);
143 hist.GetYaxis()->SetRangeUser(min, max);
144 hist.GetXaxis()->SetLabelSize(size);
145 hist.GetYaxis()->SetLabelSize(size);
146 }
147
148 protected:
149
153 virtual EResult calibrate() override;
154
155 private:
156
160 double m_sigLim;
161 unsigned int m_npBins;
162 double m_negMin;
163 double m_negMax;
164 double m_posMin;
165 double m_posMax;
167 double m_dedxMin;
168 double m_dedxMax;
170 std::string m_suffix;
173 };
175} // namespace Belle2
A calibration algorithm for CDC dE/dx electron cos(theta) dependence.
void plotFitPars(std::map< int, std::vector< double > > &fPars_Neg, std::map< int, std::vector< double > > &fPars_Pos)
function to draw the fit parameters (relative gains and resolutions)
virtual ~CDCDedxCosEdgeAlgorithm()
Destructor.
void setNegCosRange(double min, double max)
function to set negative cosine range
CDCDedxCosEdgeAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
bool m_isMerge
merge payload if calculated relative
void plotStats()
function to draw the stats plots
void setHistCosmetics(TH1D &hist, Color_t color, double min, double max, double size)
function to change histogram styles
void plotHist(std::vector< TH1D * > &hdedx, std::map< int, std::vector< double > > &fPars, std::string type)
function to draw dedx histograms for each bin
double m_negMin
min neg cosine angle
void setFitWidth(double value=2.5)
set sigma to restrict fit in (mean+/sigma) range
void getExpRunInfo()
function to get info about current exp and run
void setCosineBins(unsigned int value)
function to set number of cosine bins on (equal posi and negi side)
DBObjPtr< CDCDedxCosineEdge > m_DBCosineCor
CoseEdge correction DB object.
unsigned int m_npBins
number of bins across cosine range
void createPayload(std::vector< std::vector< double > > &vfinalconst)
function to store new payload after full calibration
std::string m_suffix
suffix for better plot naming
void setTextCosmetics(TPaveText *pt, double size)
function to change text styles
double m_posMax
max pos cosine angle
int m_dedxBins
number of bins for dedx histogram
void plotConstants(std::vector< std::vector< double > > &vfinalconst)
function to draw the final calibration constants and comparison with old constants
void setMergePayload(bool value=true)
function to merge paylaods (if relative)
void setPosCosRange(double min, double max)
function to set positive cosine range
double m_posMin
min pos cosine angle
virtual EResult calibrate() override
Cosine edge algorithm.
double m_sigLim
gaussian fit sigma limit
void fitGaussianWRange(TH1D *&temphist, fitstatus &status)
function to perform gauss fit for given histogram
void setMonitoringPlots(bool value=false)
function enable monitoring plots
void setDedxHistPars(int value, double min, double max)
function to set dedx histogram parameters
double m_negMax
max neg cosine angle
Base class for calibration algorithms.
EResult
The result of calibration.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Abstract base class for different kinds of events.