Belle II Software development
TimeWalkCalibrationAlgorithm.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#include <calibration/CalibrationAlgorithm.h>
11#include <cdc/dbobjects/CDCGeometry.h>
12#include <framework/database/DBObjPtr.h>
13#include <TH1D.h>
14#include <TH2D.h>
15
16namespace Belle2 {
21 namespace CDC {
27 public:
30
33
35 void setDebug(bool debug) {m_debug = debug; }
36
39
41 void setMinimumNDF(double ndf) {m_minNdf = ndf;}
42
44 void setMinimumPval(double pval) {m_minPval = pval;}
45
47 void enableTextOutput(bool output = true) {m_textOutput = output;}
48
50 void outputTWFileName(std::string tw_out_name) {m_outputTWFileName.assign(tw_out_name);}
52 void outputT0FileName(std::string t0_out_name) {m_outputT0FileName.assign(t0_out_name);}
53
55 void setHistFileName(const std::string& name) {m_histName = "histTW_" + name + ".root";}
56
58 void setMode(unsigned short mode)
59 {
60 m_twParamMode = mode;
61 if (mode == 0)
62 m_nTwParams = 1;
63 else if (mode == 1)
64 m_nTwParams = 2;
65 else
66 B2FATAL("Mode hasn't implemented yet");
67 }
68
69 protected:
71 EResult calibrate() override;
72
74 void createHisto();
75
77 void write();
78
80 void updateT0();
81
83 void fitToExponentialFunc(TH1D* h1);
84
86 void prepare();
87
90
92 void storeHist();
93
94 private:
95
96 TH1D* m_h1[300];
97 TH2D* m_h2[300];
98
99 double m_xmin = 0.07;
100 double m_minNdf = 20;
101 double m_minPval = 0.;
102 double m_constTerm[300] = {0.};
103 unsigned short m_flag[300] = {0};
104 std::vector<float> m_tw_old[300];
105 std::vector<float> m_tw_new[300];
106 bool m_storeHisto = true;
107 std::string m_inputTWFileName = "tw.dat";
108 std::string m_inputT0FileName = "t0.dat";
109 std::string m_outputTWFileName = "tw_new.dat";
110 std::string m_outputT0FileName = "t0_new.dat";
111 std::string m_histName = "histTW.root";
112 bool m_debug = false;
113 bool m_textOutput = false;
114 unsigned short m_twParamMode = 1;
115 unsigned short m_nTwParams = 2;
117 };
118 }
120}
121
double m_xmin
minimum value cut of drift length.
std::string m_outputT0FileName
t0 file name after calibration.
TH2D * m_h2[300]
2D histogram of residual vs ADC for each board.
unsigned short m_twParamMode
=0 for P0/Sqrt(ADC); =1 for P0*Exp(-P1*ADC).
void setStoreHisto(bool storeHist)
Store Histogram or not.
double m_constTerm[300]
const term in fitting, it will be added to T0 instead tw
void setMode(unsigned short mode)
Set time walk mode.
double m_minNdf
minimum number of degree of freedom required for track.
unsigned short m_flag[300]
flag for fit status
void setMinimumPval(double pval)
minimum chi2 prob requirement for track
double m_minPval
minimum number of Prob(chi2) of fitted track.
void updateT0()
update constant term to t0 database.
std::vector< float > m_tw_old[300]
tw list before calibration.
void setMinimumNDF(double ndf)
minimum number of degree freedom requirement for track
void setDebug(bool debug)
change flag for debug
DBObjPtr< CDCGeometry > m_cdcGeo
Geometry of CDC.
void enableTextOutput(bool output=true)
Enable text output of calibration result.
std::string m_outputTWFileName
tw file name after calibration.
std::vector< float > m_tw_new[300]
tw list after calibration.
void setHistFileName(const std::string &name)
Set name for histogram output.
void outputTWFileName(std::string tw_out_name)
output tw file name, for text mode
TH1D * m_h1[300]
Mean of residual as function of ADC of each board.
void outputT0FileName(std::string t0_out_name)
output t0 file name, for text mode
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.