14#include "GaudiKernel/AlgFactory.h"
15#include "GaudiKernel/Incident.h"
16#include "GaudiKernel/IIncidentSvc.h"
25 ISvcLocator* pSvcLocator)
26: GaudiAlgorithm ( name , pSvcLocator )
38 StatusCode sc = GaudiAlgorithm::initialize();
39 if ( sc.isFailure() )
return sc;
41 debug() <<
"==> Initialize" << endmsg;
43 sc = service(
"OfflineEvtFilterSvc", m_evtFilterSvc);
44 if ( sc != StatusCode::SUCCESS ) {
45 fatal() <<
"can not use OfflineEvtFilterSvc" << endreq;
49 m_dataSvc = eventSvc();
50 m_incidentSvc = svc<IIncidentSvc>(
"IncidentSvc",
true);
52 return StatusCode::SUCCESS;
60 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
64 int npar = m_evtFilterSvc->
getNpar();
68 if ( eventHeader->etsFlag() != 21 ) {
69 double dtEts = (long(eventHeader->etsT1()) - long(eventHeader->etsT2())) /
double(2000.);
70 for ( ; iPar < npar && m_evtFilterSvc->
getFlag(iPar) == 0; ++iPar ) {
71 if ( dtEts < m_evtFilterSvc->getTBegin(iPar) ) {
75 else if ( dtEts < m_evtFilterSvc->getTEnd(iPar) ) {
82 if ( keep && iPar < npar ) {
83 double tEts = eventHeader->etsT1() / double(2000000.);
84 for ( ; iPar < npar; ++iPar ) {
85 if ( m_evtFilterSvc->
getFlag(iPar) == 0 ) {
88 if ( tEts < m_evtFilterSvc->getTBegin(iPar) ) {
92 else if ( tEts < m_evtFilterSvc->getTEnd(iPar) ) {
101 return StatusCode::SUCCESS;
144 debug() <<
"event " << eventHeader->eventNumber() <<
" is passed" << endmsg;
145 m_incidentSvc->fireIncident(Incident(name(), IncidentType::AbortEvent));
147 return StatusCode::SUCCESS;
155 debug() <<
"==> Finalize" << endmsg;
157 return GaudiAlgorithm::finalize();
DECLARE_ALGORITHM_FACTORY(ReadRawData)
void initialize(bool fromMc)
void initialize(bool fromMc)
virtual int getFlag(unsigned int parId) const =0
virtual int getNpar() const =0
virtual StatusCode execute()
Algorithm execution.
virtual StatusCode initialize()
Algorithm initialization.
virtual StatusCode finalize()
Algorithm finalization.
virtual ~OfflineEvtFilterAlg()
Destructor.
void initialize(bool fromMc)
_EXTERN_ std::string Event
_EXTERN_ std::string Event
_EXTERN_ std::string Event
_EXTERN_ std::string Event
_EXTERN_ std::string DstHltInf
_EXTERN_ std::string Event
_EXTERN_ std::string TrigData
_EXTERN_ std::string Event