Belle II Software development
CDCDedxValidationAlgorithm.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 <calibration/CalibrationAlgorithm.h>
12#include <framework/database/DBObjPtr.h>
13
14#include <cdc/dbobjects/CDCGeometry.h>
15#include <cdc/geometry/CDCGeometryPar.h>
16#include <cdc/geometry/CDCGeometryParConstants.h>
17
18#include <vector>
19#include <string>
20
21#include <TPaveText.h>
22#include <TH1D.h>
23#include <TCanvas.h>
24
25
33 std::vector<double> wiregain;
34
38 std::vector<double> layermean;
39};
40
48 std::vector<double> cosgain;
49
53 std::vector<double> costh;
54};
55
59struct OnedData {
63 std::vector<double> inner1D;
64
68 std::vector<double> outer1D;
69
73 std::vector<double> Enta;
74};
75
76namespace Belle2 {
81
87
88 public:
89
94
99
105 void printCanvasRun(std::map<int, TH1D*>& htemp, std::string namesfx);
106
113 void printCanvas(std::vector<TH1D*>& htemp, std::string namesfx, std::string svar);
114
120 void fitGaussianWRange(TH1D*& temphist, std::string& status);
121
125 void getExpRunInfo();
126
133 void defineHisto(std::vector<TH1D*>& htemp, std::string var, std::string stype);
134
139 void wireGain(std::vector<TH1D*>& hdedxhit);
140
147 void printCanvasWire(std::vector<TH1D*> temp, std::string namesfx, const std::vector<double>& vdedx_mean);
148
157 void fit(TH1D*& hist, double& mean, double& meanErr, double& sigma, double& sigmaErr);
158
162 void bhabhaValidation();
163
167 void radeeValidation();
168
173 void defineTimeBins(std::vector<double>& vtlocaledges);
174
181 void printCanvasdEdx(std::array<std::vector<TH1D*>, 2>& htemp, std::string namesfx, std::string svar);
182
189 std::string getTimeBinLabel(const double& tedges, const int& it)
190 {
191 std::string label = "";
192 if (tedges < 2e4)label = Form("%0.01f-%0.01fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
193 else if (tedges < 1e5)label = Form("%0.0f-%0.0fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
194 else label = Form("%0.01f-%0.01fM", m_tedges[it] / 1e6, m_tedges[it + 1] / 1e6);
195 return label;
196 }
197
202 void setTestingPayload(const std::string& testingPayloadName)
203 {
204 m_testingPayloadName = testingPayloadName;
205 }
206
211 void setGlobalTag(const std::string& globalTagName)
212 {
213 m_GlobalTagName = globalTagName;
214 }
215
221 void setTextCosmetics(TPaveText pt, Color_t color)
222 {
223 pt.SetBorderSize(0);
224 pt.SetShadowColor(kWhite);
225 pt.SetTextColor(color);
226 }
227
231 void plotEventStats();
232
238 void DatabaseIN(int experiment, int run);
239
246 WireGainData getwiregain(int experiment, int run);
247
254 CosGainData getcosgain(int experiment, int run);
255
262 OnedData getonedgain(int experiment, int run);
263
270 double getrungain(int experiment, int run);
271
275 void resetDatabase();
276
277 protected:
278
282 virtual EResult calibrate() override;
283
284 private:
285 double m_sigmaR;
286
288 double m_dedxMin;
289 double m_dedxMax;
290
292 double m_cosMin;
293 double m_cosMax;
294
296 double m_momMin;
297 double m_momMax;
298
299 double* m_tedges;
300 unsigned int m_tbins;
301
303 double m_eaMin;
304 double m_eaMax;
305
306 std::array<std::string, 2> m_sring{"ler", "her"};
307
308 std::string m_suffix;
309
311
313 std::string m_testingPayloadName = "";
314
316 std::string m_GlobalTagName = "";
317
320
321 };
322
323} // namespace Belle2
void setTestingPayload(const std::string &testingPayloadName)
Set testing payload name.
void bhabhaValidation()
Validate dE/dx using bhabha sample (vs run, cosine)
double m_eaMax
upper edge of entrance angle
void setGlobalTag(const std::string &globalTagName)
Set Global Tag name.
void resetDatabase()
Clear current DB pointers and state.
void wireGain(std::vector< TH1D * > &hdedxhit)
Validate wire gain data using dE/dx histograms.
void printCanvasdEdx(std::array< std::vector< TH1D * >, 2 > &htemp, std::string namesfx, std::string svar)
Draw dE/dx histograms for momentum and cosine bins.
void printCanvasRun(std::map< int, TH1D * > &htemp, std::string namesfx)
Draw dE/dx per run histogram canvas.
void radeeValidation()
Validate dE/dx using radee sample (vs momentum, injection time)
double m_sigmaR
fit dedx dist in sigma range
void setTextCosmetics(TPaveText pt, Color_t color)
Set text cosmetics for TPaveText.
WireGainData getwiregain(int experiment, int run)
Retrieve wire gain data from DB.
void getExpRunInfo()
function to get extract calibration run/exp
OnedData getonedgain(int experiment, int run)
Retrieve 1D gain data from DB.
double * m_tedges
internal time array (copy of vtlocaledges)
void DatabaseIN(int experiment, int run)
Load database payload for given run.
void defineTimeBins(std::vector< double > &vtlocaledges)
Set bin edges for injection time.
std::array< std::string, 2 > m_sring
injection ring name
CosGainData getcosgain(int experiment, int run)
Retrieve cosine gain data from DB.
void printCanvasWire(std::vector< TH1D * > temp, std::string namesfx, const std::vector< double > &vdedx_mean)
Plot dE/dx vs wire number.
std::string m_testingPayloadName
Testing payload location.
std::string m_suffix
suffix string to separate plots
DBObjPtr< CDCGeometry > m_cdcGeo
Geometry of CDC.
CDCDedxValidationAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
double getrungain(int experiment, int run)
Retrieve run gain data from DB.
void fitGaussianWRange(TH1D *&temphist, std::string &status)
Perform Gaussian fit with range on a histogram.
void plotEventStats()
Plot summary statistics of selected events.
virtual EResult calibrate() override
Main calibration method.
void printCanvas(std::vector< TH1D * > &htemp, std::string namesfx, std::string svar)
Draw dE/dx histograms across bins.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
void defineHisto(std::vector< TH1D * > &htemp, std::string var, std::string stype)
Define dE/dx histograms for plotting.
std::string getTimeBinLabel(const double &tedges, const int &it)
Get time bin label string.
void fit(TH1D *&hist, double &mean, double &meanErr, double &sigma, double &sigmaErr)
Perform full Gaussian fit and extract parameters.
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
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.
Container for cosine gain data.
std::vector< double > cosgain
Gain correction factors for cos(theta) bins.
std::vector< double > costh
cos(theta) bin centers
Container for 1D gain data.
std::vector< double > inner1D
Inner cell dE/dx values.
std::vector< double > outer1D
Outer cell dE/dx values.
std::vector< double > Enta
Entrance angle values.
Container for wire gain data.
std::vector< double > layermean
Mean gain values per layer.
std::vector< double > wiregain
Gain values for individual wires.