EventFilter Class Reference

#include <EventFilter.h>

List of all members.

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::stringgetName ()
static long unsigned getNEvt ()
static long unsigned getNPass ()
static bool getResult ()

Private Attributes

bool m_trgFlag
int m_outputLevel
std::vector< std::stringm_chn
bool m_example

Static Private Attributes

static std::string m_type
static long unsigned m_nTotalEvent = 0
static long unsigned m_npass = 0
static bool m_efResult = false


Detailed Description

Definition at line 8 of file EventFilter.h.


Constructor & Destructor Documentation

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

Definition at line 18 of file EventFilter.cxx.

References m_chn, m_example, m_outputLevel, and m_trgFlag.

00018                                                                         :
00019   Algorithm(name, pSvcLocator) {
00020 
00021   declareProperty("useTrigger",     m_trgFlag =true);
00022   declareProperty("OutputLevel",    m_outputLevel = MSG::NIL);
00023   declareProperty("OpenedChannels", m_chn );
00024   declareProperty("Example",        m_example = false);
00025 
00026 }

EventFilter::~EventFilter (  )  [virtual]

Definition at line 28 of file EventFilter.cxx.

00028                          {
00029 }


Member Function Documentation

StatusCode EventFilter::execute (  ) 

Definition at line 45 of file EventFilter.cxx.

References Bes_Common::FATAL, DstHltInf::getEventName(), DstHltInf::getEventType(), genRecEmupikp::i, Bes_Common::INFO, DstHltInf::isType(), m_chn, m_efResult, m_example, m_npass, m_nTotalEvent, m_trgFlag, m_type, msgSvc(), print(), DstHltInf::print(), VERBOSE, and Bes_Common::WARNING.

00045                                 {
00046   
00047   MsgStream log(msgSvc(), name());
00048 
00049   uint32_t run=0,event=0;
00050   SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
00051   if (!eventHeader) {
00052     log << MSG::FATAL << "Could not find Event Header" << endreq;
00053     return( StatusCode::FAILURE);
00054   }
00055   run=eventHeader->runNumber();
00056   event=eventHeader->eventNumber();
00057   log << MSG::INFO << "execute()  RunNo=" << run << ",  EventNo=" << event << endreq;
00058 
00059   m_nTotalEvent++;
00060 
00061   m_efResult = false;
00062   setFilterPassed(false);
00063   m_type  = "RefuseByEF";
00064 
00065   if(m_trgFlag){
00066     SmartDataPtr<TrigData> trg(eventSvc(),"/Event/Trig/TrigData");
00067     if(!trg) {
00068       log << MSG::WARNING << "Could not find Event TrigData" << endreq;
00069     }
00070     else {
00071       bool pass=false;
00072       for(int i=0;i<16;i++){
00073         if(trg->getTrigChannel(i))  pass=true;
00074       }
00075       if(!pass) {
00076         m_efResult = false;
00077         m_type = "RefuseByTrg";
00078         return( StatusCode::SUCCESS);
00079       }
00080     }
00081   }
00082 
00083   DstHltInf* aHlt;
00084   SmartDataPtr<HltInf> hlt(eventSvc(),"/Event/Hlt/HltInf");
00085   if(!hlt) {
00086     log << MSG::WARNING << "Could not find Event HltInf (try DstHltInf now)" << endreq;
00087     SmartDataPtr<DstHltInf> hltDst(eventSvc(),"/Event/Hlt/DstHltInf");
00088     if(!hltDst){
00089       log << MSG::FATAL << "Could not find Event DstHltInf too ( please re-generate data)" << endreq;
00090       return( StatusCode::FAILURE);
00091       //return( StatusCode::SUCCESS);
00092     }
00093     else{
00094       aHlt=hltDst;
00095     }
00096   }
00097   else aHlt=hlt;
00098 
00099   std::vector<std::string>::iterator it=m_chn.begin();
00100   m_type = aHlt->getEventName();
00101   if(aHlt->getEventType()==0) {
00102     log << MSG::WARNING << m_type << endreq;
00103   }
00104   if(log.level()<=MSG::VERBOSE) aHlt->print();
00105 
00106   for(;it!=m_chn.end();it++){
00107     if(aHlt->isType(*it)) {
00108       m_efResult=true;
00109       setFilterPassed(true);
00110       m_npass++;
00111       log << MSG::INFO << "this event is passed" << endreq;
00112       break;
00113     }
00114   }  
00115   log << MSG::INFO << "this event is a " << m_type <<endreq;
00116 
00117   if(m_example&&!hlt) {
00118     cout<< "****** Example for getting event filter informatiom ******" << endl;
00119     cout<< "****** Please refer to the code in EventFilter.cxx  ******" << endl;
00120     print(hlt);
00121   }
00122 
00123   return ( StatusCode::SUCCESS);
00124 }

static const std::string& EventFilter::getName (  )  [inline, static]

Definition at line 16 of file EventFilter.h.

References m_type.

Referenced by EFTest::execute().

00016 { return m_type;};

static long unsigned EventFilter::getNEvt (  )  [inline, static]

Definition at line 17 of file EventFilter.h.

References m_nTotalEvent.

Referenced by EFTest::finalize().

00017 { return m_nTotalEvent;};

static long unsigned EventFilter::getNPass (  )  [inline, static]

Definition at line 18 of file EventFilter.h.

References m_npass.

Referenced by EFTest::finalize().

00018 { return m_npass;};

static bool EventFilter::getResult (  )  [inline, static]

Definition at line 19 of file EventFilter.h.

References m_efResult.

Referenced by EFTest::execute().

00019 {return m_efResult;}; 

StatusCode EventFilter::initialize (  ) 

Definition at line 31 of file EventFilter.cxx.

References Bes_Common::INFO, m_efResult, m_npass, m_nTotalEvent, m_type, and msgSvc().

00031                                   {
00032 
00033   MsgStream log(msgSvc(), name());
00034   log << MSG::INFO << "in initialize()" << endreq;
00035 
00036   m_nTotalEvent =0;
00037   m_npass =0;
00038   m_efResult = false;
00039   m_type  = "RefuseByEF";
00040 
00041   return StatusCode::SUCCESS;
00042 }

void EventFilter::print ( HltInf  ) 

Definition at line 126 of file EventFilter.cxx.

References HltID::ACOL, HltID::EACOL, HltID::EACOP, HltID::ECOST1, HltID::ECOST2, HltID::EMAX1, HltID::EMAX2, HltID::ETOT, HltInf::getData(), HltID::NEMC, HltID::NMDC, HltID::NMUC, HltID::NSHW, HltID::NTOF, HltID::NTRK, HltID::PMAX1, and HltID::PMAX2.

Referenced by execute().

00126                                    {
00127   int nmdc,ntof,nemc,nmuc,ntrk,nshower;
00128   float etot,e1,e2,cose1,cose2,p1,p2,acop,acole,acol;
00129   if(ahlt->getData(Identifier(HltID::NMDC),(uint32_t*)&nmdc)) cout<< "nmdc=" << nmdc <<endl;
00130   if(ahlt->getData(Identifier(HltID::NTOF),(uint32_t*)&ntof)) cout<< "ntof=" << ntof <<endl;
00131   if(ahlt->getData(Identifier(HltID::NEMC),(uint32_t*)&nemc)) cout<< "nemc=" << nemc <<endl;
00132   if(ahlt->getData(Identifier(HltID::NMUC),(uint32_t*)&nmuc)) cout<< "nmuc=" << nmuc <<endl;
00133   if(ahlt->getData(Identifier(HltID::NTRK),(uint32_t*)&ntrk)) cout<< "ntrk=" << ntrk <<endl;
00134   if(ahlt->getData(Identifier(HltID::NSHW),(uint32_t*)&nshower)) cout<< "nshower=" << nshower <<endl;
00135   if(ahlt->getData(Identifier(HltID::ETOT),(uint32_t*)&etot)) cout<< "etot=" << etot <<endl;
00136   if(ahlt->getData(Identifier(HltID::EMAX1),(uint32_t*)&e1)) cout<< "e1=" << e1 <<endl;
00137   if(ahlt->getData(Identifier(HltID::EMAX2),(uint32_t*)&e2)) cout<< "e2=" << e2 <<endl;
00138   if(ahlt->getData(Identifier(HltID::ECOST1),(uint32_t*)&cose1)) cout<< "cose1=" << cose1 <<endl;
00139   if(ahlt->getData(Identifier(HltID::ECOST2),(uint32_t*)&cose2)) cout<< "cose2=" << cose2 <<endl;
00140   if(ahlt->getData(Identifier(HltID::PMAX1),(uint32_t*)&p1)) cout<< "p1=" << p1 <<endl;
00141   if(ahlt->getData(Identifier(HltID::PMAX2),(uint32_t*)&p2)) cout<< "p2=" << p2 <<endl;
00142   if(ahlt->getData(Identifier(HltID::EACOP),(uint32_t*)&acop)) cout<< "acop=" << acop <<endl;
00143   if(ahlt->getData(Identifier(HltID::EACOL),(uint32_t*)&acole)) cout<< "acole=" << acole <<endl;
00144   if(ahlt->getData(Identifier(HltID::ACOL),(uint32_t*)&acol)) cout<< "acol=" << acol <<endl;
00145   return;
00146 }


Member Data Documentation

std::vector<std::string> EventFilter::m_chn [private]

Definition at line 31 of file EventFilter.h.

Referenced by EventFilter(), and execute().

bool EventFilter::m_efResult = false [static, private]

Definition at line 27 of file EventFilter.h.

Referenced by execute(), getResult(), and initialize().

bool EventFilter::m_example [private]

Definition at line 32 of file EventFilter.h.

Referenced by EventFilter(), and execute().

long unsigned EventFilter::m_npass = 0 [static, private]

Definition at line 26 of file EventFilter.h.

Referenced by execute(), getNPass(), and initialize().

long unsigned EventFilter::m_nTotalEvent = 0 [static, private]

Definition at line 25 of file EventFilter.h.

Referenced by execute(), getNEvt(), and initialize().

int EventFilter::m_outputLevel [private]

Definition at line 30 of file EventFilter.h.

Referenced by EventFilter().

bool EventFilter::m_trgFlag [private]

Definition at line 29 of file EventFilter.h.

Referenced by EventFilter(), and execute().

std::string EventFilter::m_type [static, private]

Definition at line 24 of file EventFilter.h.

Referenced by execute(), getName(), and initialize().


Generated on Tue Nov 29 23:18:49 2016 for BOSS_7.0.2 by  doxygen 1.4.7