1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/PropertyMgr.h"
3#include "GaudiKernel/StatusCode.h"
10#include "DedxCalibAlg/DedxCalib.h"
15 declareProperty(
"EventType",
m_eventType =
"isBhabha");
18 declareProperty(
"TruncRate",
truncate = 0.7);
20 declareProperty(
"RootFile",
m_rootfile =
"no file");
21 declareProperty(
"CurveFile",
m_curvefile = std::string(
"no rootfile"));
26 MsgStream log(
msgSvc(), name());
27 log << MSG::INFO <<
"DedxCalib initialze()" << endreq;
29 StatusCode gesc = service(
"MdcGeomSvc",
geosvc);
30 if (gesc == StatusCode::SUCCESS)
32 log << MSG::INFO <<
"MdcGeomSvc is running"<<endreq;
36 log << MSG::ERROR <<
"MdcGeomSvc is failed"<<endreq;
37 return StatusCode::SUCCESS;
40 StatusCode scex = service(
"DedxCorrecSvc",
exsvc);
41 if (scex == StatusCode::SUCCESS) {
42 log << MSG::INFO <<
"Hi, DedxCorrectSvc is running"<<endl;
44 log << MSG::ERROR <<
"DedxCorrectSvc is failed"<<endl;
45 return StatusCode::SUCCESS;
53 return StatusCode::SUCCESS;
58 MsgStream log(
msgSvc(), name());
59 log << MSG::INFO <<
"DedxCalib execute()" << endreq;
66 return StatusCode::SUCCESS;
71 MsgStream log(
msgSvc(), name());
72 log << MSG::INFO <<
"DedxCalib finalize()" << endreq;
74 return StatusCode::SUCCESS;
92 MsgStream log(
msgSvc(), name());
93 log<<MSG::INFO<<
"DedxCalib::ReadRecFileList()"<<endreq;
103 cout<<runlist.c_str()<<endl;
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 );
115 for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
118 if(i<= smpl && i>=min_cut ) qSum += (*ql);
121 int usedhit = smpl-min_cut+1;
122 if(usedhit>0) trunc=qSum/usedhit;
129 sort(phlist.begin(),phlist.end());
130 int smpl = (int)(phlist.size()*(
truncate+0.05));
134 for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
137 if(i<= smpl && i>=min_cut ) qSum += (*ql);
140 int usedhit = smpl-min_cut+1;
141 if(usedhit>0) trunc=qSum/usedhit;
151 cout<<
"no curve file! can not calculate chi!!! "<<endl;
157 int CurveSize,SigmaSize;
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);
168 for(
int i=0; i<CurveSize; i++)
170 cout<<Curve[i]<<endl;
171 if(i==0)
vFlag[0] = (int) Curve[i];
174 for(
int i=0; i<SigmaSize; i++)
176 cout<<
Sigma[i]<<endl;
184void 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)
189 if(runflag>0)
vFlag[2]=0;
193 if(runflag ==1 || runflag ==2 )
195 (
float)ptrk, (
float)theta, (
float)t0,(
float)pl_rp,
199 dedx_pid_exp( vflag, (
float)dEdx, trkalg,(
int)dedxhit_use,
200 (
float)ptrk, (
float)theta, (
float)t0,(
float)pl_rp,
*******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
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)
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)
double cal_dedx(float truncate, std::vector< double > phlist)
DedxCalib(const std::string &name, ISvcLocator *pSvcLocator)
vector< string > m_recFileVector
std::string m_recFileList
virtual void genNtuple()=0
virtual void WriteHists()=0
virtual void AnalyseHists()=0
virtual void BookHists()=0
double cal_dedx_bitrunc(float truncate, std::vector< double > phlist)
vector< double > Sigma_Para
virtual void FillHists()=0
virtual void initializing()=0
vector< double > Curve_Para
virtual void set_flag(int calib_F)=0
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")