2#include "GaudiKernel/Kernel.h"
3#include "GaudiKernel/IInterface.h"
4#include "GaudiKernel/StatusCode.h"
5#include "GaudiKernel/SvcFactory.h"
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/SmartDataPtr.h"
8#include "GaudiKernel/DataSvc.h"
10#include "GaudiKernel/IIncidentSvc.h"
11#include "GaudiKernel/Incident.h"
12#include "GaudiKernel/IIncidentListener.h"
15#include "CLHEP/Vector/ThreeVector.h"
29using CLHEP::Hep3Vector;
50 MsgStream log(messageService(), name());
51 log << MSG::INFO << name() <<
"DedxSimSvc::initialize()" << endreq;
53 StatusCode sc = Service::initialize();
54 if( sc.isFailure() )
return sc;
57 sc = service(
"IncidentSvc", incsvc);
60 incsvc -> addListener(
this,
"NewRun", priority);
62 sc = serviceLocator()->service(
"EventDataSvc", m_eventSvc,
true);
63 if (sc .isFailure() ) {
64 log << MSG::ERROR <<
"Unable to find EventDataSvc " << endreq;
74 m_dedx_hists =
nullptr;
76 return StatusCode::SUCCESS;
80 MsgStream log(messageService(), name());
81 log << MSG::INFO << name() <<
"DedxSimSvc::finalize()" << endreq;
82 return StatusCode::SUCCESS;
86 MsgStream log( messageService(), name() );
87 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
89 if ( inc.type() ==
"NewRun" ){
90 log << MSG::DEBUG <<
"New Run" << endreq;
91 SmartDataPtr<Event::EventHeader> evt(m_eventSvc,
"/Event/EventHeader");
94 runNo = evt -> runNumber();
95 log << MSG::DEBUG <<
"The runNumber of current event is "<<
runNo<<endreq;
98 log << MSG::ERROR <<
"ERROR accessing Event" <<endreq;
108DedxSimSvc::update_param_svc() {
109 MsgStream log(messageService(), name());
110 IDataProviderSvc* pCalibDataSvc;
111 StatusCode sc = service(
"CalibDataSvc", pCalibDataSvc,
true);
112 if ( !sc.isSuccess() ) {
114 <<
"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
119 <<
"Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"
123 std::string fullPath =
"/Calib/DedxSim";
125 m_calibDataSvc =
dynamic_cast<CalibDataSvc*
>(pCalibDataSvc);
126 SmartDataPtr<CalibData::DedxSimData> pDedxSimData(m_calibDataSvc, fullPath);
127 m_runfrom = pDedxSimData->getrunfrm();
128 m_runto = pDedxSimData->getrunto();
129 m_version = pDedxSimData->getVersion();
130 m_numDedxHists = pDedxSimData->gethistNo();
131 m_numBg = pDedxSimData->getRangeNo();
132 if (m_version == 0) m_numTheta = 10;
133 else m_numTheta = pDedxSimData->getThetaNo();
134 m_dedx_hists = pDedxSimData->getHist();
135 m_bgRange = pDedxSimData->getRange();
136 log << MSG::DEBUG <<
"DedxSimSvc::update_param_svc() finish" << endreq;
virtual StatusCode finalize()
virtual StatusCode initialize()
void handle(const Incident &)