DedxCalibCostheta Class Reference

#include <DedxCalibCostheta.h>

Inheritance diagram for DedxCalibCostheta:

DedxCalib List of all members.

Public Member Functions

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

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

Private Attributes

TH1F ** m_costheta
TH1F ** m_pos_costheta
TH1F ** m_neg_costheta
TH1F ** m_chi
TH1F ** m_pos_chi
TH1F ** m_neg_chi
TH1F * m_dEdxVsCostheta
TH1F * m_pos_dEdxVsCostheta
TH1F * m_neg_dEdxVsCostheta
vector< double > Vec_dedx
vector< double > Vec_costheta
bool m_debug
int m_debug_min
int m_debug_max

Detailed Description

Definition at line 12 of file DedxCalibCostheta.h.


Constructor & Destructor Documentation

DedxCalibCostheta::DedxCalibCostheta ( const std::string name,
ISvcLocator *  pSvcLocator 
)

Definition at line 20 of file DedxCalibCostheta.cxx.

References m_debug, m_debug_max, and m_debug_min.

00020                                                                                    : DedxCalib(name, pSvcLocator){
00021   declareProperty("Debug", m_debug=false);
00022   declareProperty("DebugMin", m_debug_min=2);
00023   declareProperty("DebugMax", m_debug_max=2);
00024 }

DedxCalibCostheta::~DedxCalibCostheta (  )  [inline]

Definition at line 16 of file DedxCalibCostheta.h.

00016 {};


Member Function Documentation

void DedxCalibCostheta::AnalyseHists (  )  [virtual]

Implements DedxCalib.

Definition at line 156 of file DedxCalibCostheta.cxx.

References genRecEmupikp::i, Bes_Common::INFO, m_chi, m_costheta, m_debug, m_neg_chi, m_neg_costheta, m_pos_chi, m_pos_costheta, msgSvc(), and NumBinCostheta.

00157 {
00158     MsgStream log(msgSvc(), name());
00159     log<<MSG::INFO<<"DedxCalibCostheta::AnalyseHists()"<<endreq;
00160 
00161     gStyle->SetOptFit(1111);
00162     for(int i=0; i<NumBinCostheta; i++)
00163     {
00164       if(m_debug) cout << "num of bin " << i << endl;
00165       if(m_costheta[i]->GetEntries()>100) m_costheta[i]->Fit("gaus", "Q" );
00166       if(m_pos_costheta[i]->GetEntries()>100) m_pos_costheta[i]->Fit("gaus", "Q" );
00167       if(m_neg_costheta[i]->GetEntries()>100) m_neg_costheta[i]->Fit("gaus", "Q" );
00168       if(m_chi[i]->GetEntries()>100) m_chi[i]->Fit("gaus", "Q" );
00169       if(m_pos_chi[i]->GetEntries()>100) m_pos_chi[i]->Fit("gaus", "Q" );
00170       if(m_neg_chi[i]->GetEntries()>100) m_neg_chi[i]->Fit("gaus", "Q" );
00171     }
00172 }

void DedxCalibCostheta::BookHists (  )  [virtual]

Implements DedxCalib.

Definition at line 26 of file DedxCalibCostheta.cxx.

References CosthetaMax, CosthetaMin, genRecEmupikp::i, Bes_Common::INFO, m_chi, m_costheta, m_dEdxVsCostheta, m_neg_chi, m_neg_costheta, m_neg_dEdxVsCostheta, m_pos_chi, m_pos_costheta, m_pos_dEdxVsCostheta, MaxChiValue, MaxHistValue1, MinChiValue, MinHistValue1, msgSvc(), NumBinCostheta, NumHistBins, DedxCalib::ReadRecFileList(), Vec_costheta, and Vec_dedx.

00027 {
00028     MsgStream log(msgSvc(), name());
00029     log<<MSG::INFO<<"DedxCalibCostheta::BookHists()"<<endreq;
00030 
00031     ReadRecFileList();
00032 
00033     m_costheta = new TH1F*[NumBinCostheta];
00034     m_pos_costheta = new TH1F*[NumBinCostheta];
00035     m_neg_costheta = new TH1F*[NumBinCostheta];
00036     m_chi  = new TH1F*[NumBinCostheta];
00037     m_pos_chi = new TH1F*[NumBinCostheta];
00038     m_neg_chi = new TH1F*[NumBinCostheta];
00039     stringstream hlabel;
00040     for(int i=0;i<NumBinCostheta;i++)
00041     {
00042         hlabel.str("");
00043         hlabel<<"dEdx_costheta"<<i;
00044         m_costheta[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinHistValue1, MaxHistValue1);
00045         hlabel.str("");
00046         hlabel<<"pos_dEdx_costheta"<<i;
00047         m_pos_costheta[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinHistValue1, MaxHistValue1);
00048         hlabel.str("");
00049         hlabel<<"neg_dEdx_costheta"<<i;
00050         m_neg_costheta[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinHistValue1, MaxHistValue1);
00051         hlabel.str("");
00052         hlabel<<"chi_costheta"<<i;
00053         m_chi[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinChiValue, MaxChiValue);
00054         hlabel.str("");
00055         hlabel<<"pos_chi_costheta"<<i;
00056         m_pos_chi[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinChiValue, MaxChiValue);
00057         hlabel.str("");
00058         hlabel<<"neg_chi_costheta"<<i;
00059         m_neg_chi[i]=new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinChiValue, MaxChiValue);
00060     }
00061     hlabel.str("");
00062     hlabel<<"dEdxVsCostheta";
00063     m_dEdxVsCostheta = new TH1F(hlabel.str().c_str(),"dEdx vs costheta",NumBinCostheta, CosthetaMin, CosthetaMax);
00064     m_dEdxVsCostheta->GetXaxis()->SetTitle("cos#theta");
00065     m_dEdxVsCostheta->GetYaxis()->SetTitle("dE/dx");
00066     hlabel.str("");
00067     hlabel<<"pos_dEdxVsCostheta";
00068     m_pos_dEdxVsCostheta = new TH1F(hlabel.str().c_str(),"positron dEdx vs costheta",NumBinCostheta, CosthetaMin, CosthetaMax);
00069     m_pos_dEdxVsCostheta->GetXaxis()->SetTitle("cos#theta");
00070     m_pos_dEdxVsCostheta->GetYaxis()->SetTitle("dE/dx");
00071     hlabel.str("");
00072     hlabel<<"neg_dEdxVsCostheta";
00073     m_neg_dEdxVsCostheta = new TH1F(hlabel.str().c_str(),"electron dEdx vs costheta",NumBinCostheta, CosthetaMin, CosthetaMax);
00074     m_neg_dEdxVsCostheta->GetXaxis()->SetTitle("cos#theta");
00075     m_neg_dEdxVsCostheta->GetYaxis()->SetTitle("dE/dx");
00076 
00077     Vec_dedx.clear();
00078     Vec_costheta.clear();
00079 }

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

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, inherited]

Definition at line 108 of file DedxCalib.cxx.

References genRecEmupikp::i.

Referenced by DedxCalibLayerGain::AnalyseHists(), DedxCalibRunByRun::FillHists(), DedxCalibMomentum::FillHists(), and 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 (  )  [inherited]

Definition at line 56 of file DedxCalib.cxx.

References DedxCalib::AnalyseHists(), DedxCalib::FillHists(), DedxCalib::genNtuple(), Bes_Common::INFO, msgSvc(), and DedxCalib::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 DedxCalibCostheta::FillHists (  )  [virtual]

Implements DedxCalib.

Definition at line 81 of file DedxCalibCostheta.cxx.

References DedxCalib::cal_dedx_bitrunc(), CosthetaMax, CosthetaMin, DedxCalib::exsvc, genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_chi, DedxCalib::m_chi_ex, m_costheta, m_debug, m_debug_max, m_debug_min, m_neg_chi, m_neg_costheta, m_pos_chi, m_pos_costheta, DedxCalib::m_recFileVector, msgSvc(), DedxCalib::ParticleFlag, DedxCalib::set_dEdx(), IDedxCorrecSvc::StandardHitCorrec(), IDedxCorrecSvc::StandardTrackCorrec(), StepCostheta, deljobs::string, DedxCalib::truncate, Vec_costheta, Vec_dedx, and DedxCalib::vFlag.

00082 {
00083     MsgStream log(msgSvc(), name());
00084     log<<MSG::INFO<<"DedxCalibCostheta::FillHists()"<<endreq;
00085 
00086     TFile* f;
00087     TTree* n103;
00088     string runlist;
00089 
00090     int ndedxhit=0;
00091     double dEdx[100]={0},pathlength[100]={0},wid[100]={0},layid[100]={0},dd_in[100]={0},eangle[100]={0},zhit[100]={0};
00092     double dedx=0;
00093     float runNO=0,runFlag=0,costheta=0,tes=0,charge=0,recalg=0,ptrk=0,chidedx=0;
00094     int usedhit=0;
00095     vector<double> phlist; 
00096     cout<<"m_recFileVector.size()= "<<m_recFileVector.size()<<endl;
00097     for(unsigned int i=0; i<m_recFileVector.size(); i++)
00098     {
00099       runlist = m_recFileVector[i];
00100       f = new TFile(runlist.c_str());
00101       n103 = (TTree*)f->Get("n103");
00102       n103-> SetBranchAddress("ndedxhit", &ndedxhit);
00103       n103-> SetBranchAddress("dEdx_hit",dEdx);
00104       n103-> SetBranchAddress("pathlength_hit",pathlength);
00105       n103-> SetBranchAddress("wid_hit",wid);
00106       n103-> SetBranchAddress("layid_hit",layid);
00107       n103-> SetBranchAddress("dd_in_hit",dd_in);
00108       n103-> SetBranchAddress("eangle_hit",eangle);
00109       n103-> SetBranchAddress("zhit_hit",zhit);
00110       n103-> SetBranchAddress("runNO",&runNO);
00111       n103-> SetBranchAddress("runFlag",&runFlag);
00112       n103-> SetBranchAddress("costheta",&costheta);
00113       n103-> SetBranchAddress("t0",&tes);
00114       n103-> SetBranchAddress("charge",&charge);
00115       n103-> SetBranchAddress("recalg",&recalg);
00116       n103-> SetBranchAddress("ndedxhit",&ndedxhit);
00117       n103-> SetBranchAddress("ptrk",&ptrk);
00118       n103-> SetBranchAddress("chidedx_e",&chidedx);
00119       for(int j=0;j<n103->GetEntries();j++)
00120         {
00121           phlist.clear();
00122           n103->GetEntry(j);
00123           if(costheta>CosthetaMax || costheta<CosthetaMin) continue;
00124           if(tes>1400) continue; 
00125           for(int k=0;k<ndedxhit;k++)
00126             {
00127               dEdx[k] = exsvc->StandardHitCorrec(0,runFlag,2,runNO,pathlength[k],wid[k],layid[k],dEdx[k],dd_in[k],eangle[k],costheta);
00128               phlist.push_back(dEdx[k]);
00129             }
00130           dedx = cal_dedx_bitrunc(truncate, phlist);
00131           int iCos = (Int_t)floor((costheta-CosthetaMin)/StepCostheta);
00132           double pre_dedx = dedx;
00133           if(m_debug && iCos>=m_debug_min && iCos<=m_debug_max) 
00134             cout << "before cor, dedx " << pre_dedx << "  with cos(theta) " << costheta << endl;
00135           dedx = exsvc->StandardTrackCorrec(0, runFlag, 2, runNO, dedx, costheta, tes);
00136           if(m_debug && iCos>=m_debug_min && iCos<=m_debug_max) 
00137             cout << "after cor, dedx " << dedx << " with gain " << pre_dedx/dedx << endl;
00138           m_costheta[iCos]->Fill(dedx);
00139           if(charge>0) m_pos_costheta[iCos]->Fill(dedx);
00140           if(charge<0) m_neg_costheta[iCos]->Fill(dedx);
00141 
00142           usedhit = ndedxhit*truncate;
00143           set_dEdx(1,dedx,recalg,runFlag,usedhit,ptrk,acos(costheta),1.5,vFlag,tes);
00144           double chi = m_chi_ex[ParticleFlag];
00145           //cout<<"chidedx= "<<chidedx<<" particleType= "<<ParticleFlag<<"  new chi= "<<chi<<endl;
00146           m_chi[iCos]->Fill(chi);
00147           if(charge>0) m_pos_chi[iCos]->Fill(chi);
00148           if(charge<0) m_neg_chi[iCos]->Fill(chi);
00149 
00150           Vec_dedx.push_back(dedx);
00151           Vec_costheta.push_back(costheta);
00152         }
00153     }
00154 }

StatusCode DedxCalib::finalize (  )  [inherited]

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 DedxCalibCostheta::genNtuple (  )  [inline, virtual]

Implements DedxCalib.

Definition at line 19 of file DedxCalibCostheta.h.

00019 {}

void DedxCalib::getCurvePar (  )  [protected, inherited]

Definition at line 146 of file DedxCalib.cxx.

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

Referenced by DedxCalib::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 (  )  [inherited]

Definition at line 24 of file DedxCalib.cxx.

References DedxCalib::BookHists(), calibUtil::ERROR, DedxCalib::exsvc, DedxCalib::geosvc, DedxCalib::getCurvePar(), Bes_Common::INFO, DedxCalib::initializing(), DedxCalib::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 DedxCalibCostheta::initializing (  )  [inline, virtual]

Implements DedxCalib.

Definition at line 17 of file DedxCalibCostheta.h.

00017 {}

void DedxCalib::ReadRecFileList (  )  [protected, inherited]

Definition at line 89 of file DedxCalib.cxx.

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

Referenced by DedxCalibWireGain::BookHists(), DedxCalibRunByRun::BookHists(), DedxCalibMomentum::BookHists(), DedxCalibLayerGain::BookHists(), DedxCalibEAng::BookHists(), DedxCalibDocaEAng::BookHists(), and 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, inherited]

Definition at line 184 of file DedxCalib.cxx.

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

Referenced by DedxCalibMomentum::FillHists(), and 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 DedxCalibCostheta::WriteHists (  )  [virtual]

Implements DedxCalib.

Definition at line 174 of file DedxCalibCostheta.cxx.

References EvtCyclic3::c_str(), CosthetaMin, genRecEmupikp::i, Bes_Common::INFO, m_chi, m_costheta, m_debug, m_dEdxVsCostheta, m_neg_chi, m_neg_costheta, m_neg_dEdxVsCostheta, m_pos_chi, m_pos_costheta, m_pos_dEdxVsCostheta, DedxCalib::m_rootfile, msgSvc(), NormalMean, NumBinCostheta, Size, StepCostheta, Vec_costheta, and Vec_dedx.

00175 {
00176     MsgStream log(msgSvc(), name());
00177     log<<MSG::INFO<<"DedxCalibCostheta::WriteHists()"<<endreq;
00178 
00179     double chientryNo[NumBinCostheta]={0},chimean[NumBinCostheta]={0},chimeanerr[NumBinCostheta]={0},chisigma[NumBinCostheta]={0},chisq[NumBinCostheta]={0};
00180     double pos_chientryNo[NumBinCostheta]={0},pos_chimean[NumBinCostheta]={0},pos_chimeanerr[NumBinCostheta]={0},pos_chisigma[NumBinCostheta]={0},pos_chisq[NumBinCostheta]={0};
00181     double neg_chientryNo[NumBinCostheta]={0},neg_chimean[NumBinCostheta]={0},neg_chimeanerr[NumBinCostheta]={0},neg_chisigma[NumBinCostheta]={0},neg_chisq[NumBinCostheta]={0};
00182     double fitentryNo[NumBinCostheta]={0},fitmean[NumBinCostheta]={0},fitmeanerr[NumBinCostheta]={0},fitsigma[NumBinCostheta]={0},gain[NumBinCostheta]={0},fitchisq[NumBinCostheta]={0};
00183     double pos_fitentryNo[NumBinCostheta]={0},pos_fitmean[NumBinCostheta]={0},pos_fitmeanerr[NumBinCostheta]={0},pos_fitsigma[NumBinCostheta]={0},pos_gain[NumBinCostheta]={0},pos_fitchisq[NumBinCostheta]={0};
00184     double neg_fitentryNo[NumBinCostheta]={0},neg_fitmean[NumBinCostheta]={0},neg_fitmeanerr[NumBinCostheta]={0},neg_fitsigma[NumBinCostheta]={0},neg_gain[NumBinCostheta]={0},neg_fitchisq[NumBinCostheta]={0};
00185     double cosBin[NumBinCostheta]={0};
00186 
00187     for(int i=0;i<NumBinCostheta;i++)
00188     {
00189         cosBin[i] = (i+0.5)*StepCostheta + CosthetaMin;
00190 
00191         chientryNo[i] = m_chi[i]->GetEntries();
00192         if(m_debug) cout << "get results at " << i << " bin with chi entries " << chientryNo[i] << endl;
00193         if(m_chi[i]->GetFunction("gaus"))
00194         {
00195             chimean[i] = m_chi[i]->GetFunction("gaus")->GetParameter(1);
00196             chimeanerr[i] = m_chi[i]->GetFunction("gaus")->GetParError(1);
00197             chisigma[i] = m_chi[i]->GetFunction("gaus")->GetParameter(2);
00198             chisq[i] = (m_chi[i]->GetFunction("gaus")->GetChisquare())/(m_chi[i]->GetFunction("gaus")->GetNDF());
00199         }
00200         pos_chientryNo[i] = m_pos_chi[i]->GetEntries();
00201         if(m_debug) cout << "get results at " << i << " bin with pos_chi entries " << pos_chientryNo[i] << endl;
00202         if(m_pos_chi[i]->GetFunction("gaus"))
00203         {
00204             pos_chimean[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(1);
00205             pos_chimeanerr[i] = m_pos_chi[i]->GetFunction("gaus")->GetParError(1);
00206             pos_chisigma[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(2);
00207             pos_chisq[i] = (m_pos_chi[i]->GetFunction("gaus")->GetChisquare())/(m_pos_chi[i]->GetFunction("gaus")->GetNDF());
00208         }
00209         neg_chientryNo[i] = m_neg_chi[i]->GetEntries();
00210         if(m_debug) cout << "get results at " << i << " bin with neg_chi entries " << neg_chientryNo[i] << endl;
00211         if(m_neg_chi[i]->GetFunction("gaus"))
00212         {
00213             neg_chimean[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(1);
00214             neg_chimeanerr[i] = m_neg_chi[i]->GetFunction("gaus")->GetParError(1);
00215             neg_chisigma[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(2);
00216             neg_chisq[i] = (m_neg_chi[i]->GetFunction("gaus")->GetChisquare())/(m_neg_chi[i]->GetFunction("gaus")->GetNDF());
00217         }
00218 
00219         fitentryNo[i] = m_costheta[i]->GetEntries();
00220         if(m_debug) cout << "get results at " << i << " bin with fit entries " << fitentryNo[i] << endl;
00221         if(m_costheta[i]->GetFunction("gaus"))
00222         {
00223             fitmean[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(1);
00224             fitmeanerr[i] = m_costheta[i]->GetFunction("gaus")->GetParError(1);
00225             fitsigma[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(2);
00226             gain[i] = fitmean[i]/NormalMean;
00227             fitchisq[i] = (m_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_costheta[i]->GetFunction("gaus")->GetNDF());
00228         }
00229         pos_fitentryNo[i] = m_pos_costheta[i]->GetEntries();
00230         if(m_debug) cout << "get results at " << i << " bin with pos_fit entries " << pos_fitentryNo[i] << endl;
00231         if(m_pos_costheta[i]->GetFunction("gaus"))
00232         {
00233             pos_fitmean[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(1);
00234             pos_fitmeanerr[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParError(1);
00235             pos_fitsigma[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(2);
00236             pos_gain[i] = pos_fitmean[i]/NormalMean;
00237             pos_fitchisq[i] = (m_pos_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_pos_costheta[i]->GetFunction("gaus")->GetNDF());
00238         }
00239         neg_fitentryNo[i] = m_neg_costheta[i]->GetEntries();
00240         if(m_debug) cout << "get results at " << i << " bin with neg_fit entries " << neg_fitentryNo[i] << endl;
00241         if(m_neg_costheta[i]->GetFunction("gaus"))
00242         {
00243             neg_fitmean[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(1);
00244             neg_fitmeanerr[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParError(1);
00245             neg_fitsigma[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(2);
00246             neg_gain[i] = neg_fitmean[i]/NormalMean;
00247             neg_fitchisq[i] = (m_neg_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_neg_costheta[i]->GetFunction("gaus")->GetNDF());
00248         }
00249 
00250         if(fitentryNo[i]>100) m_dEdxVsCostheta -> SetBinContent(i+1,fitmean[i]);
00251         if(pos_fitentryNo[i]>100) m_pos_dEdxVsCostheta -> SetBinContent(i+1,pos_fitmean[i]);
00252         if(neg_fitentryNo[i]>100) m_neg_dEdxVsCostheta -> SetBinContent(i+1,neg_fitmean[i]);
00253     }
00254 
00255     double dedx1[Size] = {0};
00256     double costheta1[Size] = {0};
00257     cout << "Vec_dedx.size() = " << Vec_dedx.size() << endl;
00258     for(unsigned int i=0;i<Size && i< Vec_dedx.size();i++)
00259     {
00260         dedx1[i] = Vec_dedx[i];
00261         costheta1[i] = Vec_costheta[i];
00262         //cout<<"i= "<<i<<"dedx= "<<dedx1[i]<<" costheta= "<<costheta1[i]<<endl;
00263     }
00264 
00265     log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
00266     TFile* f = new TFile(m_rootfile.c_str(), "RECREATE");
00267     for(int i=0;i<NumBinCostheta;i++)
00268     {
00269         m_chi[i]->Write();
00270         m_pos_chi[i]->Write();
00271         m_neg_chi[i]->Write();
00272         m_costheta[i]->Write();
00273         m_pos_costheta[i]->Write();
00274         m_neg_costheta[i]->Write();
00275     }
00276     m_dEdxVsCostheta->Write();
00277     m_pos_dEdxVsCostheta->Write();
00278     m_neg_dEdxVsCostheta->Write();
00279 
00280     TTree *costhetacalib = new TTree("costhetacalib","costhetacalib");
00281     costhetacalib -> Branch("chientryNo",chientryNo,"chientryNo[80]/D");
00282     costhetacalib -> Branch("chimean",chimean,"chimean[80]/D");
00283     costhetacalib -> Branch("chimeanerr",chimeanerr,"chimeanerr[80]/D");
00284     costhetacalib -> Branch("chisigma",chisigma,"chisigma[80]/D");
00285     costhetacalib -> Branch("chisq",chisq,"chisq[80]/D");
00286     costhetacalib -> Branch("pos_chientryNo",pos_chientryNo,"pos_chientryNo[80]/D");
00287     costhetacalib -> Branch("pos_chimean",pos_chimean,"pos_chimean[80]/D");
00288     costhetacalib -> Branch("pos_chimeanerr",pos_chimeanerr,"pos_chimeanerr[80]/D");
00289     costhetacalib -> Branch("pos_chisigma",pos_chisigma,"pos_chisigma[80]/D");
00290     costhetacalib -> Branch("pos_chisq",pos_chisq,"pos_chisq[80]/D");
00291     costhetacalib -> Branch("neg_chientryNo",neg_chientryNo,"neg_chientryNo[80]/D");
00292     costhetacalib -> Branch("neg_chimean",neg_chimean,"neg_chimean[80]/D");
00293     costhetacalib -> Branch("neg_chimeanerr",neg_chimeanerr,"neg_chimeanerr[80]/D");
00294     costhetacalib -> Branch("neg_chisigma",neg_chisigma,"neg_chisigma[80]/D");
00295     costhetacalib -> Branch("neg_chisq",neg_chisq,"neg_chisq[80]/D");
00296     costhetacalib -> Branch("fitentryNo", fitentryNo, "fitentryNo[80]/D");
00297     costhetacalib -> Branch("fitmean", fitmean, "fitmean[80]/D");
00298     costhetacalib -> Branch("fitmeanerr", fitmeanerr, "fitmeanerr[80]/D"); 
00299     costhetacalib -> Branch("fitsigma", fitsigma, "fitsigma[80]/D");
00300     costhetacalib -> Branch("costheta", gain, "gain[80]/D");
00301     costhetacalib -> Branch("fitchisq", fitchisq, "fitchisq[80]/D");
00302     costhetacalib -> Branch("pos_fitentryNo", pos_fitentryNo, "pos_fitentryNo[80]/D");
00303     costhetacalib -> Branch("pos_fitmean", pos_fitmean, "pos_fitmean[80]/D");
00304     costhetacalib -> Branch("pos_fitmeanerr", pos_fitmeanerr, "pos_fitmeanerr[80]/D");
00305     costhetacalib -> Branch("pos_fitsigma", pos_fitsigma, "pos_fitsigma[80]/D");
00306     costhetacalib -> Branch("pos_gain", pos_gain, "pos_gain[80]/D");
00307     costhetacalib -> Branch("pos_fitchisq", pos_fitchisq, "pos_fitchisq[80]/D");
00308     costhetacalib -> Branch("neg_fitentryNo", neg_fitentryNo, "neg_fitentryNo[80]/D");
00309     costhetacalib -> Branch("neg_fitmean", neg_fitmean, "neg_fitmean[80]/D");
00310     costhetacalib -> Branch("neg_fitmeanerr", neg_fitmeanerr, "neg_fitmeanerr[80]/D");
00311     costhetacalib -> Branch("neg_fitsigma", neg_fitsigma, "neg_fitsigma[80]/D");
00312     costhetacalib -> Branch("neg_gain", neg_gain, "neg_gain[80]/D");
00313     costhetacalib -> Branch("neg_fitchisq", neg_fitchisq, "neg_fitchisq[80]/D");
00314     costhetacalib -> Branch("cosBin", cosBin, "cosBin[80]/D");
00315     costhetacalib -> Branch("costheta1",costheta1,"costheta1[700000]/D");
00316     costhetacalib -> Branch("dedx1",dedx1,"dedx1[700000]/D");
00317     costhetacalib -> Fill();
00318     costhetacalib -> Write();
00319 
00320     TCanvas c1("c1", "canvas", 500, 400);
00321     c1.Print((m_rootfile+".ps[").c_str());
00322     costhetacalib -> Draw("dedx1:costheta1","dedx1>200 && dedx1<1000");
00323     c1.Print((m_rootfile+".ps").c_str());
00324     m_dEdxVsCostheta->Draw();
00325     c1.Print((m_rootfile+".ps").c_str());
00326     m_pos_dEdxVsCostheta->Draw();
00327     c1.Print((m_rootfile+".ps").c_str());
00328     m_neg_dEdxVsCostheta->Draw();
00329     c1.Print((m_rootfile+".ps").c_str());
00330     for(Int_t i=0;i<NumBinCostheta;i++)
00331     {   
00332         m_chi[i]->Draw();
00333         c1.Print((m_rootfile+".ps").c_str());
00334     }
00335     for(Int_t i=0;i<NumBinCostheta;i++)
00336     {
00337         m_pos_chi[i]->Draw();
00338         c1.Print((m_rootfile+".ps").c_str());
00339     }
00340     for(Int_t i=0;i<NumBinCostheta;i++)
00341     {
00342         m_neg_chi[i]->Draw();
00343         c1.Print((m_rootfile+".ps").c_str());
00344     }
00345     for(Int_t i=0;i<NumBinCostheta;i++)
00346     {
00347         m_costheta[i]->Draw();
00348         c1.Print((m_rootfile+".ps").c_str());
00349     }
00350     for(Int_t i=0;i<NumBinCostheta;i++)
00351     {
00352         m_pos_costheta[i]->Draw();
00353         c1.Print((m_rootfile+".ps").c_str());
00354     }
00355     for(Int_t i=0;i<NumBinCostheta;i++)
00356     {
00357         m_neg_costheta[i]->Draw();
00358         c1.Print((m_rootfile+".ps").c_str());
00359     }
00360     c1.Print((m_rootfile+".ps]").c_str());
00361     f->Close();
00362 
00363     for(Int_t i=0;i<NumBinCostheta;i++)
00364     {
00365         delete m_chi[i];
00366         delete m_pos_chi[i];
00367         delete m_neg_chi[i];
00368         delete m_costheta[i];
00369         delete m_pos_costheta[i];
00370         delete m_neg_costheta[i];
00371     }
00372     delete m_dEdxVsCostheta;
00373     delete m_pos_dEdxVsCostheta;
00374     delete m_neg_dEdxVsCostheta;
00375 }


Member Data Documentation

vector<double> DedxCalib::Curve_Para [protected, inherited]

Definition at line 39 of file DedxCalib.h.

Referenced by DedxCalib::getCurvePar(), and DedxCalib::set_dEdx().

IDedxCorrecSvc* DedxCalib::exsvc [protected, inherited]

Definition at line 30 of file DedxCalib.h.

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

IMdcGeomSvc* DedxCalib::geosvc [protected, inherited]

Definition at line 29 of file DedxCalib.h.

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

int DedxCalib::m_calibflag [protected, inherited]

Definition at line 51 of file DedxCalib.h.

Referenced by DedxCalib::DedxCalib(), and DedxCalib::initialize().

TH1F** DedxCalibCostheta::m_chi [private]

Definition at line 28 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

double DedxCalib::m_chi_ex[5] [protected, inherited]

Definition at line 46 of file DedxCalib.h.

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

TH1F** DedxCalibCostheta::m_costheta [private]

Definition at line 25 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

std::string DedxCalib::m_curvefile [protected, inherited]

Definition at line 56 of file DedxCalib.h.

Referenced by DedxCalib::DedxCalib(), and DedxCalib::getCurvePar().

bool DedxCalibCostheta::m_debug [private]

Definition at line 37 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), DedxCalibCostheta(), FillHists(), and WriteHists().

int DedxCalibCostheta::m_debug_max [private]

Definition at line 38 of file DedxCalibCostheta.h.

Referenced by DedxCalibCostheta(), and FillHists().

int DedxCalibCostheta::m_debug_min [private]

Definition at line 38 of file DedxCalibCostheta.h.

Referenced by DedxCalibCostheta(), and FillHists().

double DedxCalib::m_dedx_exp[5] [protected, inherited]

Definition at line 43 of file DedxCalib.h.

Referenced by DedxCalib::set_dEdx().

TH1F* DedxCalibCostheta::m_dEdxVsCostheta [private]

Definition at line 31 of file DedxCalibCostheta.h.

Referenced by BookHists(), and WriteHists().

std::string DedxCalib::m_eventType [protected, inherited]

Definition at line 53 of file DedxCalib.h.

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

double DedxCalib::m_ex_sigma[5] [protected, inherited]

Definition at line 44 of file DedxCalib.h.

Referenced by DedxCalib::set_dEdx().

TH1F** DedxCalibCostheta::m_neg_chi [private]

Definition at line 30 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

TH1F** DedxCalibCostheta::m_neg_costheta [private]

Definition at line 27 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

TH1F* DedxCalibCostheta::m_neg_dEdxVsCostheta [private]

Definition at line 33 of file DedxCalibCostheta.h.

Referenced by BookHists(), and WriteHists().

int DedxCalib::m_phShapeFlag [protected, inherited]

Definition at line 52 of file DedxCalib.h.

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

double DedxCalib::m_pid_prob[5] [protected, inherited]

Definition at line 45 of file DedxCalib.h.

Referenced by DedxCalib::set_dEdx().

TH1F** DedxCalibCostheta::m_pos_chi [private]

Definition at line 29 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

TH1F** DedxCalibCostheta::m_pos_costheta [private]

Definition at line 26 of file DedxCalibCostheta.h.

Referenced by AnalyseHists(), BookHists(), FillHists(), and WriteHists().

TH1F* DedxCalibCostheta::m_pos_dEdxVsCostheta [private]

Definition at line 32 of file DedxCalibCostheta.h.

Referenced by BookHists(), and WriteHists().

std::string DedxCalib::m_recFileList [protected, inherited]

Definition at line 54 of file DedxCalib.h.

Referenced by DedxCalib::DedxCalib(), and DedxCalib::ReadRecFileList().

vector<string> DedxCalib::m_recFileVector [protected, inherited]

Definition at line 48 of file DedxCalib.h.

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

std::string DedxCalib::m_rootfile [protected, inherited]

Definition at line 55 of file DedxCalib.h.

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

int DedxCalib::ParticleFlag [protected, inherited]

Definition at line 50 of file DedxCalib.h.

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

vector<double> DedxCalib::Sigma_Para [protected, inherited]

Definition at line 40 of file DedxCalib.h.

Referenced by DedxCalib::getCurvePar(), and DedxCalib::set_dEdx().

float DedxCalib::truncate [protected, inherited]

Definition at line 33 of file DedxCalib.h.

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

vector<double> DedxCalibCostheta::Vec_costheta [private]

Definition at line 36 of file DedxCalibCostheta.h.

Referenced by BookHists(), FillHists(), and WriteHists().

vector<double> DedxCalibCostheta::Vec_dedx [private]

Definition at line 35 of file DedxCalibCostheta.h.

Referenced by BookHists(), FillHists(), and WriteHists().

int DedxCalib::vFlag[3] [protected, inherited]

Definition at line 41 of file DedxCalib.h.

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


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