164 {
165 MsgStream log(messageService(), name());
166 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
167 int run = eventHeader->runNumber();
168
169
170 char stmt1[400];
171 StatusCode st1;
172
173 int runfrm,runfrm1;
174 int runto,runto1;
176
177 if(run<0) {
178 cout << "This data is the MC sample with the Run Number: " << run << endl;
179 run = -run;
180 }
181
182 if(m_bossRelease=="default") m_bossRelease = getenv("BES_RELEASE");
183 if(m_isData=="default")
184 {
185 cout<<"Please set the type of TofEnergy"<<endl;
186 exit(1);
187 }
188 if(m_isData=="Data") cType="TofEnergyData";
189 if(m_isData=="MC") cType="TofEnergyMC";
190 st1=
getSftParVer(m_bossVer,m_calPar,runfrm1,runto1,run,m_bossRelease,cType);
191 if(cType=="TofEnergyData"){
192 sprintf(stmt1,
"select CalibConst,Para1,Para2,Para3,Para4,Para5 from TofEnergyCalib where BossVer = '%s' and RunFrom <= %d and RunTo >= %d and isData = '%s'", m_bossVer.c_str(), run, run, m_isData.c_str());}
193 else if(cType=="TofEnergyMC"){
194 sprintf(stmt1,
"select CalibConst,Para1,Para2,Para3,Para4,Para5 from TofEnergySim where BossVer = '%s' and RunFrom <= %d and RunTo >= %d and isData = '%s'", m_bossVer.c_str(), run, run, m_isData.c_str());}
195
198 if( row_no > 0 ) {
200 m_CalibConst = dbrec.
GetDouble(
"CalibConst");
206 cout<<stmt1<<endl;
207 cout<<"BossReleaseVer="<<m_bossRelease.c_str()<<"\t"<<"TofEnergyBossVer="<<m_bossVer.c_str()<<endl;
208 cout<<"m_CalibConst is:"<<m_CalibConst<<endl;
209 cout<<"Para1="<<m_Para1<<"\t"
210 <<"Para2="<<m_Para2<<"\t"
211 <<"Para3="<<m_Para3<<"\t"
212 <<"Para4="<<m_Para4<<"\t"
213 <<"Para5="<<m_Para5<<endl;
214 cout << "Successfully fetch TofEnergyCalibSvc information for run: "
215 << run << endl;
216 return true;
217 } else if( row_no<=0 ) {
218 cout << " TofEnergyCalibSvc:: can not found TofEnergyCalibSvc information of run:"
219 << run << ", boss version " << m_bossRelease << endl;
220 exit(1);
221 return false;
222 }
223 return true;
224}
double GetDouble(std::string key)
StatusCode getSftParVer(std::string &SftVer, std::string &CalParVer, int &runfrm, int &runto, int RunNo, std::string BossRelease, std::string DataType)