BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
DstHltMaker Class Reference

#include <DstHltMaker.h>

+ Inheritance diagram for DstHltMaker:

Public Member Functions

 DstHltMaker (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 4 of file DstHltMaker.h.

Constructor & Destructor Documentation

◆ DstHltMaker()

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

Definition at line 23 of file DstHltMaker.cxx.

23 :
24 Algorithm(name, pSvcLocator)
25{
26 // Declare the properties
27 // declareProperty("FittingMethod", m_fittingMethod = 2);
28 // declareProperty("ConfigFile", m_configFile = "MDCConfig.xml");
29}

Member Function Documentation

◆ execute()

StatusCode DstHltMaker::execute ( )

Definition at line 43 of file DstHltMaker.cxx.

43 {
44
45 MsgStream log(msgSvc(), name());
46 log << MSG::INFO << "in execute()" << endreq;
47
48 // Part 1: Get the event header, print out event and run number
49
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
56 int eventId = eventHeader->eventNumber() ;
57 int runId = eventHeader->runNumber();
58 log << MSG::INFO << "DstHltMaker: retrieved event: " <<" Event Number "<< eventId << " run: " <<runId << endreq;
59
60 StatusCode sc = StatusCode::SUCCESS ;
61
62 // register ReconEvent Data Object to TDS; 2005/09/14
63 //HltEvent* hltEvt = new HltEvent();
64 //sc = eventSvc()->registerObject(EventModel::Hlt::Event, hltEvt);
65
66 //Part 2: Retrieve
67 DstHltInf* dstHltInf = new DstHltInf();
68 SmartDataPtr<HltInf> recHltInf(eventSvc(),"/Event/Hlt/HltInf");
69 //SmartDataPtr<DstHltInf> recHltInf(eventSvc(),"/Event/Hlt/DstHltInf");
70 if (!recHltInf) {
71 log << MSG::DEBUG << "Could not find HltInf" << endreq;
72 //return StatusCode::SUCCESS;
73 } else {
74 dstHltInf->setEventType(recHltInf->getEventType());
75 dstHltInf->setAlgProcess(recHltInf->getAlgProcess());
76 dstHltInf->setCriteriaTable(recHltInf->getCriteriaTable());
77 dstHltInf->setVersion(recHltInf->getVersion());
78 dstHltInf->setTotalEnergy(recHltInf->getTotalEnergy());
79 dstHltInf->setNumber(recHltInf->getNumber());
80 dstHltInf->setNCON(recHltInf->getNCON());
81 m_ntot++;
82 }
83 DataObject *aDstHltInfEvent;
84 eventSvc()->findObject("/Event/Hlt/DstHltInf", aDstHltInfEvent);
85 if(aDstHltInfEvent!=NULL) {
86 SmartDataPtr<DstHltInf> hltInf(eventSvc(),"/Event/Hlt/DstHltInf");
87 log<<MSG::DEBUG<<"old type="<<hltInf->getEventType()<<", alg="<<hltInf->getAlgProcess()
88 <<", criteria="<<hltInf->getCriteriaTable()<<", version="<<hltInf->getVersion()
89 <<", energy="<<hltInf->getTotalEnergy()<<endreq;
90 //then unregister DstHltInf
91 sc = eventSvc()->unregisterObject("/Event/Hlt/DstHltInf");
92 delete aDstHltInfEvent; //it must be delete to avoid memory leakage
93 log << MSG::INFO << "Old DstHltInf has been unregistered" << endreq;
94 if(sc!=StatusCode::SUCCESS) {
95 log << MSG::FATAL << "Could not unregister DstHltInf" << endreq;
96 return( StatusCode::FAILURE);
97 }
98 }
99 sc = eventSvc()->registerObject(EventModel::Hlt::DstHltInf,dstHltInf);
100
101 log << MSG::DEBUG <<"Event No."<<eventId<<" = "
102 << dstHltInf->getEventType()<<" "
103 << dstHltInf->getAlgProcess()<<" "
104 << dstHltInf->getCriteriaTable()<<" "
105 << dstHltInf->getVersion()<<" "
106 << dstHltInf->getTotalEnergy()<<endreq;
107
108 return sc;
109}
IMessageSvc * msgSvc()
void setAlgProcess(const unsigned int i)
Definition: DstHltInf.h:31
void setCriteriaTable(const unsigned int i)
Definition: DstHltInf.h:32
float getTotalEnergy() const
Definition: DstHltInf.h:46
uint32_t getCriteriaTable() const
Definition: DstHltInf.h:44
void setNumber(const unsigned int i)
Definition: DstHltInf.h:35
void setNCON(const unsigned int i)
Definition: DstHltInf.h:40
uint32_t getVersion() const
Definition: DstHltInf.h:45
uint32_t getEventType() const
Definition: DstHltInf.h:42
uint32_t getAlgProcess() const
Definition: DstHltInf.h:43
void setEventType(const unsigned int i)
Definition: DstHltInf.h:30
void setTotalEnergy(const float etot)
Definition: DstHltInf.h:34
void setVersion(const unsigned int i)
Definition: DstHltInf.h:33
_EXTERN_ std::string DstHltInf
Definition: EventModel.h:75

◆ finalize()

StatusCode DstHltMaker::finalize ( )

Definition at line 112 of file DstHltMaker.cxx.

112 {
113
114 MsgStream log(msgSvc(), name());
115 log << MSG::DEBUG << "==> Finalize DstHltMaker" << endreq;
116 log << MSG::ALWAYS << m_ntot << " events are converted." <<endreq;
117
118 return StatusCode::SUCCESS;
119}

◆ initialize()

StatusCode DstHltMaker::initialize ( )

Definition at line 32 of file DstHltMaker.cxx.

32 {
33
34 MsgStream log(msgSvc(), name());
35 log << MSG::INFO << "in initialize()" << endreq;
36
37 m_ntot=0;
38
39 return StatusCode::SUCCESS;
40}

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