BOSS 7.0.3
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
 
 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 ()
 
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

Constructor & Destructor Documentation

◆ DedxCalib() [1/2]

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}

◆ ~DedxCalib() [1/2]

DedxCalib::~DedxCalib ( )
inline

◆ DedxCalib() [2/2]

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

◆ ~DedxCalib() [2/2]

DedxCalib::~DedxCalib ( )
inline

Member Function Documentation

◆ AnalyseHists() [1/2]

◆ AnalyseHists() [2/2]

◆ BookHists() [1/2]

◆ BookHists() [2/2]

◆ cal_dedx() [1/2]

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() [2/2]

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

◆ cal_dedx_bitrunc() [1/2]

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().

◆ cal_dedx_bitrunc() [2/2]

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

◆ execute() [1/2]

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}
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

◆ execute() [2/2]

StatusCode DedxCalib::execute ( )

◆ FillHists() [1/2]

◆ FillHists() [2/2]

◆ finalize() [1/2]

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}

◆ finalize() [2/2]

StatusCode DedxCalib::finalize ( )

◆ genNtuple() [1/2]

◆ genNtuple() [2/2]

◆ getCurvePar() [1/2]

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

Referenced by initialize().

◆ getCurvePar() [2/2]

void DedxCalib::getCurvePar ( )
protected

◆ initialize() [1/2]

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
virtual void BookHists()=0
Definition: DedxCalib.cxx:81
virtual void initializing()=0
Definition: DedxCalib.cxx:77
virtual void set_flag(int calib_F)=0

◆ initialize() [2/2]

StatusCode DedxCalib::initialize ( )

◆ initializing() [1/2]

◆ initializing() [2/2]

◆ ReadRecFileList() [1/2]

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}

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

◆ ReadRecFileList() [2/2]

void DedxCalib::ReadRecFileList ( )
protected

◆ set_dEdx() [1/2]

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)

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

◆ set_dEdx() [2/2]

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

◆ WriteHists() [1/2]

◆ WriteHists() [2/2]

Member Data Documentation

◆ Curve_Para

vector< double > DedxCalib::Curve_Para
protected

◆ exsvc

◆ geosvc

IMdcGeomSvc * DedxCalib::geosvc
protected

◆ m_calibflag

int DedxCalib::m_calibflag
protected

◆ m_chi_ex

double DedxCalib::m_chi_ex
protected

◆ m_curvefile

std::string DedxCalib::m_curvefile
protected

◆ m_dedx_exp

double DedxCalib::m_dedx_exp
protected

Definition at line 43 of file InstallArea/include/DedxCalibAlg/DedxCalibAlg/DedxCalib.h.

Referenced by set_dEdx().

◆ m_eventType

std::string DedxCalib::m_eventType
protected

◆ m_ex_sigma

double DedxCalib::m_ex_sigma
protected

Definition at line 44 of file InstallArea/include/DedxCalibAlg/DedxCalibAlg/DedxCalib.h.

Referenced by set_dEdx().

◆ m_phShapeFlag

◆ m_pid_prob

double DedxCalib::m_pid_prob
protected

Definition at line 45 of file InstallArea/include/DedxCalibAlg/DedxCalibAlg/DedxCalib.h.

Referenced by set_dEdx().

◆ m_recFileList

std::string DedxCalib::m_recFileList
protected

◆ m_recFileVector

◆ m_rootfile

◆ ParticleFlag

◆ Sigma_Para

vector< double > DedxCalib::Sigma_Para
protected

◆ truncate

◆ vFlag


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