BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
OfflineEvtFilterAlg Class Reference

#include <OfflineEvtFilterAlg.h>

+ Inheritance diagram for OfflineEvtFilterAlg:

Public Member Functions

 OfflineEvtFilterAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor.
 
virtual ~OfflineEvtFilterAlg ()
 Destructor.
 
virtual StatusCode initialize ()
 Algorithm initialization.
 
virtual StatusCode execute ()
 Algorithm execution.
 
virtual StatusCode finalize ()
 Algorithm finalization.
 

Detailed Description

Definition at line 9 of file OfflineEvtFilterAlg.h.

Constructor & Destructor Documentation

◆ OfflineEvtFilterAlg()

OfflineEvtFilterAlg::OfflineEvtFilterAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard constructor.

Definition at line 24 of file OfflineEvtFilterAlg.cxx.

26: GaudiAlgorithm ( name , pSvcLocator )
27{
28}

◆ ~OfflineEvtFilterAlg()

OfflineEvtFilterAlg::~OfflineEvtFilterAlg ( )
virtual

Destructor.

Definition at line 32 of file OfflineEvtFilterAlg.cxx.

32{}

Member Function Documentation

◆ execute()

StatusCode OfflineEvtFilterAlg::execute ( )
virtual

Algorithm execution.

filter with ets-ist

filter with ets

Definition at line 58 of file OfflineEvtFilterAlg.cxx.

58 {
59
60 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
61
62 // whether to keep this event for further reconstruction
63 bool keep = true;
64 int npar = m_evtFilterSvc->getNpar();
65
66 int iPar = 0;
67 /// filter with ets-ist
68 if ( eventHeader->etsFlag() != 21 ) {
69 double dtEts = (long(eventHeader->etsT1()) - long(eventHeader->etsT2())) / double(2000.); //in ms
70 for ( ; iPar < npar && m_evtFilterSvc->getFlag(iPar) == 0; ++iPar ) {
71 if ( dtEts < m_evtFilterSvc->getTBegin(iPar) ) {
72 //keep = true by default
73 break;
74 }
75 else if ( dtEts < m_evtFilterSvc->getTEnd(iPar) ) {
76 keep = false;
77 break;
78 }
79 }
80 }
81 /// filter with ets
82 if ( keep && iPar < npar ) {
83 double tEts = eventHeader->etsT1() / double(2000000.); //in second
84 for ( ; iPar < npar; ++iPar ) {
85 if ( m_evtFilterSvc->getFlag(iPar) == 0 ) {
86 continue;
87 }
88 if ( tEts < m_evtFilterSvc->getTBegin(iPar) ) {
89 //keep = true by default
90 break;
91 }
92 else if ( tEts < m_evtFilterSvc->getTEnd(iPar) ) {
93 keep = false;
94 break;
95 }
96 }
97 }
98
99 if ( keep ) {
100 // this is a good event, nothing to do
101 return StatusCode::SUCCESS;
102 }
103
104 // Otherwise, this is a bad event ...
105 // We register empty data objects without any hits to the Gaudi EDS
106
107 {
108 DigiEvent *digi = new DigiEvent();
109 digi->initialize(false); //not from MC
110 m_dataSvc->registerObject(EventModel::Digi::Event, digi);
111 }
112
113 {
114 DstEvent* dst = new DstEvent();
115 m_dataSvc->registerObject(EventModel::Dst::Event, dst);
116 }
117
118 {
119 TrigEvent * trig = new TrigEvent();
120 trig->initialize(false); //not from MC
121 m_dataSvc->registerObject(EventModel::Trig::Event, trig);
122 TrigData* trigData = new TrigData();
123 m_dataSvc->registerObject(EventModel::Trig::TrigData, trigData);
124 }
125
126 {
127 EvtRecObject* evtRecObject = new EvtRecObject();
128 m_dataSvc->registerObject(EventModel::EvtRec::Event, evtRecObject);
129 }
130
131 {
132 HltEvent * hlt = new HltEvent();
133 hlt->initialize(false); //not from MC
134 m_dataSvc->registerObject(EventModel::Hlt::Event, hlt);
135 DstHltInf* dstHltInf = new DstHltInf();
136 m_dataSvc->registerObject(EventModel::Hlt::DstHltInf, dstHltInf);
137 }
138
139 {
140 ReconEvent * recon = new ReconEvent();
141 m_dataSvc->registerObject(EventModel::Recon::Event, recon);
142 }
143
144 debug() << "event " << eventHeader->eventNumber() << " is passed" << endmsg;
145 m_incidentSvc->fireIncident(Incident(name(), IncidentType::AbortEvent));
146
147 return StatusCode::SUCCESS;
148}
void initialize(bool fromMc)
Definition: DigiEvent.h:30
void initialize(bool fromMc)
Definition: HltEvent.h:13
virtual int getFlag(unsigned int parId) const =0
virtual int getNpar() const =0
void initialize(bool fromMc)
Definition: TrigEvent.h:13
_EXTERN_ std::string Event
Definition: EventModel.h:56
_EXTERN_ std::string Event
Definition: EventModel.h:128
_EXTERN_ std::string Event
Definition: EventModel.h:115
_EXTERN_ std::string Event
Definition: EventModel.h:72
_EXTERN_ std::string DstHltInf
Definition: EventModel.h:75
_EXTERN_ std::string Event
Definition: EventModel.h:84
_EXTERN_ std::string TrigData
Definition: EventModel.h:68
_EXTERN_ std::string Event
Definition: EventModel.h:66

◆ finalize()

StatusCode OfflineEvtFilterAlg::finalize ( )
virtual

Algorithm finalization.

Definition at line 153 of file OfflineEvtFilterAlg.cxx.

153 {
154
155 debug() << "==> Finalize" << endmsg;
156
157 return GaudiAlgorithm::finalize(); // must be called after all other actions
158}

◆ initialize()

StatusCode OfflineEvtFilterAlg::initialize ( )
virtual

Algorithm initialization.

Definition at line 37 of file OfflineEvtFilterAlg.cxx.

37 {
38 StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
39 if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
40
41 debug() << "==> Initialize" << endmsg;
42
43 sc = service("OfflineEvtFilterSvc", m_evtFilterSvc);
44 if ( sc != StatusCode::SUCCESS ) {
45 fatal() << "can not use OfflineEvtFilterSvc" << endreq;
46 return sc;
47 }
48
49 m_dataSvc = eventSvc();
50 m_incidentSvc = svc<IIncidentSvc>("IncidentSvc",true);
51
52 return StatusCode::SUCCESS;
53}
@ fatal
Definition: Core.h:24

The documentation for this class was generated from the following files: