BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EventFilter Class Reference

#include <EventFilter.h>

Inheritance diagram for EventFilter:

Public Member Functions

 EventFilter (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~EventFilter ()
StatusCode initialize ()
StatusCode execute ()
void print (HltInf *)

Static Public Member Functions

static const std::string & getName ()
static long unsigned getNEvt ()
static long unsigned getNPass ()
static bool getResult ()

Detailed Description

Definition at line 8 of file EventFilter.h.

Constructor & Destructor Documentation

◆ EventFilter()

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

Definition at line 19 of file EventFilter.cxx.

20 : Algorithm( name, pSvcLocator ) {
21
22 declareProperty( "useTrigger", m_trgFlag = true );
23 declareProperty( "OutputLevel", m_outputLevel = MSG::NIL );
24 declareProperty( "OpenedChannels", m_chn );
25 declareProperty( "Example", m_example = false );
26}

Referenced by EventFilter().

◆ ~EventFilter()

EventFilter::~EventFilter ( )
virtual

Definition at line 28 of file EventFilter.cxx.

28{}

Member Function Documentation

◆ execute()

StatusCode EventFilter::execute ( )

Definition at line 43 of file EventFilter.cxx.

43 {
44
45 MsgStream log( msgSvc(), name() );
46
47 uint32_t run = 0, event = 0;
48 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
49 if ( !eventHeader )
50 {
51 log << MSG::FATAL << "Could not find Event Header" << endmsg;
52 return ( StatusCode::FAILURE );
53 }
54 run = eventHeader->runNumber();
55 event = eventHeader->eventNumber();
56 log << MSG::INFO << "execute() RunNo=" << run << ", EventNo=" << event << endmsg;
57
58 m_nTotalEvent++;
59
60 m_efResult = false;
61 setFilterPassed( false );
62 m_type = "RefuseByEF";
63
64 if ( m_trgFlag )
65 {
66 SmartDataPtr<TrigData> trg( eventSvc(), "/Event/Trig/TrigData" );
67 if ( !trg ) { log << MSG::WARNING << "Could not find Event TrigData" << endmsg; }
68 else
69 {
70 bool pass = false;
71 for ( int i = 0; i < 16; i++ )
72 {
73 if ( trg->getTrigChannel( i ) ) pass = true;
74 }
75 if ( !pass )
76 {
77 m_efResult = false;
78 m_type = "RefuseByTrg";
79 return ( StatusCode::SUCCESS );
80 }
81 }
82 }
83
84 DstHltInf* aHlt;
85 SmartDataPtr<HltInf> hlt( eventSvc(), "/Event/Hlt/HltInf" );
86 if ( !hlt )
87 {
88 log << MSG::WARNING << "Could not find Event HltInf (try DstHltInf now)" << endmsg;
89 SmartDataPtr<DstHltInf> hltDst( eventSvc(), "/Event/Hlt/DstHltInf" );
90 if ( !hltDst )
91 {
92 log << MSG::FATAL << "Could not find Event DstHltInf too ( please re-generate data)"
93 << endmsg;
94 return ( StatusCode::FAILURE );
95 // return( StatusCode::SUCCESS);
96 }
97 else { aHlt = hltDst; }
98 }
99 else aHlt = hlt;
100
101 std::vector<std::string>::iterator it = m_chn.begin();
102 m_type = aHlt->getEventName();
103 if ( aHlt->getEventType() == 0 ) { log << MSG::WARNING << m_type << endmsg; }
104 if ( log.level() <= MSG::VERBOSE ) aHlt->print();
105
106 for ( ; it != m_chn.end(); it++ )
107 {
108 if ( aHlt->isType( *it ) )
109 {
110 m_efResult = true;
111 setFilterPassed( true );
112 m_npass++;
113 log << MSG::INFO << "this event is passed" << endmsg;
114 break;
115 }
116 }
117 log << MSG::INFO << "this event is a " << m_type << endmsg;
118
119 if ( m_example && !hlt )
120 {
121 cout << "****** Example for getting event filter informatiom ******" << endl;
122 cout << "****** Please refer to the code in EventFilter.cxx ******" << endl;
123 print( hlt );
124 }
125
126 return ( StatusCode::SUCCESS );
127}
IMessageSvc * msgSvc()
bool isType(string &type) const
Definition DstHltInf.cxx:67
const string & getEventName() const
Definition DstHltInf.cxx:59
void print(HltInf *)

◆ getName()

const std::string & EventFilter::getName ( )
inlinestatic

Definition at line 16 of file EventFilter.h.

16{ return m_type; };

Referenced by EFTest::execute().

◆ getNEvt()

long unsigned EventFilter::getNEvt ( )
inlinestatic

Definition at line 17 of file EventFilter.h.

17{ return m_nTotalEvent; };

Referenced by EFTest::finalize().

◆ getNPass()

long unsigned EventFilter::getNPass ( )
inlinestatic

Definition at line 18 of file EventFilter.h.

18{ return m_npass; };

Referenced by EFTest::finalize().

◆ getResult()

bool EventFilter::getResult ( )
inlinestatic

Definition at line 19 of file EventFilter.h.

19{ return m_efResult; };

Referenced by EFTest::execute().

◆ initialize()

StatusCode EventFilter::initialize ( )

Definition at line 30 of file EventFilter.cxx.

30 {
31
32 MsgStream log( msgSvc(), name() );
33 log << MSG::INFO << "in initialize()" << endmsg;
34
35 m_nTotalEvent = 0;
36 m_npass = 0;
37 m_efResult = false;
38 m_type = "RefuseByEF";
39
40 return StatusCode::SUCCESS;
41}

◆ print()

void EventFilter::print ( HltInf * ahlt)

Definition at line 129 of file EventFilter.cxx.

129 {
130 int nmdc, ntof, nemc, nmuc, ntrk, nshower;
131 float etot, e1, e2, cose1, cose2, p1, p2, acop, acole, acol;
132 if ( ahlt->getData( Identifier( HltID::NMDC ), (uint32_t*)&nmdc ) )
133 cout << "nmdc=" << nmdc << endl;
134 if ( ahlt->getData( Identifier( HltID::NTOF ), (uint32_t*)&ntof ) )
135 cout << "ntof=" << ntof << endl;
136 if ( ahlt->getData( Identifier( HltID::NEMC ), (uint32_t*)&nemc ) )
137 cout << "nemc=" << nemc << endl;
138 if ( ahlt->getData( Identifier( HltID::NMUC ), (uint32_t*)&nmuc ) )
139 cout << "nmuc=" << nmuc << endl;
140 if ( ahlt->getData( Identifier( HltID::NTRK ), (uint32_t*)&ntrk ) )
141 cout << "ntrk=" << ntrk << endl;
142 if ( ahlt->getData( Identifier( HltID::NSHW ), (uint32_t*)&nshower ) )
143 cout << "nshower=" << nshower << endl;
144 if ( ahlt->getData( Identifier( HltID::ETOT ), (uint32_t*)&etot ) )
145 cout << "etot=" << etot << endl;
146 if ( ahlt->getData( Identifier( HltID::EMAX1 ), (uint32_t*)&e1 ) )
147 cout << "e1=" << e1 << endl;
148 if ( ahlt->getData( Identifier( HltID::EMAX2 ), (uint32_t*)&e2 ) )
149 cout << "e2=" << e2 << endl;
150 if ( ahlt->getData( Identifier( HltID::ECOST1 ), (uint32_t*)&cose1 ) )
151 cout << "cose1=" << cose1 << endl;
152 if ( ahlt->getData( Identifier( HltID::ECOST2 ), (uint32_t*)&cose2 ) )
153 cout << "cose2=" << cose2 << endl;
154 if ( ahlt->getData( Identifier( HltID::PMAX1 ), (uint32_t*)&p1 ) )
155 cout << "p1=" << p1 << endl;
156 if ( ahlt->getData( Identifier( HltID::PMAX2 ), (uint32_t*)&p2 ) )
157 cout << "p2=" << p2 << endl;
158 if ( ahlt->getData( Identifier( HltID::EACOP ), (uint32_t*)&acop ) )
159 cout << "acop=" << acop << endl;
160 if ( ahlt->getData( Identifier( HltID::EACOL ), (uint32_t*)&acole ) )
161 cout << "acole=" << acole << endl;
162 if ( ahlt->getData( Identifier( HltID::ACOL ), (uint32_t*)&acol ) )
163 cout << "acol=" << acol << endl;
164 return;
165}
double p2[4]
double p1[4]
Double_t etot
Double_t e1
Double_t e2
virtual bool getData(const Identifier &, uint32_t *)
Definition HltInf.cxx:92

Referenced by execute().


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