1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/PropertyMgr.h"
3#include "GaudiKernel/StatusCode.h"
13 : Algorithm( name, pSvcLocator ) {
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" ) );
25 MsgStream log(
msgSvc(), name() );
26 log << MSG::INFO <<
"DedxCalib initialze()" << endmsg;
28 StatusCode gesc = service(
"MdcGeomSvc",
geosvc );
29 if ( gesc == StatusCode::SUCCESS ) { log << MSG::INFO <<
"MdcGeomSvc is running" << endmsg; }
32 log << MSG::ERROR <<
"MdcGeomSvc is failed" << endmsg;
33 return StatusCode::SUCCESS;
36 StatusCode scex = service(
"DedxCorrecSvc",
exsvc );
37 if ( scex == StatusCode::SUCCESS )
38 { log << MSG::INFO <<
"Hi, DedxCorrectSvc is running" << endl; }
41 log << MSG::ERROR <<
"DedxCorrectSvc is failed" << endl;
42 return StatusCode::SUCCESS;
50 return StatusCode::SUCCESS;
54 MsgStream log(
msgSvc(), name() );
55 log << MSG::INFO <<
"DedxCalib execute()" << endmsg;
62 return StatusCode::SUCCESS;
66 MsgStream log(
msgSvc(), name() );
67 log << MSG::INFO <<
"DedxCalib finalize()" << endmsg;
69 return StatusCode::SUCCESS;
86 MsgStream log(
msgSvc(), name() );
87 log << MSG::INFO <<
"DedxCalib::ReadRecFileList()" << endmsg;
96 cout << runlist.c_str() << endl;
102 sort( phlist.begin(), phlist.end() );
103 int smpl = (int)( phlist.size() * (
truncate + 0.05 ) );
104 int min_cut = (int)( phlist.size() * 0.05 + 0.5 );
107 for ( vector<double>::iterator ql = phlist.begin(); ql != phlist.end(); ql++ )
110 if ( i <= smpl && i >= min_cut ) qSum += ( *ql );
113 int usedhit = smpl - min_cut + 1;
114 if ( usedhit > 0 ) trunc = qSum / usedhit;
120 sort( phlist.begin(), phlist.end() );
121 int smpl = (int)( phlist.size() * (
truncate + 0.05 ) );
125 for ( vector<double>::iterator ql = phlist.begin(); ql != phlist.end(); ql++ )
128 if ( i <= smpl && i >= min_cut ) qSum += ( *ql );
131 int usedhit = smpl - min_cut + 1;
132 if ( usedhit > 0 ) trunc = qSum / usedhit;
142 cout <<
"no curve file! can not calculate chi!!! " << endl;
148 int CurveSize, SigmaSize;
150 TTree* curve = (TTree*)
f->Get(
"curve" );
151 TTree* sigma = (TTree*)
f->Get(
"sigma" );
152 curve->SetBranchAddress(
"CurveSize", &CurveSize );
153 curve->SetBranchAddress(
"curve", Curve );
154 sigma->SetBranchAddress(
"SigmaSize", &SigmaSize );
155 sigma->SetBranchAddress(
"sigma",
Sigma );
156 curve->GetEntry( 0 );
157 sigma->GetEntry( 0 );
159 for (
int i = 0; i < CurveSize; i++ )
161 cout << Curve[i] << endl;
162 if ( i == 0 )
vFlag[0] = (int)Curve[i];
165 for (
int i = 0; i < SigmaSize; i++ )
167 cout <<
Sigma[i] << endl;
176 float ptrk,
float theta,
float pl_rp,
int vflag[3],
double t0 ) {
180 if ( runflag > 0 )
vFlag[2] = 0;
184 if ( runflag == 1 || runflag == 2 )
185 dedx_pid_exp_old( landau, runflag, (
float)dEdx, (
int)dedxhit_use, (
float)ptrk,
190 dedx_pid_exp( vflag, (
float)dEdx, trkalg, (
int)dedxhit_use, (
float)ptrk, (
float)theta,
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
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)
*******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 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)
std::string m_recFileList
virtual void genNtuple()=0
vector< double > Sigma_Para
virtual void WriteHists()=0
vector< double > Curve_Para
virtual void AnalyseHists()=0
virtual void BookHists()=0
double cal_dedx_bitrunc(float truncate, std::vector< double > phlist)
virtual void FillHists()=0
vector< string > m_recFileVector
virtual void initializing()=0