3#include "GaudiKernel/Kernel.h"
4#include "GaudiKernel/IInterface.h"
5#include "GaudiKernel/StatusCode.h"
6#include "GaudiKernel/SvcFactory.h"
7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/IIncidentSvc.h"
9#include "GaudiKernel/Incident.h"
10#include "GaudiKernel/ISvcLocator.h"
11#include "GaudiKernel/Bootstrap.h"
12#include "GaudiKernel/SmartDataPtr.h"
13#include "GaudiKernel/DataSvc.h"
26 base_class (name, svcloc) {
42 MsgStream log(messageService(), name());
43 log << MSG::INFO <<
"InjSigTimeSvc::initialize()" << endreq;
45 StatusCode sc = Service::initialize();
46 if( sc.isFailure() )
return sc;
49 sc = service(
"IncidentSvc", incsvc);
52 incsvc -> addListener(
this,
"NewRun", priority);
55 sc = service(
"CalibDataSvc", m_pCalDataSvc,
true);
56 if( sc == StatusCode::SUCCESS ){
57 log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endreq;
59 log << MSG::FATAL <<
"can not get IDataProviderSvc" << endreq;
62 return StatusCode::SUCCESS;
66 MsgStream log(messageService(), name());
67 log << MSG::INFO <<
"InjSigTimeSvc::finalize()" << endreq;
73 return StatusCode::SUCCESS;
77 MsgStream log( messageService(), name() );
78 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
80 if ( inc.type() ==
"NewRun" ){
81 log << MSG::DEBUG <<
"NewRun" << endreq;
83 if( ! initCalibConst() ){
85 <<
"can not initilize InjSigTime Constants" << endreq;
91bool InjSigTimeSvc::initCalibConst(){
92 MsgStream log(messageService(), name());
93 log << MSG::INFO <<
"read calib const from TCDS" << endreq;
95 IDataProviderSvc* eventSvc =
NULL;
96 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
97 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,
"/Event/EventHeader");
99 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
100 return( StatusCode::FAILURE);
108 string fullPath =
"/Calib/InjSigTime";
109 SmartDataPtr<CalibData::InjSigTimeCal> calConst(m_pCalDataSvc, fullPath);
111 log << MSG::ERROR <<
"can not get InjSigTime via SmartPtr"
116 m_npar = calConst->getNpar();
117 for(
int i=0; i<m_npar; i++){
118 m_IST.push_back(calConst->getIST(i));
119 m_flag.push_back(calConst->getFlag(i));
virtual StatusCode finalize()
void handle(const Incident &)
virtual StatusCode initialize()