BOSS 7.0.5
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 *)
 
 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 ()
 
static const std::string & getName ()
 
static long unsigned getNEvt ()
 
static long unsigned getNPass ()
 
static bool getResult ()
 

Detailed Description

Constructor & Destructor Documentation

◆ EventFilter() [1/2]

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

Definition at line 18 of file EventFilter.cxx.

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

◆ ~EventFilter() [1/2]

EventFilter::~EventFilter ( )
virtual

Definition at line 28 of file EventFilter.cxx.

28 {
29}

◆ EventFilter() [2/2]

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

◆ ~EventFilter() [2/2]

virtual EventFilter::~EventFilter ( )
virtual

Member Function Documentation

◆ execute() [1/2]

StatusCode EventFilter::execute ( )

Definition at line 45 of file EventFilter.cxx.

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

◆ execute() [2/2]

StatusCode EventFilter::execute ( )

◆ getName() [1/2]

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

Definition at line 16 of file EventFilter/EventFilter-02-00-10/EventFilter/EventFilter.h.

16{ return m_type;};

Referenced by EFTest::execute().

◆ getName() [2/2]

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

Definition at line 16 of file InstallArea/include/EventFilter/EventFilter/EventFilter.h.

16{ return m_type;};

◆ getNEvt() [1/2]

static long unsigned EventFilter::getNEvt ( )
inlinestatic

Definition at line 17 of file EventFilter/EventFilter-02-00-10/EventFilter/EventFilter.h.

17{ return m_nTotalEvent;};

Referenced by EFTest::finalize().

◆ getNEvt() [2/2]

static long unsigned EventFilter::getNEvt ( )
inlinestatic

Definition at line 17 of file InstallArea/include/EventFilter/EventFilter/EventFilter.h.

17{ return m_nTotalEvent;};

◆ getNPass() [1/2]

static long unsigned EventFilter::getNPass ( )
inlinestatic

Definition at line 18 of file EventFilter/EventFilter-02-00-10/EventFilter/EventFilter.h.

18{ return m_npass;};

Referenced by EFTest::finalize().

◆ getNPass() [2/2]

static long unsigned EventFilter::getNPass ( )
inlinestatic

Definition at line 18 of file InstallArea/include/EventFilter/EventFilter/EventFilter.h.

18{ return m_npass;};

◆ getResult() [1/2]

static bool EventFilter::getResult ( )
inlinestatic

Definition at line 19 of file EventFilter/EventFilter-02-00-10/EventFilter/EventFilter.h.

19{return m_efResult;};

Referenced by EFTest::execute().

◆ getResult() [2/2]

static bool EventFilter::getResult ( )
inlinestatic

Definition at line 19 of file InstallArea/include/EventFilter/EventFilter/EventFilter.h.

19{return m_efResult;};

◆ initialize() [1/2]

StatusCode EventFilter::initialize ( )

Definition at line 31 of file EventFilter.cxx.

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

◆ initialize() [2/2]

StatusCode EventFilter::initialize ( )

◆ print() [1/2]

void EventFilter::print ( HltInf ahlt)

Definition at line 126 of file EventFilter.cxx.

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

Referenced by execute().

◆ print() [2/2]

void EventFilter::print ( HltInf )

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