BOSS 7.1.2
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.

19 :
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
27}

◆ ~EventFilter()

EventFilter::~EventFilter ( )
virtual

Definition at line 29 of file EventFilter.cxx.

29 {
30}

Member Function Documentation

◆ execute()

StatusCode EventFilter::execute ( )

Definition at line 46 of file EventFilter.cxx.

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

◆ getName()

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

Definition at line 16 of file EventFilter.h.

16{ return m_type;};

Referenced by EFTest::execute().

◆ getNEvt()

static long unsigned EventFilter::getNEvt ( )
inlinestatic

Definition at line 17 of file EventFilter.h.

17{ return m_nTotalEvent;};

Referenced by EFTest::finalize().

◆ getNPass()

static long unsigned EventFilter::getNPass ( )
inlinestatic

Definition at line 18 of file EventFilter.h.

18{ return m_npass;};

Referenced by EFTest::finalize().

◆ getResult()

static 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 32 of file EventFilter.cxx.

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

◆ print()

void EventFilter::print ( HltInf * ahlt)

Definition at line 127 of file EventFilter.cxx.

127 {
128 int nmdc,ntof,nemc,nmuc,ntrk,nshower;
129 float etot,e1,e2,cose1,cose2,p1,p2,acop,acole,acol;
130 if(ahlt->getData(Identifier(HltID::NMDC),(uint32_t*)&nmdc)) cout<< "nmdc=" << nmdc <<endl;
131 if(ahlt->getData(Identifier(HltID::NTOF),(uint32_t*)&ntof)) cout<< "ntof=" << ntof <<endl;
132 if(ahlt->getData(Identifier(HltID::NEMC),(uint32_t*)&nemc)) cout<< "nemc=" << nemc <<endl;
133 if(ahlt->getData(Identifier(HltID::NMUC),(uint32_t*)&nmuc)) cout<< "nmuc=" << nmuc <<endl;
134 if(ahlt->getData(Identifier(HltID::NTRK),(uint32_t*)&ntrk)) cout<< "ntrk=" << ntrk <<endl;
135 if(ahlt->getData(Identifier(HltID::NSHW),(uint32_t*)&nshower)) cout<< "nshower=" << nshower <<endl;
136 if(ahlt->getData(Identifier(HltID::ETOT),(uint32_t*)&etot)) cout<< "etot=" << etot <<endl;
137 if(ahlt->getData(Identifier(HltID::EMAX1),(uint32_t*)&e1)) cout<< "e1=" << e1 <<endl;
138 if(ahlt->getData(Identifier(HltID::EMAX2),(uint32_t*)&e2)) cout<< "e2=" << e2 <<endl;
139 if(ahlt->getData(Identifier(HltID::ECOST1),(uint32_t*)&cose1)) cout<< "cose1=" << cose1 <<endl;
140 if(ahlt->getData(Identifier(HltID::ECOST2),(uint32_t*)&cose2)) cout<< "cose2=" << cose2 <<endl;
141 if(ahlt->getData(Identifier(HltID::PMAX1),(uint32_t*)&p1)) cout<< "p1=" << p1 <<endl;
142 if(ahlt->getData(Identifier(HltID::PMAX2),(uint32_t*)&p2)) cout<< "p2=" << p2 <<endl;
143 if(ahlt->getData(Identifier(HltID::EACOP),(uint32_t*)&acop)) cout<< "acop=" << acop <<endl;
144 if(ahlt->getData(Identifier(HltID::EACOL),(uint32_t*)&acole)) cout<< "acole=" << acole <<endl;
145 if(ahlt->getData(Identifier(HltID::ACOL),(uint32_t*)&acol)) cout<< "acol=" << acol <<endl;
146 return;
147}
double p1[4]
double p2[4]
Double_t etot
Double_t e1
Double_t e2
@ ECOST2
Definition HltID.h:26
@ EMAX2
Definition HltID.h:26
@ ECOST1
Definition HltID.h:26
@ NSHW
Definition HltID.h:25
@ EACOL
Definition HltID.h:26
@ NEMC
Definition HltID.h:25
@ ETOT
Definition HltID.h:25
@ EMAX1
Definition HltID.h:26
@ EACOP
Definition HltID.h:26
@ PMAX2
Definition HltID.h:23
@ PMAX1
Definition HltID.h:22
@ ACOL
Definition HltID.h:23
@ NMDC
Definition HltID.h:22
@ NTRK
Definition HltID.h:22
@ NTOF
Definition HltID.h:24
@ NMUC
Definition HltID.h:28
virtual bool getData(const Identifier &, uint32_t *)
Definition HltInf.cxx:80

Referenced by execute().


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