DedxCalib Class Reference

#include <DedxCalib.h>

Inheritance diagram for DedxCalib:

DedxCalibCostheta DedxCalibDocaEAng DedxCalibEAng DedxCalibEvent DedxCalibLayerGain DedxCalibMomentum DedxCalibRunByRun DedxCalibWireGain List of all members.

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< stringm_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 ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 12 of file DedxCalib.cxx.

References m_calibflag, m_curvefile, m_eventType, m_phShapeFlag, m_recFileList, m_rootfile, ParticleFlag, deljobs::string, and truncate.

00012                                                                     : Algorithm(name, pSvcLocator)
00013 {
00014     declareProperty("ParticleType",ParticleFlag=-1);
00015     declareProperty("EventType", m_eventType = "isBhabha");
00016     declareProperty("CalibFlag",m_calibflag=63);
00017     declareProperty("PhShapeFlag",m_phShapeFlag=0);
00018     declareProperty("TruncRate",truncate = 0.7);
00019     declareProperty("RecFileList", m_recFileList = "no file");
00020     declareProperty("RootFile",m_rootfile = "no file");
00021     declareProperty("CurveFile",m_curvefile = std::string("no rootfile"));
00022 }

DedxCalib::~DedxCalib (  )  [inline]

Definition at line 15 of file DedxCalib.h.

00015 {};


Member Function Documentation

void DedxCalib::AnalyseHists (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 85 of file DedxCalib.cxx.

Referenced by execute().

00085 {}

void DedxCalib::BookHists (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 81 of file DedxCalib.cxx.

Referenced by initialize().

00081 {}

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

Definition at line 127 of file DedxCalib.cxx.

References genRecEmupikp::i.

00128 {
00129     sort(phlist.begin(),phlist.end());
00130     int smpl = (int)(phlist.size()*(truncate+0.05));
00131     int min_cut = 0;
00132     double qSum = 0;
00133     unsigned i = 0;
00134     for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
00135     {
00136         i++;
00137         if(i<= smpl && i>=min_cut ) qSum += (*ql);
00138     }
00139     double trunc=-99;
00140     int usedhit = smpl-min_cut+1;
00141     if(usedhit>0)  trunc=qSum/usedhit;
00142 
00143     return trunc;
00144 }

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

Definition at line 108 of file DedxCalib.cxx.

References genRecEmupikp::i.

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

00109 {   
00110     sort(phlist.begin(),phlist.end());
00111     int smpl = (int)(phlist.size()*(truncate+0.05));
00112     int min_cut = (int)( phlist.size()*0.05 + 0.5 );
00113     double qSum = 0;
00114     unsigned i = 0;
00115     for(vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++)
00116     {   
00117         i++;
00118         if(i<= smpl && i>=min_cut ) qSum += (*ql);
00119     }
00120     double trunc=-99;
00121     int usedhit = smpl-min_cut+1;
00122     if(usedhit>0)  trunc=qSum/usedhit;
00123 
00124     return trunc;
00125 }

StatusCode DedxCalib::execute (  ) 

Definition at line 56 of file DedxCalib.cxx.

References AnalyseHists(), FillHists(), genNtuple(), Bes_Common::INFO, msgSvc(), and WriteHists().

00057 {
00058     MsgStream log(msgSvc(), name());
00059     log << MSG::INFO << "DedxCalib execute()" << endreq;
00060 
00061     genNtuple();
00062     FillHists();
00063     AnalyseHists();
00064     WriteHists();
00065 
00066     return StatusCode::SUCCESS;
00067 }

void DedxCalib::FillHists (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 83 of file DedxCalib.cxx.

Referenced by execute().

00083 {}

StatusCode DedxCalib::finalize (  ) 

Definition at line 69 of file DedxCalib.cxx.

References Bes_Common::INFO, and msgSvc().

00070 {
00071     MsgStream log(msgSvc(), name());
00072     log << MSG::INFO << "DedxCalib finalize()" << endreq;
00073 
00074     return StatusCode::SUCCESS;
00075 }

void DedxCalib::genNtuple (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 79 of file DedxCalib.cxx.

Referenced by execute().

00079 {}

void DedxCalib::getCurvePar (  )  [protected]

Definition at line 146 of file DedxCalib.cxx.

References Curve_Para, genRecEmupikp::i, m_curvefile, Sigma, Sigma_Para, and vFlag.

Referenced by initialize().

00148 {
00149     if(m_curvefile=="no rootfile")
00150     {
00151         cout<<"no curve file! can not calculate chi!!! "<<endl;
00152         return;
00153     }
00154 
00155     double Curve[100];
00156     double Sigma[100];
00157     int CurveSize,SigmaSize;
00158     TFile* f = new TFile(m_curvefile.c_str());
00159     TTree *curve = (TTree*) f->Get("curve");
00160     TTree *sigma = (TTree*) f->Get("sigma");
00161     curve->SetBranchAddress("CurveSize",&CurveSize);
00162     curve->SetBranchAddress("curve",Curve);
00163     sigma->SetBranchAddress("SigmaSize",&SigmaSize);
00164     sigma->SetBranchAddress("sigma",Sigma);
00165     curve->GetEntry(0);
00166     sigma->GetEntry(0);
00167 
00168     for(int i=0; i<CurveSize; i++) // get the dedx curve parameters
00169     {
00170         cout<<Curve[i]<<endl;
00171         if(i==0)  vFlag[0] = (int) Curve[i];  //first element is dedx curve version
00172         else  Curve_Para.push_back(Curve[i]);  //dedx curve parameters
00173     }   
00174     for(int i=0; i<SigmaSize; i++)
00175     {
00176         cout<<Sigma[i]<<endl;
00177         if(i==0) vFlag[1] = (int) Sigma[i];  //dedx sigma version: 2: psip; 3:jpsi
00178         else  Sigma_Para.push_back(Sigma[i]);  //dedx sigma parameters
00179     }
00180     //if(runflag>0)   vFlag[2]=0;
00181     //else            vFlag[2]=1;
00182 }

StatusCode DedxCalib::initialize (  ) 

Definition at line 24 of file DedxCalib.cxx.

References BookHists(), calibUtil::ERROR, exsvc, geosvc, getCurvePar(), Bes_Common::INFO, initializing(), m_calibflag, msgSvc(), and IDedxCorrecSvc::set_flag().

00025 {
00026     MsgStream log(msgSvc(), name());
00027     log << MSG::INFO << "DedxCalib initialze()" << endreq;
00028 
00029     StatusCode gesc = service("MdcGeomSvc", geosvc);
00030     if (gesc ==  StatusCode::SUCCESS)
00031     {
00032         log << MSG::INFO <<"MdcGeomSvc is running"<<endreq;
00033     }
00034     else
00035     {
00036         log << MSG::ERROR <<"MdcGeomSvc is failed"<<endreq;
00037         return StatusCode::SUCCESS;
00038     }
00039 
00040     StatusCode scex = service("DedxCorrecSvc", exsvc);
00041     if (scex ==  StatusCode::SUCCESS) {
00042         log << MSG::INFO <<"Hi, DedxCorrectSvc is running"<<endl;
00043     } else {
00044         log << MSG::ERROR <<"DedxCorrectSvc is failed"<<endl;
00045         return StatusCode::SUCCESS;
00046     }
00047     exsvc->set_flag( m_calibflag );
00048 
00049     initializing();
00050     BookHists();
00051     getCurvePar();
00052 
00053     return StatusCode::SUCCESS;
00054 }

void DedxCalib::initializing (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 77 of file DedxCalib.cxx.

Referenced by initialize().

00077 {}

void DedxCalib::ReadRecFileList (  )  [protected]

Definition at line 89 of file DedxCalib.cxx.

References Bes_Common::INFO, m_recFileList, m_recFileVector, msgSvc(), and deljobs::string.

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

00090 {   
00091 
00092     MsgStream log(msgSvc(), name());
00093     log<<MSG::INFO<<"DedxCalib::ReadRecFileList()"<<endreq;
00094 
00095     ifstream filea(m_recFileList.c_str(),ifstream::in);
00096     cout<<m_recFileList.c_str()<<endl;
00097 
00098     string runlist;
00099     filea>>runlist;
00100     do  
00101     {   
00102         m_recFileVector.push_back(runlist);
00103         cout<<runlist.c_str()<<endl;
00104         filea>>runlist;
00105     }while(filea);
00106 }

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.

References Curve_Para, dedx_pid_exp(), dedx_pid_exp_old(), m_chi_ex, m_dedx_exp, m_ex_sigma, m_pid_prob, Sigma_Para, and vFlag.

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

00185 { 
00186     //landau: 1:landau distribution; 0:gaus distribution
00187     //pl_rp: 1.5, not know what
00188     //getCurvePar(runflag);
00189  if(runflag>0)   vFlag[2]=0;
00190      else            vFlag[2]=1;
00191 
00192     //some old data with old methods
00193     if(runflag ==1 || runflag ==2 )
00194       dedx_pid_exp_old( landau, runflag, (float)dEdx, (int)dedxhit_use,
00195                   (float)ptrk, (float)theta, (float)t0,(float)pl_rp,
00196                   m_dedx_exp, m_ex_sigma, m_pid_prob, m_chi_ex);
00197     //for 2009 psip data and after
00198     else
00199       dedx_pid_exp( vflag, (float)dEdx, trkalg,(int)dedxhit_use,
00200                   (float)ptrk, (float)theta, (float)t0,(float)pl_rp,
00201                   m_dedx_exp, m_ex_sigma, m_pid_prob, m_chi_ex, Curve_Para, Sigma_Para);
00202 }

void DedxCalib::WriteHists (  )  [pure virtual]

Implemented in DedxCalibCostheta, DedxCalibDocaEAng, DedxCalibEAng, DedxCalibEvent, DedxCalibLayerGain, DedxCalibMomentum, DedxCalibRunByRun, and DedxCalibWireGain.

Definition at line 87 of file DedxCalib.cxx.

Referenced by execute().

00087 {}


Member Data Documentation

vector<double> DedxCalib::Curve_Para [protected]

Definition at line 39 of file DedxCalib.h.

Referenced by getCurvePar(), and set_dEdx().

IDedxCorrecSvc* DedxCalib::exsvc [protected]

Definition at line 30 of file DedxCalib.h.

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

IMdcGeomSvc* DedxCalib::geosvc [protected]

Definition at line 29 of file DedxCalib.h.

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

int DedxCalib::m_calibflag [protected]

Definition at line 51 of file DedxCalib.h.

Referenced by DedxCalib(), and initialize().

double DedxCalib::m_chi_ex[5] [protected]

Definition at line 46 of file DedxCalib.h.

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

std::string DedxCalib::m_curvefile [protected]

Definition at line 56 of file DedxCalib.h.

Referenced by DedxCalib(), and getCurvePar().

double DedxCalib::m_dedx_exp[5] [protected]

Definition at line 43 of file DedxCalib.h.

Referenced by set_dEdx().

std::string DedxCalib::m_eventType [protected]

Definition at line 53 of file DedxCalib.h.

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

double DedxCalib::m_ex_sigma[5] [protected]

Definition at line 44 of file DedxCalib.h.

Referenced by set_dEdx().

int DedxCalib::m_phShapeFlag [protected]

Definition at line 52 of file DedxCalib.h.

Referenced by DedxCalibWireGain::AnalyseHists(), DedxCalibLayerGain::AnalyseHists(), DedxCalibEAng::AnalyseHists(), DedxCalibDocaEAng::AnalyseHists(), DedxCalib(), DedxCalibWireGain::WriteHists(), DedxCalibLayerGain::WriteHists(), DedxCalibEAng::WriteHists(), and DedxCalibDocaEAng::WriteHists().

double DedxCalib::m_pid_prob[5] [protected]

Definition at line 45 of file DedxCalib.h.

Referenced by set_dEdx().

std::string DedxCalib::m_recFileList [protected]

Definition at line 54 of file DedxCalib.h.

Referenced by DedxCalib(), and ReadRecFileList().

vector<string> DedxCalib::m_recFileVector [protected]

Definition at line 48 of file DedxCalib.h.

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

std::string DedxCalib::m_rootfile [protected]

Definition at line 55 of file DedxCalib.h.

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

int DedxCalib::ParticleFlag [protected]

Definition at line 50 of file DedxCalib.h.

Referenced by DedxCalib(), DedxCalibMomentum::FillHists(), DedxCalibCostheta::FillHists(), and DedxCalibEvent::genNtuple().

vector<double> DedxCalib::Sigma_Para [protected]

Definition at line 40 of file DedxCalib.h.

Referenced by getCurvePar(), and set_dEdx().

float DedxCalib::truncate [protected]

Definition at line 33 of file DedxCalib.h.

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

int DedxCalib::vFlag[3] [protected]

Definition at line 41 of file DedxCalib.h.

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


Generated on Tue Nov 29 23:18:14 2016 for BOSS_7.0.2 by  doxygen 1.4.7