44 {
45 MsgStream log(
msgSvc(), name() );
46 log << MSG::INFO << "DedxCalibRunByRun::FillHists()" << endmsg;
47
49 TTree* n103;
50 string runlist;
51
52 int ndedxhit = 0;
53 double dEdx[100] = { 0 }, pathlength[100] = { 0 }, wid[100] = { 0 }, layid[100] = { 0 },
54 dd_in[100] = { 0 }, eangle[100] = { 0 }, zhit[100] = { 0 };
55 double dedx = 0;
56 float runNO = 0, evtNO = 0, runFlag = 0, costheta = 0, tes = 0;
57 vector<double> phlist;
58 for (
int i = 0; i <
runNo; i++ )
59 {
61 f =
new TFile( runlist.c_str() );
62 n103 = (TTree*)
f->Get(
"n103" );
63 n103->SetBranchAddress( "ndedxhit", &ndedxhit );
64 n103->SetBranchAddress( "dEdx_hit", dEdx );
65 n103->SetBranchAddress( "pathlength_hit", pathlength );
66 n103->SetBranchAddress( "wid_hit", wid );
67 n103->SetBranchAddress( "layid_hit", layid );
68 n103->SetBranchAddress( "dd_in_hit", dd_in );
69 n103->SetBranchAddress( "eangle_hit", eangle );
70 n103->SetBranchAddress( "zhit_hit", zhit );
71 n103->SetBranchAddress( "runNO", &runNO );
72 n103->SetBranchAddress( "evtNO", &evtNO );
73 n103->SetBranchAddress( "runFlag", &runFlag );
74 n103->SetBranchAddress( "costheta", &costheta );
75 n103->SetBranchAddress( "t0", &tes );
76 int m( 0 );
77 int index( 0 );
78 float evtfrom( 0 );
79 struct runevt m_runevt;
80 for ( int j = 0; j < n103->GetEntries(); j++ )
81 {
82 phlist.clear();
83 n103->GetEntry( j );
84 for ( int k = 0; k < ndedxhit; k++ )
85 {
86 dEdx[k] =
exsvc->StandardHitCorrec( 0, runFlag, 2, runNO, evtNO, pathlength[k], wid[k],
87 layid[k], dEdx[k], dd_in[k], eangle[k], costheta );
88 phlist.push_back( dEdx[k] );
89 }
91 dedx =
exsvc->StandardTrackCorrec( 0, runFlag, 2, runNO, evtNO, dedx, costheta, tes );
93 m_hist->Fill( dedx );
94 m++;
96 {
97 m_runevt.runno = runNO;
98 m_runevt.evtfrom = evtfrom;
99 m_runevt.evtto = evtNO;
101 m_runevt.local_index = index;
102 m_evtNOVector.push_back( m_runevt );
103 evtfrom = evtNO + 1;
104 index++;
105 m = 0;
106 }
108 {
109 log << MSG::FATAL << "DedxCalibRunByRun: Too many events in a run!!!" << endmsg;
110 break;
111 }
112 }
113 if ( index ) m_evtNOVector.pop_back();
114 else
115 {
116 m_runevt.runno = runNO;
117 m_runevt.evtfrom = 0;
119 m_runevt.local_index = 0;
120 }
122 m_evtNOVector.push_back( m_runevt );
123 cout << "runNO = " << m_runevt.runno << endl;
124 }
125}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
double cal_dedx_bitrunc(float truncate, std::vector< double > phlist)