3#include "GaudiKernel/Bootstrap.h"
4#include "GaudiKernel/DataSvc.h"
5#include "GaudiKernel/IIncidentSvc.h"
6#include "GaudiKernel/IInterface.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/Incident.h"
9#include "GaudiKernel/Kernel.h"
10#include "GaudiKernel/MsgStream.h"
11#include "GaudiKernel/SmartDataPtr.h"
12#include "GaudiKernel/StatusCode.h"
14#include "CalibData/CalibModel.h"
15#include "CalibData/Ets/InjSigTimeCal.h"
16#include "EventModel/EventHeader.h"
25 : base_class( name, svcloc ) {}
30 MsgStream log(
msgSvc(), name() );
31 log << MSG::INFO <<
"InjSigTimeSvc::initialize()" << endmsg;
33 StatusCode sc = Service::initialize();
34 if ( sc.isFailure() )
return sc;
37 sc = service(
"IncidentSvc", incsvc );
39 if ( sc.isSuccess() ) { incsvc->addListener(
this,
"NewRun", priority ); }
41 sc = service(
"CalibDataSvc", m_pCalDataSvc,
true );
42 if ( sc == StatusCode::SUCCESS )
43 { log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endmsg; }
44 else { log << MSG::FATAL <<
"can not get IDataProviderSvc" << endmsg; }
46 return StatusCode::SUCCESS;
50 MsgStream log(
msgSvc(), name() );
51 log << MSG::INFO <<
"InjSigTimeSvc::finalize()" << endmsg;
57 return StatusCode::SUCCESS;
61 MsgStream log(
msgSvc(), name() );
62 log << MSG::DEBUG <<
"handle: " << inc.type() << endmsg;
64 if ( inc.type() ==
"NewRun" )
66 log << MSG::DEBUG <<
"NewRun" << endmsg;
68 if ( !initCalibConst() )
69 { log << MSG::ERROR <<
"can not initilize InjSigTime Constants" << endmsg; }
73bool InjSigTimeSvc::initCalibConst() {
74 MsgStream log(
msgSvc(), name() );
75 log << MSG::INFO <<
"read calib const from TCDS" << endmsg;
77 IDataProviderSvc* eventSvc = NULL;
78 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc );
79 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc,
"/Event/EventHeader" );
82 log << MSG::FATAL <<
"Could not find Event Header" << endmsg;
91 string fullPath =
"/Calib/InjSigTime";
92 SmartDataPtr<CalibData::InjSigTimeCal> calConst( m_pCalDataSvc, fullPath );
95 log << MSG::ERROR <<
"can not get InjSigTime via SmartPtr" << endmsg;
99 m_npar = calConst->getNpar();
100 for (
int i = 0; i < m_npar; i++ )
102 m_IST.push_back( calConst->getIST( i ) );
103 m_flag.push_back( calConst->getFlag( i ) );
DECLARE_COMPONENT(BesBdkRc)
virtual StatusCode finalize()
InjSigTimeSvc(const std::string &name, ISvcLocator *svcloc)
void handle(const Incident &)
virtual StatusCode initialize()