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/InjSigIntervalCal.h"
16#include "EventModel/EventHeader.h"
26 : base_class( name, svcloc ) {}
40 MsgStream log(
msgSvc(), name() );
41 log << MSG::INFO <<
"InjSigIntervalSvc::initialize()" << endmsg;
43 StatusCode sc = Service::initialize();
44 if ( sc.isFailure() )
return sc;
47 sc = service(
"IncidentSvc", incsvc );
49 if ( sc.isSuccess() ) { incsvc->addListener(
this,
"NewRun", priority ); }
51 sc = service(
"CalibDataSvc", m_pCalDataSvc,
true );
52 if ( sc == StatusCode::SUCCESS )
53 { log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endmsg; }
54 else { log << MSG::FATAL <<
"can not get IDataProviderSvc" << endmsg; }
56 return StatusCode::SUCCESS;
60 MsgStream log(
msgSvc(), name() );
61 log << MSG::INFO <<
"InjSigIntervalSvc::finalize()" << endmsg;
63 return StatusCode::SUCCESS;
67 MsgStream log(
msgSvc(), name() );
68 log << MSG::DEBUG <<
"handle: " << inc.type() << endmsg;
70 if ( inc.type() ==
"NewRun" )
72 log << MSG::DEBUG <<
"NewRun" << endmsg;
74 if ( !initCalibConst() )
75 { log << MSG::ERROR <<
"can not initilize InjSigInterval Constants" << endmsg; }
79bool InjSigIntervalSvc::initCalibConst() {
80 MsgStream log(
msgSvc(), name() );
81 log << MSG::INFO <<
"read calib const from TCDS" << endmsg;
83 IDataProviderSvc* eventSvc = NULL;
84 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc );
85 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc,
"/Event/EventHeader" );
88 log << MSG::FATAL <<
"Could not find Event Header" << endmsg;
93 string fullPath =
"/Calib/InjSigInterval";
94 SmartDataPtr<CalibData::InjSigIntervalCal> calConst( m_pCalDataSvc, fullPath );
97 log << MSG::ERROR <<
"can not get InjSigInterval via SmartPtr" << endmsg;
101 m_tInterval = calConst->getTInterval();
DECLARE_COMPONENT(BesBdkRc)
InjSigIntervalSvc(const std::string &name, ISvcLocator *svcloc)
void handle(const Incident &)
virtual StatusCode finalize()
virtual StatusCode initialize()