BOSS 8.0.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 25 of file OfflineEvtFilterAlg.cxx.

26 : Algorithm( name, pSvcLocator ) {}

Referenced by OfflineEvtFilterAlg().

◆ ~OfflineEvtFilterAlg()

OfflineEvtFilterAlg::~OfflineEvtFilterAlg ( )
virtual

Destructor.

Definition at line 30 of file OfflineEvtFilterAlg.cxx.

30{}

Member Function Documentation

◆ execute()

StatusCode OfflineEvtFilterAlg::execute ( )
virtual

Algorithm execution.

filter with ets-ist

filter with ets

Definition at line 57 of file OfflineEvtFilterAlg.cxx.

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

◆ finalize()

StatusCode OfflineEvtFilterAlg::finalize ( )
virtual

Algorithm finalization.

Definition at line 160 of file OfflineEvtFilterAlg.cxx.

160 {
161
162 debug() << "==> Finalize" << endmsg;
163
164 return StatusCode::SUCCESS;
165 //GaudiAlgorithm::finalize(); // must be called after all other actions
166}

◆ initialize()

StatusCode OfflineEvtFilterAlg::initialize ( )
virtual

Algorithm initialization.

Definition at line 35 of file OfflineEvtFilterAlg.cxx.

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

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