242 {
243 MsgStream log( messageService(), name() );
244 log << MSG::DEBUG << "In getCaliConst" << endreq;
245
247
248 StatusCode sc;
249
250
251 if(m_ifReadBunch == true) {
252 std::vector<std::string> sbunch;
253 std::vector<double> bunchInfo;
254 ConnectionProvider::eRet e = m_connect->
getReadBunchInfo(sbunch,
runNo,m_SftVer,m_ParVer,m_bossRelease);
255 if(e == 7 ) {
256 bool last = true;
257 for(int id = 1; true; id++) {
259 last = true;
260 if(e == 7) {
263 last = false;
264 }
265 }
266 if(e == 0) {
267 if(last ==
true) log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo+
id <<
" instead of run " <<
runNo << endreq;
268 if(last ==
false) log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo-
id <<
" instead of run " <<
runNo << endreq;
269 break;
270 }
271 }
272 }
273 if(e != 0 && e != 7) {
274 log << MSG::ERROR << "Could not find Bunch infor., exit." << endreq;
275 exit(1);
276 }
277 for(unsigned int i = 0; i < sbunch.size(); i++)
278 {
279 bunchInfo.push_back(atof(sbunch[i].
c_str()));
280 }
281 sbunch.clear();
282
283 if(bunchInfo.size() == 6)
284 {
285
286 m_bunch_x = 10*bunchInfo[0];
287 m_bunch_y = 10*bunchInfo[1];
288 m_bunch_z = 10*bunchInfo[2];
289 m_sigma_x = 10*bunchInfo[3];
290 m_sigma_y = 10*bunchInfo[4];
291 m_sigma_z = 10*bunchInfo[5];
292 log << MSG::INFO <<
"BunchPosX: " << m_bunch_x <<
" BunchPosY: " << m_bunch_y <<
" BunchPosZ: " << m_bunch_z <<
" in Run " <<
runNo << endreq;
293 log << MSG::INFO <<
"BunchSigmaX: " << m_sigma_x <<
" BunchSigmaY: " << m_sigma_y <<
" BunchSigmaZ: " << m_sigma_z <<
" in Run " <<
runNo << endreq;
294 }
295 else {
296 log << MSG::ERROR << "Please check the bunch information, the size is " << bunchInfo.size() << endreq;
297 }
298 bunchInfo.clear();
299 }
300
301
302 if(m_ifReadTrg == true) {
303 m_trgTable.clear();
304 std::vector<std::string> strgTable;
306 if(e != 0 ) {
307 log << MSG::ERROR << "Could not find TrgTable infor., exit." << endreq;
308 exit(1);
309 }
310 for(unsigned int i = 0; i < strgTable.size(); i++)
311 {
312 long long value = 0;
313 for (unsigned int j = 0; j < (strgTable[i]).length(); j++)
314 {
315 value = value*10 + (strgTable[i][j] - '0');
316 }
317 m_trgTable.push_back(uint32_t(value));
318 }
319 strgTable.clear();
320 if(m_trgTable.size() != 65) log << MSG::ERROR << "Please check the TrgTable information, the size is " << m_trgTable.size() << endreq;
321
322 std::vector<double> vtrgGain;
324 if(e != 0 ) {
325 log << MSG::ERROR << "Could not find emc gain infor., exit." << endreq;
326 exit(1);
327 }
328 for(unsigned int i = 0; i < vtrgGain.size(); i++) {
329 m_trgGain[i] = vtrgGain[i];
330 }
331
332
334 if(e != 0 ) {
335 log << MSG::ERROR << "Could not find Trigger config infor., exit." << endreq;
336 exit(1);
337 }
349 }
350
351
352 if(m_ifReadRandTrg == true) {
353 std::vector<std::string> fileInfor;
355 if(e == 7 ) {
356 bool last = true;
357 for(int id = 1; true; id++) {
359 last = true;
360 if(e == 7) {
363 last = false;
364 }
365 }
366 if(e == 0) {
367 if(last ==
true) log << MSG::INFO <<
"Use Bg files of run " <<
runNo+
id <<
" instead of run " <<
runNo << endreq;
368 if(last ==
false) log << MSG::INFO <<
"Use Bg files of run " <<
runNo-
id <<
" instead of run " <<
runNo << endreq;
369 break;
370 }
371 }
372 }
373 if(e != 0 && e != 7) {
374 log << MSG::ERROR << "Could not find background infor., exit." << endreq;
375 exit(1);
376 }
377 m_bgfilename.clear();
378 for(unsigned int i = 0; i < fileInfor.size(); i+=2)
379 {
380 m_bgfilename.push_back(fileInfor[i]+"/"+fileInfor[i+1]);
381 }
382 fileInfor.clear();
383 for(unsigned int i = 0; i < m_bgfilename.size(); i++) {
384 log << MSG::INFO <<
"Background file name: " << m_bgfilename[i] <<
" in run " <<
runNo << endreq;
385 }
386
387
388 std::string srunTime;
389 std::string stau_value;
390 e = m_connect->
getLumCurvePar(srunTime, stau_value,
runNo, m_SftVer, m_ParVer, m_bossRelease);
391 if(e != 0 ) {
392 log << MSG::ERROR << "Could not find Luminosity curve parameters, exit." << endreq;
393 exit(1);
394 }
395 m_runTotalTime = std::atof(srunTime.c_str());
396 m_tauValue = std::atof(stau_value.c_str());
397 log << MSG::INFO <<
"Total time is " << m_runTotalTime <<
", tau is " << m_tauValue <<
" in run " <<
runNo <<
". " << endreq;
398 }
399
400
401 if(m_ifReadTFEE == true) {
402 m_tfee.clear();
404 if(e != 0 ) {
405 log << MSG::ERROR << "Could not find TFEE infor., exit." << endreq;
406 exit(1);
407 }
408
409 for(unsigned int i = 0; i < m_tfee.size(); i++) {
410 log << MSG::INFO << "TFEE ----> " << m_tfee[i] << endreq;
411 }
412 }
413
414
415 if(m_ifReadRunInfo == true) {
416 m_runInfo.clear();
417 std::vector<std::string> srunInfo;
419 if(e != 0 ) {
420 log << MSG::ERROR << "Could not find run infor., exit." << endreq;
421 exit(1);
422 }
423 for(unsigned int i = 0; i < srunInfo.size(); i++)
424 {
425 m_runInfo.push_back(atof(srunInfo[i].
c_str()));
426 }
427 srunInfo.clear();
428
429 for(unsigned int i = 0; i < m_runInfo.size(); i++) {
430 log << MSG::INFO << "runInfo ----> " << m_runInfo[i] << endreq;
431 }
432 }
433
434}
ConnectionProvider::eRet getRunInfo(std::vector< std::string > &runInfo, int runNo)
ConnectionProvider::eRet getReadBunchInfo(std::vector< std::string > &bunch, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease)
ConnectionProvider::eRet getLumCurvePar(std::string &runTotalTime, std::string &tau_value, int runNo, std::string SftVer, std::string ParVer, std::string BossRelease)
ConnectionProvider::eRet getTrgConfigInfo(int runNo)
ConnectionProvider::eRet getEmcGain(std::vector< double > &emcGain, int runNo)
ConnectionProvider::eRet getReadTrgTableInfo(std::vector< std::string > &trgTable, int runNo)
ConnectionProvider::eRet getReadTofThreshInfo(std::vector< std::string > &tofThresh, int runNo)