BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
DedxCalibRunByRun Class Reference

#include <DedxCalibRunByRun.h>

+ Inheritance diagram for DedxCalibRunByRun:

Public Member Functions

 DedxCalibRunByRun (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~DedxCalibRunByRun ()
 
void initializing ()
 
void BookHists ()
 
void genNtuple ()
 
void FillHists ()
 
void AnalyseHists ()
 
void WriteHists ()
 
 DedxCalibRunByRun (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~DedxCalibRunByRun ()
 
void initializing ()
 
void BookHists ()
 
void genNtuple ()
 
void FillHists ()
 
void AnalyseHists ()
 
void WriteHists ()
 
- Public Member Functions inherited from DedxCalib
 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
 
 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
 

Additional Inherited Members

- Protected Member Functions inherited from DedxCalib
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 ()
 
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 inherited from DedxCalib
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< string > m_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

Constructor & Destructor Documentation

◆ DedxCalibRunByRun() [1/2]

DedxCalibRunByRun::DedxCalibRunByRun ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 16 of file DedxCalibRunByRun.cxx.

◆ ~DedxCalibRunByRun() [1/2]

DedxCalibRunByRun::~DedxCalibRunByRun ( )
inline

◆ DedxCalibRunByRun() [2/2]

DedxCalibRunByRun::DedxCalibRunByRun ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~DedxCalibRunByRun() [2/2]

DedxCalibRunByRun::~DedxCalibRunByRun ( )
inline

Member Function Documentation

◆ AnalyseHists() [1/2]

void DedxCalibRunByRun::AnalyseHists ( )
virtual

Implements DedxCalib.

Definition at line 90 of file DedxCalibRunByRun.cxx.

91{
92 MsgStream log(msgSvc(), name());
93 log<<MSG::INFO<<"DedxCalibRunByRun::AnalyseHists()"<<endreq;
94
95 m_hist->Fit("gaus", "Q" );
96 for(int i=0; i<runNo; i++)
97 {
98 m_rungain[i]->Fit("gaus", "Q" );
99 }
100}
int runNo
Definition: DQA_TO_DB.cxx:12

◆ AnalyseHists() [2/2]

void DedxCalibRunByRun::AnalyseHists ( )
virtual

Implements DedxCalib.

◆ BookHists() [1/2]

void DedxCalibRunByRun::BookHists ( )
virtual

Implements DedxCalib.

Definition at line 19 of file DedxCalibRunByRun.cxx.

20{
21 MsgStream log(msgSvc(), name());
22 log<<MSG::INFO<<"DedxCalibRunByRun::BookHists()"<<endreq;
23
25 runNo = m_recFileVector.size();
26
27 m_hist = new TH1F("dEdx_allRun","dEdx_allRun",NumHistBins,MinHistValue1,MaxHistValue1);
28 m_hist->GetXaxis()->SetTitle("dE/dx");
29 m_hist->GetYaxis()->SetTitle("entries");
30 m_rungain = new TH1F*[runNo];
31 stringstream hlabel;
32 for(int i=0; i<runNo; i++)
33 {
34 hlabel.str("");
35 hlabel<<"dEdx_Run_"<<i;
36 m_rungain[i] = new TH1F(hlabel.str().c_str(), hlabel.str().c_str(),NumHistBins,MinHistValue1,MaxHistValue1);
37 }
38}
void ReadRecFileList()
Definition: DedxCalib.cxx:89

◆ BookHists() [2/2]

void DedxCalibRunByRun::BookHists ( )
virtual

Implements DedxCalib.

◆ FillHists() [1/2]

void DedxCalibRunByRun::FillHists ( )
virtual

Implements DedxCalib.

Definition at line 40 of file DedxCalibRunByRun.cxx.

41{
42 MsgStream log(msgSvc(), name());
43 log<<MSG::INFO<<"DedxCalibRunByRun::FillHists()"<<endreq;
44
45 TFile* f;
46 TTree* n103;
47 string runlist;
48
49 int ndedxhit=0;
50 double dEdx[100]={0},pathlength[100]={0},wid[100]={0},layid[100]={0},dd_in[100]={0},eangle[100]={0},zhit[100]={0};
51 double dedx=0;
52 float runNO=0,runFlag=0,costheta=0,tes=0;
53 vector<double> phlist;
54 for(int i=0; i<runNo; i++)
55 {
56 runlist = m_recFileVector[i];
57 f = new TFile(runlist.c_str());
58 n103 = (TTree*)f->Get("n103");
59 n103-> SetBranchAddress("ndedxhit", &ndedxhit);
60 n103-> SetBranchAddress("dEdx_hit",dEdx);
61 n103-> SetBranchAddress("pathlength_hit",pathlength);
62 n103-> SetBranchAddress("wid_hit",wid);
63 n103-> SetBranchAddress("layid_hit",layid);
64 n103-> SetBranchAddress("dd_in_hit",dd_in);
65 n103-> SetBranchAddress("eangle_hit",eangle);
66 n103-> SetBranchAddress("zhit_hit",zhit);
67 n103-> SetBranchAddress("runNO",&runNO);
68 n103-> SetBranchAddress("runFlag",&runFlag);
69 n103-> SetBranchAddress("costheta",&costheta);
70 n103-> SetBranchAddress("t0",&tes);
71 for(int j=0;j<n103->GetEntries();j++)
72 {
73 phlist.clear();
74 n103->GetEntry(j);
75 for(int k=0;k<ndedxhit;k++)
76 {
77 dEdx[k] = exsvc->StandardHitCorrec(0,runFlag,2,runNO,pathlength[k],wid[k],layid[k],dEdx[k],dd_in[k],eangle[k],costheta);
78 phlist.push_back(dEdx[k]);
79 }
80 dedx = cal_dedx_bitrunc(truncate, phlist);
81 dedx = exsvc->StandardTrackCorrec(0, runFlag, 2, runNO, dedx, costheta, tes);
82 m_rungain[i]->Fill(dedx);
83 m_hist->Fill(dedx);
84 }
85 cout<<"runNO = "<<runNO<<endl;
86 m_runNOVector.push_back(runNO);
87 }
88}
data SetBranchAddress("time",&time)
double cal_dedx_bitrunc(float truncate, std::vector< double > phlist)
Definition: DedxCalib.cxx:108
virtual double StandardHitCorrec(int calib_rec_Flag, int runFlag, int ntpFlag, int runNO, double pathl, int wid, int layid, double adc, double dd, double eangle, double costheta) const =0
virtual double StandardTrackCorrec(int calib_rec_Flag, int typFlag, int ntpFlag, int runNO, double ex, double costheta, double t0) const =0

◆ FillHists() [2/2]

void DedxCalibRunByRun::FillHists ( )
virtual

Implements DedxCalib.

◆ genNtuple() [1/2]

void DedxCalibRunByRun::genNtuple ( )
inlinevirtual

◆ genNtuple() [2/2]

void DedxCalibRunByRun::genNtuple ( )
inlinevirtual

◆ initializing() [1/2]

void DedxCalibRunByRun::initializing ( )
inlinevirtual

◆ initializing() [2/2]

void DedxCalibRunByRun::initializing ( )
inlinevirtual

◆ WriteHists() [1/2]

void DedxCalibRunByRun::WriteHists ( )
virtual

Implements DedxCalib.

Definition at line 102 of file DedxCalibRunByRun.cxx.

103{
104 MsgStream log(msgSvc(), name());
105 log<<MSG::INFO<<"DedxCalibRunByRun::WriteHists()"<<endreq;
106
107 TFile* f = new TFile(m_rootfile.c_str(), "recreate");
108
109 Double_t gainpar=0, resolpar=0;
110 gainpar = m_hist -> GetFunction("gaus") -> GetParameter(1);
111 resolpar = m_hist -> GetFunction("gaus") -> GetParameter(2);
112
113 TTree* gain = new TTree("gaincalib", "gaincalib");
114 gain -> Branch("gain", &gainpar, "gain[1]/D");
115 gain->Fill();
116 TTree* resol = new TTree("resolcalib", "resolcalib");
117 resol -> Branch("resol", &resolpar, "resol[1]/D");
118 resol->Fill();
119
120 Int_t runno=0;
121 Double_t runmean=0, rungain=0, runresol=0;
122 TTree* runbyrun = new TTree("runcalib", "runcalib");
123 runbyrun -> Branch("runno", &runno, "runno/I");
124 runbyrun -> Branch("runmean", &runmean, "runmean/D");
125 runbyrun -> Branch("rungain", &rungain, "rungain/D");
126 runbyrun -> Branch("runresol", &runresol, "runresol/D");
127 for(int i=0; i<runNo; i++)
128 {
129 runno = m_runNOVector[i];
130 runmean = m_rungain[i] -> GetFunction("gaus") -> GetParameter(1);
131 runresol = m_rungain[i] -> GetFunction("gaus") -> GetParameter(2);
132 rungain = runmean/NormalMean;
133 cout<<"i = "<<i<<" runno = "<<runno <<" @ runmean = "<<runmean<<" @ rungain = "<<rungain<<" @ runresol = "<<runresol<<endl;
134 runbyrun -> Fill();
135 }
136
137 m_hist->Write();
138 for(int i=0; i<runNo; i++) m_rungain[i]->Write();
139 gain->Write();
140 resol -> Write();
141 runbyrun -> Write();
142
143 delete m_hist;
144 for(int i=0; i<runNo; i++) delete m_rungain[i];
145 delete gain;
146 delete resol;
147 delete runbyrun;
148 f->Close();
149}

◆ WriteHists() [2/2]

void DedxCalibRunByRun::WriteHists ( )
virtual

Implements DedxCalib.


The documentation for this class was generated from the following files: