#include <DstHltMaker.h>
Public Member Functions | |
DstHltMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
uint32_t | m_ntot |
Definition at line 4 of file DstHltMaker.h.
DstHltMaker::DstHltMaker | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 23 of file DstHltMaker.cxx.
00023 : 00024 Algorithm(name, pSvcLocator) 00025 { 00026 // Declare the properties 00027 // declareProperty("FittingMethod", m_fittingMethod = 2); 00028 // declareProperty("ConfigFile", m_configFile = "MDCConfig.xml"); 00029 }
StatusCode DstHltMaker::execute | ( | ) |
Definition at line 43 of file DstHltMaker.cxx.
References Bes_Common::DEBUG, EventModel::Hlt::DstHltInf, Bes_Common::FATAL, DstHltInf::getAlgProcess(), DstHltInf::getCriteriaTable(), DstHltInf::getEventType(), DstHltInf::getTotalEnergy(), DstHltInf::getVersion(), Bes_Common::INFO, m_ntot, msgSvc(), DstHltInf::setAlgProcess(), DstHltInf::setCriteriaTable(), DstHltInf::setEventType(), DstHltInf::setNCON(), DstHltInf::setNumber(), DstHltInf::setTotalEnergy(), and DstHltInf::setVersion().
00043 { 00044 00045 MsgStream log(msgSvc(), name()); 00046 log << MSG::INFO << "in execute()" << endreq; 00047 00048 // Part 1: Get the event header, print out event and run number 00049 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 00056 int eventId = eventHeader->eventNumber() ; 00057 int runId = eventHeader->runNumber(); 00058 log << MSG::INFO << "DstHltMaker: retrieved event: " <<" Event Number "<< eventId << " run: " <<runId << endreq; 00059 00060 StatusCode sc = StatusCode::SUCCESS ; 00061 00062 // register ReconEvent Data Object to TDS; 2005/09/14 00063 //HltEvent* hltEvt = new HltEvent(); 00064 //sc = eventSvc()->registerObject(EventModel::Hlt::Event, hltEvt); 00065 00066 //Part 2: Retrieve 00067 DstHltInf* dstHltInf = new DstHltInf(); 00068 SmartDataPtr<HltInf> recHltInf(eventSvc(),"/Event/Hlt/HltInf"); 00069 //SmartDataPtr<DstHltInf> recHltInf(eventSvc(),"/Event/Hlt/DstHltInf"); 00070 if (!recHltInf) { 00071 log << MSG::DEBUG << "Could not find HltInf" << endreq; 00072 //return StatusCode::SUCCESS; 00073 } else { 00074 dstHltInf->setEventType(recHltInf->getEventType()); 00075 dstHltInf->setAlgProcess(recHltInf->getAlgProcess()); 00076 dstHltInf->setCriteriaTable(recHltInf->getCriteriaTable()); 00077 dstHltInf->setVersion(recHltInf->getVersion()); 00078 dstHltInf->setTotalEnergy(recHltInf->getTotalEnergy()); 00079 dstHltInf->setNumber(recHltInf->getNumber()); 00080 dstHltInf->setNCON(recHltInf->getNCON()); 00081 m_ntot++; 00082 } 00083 DataObject *aDstHltInfEvent; 00084 eventSvc()->findObject("/Event/Hlt/DstHltInf", aDstHltInfEvent); 00085 if(aDstHltInfEvent!=NULL) { 00086 SmartDataPtr<DstHltInf> hltInf(eventSvc(),"/Event/Hlt/DstHltInf"); 00087 log<<MSG::DEBUG<<"old type="<<hltInf->getEventType()<<", alg="<<hltInf->getAlgProcess() 00088 <<", criteria="<<hltInf->getCriteriaTable()<<", version="<<hltInf->getVersion() 00089 <<", energy="<<hltInf->getTotalEnergy()<<endreq; 00090 //then unregister DstHltInf 00091 sc = eventSvc()->unregisterObject("/Event/Hlt/DstHltInf"); 00092 delete aDstHltInfEvent; //it must be delete to avoid memory leakage 00093 log << MSG::INFO << "Old DstHltInf has been unregistered" << endreq; 00094 if(sc!=StatusCode::SUCCESS) { 00095 log << MSG::FATAL << "Could not unregister DstHltInf" << endreq; 00096 return( StatusCode::FAILURE); 00097 } 00098 } 00099 sc = eventSvc()->registerObject(EventModel::Hlt::DstHltInf,dstHltInf); 00100 00101 log << MSG::DEBUG <<"Event No."<<eventId<<" = " 00102 << dstHltInf->getEventType()<<" " 00103 << dstHltInf->getAlgProcess()<<" " 00104 << dstHltInf->getCriteriaTable()<<" " 00105 << dstHltInf->getVersion()<<" " 00106 << dstHltInf->getTotalEnergy()<<endreq; 00107 00108 return sc; 00109 }
StatusCode DstHltMaker::finalize | ( | ) |
Definition at line 112 of file DstHltMaker.cxx.
References Bes_Common::DEBUG, m_ntot, and msgSvc().
00112 { 00113 00114 MsgStream log(msgSvc(), name()); 00115 log << MSG::DEBUG << "==> Finalize DstHltMaker" << endreq; 00116 log << MSG::ALWAYS << m_ntot << " events are converted." <<endreq; 00117 00118 return StatusCode::SUCCESS; 00119 }
StatusCode DstHltMaker::initialize | ( | ) |
Definition at line 32 of file DstHltMaker.cxx.
References Bes_Common::INFO, m_ntot, and msgSvc().
00032 { 00033 00034 MsgStream log(msgSvc(), name()); 00035 log << MSG::INFO << "in initialize()" << endreq; 00036 00037 m_ntot=0; 00038 00039 return StatusCode::SUCCESS; 00040 }
uint32_t DstHltMaker::m_ntot [private] |