41 base_class (name, svcloc){
43 declareProperty(
"Host" , host = std::string(
"bes3db2.ihep.ac.cn"));
44 declareProperty(
"DbName" , dbName = std::string(
"offlinedb"));
45 declareProperty(
"UserName" , userName = std::string(
"guest"));
46 declareProperty(
"Password" , password = std::string(
"guestpass"));
47 declareProperty(
"BossRelease",m_bossRelease = std::string(
"default"));
48 declareProperty(
"EmcSatuDeadEnPar",m_calPar=
"default");
49 declareProperty(
"EmcSatuDeadEnBossVer",m_bossVer=
"default");
132 std::string& CalParVer,
136 std::string BossRelease,
140 MsgStream log(
msgSvc(),
"EmcSatuDeadEnSvc" );
146 StatusCode sc=serviceLocator()->service(
"DatabaseSvc",
m_dbsvc,
true);
147 if (sc .isFailure() ) {
148 log << MSG::ERROR <<
" Unable to find DatabaseSvc " << endreq;
152 const char* bossRelease = BossRelease.c_str();
153 const char* dataType = DataType.c_str();
155 sprintf(stmt,
"select RunFrom,RunTo,SftVer,ParVer from CalVtxLumVer where BossRelease = '%s' and RunFrom <= %d and RunTo >= %d and DataType='%s' ",bossRelease,run_No,run_No,dataType);
156 log << MSG::DEBUG <<
"stmt="<<stmt<<endreq;
161 log << MSG::ERROR <<
"error searching with:"<<stmt<<endreq;
166 runfrm=records1->
GetInt(
"RunFrom");
167 runto=records1->
GetInt(
"RunTo");
168 log << MSG::DEBUG <<dataType<<
" runfrm,runto in getSftParVer is:"<<runfrm<<
"::::"<<runto<<endreq;
172 log << MSG::DEBUG <<
"stmt="<<stmt<<
"\t"<<
SftVer<<
"\t"<<CalParVer<<endreq;
175 log << MSG::ERROR <<
"ERROR: "<<dataType<<
" set overlapped run number in the table CalVtxLumVer"<<endreq;
178 return StatusCode::SUCCESS;
182 MsgStream log(messageService(), name());
183 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,
"/Event/EventHeader");
184 int run = eventHeader->runNumber();
185 log << MSG::DEBUG <<
"Run in getEmcSatuDeadEnSvcInfo() is: "<<run<<endreq;
195 log << MSG::DEBUG <<
"This data is the MC sample with the Run Number: " << run << endreq;
203 if(m_bossRelease==
"default")
205 log << MSG::FATAL <<
" Boss Release for EmcSatuDeadEnSvc not set!" << endreq;
211 cType=
"EmcSatuDeadEn";
213 st1=
getSftParVer(m_bossVer,m_calPar,runfrm1,runto1,run,m_bossRelease,cType);
215 sprintf(stmt1,
"select RunFrom,RunTo,EmcSatuEn,EmcDeadEn from EmcSatuDeadEn where SftVer = '%s' and RunFrom <= %d and RunTo >= %d ", m_bossVer.c_str(), run, run);
224 m_SatuEnFile = dbrec.
GetString(
"EmcSatuEn");
225 m_DeadEnFile = dbrec.
GetString(
"EmcDeadEn");
226 m_RunFrom = dbrec.
GetInt(
"RunFrom");
227 m_RunTo = dbrec.
GetInt(
"RunTo");
229 log << MSG::DEBUG <<
"BossReleaseVer="<<m_bossRelease.c_str()<<
"\t"<<
"EmcSatuDeadEnBossVer="<<m_bossVer.c_str()<<endreq;
230 log << MSG::DEBUG <<
"m_SatuEnFile is:"<<m_SatuEnFile<<endreq;
231 log << MSG::DEBUG <<
"m_DeadEnFile is:"<<m_DeadEnFile<<endreq;
232 log << MSG::DEBUG <<
"m_RunFrom is:"<<m_RunFrom<<endreq;
233 log << MSG::DEBUG <<
"m_RunTo is:"<<m_RunTo<<endreq;
234 log << MSG::DEBUG <<
"Successfully fetch EmcSatuDeadEnSvc information for run: " << run << endreq;
238 }
else if( row_no<=0 ) {
239 cout <<
" EmcSatuDeadEnSvc:: can not found EmcSatuDeadEnSvc information of run:"
240 << run <<
", boss version " << m_bossRelease << endl;
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)
StatusCode getSftParVer(std::string &SftVer, std::string &CalParVer, int &runfrm, int &runto, int RunNo, std::string BossRelease, std::string DataType)