120 MsgStream log(messageService(), name());
121 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,
"/Event/EventHeader");
122 int run = eventHeader->runNumber();
124 log << MSG::INFO <<
"This data is the MC sample with the Run Number: " << run << endreq;
127 log << MSG::INFO <<
"Reverse the sign of Run Number" << endreq;
137 if(m_sftver ==
"default" && m_bossRelease ==
"default")
139 log << MSG::FATAL <<
" BossRelease and BossVer for DedxCurve not set!" << endreq;
143 if( (run<m_runFromMax || run>m_runToMin) )
145 if(m_sftver ==
"default")
147 sprintf(stmt1,
"select RunFrom, RunTo, SftVer, ParVer from CalVtxLumVer where BossRelease = '%s' and RunFrom <= %d and RunTo >= %d and DataType = 'DedxCurve'", m_bossRelease.c_str(), run, run);
148 std::cout<<stmt1<<std::endl;
150 int row_no = m_dbsvc->
query(
"offlinedb",stmt1,rest);
152 log << MSG::FATAL <<
"can not find result for DedxCur with: " << stmt1 << endreq;
156 log << MSG::FATAL <<
"find more than 1 results for DedxCur with: " << stmt1 << endreq;
161 m_calParVer = recordst->
GetString(
"ParVer");
162 m_runFromMax = atoi((recordst->
GetString(
"RunFrom")).c_str());
163 m_runToMin = atoi((recordst->
GetString(
"RunTo")).c_str());
164 log << MSG::INFO <<
"get from CalVtxLumVer, m_runFromMax: "<< m_runFromMax <<
" m_runToMin: "<<m_runToMin<< endreq;
169 if(m_calParVer!=
"default")
170 sprintf(stmt1,
"select RunFrom, RunTo, DedxCurvePar,DedxSigmaPar, SftVer, CurveFileName from DedxCurvePar where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and DedxCurveParVer = %s and Status='%s'",sftver.c_str(),run,run,m_calParVer.c_str(), m_dbStatus.c_str());
172 sprintf(stmt1,
"select RunFrom, RunTo, DedxCurvePar,DedxSigmaPar, SftVer, CurveFileName from DedxCurvePar where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and Status='%s' order by DedxCurveParVer desc",sftver.c_str(),run,run, m_dbStatus.c_str());
173 std::cout<<stmt1<<std::endl;
176 int row_no = m_dbsvc->
query(
"offlinedb", stmt1, res);
178 log << MSG::FATAL <<
"can not find result for DedxCur with: "<< stmt1 << endreq;
182 log << MSG::FATAL <<
"find more than 1 results for DedxCur with: "<< stmt1 << endreq;
187 int runFrom = atoi((records->
GetString(
"RunFrom")).c_str());
188 int runTo = atoi((records->
GetString(
"RunTo")).c_str());
189 std::cout <<
"before output DedxCurveService version" << endl;
190 std::cout<<
" SftVer is " << records->
GetString(
"SftVer")
192 <<
" File name is "<<records->
GetString(
"CurveFileName")
194 std::cout <<
"after output DedxCurveService version" << endl;
196 if(m_sftver==
"default")
198 m_runFromMax = runFrom>m_runFromMax? runFrom:m_runFromMax;
199 m_runToMin = runTo<m_runToMin? runTo:m_runToMin;
203 m_runFromMax = runFrom;
206 log << MSG::INFO <<
"get from DedxCurvePar runFrom: "<< runFrom <<
" runTo: "<<runTo<< endreq;
207 log << MSG::INFO <<
"m_runFromMax: "<< m_runFromMax <<
" m_runToMin: "<<m_runToMin<< endreq;
209 TBuffer *buf1 =
new TBufferFile(TBuffer::kRead);
210 buf1->SetBuffer((*records)[
"DedxCurvePar"],327680,kFALSE);
211 TBuffer *buf2 =
new TBufferFile(TBuffer::kRead);
212 buf2->SetBuffer((*records)[
"DedxSigmaPar"],327680,kFALSE);
215 TTree* curvetree =
new TTree();
216 curvetree->Streamer(*buf1);
218 TTree* sigmatree =
new TTree();
219 sigmatree->Streamer(*buf2);
230 Int_t nentries_curve = (Int_t)curvetree ->GetEntries();
231 Int_t nentries_sigma = (Int_t)sigmatree ->GetEntries();
234 log << MSG::ERROR<<
"CurveSize larger than designed number"<<endreq;
242 log << MSG::ERROR<<
"SigmaSize larger than designed number"<<endreq;
245 m_sigma[i]=
sigma[i];}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)