DedxCalibLayerGain Class Reference

#include <DedxCalibLayerGain.h>

Inheritance diagram for DedxCalibLayerGain:

DedxCalib List of all members.

Public Member Functions

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

vector< float > m_vector [43]
TH1F ** m_laygain
TH1F ** m_laygain_gaus

Detailed Description

Definition at line 9 of file DedxCalibLayerGain.h.


Constructor & Destructor Documentation

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

Definition at line 16 of file DedxCalibLayerGain.cxx.

00016 : DedxCalib(name, pSvcLocator){}

DedxCalibLayerGain::~DedxCalibLayerGain (  )  [inline]

Definition at line 13 of file DedxCalibLayerGain.h.

00013 {};


Member Function Documentation

void DedxCalibLayerGain::AnalyseHists (  )  [virtual]

Implements DedxCalib.

Definition at line 114 of file DedxCalibLayerGain.cxx.

References AsymGauss(), DedxCalib::cal_dedx_bitrunc(), calculate(), getMean(), getRms(), genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, Landau(), landaun(), layNo, m_laygain, m_laygain_gaus, DedxCalib::m_phShapeFlag, m_vector, msgSvc(), mylan(), NumHistBins, DedxCalib::truncate, and Vavilov().

00115 {
00116     MsgStream log(msgSvc(), name());
00117     log<<MSG::INFO<<"DedxCalibLayerGain::AnalyseHists()"<<endreq;
00118 
00119     TF1* func;
00120     Double_t entry=0,mean=0,rms=0;
00121     Double_t binmax=0;
00122     Double_t lp[3]={0};
00123     gStyle->SetOptFit(1111);
00124 
00125     stringstream hlabel;
00126     double dedxt;
00127     vector<double> phlist;
00128     vector<double> phlist_gaus;
00129     for(int i=0; i<layNo; i++)
00130     {
00131         entry = m_laygain[i]->GetEntries();
00132         if(entry<10) continue;
00133         mean = m_laygain[i]->GetMean();
00134         rms = m_laygain[i]->GetRMS();
00135         binmax = m_laygain[i]->GetMaximumBin();
00136         lp[1] = m_laygain[i]->GetBinCenter(binmax);
00137         lp[2] = 200;
00138         lp[0] = (m_laygain[i]->GetBinContent(binmax)+m_laygain[i]->GetBinContent(binmax-1)+m_laygain[i]->GetBinContent(binmax+1))/3;
00139 
00140         if(m_phShapeFlag==0)
00141         {
00142             func = new TF1("mylan",mylan,10,3000,4);
00143             func->SetParameters(entry, mean, rms, -0.9);
00144         }
00145         else if(m_phShapeFlag==1)   
00146         {
00147             func = new TF1("landaun",landaun,10,3000,3);
00148             func->SetParameters(lp[0], lp[1], lp[2] );
00149         }
00150         else if(m_phShapeFlag==2)  
00151         {
00152             func = new TF1("Landau",Landau,10,3000,2);
00153             func->SetParameters(0.7*mean, rms );
00154         }
00155         else if(m_phShapeFlag==3)  
00156         {
00157             func = new TF1("Vavilov",Vavilov,10,3000,2);
00158             func->SetParameters(0.05, 0.6);
00159         }
00160         else if(m_phShapeFlag==4) 
00161         {
00162             func = new TF1("AsymGauss",AsymGauss,10,3000,4);
00163             func->SetParameters(entry, mean, rms, 1.0 );
00164         }
00165         func->SetLineWidth(2.1);
00166         func->SetLineColor(2);
00167 
00168         m_laygain[i]->Fit(func, "r" );
00169 
00170 
00171         //******* begin truncated dedx fitting **************************//
00172         for(int j=0;j<m_vector[i].size();j+=100)
00173         {
00174             for(int k=0;k<100;k++) phlist.push_back(m_vector[i][j+k]);
00175             dedxt = cal_dedx_bitrunc(truncate, phlist);
00176             phlist_gaus.push_back(dedxt);
00177             phlist.clear();
00178         }
00179 
00180         hlabel.str("");
00181         hlabel<<"dEdx_gaus_Lay_"<<i;
00182         calculate(phlist_gaus);
00183         //cout<<getMean()-10*getRms()<<"   "<<getMean()+10*getRms()<<endl;
00184         m_laygain_gaus[i] = new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, getMean()-10*getRms(), getMean()+10*getRms());
00185         for(int j=0;j<phlist_gaus.size();j++)  m_laygain_gaus[i]->Fill(phlist_gaus[j]);
00186         phlist_gaus.clear();
00187         m_laygain_gaus[i]->Fit("gaus","Q");
00188 
00189 
00190     }
00191 }

void DedxCalibLayerGain::BookHists (  )  [virtual]

Implements DedxCalib.

Definition at line 41 of file DedxCalibLayerGain.cxx.

References genRecEmupikp::i, Bes_Common::INFO, layNo, m_laygain, m_laygain_gaus, MaxHistValue, MaxHistValue1, MinHistValue, MinHistValue1, msgSvc(), NumHistBins, and DedxCalib::ReadRecFileList().

00042 {
00043     MsgStream log(msgSvc(), name());
00044     log<<MSG::INFO<<"DedxCalibLayerGain::BookHists()"<<endreq;
00045 
00046     ReadRecFileList();
00047 
00048     m_laygain = new TH1F*[layNo];
00049     m_laygain_gaus = new TH1F*[layNo];
00050     stringstream hlabel;
00051     for(int i=0; i<layNo; i++)
00052     {
00053         hlabel.str("");
00054         hlabel<<"dEdx_Lay_"<<i;
00055         m_laygain[i] = new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinHistValue, MaxHistValue);
00056         hlabel.str("");
00057         hlabel<<"dEdx_gaus_Lay_"<<i;
00058         m_laygain_gaus[i] = new TH1F(hlabel.str().c_str(), hlabel.str().c_str(), NumHistBins, MinHistValue1, MaxHistValue1);         
00059     }
00060 }

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 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 (  )  [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 DedxCalibLayerGain::FillHists (  )  [virtual]

Implements DedxCalib.

Definition at line 62 of file DedxCalibLayerGain.cxx.

References DedxCalib::exsvc, genRecEmupikp::i, Iner_DriftDistCut, Bes_Common::INFO, ganga-rec::j, m_laygain, DedxCalib::m_recFileVector, m_vector, MaxADCValuecut, msgSvc(), Out_DriftDistCut, push_back(), RPhi_PathMaxCut, IDedxCorrecSvc::StandardHitCorrec(), IDedxCorrecSvc::StandardTrackCorrec(), and deljobs::string.

00063 {
00064     MsgStream log(msgSvc(), name());
00065     log<<MSG::INFO<<"DedxCalibLayerGain::FillHists()"<<endreq;
00066 
00067     TFile* f;
00068     TTree* n102;
00069     string runlist;
00070 
00071     double dedx=0;
00072     float runNO=0,runFlag=0,pathlength=0,wid=0,layid=0,dd_in=0,driftdist=0,eangle=0,zhit=0,costheta=0,tes=0,ptrk=0;  
00073     cout<<"m_recFileVector.size()= "<<m_recFileVector.size()<<endl;
00074     for(int i=0; i<m_recFileVector.size(); i++)
00075     {   
00076         runlist = m_recFileVector[i];
00077         cout<<"runlist: "<<runlist.c_str()<<endl;
00078         f = new TFile(runlist.c_str());
00079         n102 = (TTree*)f->Get("n102");
00080         n102-> SetBranchAddress("adc_raw",&dedx);
00081         n102-> SetBranchAddress("path_rphi",&pathlength);
00082         n102-> SetBranchAddress("wire",&wid);
00083         n102-> SetBranchAddress("layer",&layid);
00084         n102-> SetBranchAddress("doca_in",&dd_in);
00085         n102-> SetBranchAddress("driftdist",&driftdist);
00086         n102-> SetBranchAddress("eangle",&eangle);
00087         n102-> SetBranchAddress("zhit",&zhit);
00088         n102-> SetBranchAddress("runNO",&runNO);
00089         n102-> SetBranchAddress("runFlag",&runFlag);
00090         n102-> SetBranchAddress("costheta1",&costheta);
00091         n102-> SetBranchAddress("t01",&tes);
00092         n102->SetBranchAddress("ptrk1",&ptrk);
00093 
00094         for(int j=0;j<n102->GetEntries();j++)
00095         {
00096             n102->GetEntry(j);
00097             if(tes>1400) continue;
00098             if (ptrk<0.1) continue;
00099             //if(wid>=6731 && wid<=6739) continue;
00100             if(layid <8)
00101             {if(dedx<MinADCValuecut || dedx>MaxADCValuecut || pathlength>RPhi_PathMaxCut || pathlength<Iner_RPhi_PathMinCut || driftdist>Iner_DriftDistCut) continue;}
00102             else
00103             {if(dedx<MinADCValuecut || dedx>MaxADCValuecut || pathlength>RPhi_PathMaxCut || pathlength<Out_RPhi_PathMinCut || driftdist>Out_DriftDistCut) continue;}
00104             dedx = exsvc->StandardHitCorrec(0,runFlag,2,runNO,pathlength,wid,layid,dedx,dd_in,eangle,costheta);
00105             dedx = exsvc->StandardTrackCorrec(0, runFlag, 2, runNO, dedx, costheta, tes);
00106             m_laygain[(int)layid]->Fill(dedx);
00107 
00108             m_vector[(int)layid].push_back(dedx);
00109         }
00110     }
00111 
00112 }

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

Implements DedxCalib.

Definition at line 16 of file DedxCalibLayerGain.h.

00016 {}

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

Implements DedxCalib.

Definition at line 14 of file DedxCalibLayerGain.h.

00014 {}

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(), 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, 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 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 DedxCalibLayerGain::WriteHists (  )  [virtual]

Implements DedxCalib.

Definition at line 193 of file DedxCalibLayerGain.cxx.

References EvtCyclic3::c_str(), genRecEmupikp::i, Bes_Common::INFO, layNo, m_laygain, m_laygain_gaus, DedxCalib::m_phShapeFlag, DedxCalib::m_rootfile, and msgSvc().

00194 {
00195     MsgStream log(msgSvc(), name());
00196     log<<MSG::INFO<<"DedxCalibLayerGain::WriteHists()"<<endreq;
00197 
00198 
00199     double entryNo[layNo]={0},mean[layNo]={0},sigma[layNo]={0},proper[layNo]={0},fitmean[layNo]={0},fitmeanerr[layNo]={0},fitsigma[layNo]={0},layerg[layNo]={0},layer[layNo]={0},chisq[layNo]={0};
00200     double fitmean_gaus[layNo]={0},fitmeanerr_gaus[layNo]={0},fitsigma_gaus[layNo]={0},layerg_gaus[layNo]={0};
00201     for(int i=0; i<layNo; i++)
00202     {
00203         fitmean_gaus[i] = m_laygain_gaus[i]->GetFunction("gaus")->GetParameter(1);
00204         fitmeanerr_gaus[i] = m_laygain_gaus[i]->GetFunction("gaus")->GetParError(1);
00205         fitsigma_gaus[i] = m_laygain_gaus[i]->GetFunction("gaus")->GetParameter(2);
00206 
00207         entryNo[i] = m_laygain[i]->GetEntries();
00208         mean[i] = m_laygain[i]->GetMean();
00209         sigma[i] = m_laygain[i]->GetRMS();
00210         proper[i] = m_laygain[i]->GetBinCenter(m_laygain[i]->GetMaximumBin());
00211         if(entryNo[i]<10) continue;
00212 
00213         if(m_phShapeFlag==0)
00214         {
00215             fitmean[i] = m_laygain[i]->GetFunction("mylan")->GetParameter(1);
00216             fitmeanerr[i] = m_laygain[i]->GetFunction("mylan")->GetParError(1);
00217             fitsigma[i] = m_laygain[i]->GetFunction("mylan")->GetParameter(2);
00218             chisq[i] = (m_laygain[i]->GetFunction("mylan")-> GetChisquare())/(m_laygain[i]->GetFunction("mylan")->  GetNDF());
00219         }
00220         else if(m_phShapeFlag==1)
00221         {
00222             fitmean[i] = m_laygain[i]->GetFunction("landaun")->GetParameter(1);
00223             fitmeanerr[i] = m_laygain[i]->GetFunction("landaun")->GetParError(1);
00224             fitsigma[i] = m_laygain[i]->GetFunction("landaun")->GetParameter(2);
00225             chisq[i] = (m_laygain[i]->GetFunction("landaun")-> GetChisquare())/(m_laygain[i]->GetFunction("landaun")->  GetNDF());
00226         }
00227         else if(m_phShapeFlag==2)
00228         {
00229             fitmean[i] = m_laygain[i]->GetFunction("Landau")->GetParameter(1);
00230             fitmeanerr[i] = m_laygain[i]->GetFunction("Landau")->GetParError(1);
00231             fitsigma[i] = m_laygain[i]->GetFunction("Landau")->GetParameter(2);
00232             chisq[i] = (m_laygain[i]->GetFunction("Landau")-> GetChisquare())/(m_laygain[i]->GetFunction("Landau")->  GetNDF());
00233         }
00234         else if(m_phShapeFlag==3)
00235         {
00236             fitmean[i] = m_laygain[i]->GetFunction("Vavilov")->GetParameter(1);
00237             fitmeanerr[i] = m_laygain[i]->GetFunction("Vavilov")->GetParError(1);
00238             fitsigma[i] = m_laygain[i]->GetFunction("Vavilov")->GetParameter(2);
00239             chisq[i] = (m_laygain[i]->GetFunction("Vavilov")-> GetChisquare())/(m_laygain[i]->GetFunction("Vavilov")->  GetNDF());
00240         }
00241         else if(m_phShapeFlag==4)
00242         {
00243             fitmean[i] = m_laygain[i]->GetFunction("AsymGauss")->GetParameter(1);
00244             fitmeanerr[i] = m_laygain[i]->GetFunction("AsymGauss")->GetParError(1);
00245             fitsigma[i] = m_laygain[i]->GetFunction("AsymGauss")->GetParameter(2);
00246             chisq[i] = (m_laygain[i]->GetFunction("AsymGauss")-> GetChisquare())/(m_laygain[i]->GetFunction("AsymGauss")->  GetNDF());
00247         }
00248         //cout<<"fitmean[i]= "<<fitmean[i]<<" fitmeanerr[i]= "<<fitmeanerr[i]<<" fitsigma[i]= "<<fitsigma[i]<<endl;
00249     }
00250 
00251     double sum=0, sum_gaus=0, n=0;
00252     for(int i=4; i<layNo; i++)
00253     {
00254         if(fitmean[i]>0 && fitmeanerr[i]>0 && fitmeanerr[i]<10 && fitsigma[i]>0 && fitsigma[i]<200 && entryNo[i]>1500)
00255         {
00256             sum += fitmean[i];
00257             sum_gaus+= fitmean_gaus[i];
00258             n++;
00259         }    
00260     }
00261     sum/=n;
00262     sum_gaus/=n;
00263     cout<<"average value of good layer: "<<sum<<endl;
00264 
00265     for(int i=0;i<layNo;i++)
00266     {
00267         layerg[i] = fitmean[i]/sum;
00268         layerg_gaus[i] = fitmean_gaus[i]/sum_gaus;
00269         layer[i] = i;
00270     }
00271 
00272 
00273     log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
00274     TFile* f = new TFile(m_rootfile.c_str(), "recreate");
00275     for(int i=0;i<layNo;i++)
00276     {
00277         m_laygain[i]->Write();
00278         m_laygain_gaus[i]->Write();
00279     }
00280 
00281     TTree* layergcalib = new TTree("layergcalib", "layergcalib");
00282     layergcalib->Branch("layerg_gaus", layerg_gaus, "layerg_gaus[43]/D");
00283     layergcalib->Branch("layerg", layerg, "layerg[43]/D");
00284     layergcalib->Branch("layer", layer, "layer[43]/D");
00285     layergcalib->Branch("entryNo", entryNo, "entryNo[43]/D");
00286     layergcalib->Branch("mean", mean, "mean[43]/D");
00287     layergcalib->Branch("sigma", sigma, "sigma[43]/D");           
00288     layergcalib->Branch("fitmean", fitmean, "fitmean[43]/D");
00289     layergcalib->Branch("fitmeanerr", fitmeanerr, "fitmeanerr[43]/D");
00290     layergcalib->Branch("fitsigma", fitsigma, "fitsigma[43]/D");
00291     layergcalib->Branch("chisq", chisq, "chisq[43]/D");
00292     layergcalib->Branch("fitmean_gaus", fitmean_gaus, "fitmean_gaus[43]/D");
00293     layergcalib->Branch("fitmeanerr_gaus", fitmeanerr_gaus, "fitmeanerr_gaus[43]/D");
00294     layergcalib->Branch("fitsigma_gaus", fitsigma_gaus, "fitsigma_gaus[43]/D");
00295     layergcalib->Fill();
00296     layergcalib->Write();
00297 
00298     f->Close();
00299 
00300     TCanvas c1("c1", "canvas", 500, 400);
00301     c1.Print((m_rootfile+".ps[").c_str());
00302     for(int i=0;i<layNo;i++)
00303     {
00304         m_laygain[i]->Draw();
00305         c1.Print((m_rootfile+".ps").c_str());
00306     }
00307     c1.Print((m_rootfile+".ps]").c_str());
00308 
00309     for(int i=0;i<layNo;i++)
00310     {
00311         delete m_laygain[i];
00312         delete m_laygain_gaus[i];
00313     }
00314 }


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(), FillHists(), DedxCalibEAng::FillHists(), DedxCalibDocaEAng::FillHists(), DedxCalibCostheta::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().

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

Definition at line 46 of file DedxCalib.h.

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

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

Definition at line 56 of file DedxCalib.h.

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

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

Definition at line 43 of file DedxCalib.h.

Referenced by DedxCalib::set_dEdx().

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** DedxCalibLayerGain::m_laygain [private]

Definition at line 23 of file DedxCalibLayerGain.h.

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

TH1F** DedxCalibLayerGain::m_laygain_gaus [private]

Definition at line 24 of file DedxCalibLayerGain.h.

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

int DedxCalib::m_phShapeFlag [protected, inherited]

Definition at line 52 of file DedxCalib.h.

Referenced by DedxCalibWireGain::AnalyseHists(), AnalyseHists(), DedxCalibEAng::AnalyseHists(), DedxCalibDocaEAng::AnalyseHists(), DedxCalib::DedxCalib(), DedxCalibWireGain::WriteHists(), 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().

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(), FillHists(), DedxCalibEAng::FillHists(), DedxCalibDocaEAng::FillHists(), DedxCalibCostheta::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(), WriteHists(), DedxCalibEAng::WriteHists(), DedxCalibDocaEAng::WriteHists(), and DedxCalibCostheta::WriteHists().

vector<float> DedxCalibLayerGain::m_vector[43] [private]

Definition at line 22 of file DedxCalibLayerGain.h.

Referenced by AnalyseHists(), and FillHists().

int DedxCalib::ParticleFlag [protected, inherited]

Definition at line 50 of file DedxCalib.h.

Referenced by DedxCalib::DedxCalib(), DedxCalibMomentum::FillHists(), DedxCalibCostheta::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 AnalyseHists(), DedxCalib::DedxCalib(), DedxCalibRunByRun::FillHists(), DedxCalibMomentum::FillHists(), and DedxCalibCostheta::FillHists().

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

Definition at line 41 of file DedxCalib.h.

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


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