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 <cdc/dbobjects/CDCDedxInjectionTime.h>
19
20#include <vector>
21#include <string>
22
23#include <TPaveText.h>
24#include <TH1D.h>
25#include <TCanvas.h>
26
27
35 std::vector<double> wiregain;
36
40 std::vector<double> layermean;
41};
42
50 std::array<std::vector<double>, 3> cosgain;
51
55 std::vector<double> costh;
56};
57
61struct OnedData {
65 std::array<std::vector<double>, 3> oneDcorr;
66
70 std::vector<double> enta;
71};
72
73namespace Belle2 {
78
84
85 public:
86
91
96
102 void printCanvasRun(std::map<int, TH1D*>& htemp, std::string namesfx);
103
110 void printCanvas(std::vector<TH1D*>& htemp, std::string namesfx, std::string svar);
111
117 void fitGaussianWRange(TH1D*& temphist, std::string& status);
118
122 void getExpRunInfo();
123
130 void defineHisto(std::vector<TH1D*>& htemp, std::string var, std::string stype);
131
136 void wireGain(std::vector<TH1D*>& hdedxhit);
137
144 void printCanvasWire(std::vector<TH1D*> temp, std::string namesfx, const std::vector<double>& vdedx_mean);
145
154 void fit(TH1D*& hist, double& mean, double& meanErr, double& sigma, double& sigmaErr);
155
159 void bhabhaValidation();
160
164 void radeeValidation();
165
170 void defineTimeBins(std::vector<double>& vtlocaledges);
171
178 void printCanvasdEdx(std::array<std::vector<TH1D*>, 2>& htemp, std::string namesfx, std::string svar);
179
186 std::string getTimeBinLabel(const double& tedges, const int& it)
187 {
188 std::string label = "";
189 if (tedges < 2e4)label = Form("%0.01f-%0.01fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
190 else if (tedges < 1e5)label = Form("%0.0f-%0.0fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
191 else label = Form("%0.01f-%0.01fM", m_tedges[it] / 1e6, m_tedges[it + 1] / 1e6);
192 return label;
193 }
194
199 void setTestingPayload(const std::string& testingPayloadName)
200 {
201 m_testingPayloadName = testingPayloadName;
202 }
203
208 void setGlobalTag(const std::string& globalTagName)
209 {
210 m_GlobalTagName = globalTagName;
211 }
212
218 void setTextCosmetics(TPaveText pt, Color_t color)
219 {
220 pt.SetBorderSize(0);
221 pt.SetShadowColor(kWhite);
222 pt.SetTextColor(color);
223 }
224
228 void plotEventStats();
229
235 void DatabaseIN(int experiment, int run);
236
243 WireGainData getwiregain(int experiment, int run);
244
251 CosGainData getcosgain(int experiment, int run);
252
259 OnedData getonedgain(int experiment, int run);
260
267 double getrungain(int experiment, int run);
268
272 void resetDatabase();
273
274 protected:
275
279 virtual EResult calibrate() override;
280
281 private:
282 double m_sigmaR;
283
285 double m_dedxMin;
286 double m_dedxMax;
287
289 double m_cosMin;
290 double m_cosMax;
291
293 double m_momMin;
294 double m_momMax;
295
296 double* m_tedges;
297 unsigned int m_tbins;
298
300 double m_eaMin;
301 double m_eaMax;
302
303 std::array<std::string, 2> m_sring{"ler", "her"};
304
305 std::string m_suffix;
306
308
310 std::string m_testingPayloadName = "";
311
313 std::string m_GlobalTagName = "";
314
317
319 };
320
321} // 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.
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
Injection time DB object.
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::array< std::vector< double >, 3 > cosgain
Gain correction factors for cos(theta) bins.
std::vector< double > costh
cos(theta) bin centers
Container for 1D gain data.
std::vector< double > enta
Entrance angle values.
std::array< std::vector< double >, 3 > oneDcorr
1D cell dE/dx values
Container for wire gain data.
std::vector< double > layermean
Mean gain values per layer.
std::vector< double > wiregain
Gain values for individual wires.