1#include "GaudiKernel/MsgStream.h"
21 MsgStream log(
msgSvc(), name());
22 log<<MSG::INFO<<
"DedxCalibRunByRun::BookHists()"<<endreq;
28 m_hist->GetXaxis()->SetTitle(
"dE/dx");
29 m_hist->GetYaxis()->SetTitle(
"entries");
30 m_rungain =
new TH1F*[
runNo];
32 for(
int i=0; i<
runNo; i++)
35 hlabel<<
"dEdx_Run_"<<i;
42 MsgStream log(
msgSvc(), name());
43 log<<MSG::INFO<<
"DedxCalibRunByRun::FillHists()"<<endreq;
50 double dEdx[100]={0},pathlength[100]={0},wid[100]={0},layid[100]={0},dd_in[100]={0},eangle[100]={0},zhit[100]={0};
52 float runNO=0,runFlag=0,costheta=0,tes=0;
53 vector<double> phlist;
54 for(
int i=0; i<
runNo; i++)
57 f =
new TFile(runlist.c_str());
58 n103 = (TTree*)f->Get(
"n103");
71 for(
int j=0;j<n103->GetEntries();j++)
75 for(
int k=0;k<ndedxhit;k++)
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]);
82 m_rungain[i]->Fill(dedx);
85 cout<<
"runNO = "<<runNO<<endl;
86 m_runNOVector.push_back(runNO);
92 MsgStream log(
msgSvc(), name());
93 log<<MSG::INFO<<
"DedxCalibRunByRun::AnalyseHists()"<<endreq;
95 m_hist->Fit(
"gaus",
"Q" );
96 for(
int i=0; i<
runNo; i++)
98 m_rungain[i]->Fit(
"gaus",
"Q" );
104 MsgStream log(
msgSvc(), name());
105 log<<MSG::INFO<<
"DedxCalibRunByRun::WriteHists()"<<endreq;
107 TFile* f =
new TFile(
m_rootfile.c_str(),
"recreate");
109 Double_t gainpar=0, resolpar=0;
110 gainpar = m_hist -> GetFunction(
"gaus") -> GetParameter(1);
111 resolpar = m_hist -> GetFunction(
"gaus") -> GetParameter(2);
113 TTree* gain =
new TTree(
"gaincalib",
"gaincalib");
114 gain -> Branch(
"gain", &gainpar,
"gain[1]/D");
116 TTree* resol =
new TTree(
"resolcalib",
"resolcalib");
117 resol -> Branch(
"resol", &resolpar,
"resol[1]/D");
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++)
129 runno = m_runNOVector[i];
130 runmean = m_rungain[i] -> GetFunction(
"gaus") -> GetParameter(1);
131 runresol = m_rungain[i] -> GetFunction(
"gaus") -> GetParameter(2);
133 cout<<
"i = "<<i<<
" runno = "<<runno <<
" @ runmean = "<<runmean<<
" @ rungain = "<<rungain<<
" @ runresol = "<<runresol<<endl;
138 for(
int i=0; i<
runNo; i++) m_rungain[i]->Write();
144 for(
int i=0; i<
runNo; i++)
delete m_rungain[i];
data SetBranchAddress("time",&time)
DedxCalibRunByRun(const std::string &name, ISvcLocator *pSvcLocator)
double cal_dedx_bitrunc(float truncate, std::vector< double > phlist)
vector< string > m_recFileVector
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