#include <HltEventMaker.h>
Public Member Functions | |
HltEventMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
uint32_t | m_ntot |
Definition at line 6 of file HltEventMaker.h.
HltEventMaker::HltEventMaker | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 20 of file HltEventMaker.cxx.
00020 : Algorithm(name, pSvcLocator) 00021 { 00022 //Declare the properties 00023 }
StatusCode HltEventMaker::execute | ( | ) |
Definition at line 33 of file HltEventMaker.cxx.
References Bes_Common::DEBUG, Bes_Common::FATAL, EventModel::Hlt::HltInf, Bes_Common::INFO, HltID::is_algorithm(), HltID::is_con_inf(), HltID::is_criteria(), HltID::is_emc_inf(), HltID::is_energy(), HltID::is_eventtype(), HltID::is_mdc_inf(), HltID::is_muc_inf(), HltID::is_ncon(), HltID::is_number(), HltID::is_tof_inf(), HltID::is_version(), iter(), m_ntot, msgSvc(), HltInf::push_con(), HltInf::push_emc(), HltInf::push_mdc(), HltInf::push_muc(), HltInf::push_tof(), DstHltInf::setAlgProcess(), DstHltInf::setCriteriaTable(), DstHltInf::setEventType(), DstHltInf::setNCON(), DstHltInf::setNumber(), DstHltInf::setTotalEnergy(), DstHltInf::setVersion(), type, and VERBOSE.
00033 { 00034 MsgStream log(msgSvc(),name()); 00035 log<<MSG::DEBUG<< "HltEventMaker: in execute()" <<endreq; 00036 00037 // Get the event header, print out event and run number 00038 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00039 if (!eventHeader) { 00040 log << MSG::FATAL << "Could not find Event Header" << endreq; 00041 return StatusCode::FAILURE; 00042 } 00043 00044 int eventId = eventHeader->eventNumber() ; 00045 int runId = eventHeader->runNumber(); 00046 log << MSG::INFO << "HltEventMaker: retrieved event: " <<" Event Number "<< eventId << " run: " <<runId << endreq; 00047 00048 HltInf* aHlt = new HltInf(); 00049 //Get EventFilter information from TDS 00050 SmartDataPtr<HltRawCol> hltRawCol(eventSvc(),"/Event/Hlt/HltRawCol"); 00051 if (!hltRawCol) { 00052 log << MSG::DEBUG << "Could not find HltRawCol!" << endreq; 00053 //return StatusCode::SUCCESS; 00054 } 00055 else{ 00056 uint32_t type=0,alg=0,cri=0,ver=0; 00057 float etot=0; 00058 uint32_t nmdc=0xFF,ntof=0xFF,nemc=0xFF,nmuc=0xFF; 00059 00060 HltRawCol::iterator iter = hltRawCol->begin(); 00061 for (;iter != hltRawCol->end(); iter++ ) { 00062 Identifier id = (*iter)->identify(); 00063 log << MSG::VERBOSE << "EventFilter info id: " << hex << id << ": " 00064 << (*iter)->getIntChannel() << ","<< dec << (*iter)->getFloatChannel() <<endreq; 00065 if(HltID::is_eventtype(id)) aHlt->setEventType(type=(*iter)->getIntChannel()); 00066 if(HltID::is_algorithm(id)) aHlt->setAlgProcess(alg=(*iter)->getIntChannel()); 00067 if(HltID::is_criteria(id)) aHlt->setCriteriaTable(cri=(*iter)->getIntChannel()); 00068 if(HltID::is_version(id)) aHlt->setVersion(ver=(*iter)->getIntChannel()); 00069 if(HltID::is_energy(id)) aHlt->setTotalEnergy(etot=(*iter)->getFloatChannel()); 00070 00071 uint32_t pureid= id&0xFF; 00072 if(HltID::is_number(id)){ 00073 uint32_t datanum=(*iter)->getIntChannel(); 00074 aHlt->setNumber(datanum); 00075 nmdc=datanum&0xFF; 00076 ntof=(datanum&0xFF00)>>8; 00077 nemc=(datanum&0xFF0000)>>16; 00078 nmuc=(datanum&0xFF000000)>>24; 00079 log << MSG::VERBOSE << nmdc << ", " << ntof << ", " << nemc << ", " << nmuc << endreq; 00080 } 00081 else if(HltID::is_mdc_inf(id)){ 00082 aHlt->push_mdc((*iter)->getIntChannel()); 00083 } 00084 else if(HltID::is_tof_inf(id)){ 00085 aHlt->push_tof((*iter)->getIntChannel()); 00086 } 00087 else if(HltID::is_emc_inf(id)){ 00088 aHlt->push_emc((*iter)->getIntChannel()); 00089 } 00090 else if(HltID::is_muc_inf(id)){ 00091 aHlt->push_muc((*iter)->getIntChannel()); 00092 } 00093 else if(HltID::is_con_inf(id)){ 00094 if(HltID::is_ncon(id)) aHlt->setNCON((*iter)->getIntChannel()); 00095 else aHlt->push_con((*iter)->getIntChannel()); 00096 } 00097 } 00098 log<<MSG::DEBUG<<"type="<<type<<", alg="<<alg<<", criteria="<<cri 00099 <<", version="<<ver<<", energy="<<etot<<endreq; 00100 00101 m_ntot++; 00102 } 00103 //Register related event filter information to TDS for physics analysis 00104 StatusCode sc; 00105 DataObject *aHltInfEvent; 00106 eventSvc()->findObject("/Event/Hlt/HltInf", aHltInfEvent); 00107 if(aHltInfEvent!=NULL) { 00108 SmartDataPtr<HltInf> hltInf(eventSvc(),"/Event/Hlt/HltInf"); 00109 log<<MSG::DEBUG<<"old type="<<hltInf->getEventType()<<", alg="<<hltInf->getAlgProcess() 00110 <<", criteria="<<hltInf->getCriteriaTable()<<", version="<<hltInf->getVersion() 00111 <<", energy="<<hltInf->getTotalEnergy()<<endreq; 00112 //then unregister HltInf 00113 sc = eventSvc()->unregisterObject("/Event/Hlt/HltInf"); 00114 delete aHltInfEvent; //it must be delete to avoid memory leakage 00115 log << MSG::INFO << "Old HltInf has been unregistered" << endreq; 00116 if(sc!=StatusCode::SUCCESS) { 00117 log << MSG::FATAL << "Could not unregister HltInf" << endreq; 00118 return( StatusCode::FAILURE); 00119 } 00120 } 00121 sc = eventSvc()->registerObject(EventModel::Hlt::HltInf,aHlt); 00122 if(sc!=StatusCode::SUCCESS) { 00123 log<<MSG::FATAL<< "Could not register HltInf" <<endreq; 00124 return StatusCode::FAILURE; 00125 } 00126 00127 return StatusCode::SUCCESS; 00128 }
StatusCode HltEventMaker::finalize | ( | ) |
Definition at line 130 of file HltEventMaker.cxx.
References Bes_Common::DEBUG, m_ntot, and msgSvc().
00130 { 00131 MsgStream log(msgSvc(), name()); 00132 log << MSG::DEBUG << "==> Finalize HltEventMaker" << endreq; 00133 log << MSG::ALWAYS << m_ntot << " events are converted." <<endreq; 00134 return StatusCode::SUCCESS; 00135 }
StatusCode HltEventMaker::initialize | ( | ) |
Definition at line 25 of file HltEventMaker.cxx.
References Bes_Common::DEBUG, m_ntot, and msgSvc().
00025 { 00026 MsgStream log(msgSvc(), name()); 00027 log << MSG::DEBUG << "HltEventMaker: in initialize()" << endreq; 00028 m_ntot=0; 00029 00030 return StatusCode::SUCCESS; 00031 }
uint32_t HltEventMaker::m_ntot [private] |
Definition at line 15 of file HltEventMaker.h.
Referenced by execute(), finalize(), and initialize().