CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
TofEnergyRec Class Reference

#include <TofEnergyRec.h>

+ Inheritance diagram for TofEnergyRec:

Public Member Functions

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

Detailed Description

Definition at line 15 of file TofEnergyRec.h.

Constructor & Destructor Documentation

◆ TofEnergyRec()

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

Definition at line 44 of file TofEnergyRec.cxx.

44 :
45 Algorithm(name, pSvcLocator)
46{
47 declareProperty("Output", m_output = false);
48 declareProperty("EventNb", m_eventNb = 0);
49 declareProperty("CalibConst", m_calibConst = 0.0085);
50 declareProperty("IsData", m_isData = true);
51}

Member Function Documentation

◆ execute()

StatusCode TofEnergyRec::execute ( )

Definition at line 93 of file TofEnergyRec.cxx.

93 {
94
95 MsgStream log(msgSvc(), name());
96 log << MSG::INFO << "TofEnergyRec in execute()!!" << endreq;
97
98 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
99 if( !eventHeader ) {
100 log << MSG::FATAL << "TofEnergyRec could not find Event Header!" << endreq;
101 return StatusCode::FAILURE;
102 }
103 int run = eventHeader->runNumber();
104 int event = eventHeader->eventNumber();
105 if( m_eventNb!=0 && m_event%m_eventNb== 0 ) std::cout << "--------event: " << m_event
106 << ", run= " << run << " event= " << event << std::endl;
107 log << MSG::INFO << "run= " << run << " event= " << event << endreq;
108 m_event++;
109
111 StatusCode sc = service("RawDataProviderSvc", tofDigiSvc);
112 if(sc != StatusCode::SUCCESS) {
113 log << MSG::FATAL << "TofEnergyRec could not find RawDataProviderSvc!" << endreq;
114 return StatusCode::SUCCESS;
115 }
116
117 //check whether the Recon has been already registered
118 DataObject *aReconEvent;
119 eventSvc()->findObject("/Event/Recon",aReconEvent);
120 if(aReconEvent==NULL) {
121 log << MSG::INFO << "Register ReconEvent" << endreq;
122 //then register Recon
123 aReconEvent = new ReconEvent();
124 sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
125 if(sc!=StatusCode::SUCCESS) {
126 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
127 return StatusCode::FAILURE;
128 }
129 }
130
131 //Register RecTofTrackCol
132 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),EventModel::Recon::RecTofTrackCol);
133 if (!tofTrackCol) {
134 log << MSG::INFO << "Register RecTofTrackCol!" << endreq;
135 tofTrackCol = new RecTofTrackCol;
136 sc = eventSvc()->registerObject(EventModel::Recon::RecTofTrackCol, tofTrackCol);
137 if(sc!=StatusCode::SUCCESS) {
138 log << MSG::FATAL << "Could not register RecTofTrackCol!" <<endreq;
139 }
140 }
141
142
143
144 //Retrieve RecEsTimeCol
145 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
146 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
147 log << MSG::WARNING << "TofRec Could not find RecEsTimeCol! Run = " << run << " Event = " << event << endreq;
148 return StatusCode::SUCCESS;
149 }
150 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
151 double t0=0;
152 t0 = (*iter_ESTime)->getTest();
153 int t0Stat = (*iter_ESTime)->getStat();
154
155
156 std::vector<TofData*> tofDataVec;
157 tofDataVec = tofDigiSvc->tofDataVectorTof();
158
159
160 m_tofShower->findShower(tofDataVec, tofTrackCol, t0);
161
162 return StatusCode::SUCCESS;
163
164}
IRawDataProviderSvc * tofDigiSvc
Definition MrpcRec.cxx:46
ObjectVector< RecTofTrack > RecTofTrackCol
Definition RecTofTrack.h:33
IMessageSvc * msgSvc()
virtual TofDataVector & tofDataVectorTof(double estime=0)=0
void findShower(vector< TofData * > &tofDataVec, RecTofTrackCol *recTofTrackCol, double)
_EXTERN_ std::string RecTofTrackCol
Definition EventModel.h:103

◆ finalize()

StatusCode TofEnergyRec::finalize ( )

Definition at line 168 of file TofEnergyRec.cxx.

168 {
169 cout << "Total event:" << m_event << endl;
170 delete m_tofShower;
171 return StatusCode::SUCCESS;
172}

◆ initialize()

StatusCode TofEnergyRec::initialize ( )

Definition at line 55 of file TofEnergyRec.cxx.

55 {
56
57 MsgStream log(msgSvc(), name());
58 log << MSG::INFO << "TofEnergyRec in initialize()" << endreq;
59
60 m_event = 0;
61 m_tofShower = new TofShower;
62 m_tofShower->setCalibConst(m_calibConst);
63 m_tofShower->setIsData(m_isData);
64 //m_tofShower->readCalibPar();
65
66 if(m_output) {
67 cout<<"--------Book Tof Energy Ntuple!"<<endl;
68 NTuplePtr nt(ntupleSvc(), "FILE209/sci");
69 NTuplePtr nt1(ntupleSvc(), "FILE209/shower");
70 NTuplePtr nt2(ntupleSvc(), "FILE209/seed");
71 if ( nt&&nt1&&nt2 ) {
72 m_tuple = nt;
73 m_tuple1 = nt1;
74 m_tuple2 = nt2;
75 } else {
76 m_tuple = ntupleSvc()->book ("FILE209/sci", CLID_ColumnWiseTuple, "TofEnergyRec");
77 m_tuple1 = ntupleSvc()->book ("FILE209/shower", CLID_ColumnWiseTuple, "TofEnergyRec");
78 m_tuple2 = ntupleSvc()->book ("FILE209/seed", CLID_ColumnWiseTuple, "TofEnergyRec");
79 if ( m_tuple&&m_tuple1&&m_tuple2 ) {
80 m_tofShower->BookNtuple(m_tuple,m_tuple1,m_tuple2);
81 }
82 else {
83 log << MSG::ERROR << " ----- TofShower cannot book N-tuple:" << long(m_tuple) << endmsg;
84 }
85 }
86 }
87
88 return StatusCode::SUCCESS;
89}
INTupleSvc * ntupleSvc()
void setCalibConst(const double cal)
Definition TofShower.h:56
void BookNtuple(NTuple::Tuple *&tuple, NTuple::Tuple *&tuple1, NTuple::Tuple *&tuple2)
Definition TofShower.cxx:36
void setIsData(const bool isData)
Definition TofShower.h:59

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