BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
DedxCalib Class Referenceabstract

#include <DedxCalib.h>

+ Inheritance diagram for DedxCalib:

Public Member Functions

 DedxCalib (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~DedxCalib ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
virtual void genNtuple ()=0
 
virtual void initializing ()=0
 
virtual void BookHists ()=0
 
virtual void FillHists ()=0
 
virtual void AnalyseHists ()=0
 
virtual void WriteHists ()=0
 

Protected Member Functions

double cal_dedx_bitrunc (float truncate, std::vector< double > phlist)
 
double cal_dedx (float truncate, std::vector< double > phlist)
 
void getCurvePar ()
 
void set_dEdx (int landau, float dEdx, int trkalg, int runflag, int dedxhit_use, float ptrk, float theta, float pl_rp, int vflag[3], double t0)
 
void ReadRecFileList ()
 

Protected Attributes

IMdcGeomSvcgeosvc
 
IDedxCorrecSvcexsvc
 
float truncate
 
vector< double > Curve_Para
 
vector< double > Sigma_Para
 
int vFlag [3]
 
double m_dedx_exp [5]
 
double m_ex_sigma [5]
 
double m_pid_prob [5]
 
double m_chi_ex [5]
 
vector< string > m_recFileVector
 
int ParticleFlag
 
int m_calibflag
 
int m_phShapeFlag
 
std::string m_eventType
 
std::string m_recFileList
 
std::string m_rootfile
 
std::string m_curvefile
 

Detailed Description

Definition at line 11 of file DedxCalib.h.

Constructor & Destructor Documentation

◆ DedxCalib()

DedxCalib::DedxCalib ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 12 of file DedxCalib.cxx.

12 : Algorithm(name, pSvcLocator)
13{
14 declareProperty("ParticleType",ParticleFlag=-1);
15 declareProperty("EventType", m_eventType = "isBhabha");
16 declareProperty("CalibFlag",m_calibflag=63);
17 declareProperty("PhShapeFlag",m_phShapeFlag=0);
18 declareProperty("TruncRate",truncate = 0.7);
19 declareProperty("RecFileList", m_recFileList = "no file");
20 declareProperty("RootFile",m_rootfile = "no file");
21 declareProperty("CurveFile",m_curvefile = std::string("no rootfile"));
22}
std::string m_curvefile
Definition: DedxCalib.h:56
int ParticleFlag
Definition: DedxCalib.h:50
int m_phShapeFlag
Definition: DedxCalib.h:52
std::string m_rootfile
Definition: DedxCalib.h:55
std::string m_recFileList
Definition: DedxCalib.h:54
int m_calibflag
Definition: DedxCalib.h:51
std::string m_eventType
Definition: DedxCalib.h:53
float truncate
Definition: DedxCalib.h:33

◆ ~DedxCalib()

DedxCalib::~DedxCalib ( )
inline

Definition at line 15 of file DedxCalib.h.

15{};

Member Function Documentation

◆ AnalyseHists()

void DedxCalib::AnalyseHists ( )
pure virtual

◆ BookHists()

void DedxCalib::BookHists ( )
pure virtual

◆ cal_dedx()

double DedxCalib::cal_dedx ( float  truncate,
std::vector< double >  phlist 
)
protected

Definition at line 127 of file DedxCalib.cxx.

128{
129 sort(phlist.begin(),phlist.end());
130 int smpl = (int)(phlist.size()*(truncate+0.05));
131 int min_cut = 0;
132 double qSum = 0;
133 unsigned i = 0;
134 for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
135 {
136 i++;
137 if(i<= smpl && i>=min_cut ) qSum += (*ql);
138 }
139 double trunc=-99;
140 int usedhit = smpl-min_cut+1;
141 if(usedhit>0) trunc=qSum/usedhit;
142
143 return trunc;
144}

◆ cal_dedx_bitrunc()

double DedxCalib::cal_dedx_bitrunc ( float  truncate,
std::vector< double >  phlist 
)
protected

Definition at line 108 of file DedxCalib.cxx.

109{
110 sort(phlist.begin(),phlist.end());
111 int smpl = (int)(phlist.size()*(truncate+0.05));
112 int min_cut = (int)( phlist.size()*0.05 + 0.5 );
113 double qSum = 0;
114 unsigned i = 0;
115 for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
116 {
117 i++;
118 if(i<= smpl && i>=min_cut ) qSum += (*ql);
119 }
120 double trunc=-99;
121 int usedhit = smpl-min_cut+1;
122 if(usedhit>0) trunc=qSum/usedhit;
123
124 return trunc;
125}

Referenced by DedxCalibLayerGain::AnalyseHists(), DedxCalibCostheta::FillHists(), DedxCalibMomentum::FillHists(), and DedxCalibRunByRun::FillHists().

◆ execute()

StatusCode DedxCalib::execute ( )

Definition at line 56 of file DedxCalib.cxx.

57{
58 MsgStream log(msgSvc(), name());
59 log << MSG::INFO << "DedxCalib execute()" << endreq;
60
61 genNtuple();
62 FillHists();
64 WriteHists();
65
66 return StatusCode::SUCCESS;
67}
IMessageSvc * msgSvc()
virtual void genNtuple()=0
Definition: DedxCalib.cxx:79
virtual void WriteHists()=0
Definition: DedxCalib.cxx:87
virtual void AnalyseHists()=0
Definition: DedxCalib.cxx:85
virtual void FillHists()=0
Definition: DedxCalib.cxx:83

◆ FillHists()

void DedxCalib::FillHists ( )
pure virtual

◆ finalize()

StatusCode DedxCalib::finalize ( )

Definition at line 69 of file DedxCalib.cxx.

70{
71 MsgStream log(msgSvc(), name());
72 log << MSG::INFO << "DedxCalib finalize()" << endreq;
73
74 return StatusCode::SUCCESS;
75}

◆ genNtuple()

void DedxCalib::genNtuple ( )
pure virtual

◆ getCurvePar()

void DedxCalib::getCurvePar ( )
protected

Definition at line 146 of file DedxCalib.cxx.

148{
149 if(m_curvefile=="no rootfile")
150 {
151 cout<<"no curve file! can not calculate chi!!! "<<endl;
152 return;
153 }
154
155 double Curve[100];
156 double Sigma[100];
157 int CurveSize,SigmaSize;
158 TFile* f = new TFile(m_curvefile.c_str());
159 TTree *curve = (TTree*) f->Get("curve");
160 TTree *sigma = (TTree*) f->Get("sigma");
161 curve->SetBranchAddress("CurveSize",&CurveSize);
162 curve->SetBranchAddress("curve",Curve);
163 sigma->SetBranchAddress("SigmaSize",&SigmaSize);
164 sigma->SetBranchAddress("sigma",Sigma);
165 curve->GetEntry(0);
166 sigma->GetEntry(0);
167
168 for(int i=0; i<CurveSize; i++) // get the dedx curve parameters
169 {
170 cout<<Curve[i]<<endl;
171 if(i==0) vFlag[0] = (int) Curve[i]; //first element is dedx curve version
172 else Curve_Para.push_back(Curve[i]); //dedx curve parameters
173 }
174 for(int i=0; i<SigmaSize; i++)
175 {
176 cout<<Sigma[i]<<endl;
177 if(i==0) vFlag[1] = (int) Sigma[i]; //dedx sigma version: 2: psip; 3:jpsi
178 else Sigma_Para.push_back(Sigma[i]); //dedx sigma parameters
179 }
180 //if(runflag>0) vFlag[2]=0;
181 //else vFlag[2]=1;
182}
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for Sigma
Definition: FoamA.h:83
int vFlag[3]
Definition: DedxCalib.h:41
vector< double > Sigma_Para
Definition: DedxCalib.h:40
vector< double > Curve_Para
Definition: DedxCalib.h:39

Referenced by initialize().

◆ initialize()

StatusCode DedxCalib::initialize ( )

Definition at line 24 of file DedxCalib.cxx.

25{
26 MsgStream log(msgSvc(), name());
27 log << MSG::INFO << "DedxCalib initialze()" << endreq;
28
29 StatusCode gesc = service("MdcGeomSvc", geosvc);
30 if (gesc == StatusCode::SUCCESS)
31 {
32 log << MSG::INFO <<"MdcGeomSvc is running"<<endreq;
33 }
34 else
35 {
36 log << MSG::ERROR <<"MdcGeomSvc is failed"<<endreq;
37 return StatusCode::SUCCESS;
38 }
39
40 StatusCode scex = service("DedxCorrecSvc", exsvc);
41 if (scex == StatusCode::SUCCESS) {
42 log << MSG::INFO <<"Hi, DedxCorrectSvc is running"<<endl;
43 } else {
44 log << MSG::ERROR <<"DedxCorrectSvc is failed"<<endl;
45 return StatusCode::SUCCESS;
46 }
48
50 BookHists();
52
53 return StatusCode::SUCCESS;
54}
void getCurvePar()
Definition: DedxCalib.cxx:146
IDedxCorrecSvc * exsvc
Definition: DedxCalib.h:30
virtual void BookHists()=0
Definition: DedxCalib.cxx:81
virtual void initializing()=0
Definition: DedxCalib.cxx:77
IMdcGeomSvc * geosvc
Definition: DedxCalib.h:29
virtual void set_flag(int calib_F)=0

◆ initializing()

void DedxCalib::initializing ( )
pure virtual

◆ ReadRecFileList()

void DedxCalib::ReadRecFileList ( )
protected

Definition at line 89 of file DedxCalib.cxx.

90{
91
92 MsgStream log(msgSvc(), name());
93 log<<MSG::INFO<<"DedxCalib::ReadRecFileList()"<<endreq;
94
95 ifstream filea(m_recFileList.c_str(),ifstream::in);
96 cout<<m_recFileList.c_str()<<endl;
97
98 string runlist;
99 filea>>runlist;
100 do
101 {
102 m_recFileVector.push_back(runlist);
103 cout<<runlist.c_str()<<endl;
104 filea>>runlist;
105 }while(filea);
106}
vector< string > m_recFileVector
Definition: DedxCalib.h:48
std::ifstream ifstream
Definition: bpkt_streams.h:44

Referenced by DedxCalibCostheta::BookHists(), DedxCalibDocaEAng::BookHists(), DedxCalibEAng::BookHists(), DedxCalibLayerGain::BookHists(), DedxCalibMomentum::BookHists(), DedxCalibRunByRun::BookHists(), and DedxCalibWireGain::BookHists().

◆ set_dEdx()

void DedxCalib::set_dEdx ( int  landau,
float  dEdx,
int  trkalg,
int  runflag,
int  dedxhit_use,
float  ptrk,
float  theta,
float  pl_rp,
int  vflag[3],
double  t0 
)
protected

Definition at line 184 of file DedxCalib.cxx.

185{
186 //landau: 1:landau distribution; 0:gaus distribution
187 //pl_rp: 1.5, not know what
188 //getCurvePar(runflag);
189 if(runflag>0) vFlag[2]=0;
190 else vFlag[2]=1;
191
192 //some old data with old methods
193 if(runflag ==1 || runflag ==2 )
194 dedx_pid_exp_old( landau, runflag, (float)dEdx, (int)dedxhit_use,
195 (float)ptrk, (float)theta, (float)t0,(float)pl_rp,
197 //for 2009 psip data and after
198 else
199 dedx_pid_exp( vflag, (float)dEdx, trkalg,(int)dedxhit_use,
200 (float)ptrk, (float)theta, (float)t0,(float)pl_rp,
202}
void dedx_pid_exp_old(int landau, int runflag, float dedx, int Nohit, float mom, float theta, float t0, float lsamp, double dedx_exp[5], double ex_sigma[5], double pid_prob[5], double chi_dedx[5])
void dedx_pid_exp(int vflag[3], float dedx, int trkalg, int Nohit, float mom, float theta, float t0, float lsamp, double dedx_exp[5], double ex_sigma[5], double pid_prob[5], double chi_dedx[5], std::vector< double > &par, std::vector< double > &sig_par)
double m_chi_ex[5]
Definition: DedxCalib.h:46
double m_pid_prob[5]
Definition: DedxCalib.h:45
double m_dedx_exp[5]
Definition: DedxCalib.h:43
double m_ex_sigma[5]
Definition: DedxCalib.h:44

Referenced by DedxCalibCostheta::FillHists(), and DedxCalibMomentum::FillHists().

◆ WriteHists()

void DedxCalib::WriteHists ( )
pure virtual

Member Data Documentation

◆ Curve_Para

vector<double> DedxCalib::Curve_Para
protected

Definition at line 39 of file DedxCalib.h.

Referenced by getCurvePar(), and set_dEdx().

◆ exsvc

◆ geosvc

IMdcGeomSvc* DedxCalib::geosvc
protected

Definition at line 29 of file DedxCalib.h.

Referenced by DedxCalibEvent::genNtuple(), and initialize().

◆ m_calibflag

int DedxCalib::m_calibflag
protected

Definition at line 51 of file DedxCalib.h.

Referenced by DedxCalib(), and initialize().

◆ m_chi_ex

double DedxCalib::m_chi_ex[5]
protected

◆ m_curvefile

std::string DedxCalib::m_curvefile
protected

Definition at line 56 of file DedxCalib.h.

Referenced by DedxCalib(), and getCurvePar().

◆ m_dedx_exp

double DedxCalib::m_dedx_exp[5]
protected

Definition at line 43 of file DedxCalib.h.

Referenced by set_dEdx().

◆ m_eventType

std::string DedxCalib::m_eventType
protected

Definition at line 53 of file DedxCalib.h.

Referenced by DedxCalib(), and DedxCalibEvent::genNtuple().

◆ m_ex_sigma

double DedxCalib::m_ex_sigma[5]
protected

Definition at line 44 of file DedxCalib.h.

Referenced by set_dEdx().

◆ m_phShapeFlag

◆ m_pid_prob

double DedxCalib::m_pid_prob[5]
protected

Definition at line 45 of file DedxCalib.h.

Referenced by set_dEdx().

◆ m_recFileList

std::string DedxCalib::m_recFileList
protected

Definition at line 54 of file DedxCalib.h.

Referenced by DedxCalib(), and ReadRecFileList().

◆ m_recFileVector

◆ m_rootfile

◆ ParticleFlag

int DedxCalib::ParticleFlag
protected

◆ Sigma_Para

vector<double> DedxCalib::Sigma_Para
protected

Definition at line 40 of file DedxCalib.h.

Referenced by getCurvePar(), and set_dEdx().

◆ truncate

◆ vFlag

int DedxCalib::vFlag[3]
protected

The documentation for this class was generated from the following files: