284 {
285 MsgStream log(
msgSvc(), name() );
286 log << MSG::DEBUG << "In getCaliConst" << endmsg;
287
288 using RealDBUtil::ConnectionProvider;
289
290 StatusCode sc;
291
292
293 if ( m_ifReadBunch == true )
294 {
295 std::vector<std::string> sbunch;
296 std::vector<double> bunchInfo;
297 ConnectionProvider::eRet e =
298 m_connect->getReadBunchInfo( sbunch,
runNo, m_SftVer, m_ParVer, m_bossRelease );
299 if ( e == 7 )
300 {
301 bool last = true;
302 for ( int id = 1; true; id++ )
303 {
304 e = m_connect->getReadBunchInfo( sbunch,
runNo +
id, m_SftVer, m_ParVer,
305 m_bossRelease );
306 last = true;
307 if ( e == 7 )
308 {
309 if ( (
runNo -
id ) > 0 )
310 {
311 e = m_connect->getReadBunchInfo( sbunch,
runNo -
id, m_SftVer, m_ParVer,
312 m_bossRelease );
313 last = false;
314 }
315 }
316 if ( e == 0 )
317 {
318 if ( last == true )
319 log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo +
id <<
" instead of run "
321 if ( last == false )
322 log << MSG::INFO <<
"Use Bunch infor. of run " <<
runNo -
id <<
" instead of run "
324 break;
325 }
326 }
327 }
328 if ( e != 0 && e != 7 )
329 {
330 log << MSG::ERROR << "Could not find Bunch infor., exit." << endmsg;
331 exit( 1 );
332 }
333 for ( unsigned int i = 0; i < sbunch.size(); i++ )
334 { bunchInfo.push_back( atof( sbunch[i].
c_str() ) ); }
335 sbunch.clear();
336
337 if ( bunchInfo.size() == 6 )
338 {
339
340 m_bunch_x = 10 * bunchInfo[0];
341 m_bunch_y = 10 * bunchInfo[1];
342 m_bunch_z = 10 * bunchInfo[2];
343 m_sigma_x = 10 * bunchInfo[3];
344 m_sigma_y = 10 * bunchInfo[4];
345 m_sigma_z = 10 * bunchInfo[5];
346 log << MSG::INFO << "BunchPosX: " << m_bunch_x << " BunchPosY: " << m_bunch_y
347 <<
" BunchPosZ: " << m_bunch_z <<
" in Run " <<
runNo << endmsg;
348 log << MSG::INFO << "BunchSigmaX: " << m_sigma_x << " BunchSigmaY: " << m_sigma_y
349 <<
" BunchSigmaZ: " << m_sigma_z <<
" in Run " <<
runNo << endmsg;
350 }
351 else
352 {
353 log << MSG::ERROR << "Please check the bunch information, the size is "
354 << bunchInfo.size() << endmsg;
355 }
356 bunchInfo.clear();
357 }
358
359
360 if ( m_ifReadTrg == true )
361 {
362 m_trgTable.clear();
363 std::vector<std::string> strgTable;
364 ConnectionProvider::eRet e = m_connect->getReadTrgTableInfo( strgTable,
runNo );
365 if ( e != 0 )
366 {
367 log << MSG::ERROR << "Could not find TrgTable infor., exit." << endmsg;
368 exit( 1 );
369 }
370 for ( unsigned int i = 0; i < strgTable.size(); i++ )
371 {
372 long long value = 0;
373 for ( unsigned int j = 0; j < ( strgTable[i] ).length(); j++ )
374 { value = value * 10 + ( strgTable[i][j] - '0' ); }
375 m_trgTable.push_back( uint32_t( value ) );
376 }
377 strgTable.clear();
378 if ( m_trgTable.size() != 65 )
379 log << MSG::ERROR << "Please check the TrgTable information, the size is "
380 << m_trgTable.size() << endmsg;
381
382 std::vector<double> vtrgGain;
383 e = m_connect->getEmcGain( vtrgGain,
runNo );
384 if ( e != 0 )
385 {
386 log << MSG::ERROR << "Could not find emc gain infor., exit." << endmsg;
387 exit( 1 );
388 }
389 for ( unsigned int i = 0; i < vtrgGain.size(); i++ ) { m_trgGain[i] = vtrgGain[i]; }
390
391
392 e = m_connect->getTrgConfigInfo(
runNo );
393 if ( e != 0 )
394 {
395 log << MSG::ERROR << "Could not find Trigger config infor., exit." << endmsg;
396 exit( 1 );
397 }
398 m_EtotDataSteps = m_connect->getEtotDataSteps();
399 m_VthBEtotH = m_connect->getVthBEtotH();
400 m_VthEEtotH = m_connect->getVthEEtotH();
401 m_VthEtotL = m_connect->getVthEtotL();
402 m_VthEtotM = m_connect->getVthEtotM();
403 m_VthBLZ = m_connect->getVthBLZ();
404 m_VthDiffB = m_connect->getVthDiffB();
405 m_VthDiffE = m_connect->getVthDiffE();
406 m_VthBalBLK = m_connect->getVthBalBLK();
407 m_VthBalEEMC = m_connect->getVthBalEEMC();
408 m_VthDiffMin = m_connect->getVthDiffMin();
409 }
410
411
412 if ( m_ifReadRandTrg == true )
413 {
414 std::vector<std::string> fileInfor;
415 ConnectionProvider::eRet e = m_connect->getReadBackgroundInfo( fileInfor,
runNo );
416 if ( e == 7 )
417 {
418 bool last = true;
419 for ( int id = 1; true; id++ )
420 {
421 e = m_connect->getReadBackgroundInfo( fileInfor,
runNo +
id );
422 last = true;
423 if ( e == 7 )
424 {
425 if ( (
runNo -
id ) > 0 )
426 {
427 e = m_connect->getReadBackgroundInfo( fileInfor,
runNo -
id );
428 last = false;
429 }
430 }
431 if ( e == 0 )
432 {
433 if ( last == true )
434 log << MSG::INFO <<
"Use Bg files of run " <<
runNo +
id <<
" instead of run "
436 if ( last == false )
437 log << MSG::INFO <<
"Use Bg files of run " <<
runNo -
id <<
" instead of run "
439 break;
440 }
441 }
442 }
443 if ( e != 0 && e != 7 )
444 {
445 log << MSG::ERROR << "Could not find background infor., exit." << endmsg;
446 exit( 1 );
447 }
448 m_bgfilename.clear();
449 for ( unsigned int i = 0; i < fileInfor.size(); i += 2 )
450 { m_bgfilename.push_back( fileInfor[i] + "/" + fileInfor[i + 1] ); }
451 fileInfor.clear();
452 for ( unsigned int i = 0; i < m_bgfilename.size(); i++ )
453 {
454 log << MSG::INFO <<
"Background file name: " << m_bgfilename[i] <<
" in run " <<
runNo
455 << endmsg;
456 }
457
458
459 std::string srunTime;
460 std::string stau_value;
461 e = m_connect->getLumCurvePar( srunTime, stau_value,
runNo, m_SftVer, m_ParVer,
462 m_bossRelease );
463 if ( e != 0 )
464 {
465 log << MSG::ERROR << "Could not find Luminosity curve parameters, exit." << endmsg;
466 exit( 1 );
467 }
468 m_runTotalTime = std::atof( srunTime.c_str() );
469 m_tauValue = std::atof( stau_value.c_str() );
470 log << MSG::INFO << "Total time is " << m_runTotalTime << ", tau is " << m_tauValue
471 <<
" in run " <<
runNo <<
". " << endmsg;
472 }
473
474
475 if ( m_ifReadTFEE == true )
476 {
477 m_tfee.clear();
478 ConnectionProvider::eRet e = m_connect->getReadTofThreshInfo( m_tfee,
runNo );
479 if ( e != 0 )
480 {
481 log << MSG::ERROR << "Could not find TFEE infor., exit." << endmsg;
482 exit( 1 );
483 }
484
485 for ( unsigned int i = 0; i < m_tfee.size(); i++ )
486 { log << MSG::INFO << "TFEE ----> " << m_tfee[i] << endmsg; }
487 }
488
489
490 if ( m_ifReadRunInfo == true )
491 {
492 m_runInfo.clear();
493 std::vector<std::string> srunInfo;
494 ConnectionProvider::eRet e = m_connect->getRunInfo( srunInfo,
runNo );
495 if ( e != 0 )
496 {
497 log << MSG::ERROR << "Could not find run infor., exit." << endmsg;
498 exit( 1 );
499 }
500 for ( unsigned int i = 0; i < srunInfo.size(); i++ )
501 { m_runInfo.push_back( atof( srunInfo[i].
c_str() ) ); }
502 srunInfo.clear();
503
504 for ( unsigned int i = 0; i < m_runInfo.size(); i++ )
505 { log << MSG::INFO << "runInfo ----> " << m_runInfo[i] << endmsg; }
506 }
507}