BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RootIoAlg Class Reference

#include <RootIoAlg.h>

+ Inheritance diagram for RootIoAlg:

Public Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ RootIoAlg() [1/2]

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

Definition at line 44 of file RootIoAlg.cxx.

44 :
45 Algorithm(name, pSvcLocator)
46{
47 // Declare the properties
48// declareProperty("FittingMethod", m_fittingMethod = 2);
49// declareProperty("ConfigFile", m_configFile = "MDCConfig.xml");
50}

◆ RootIoAlg() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode RootIoAlg::execute ( )

Definition at line 73 of file RootIoAlg.cxx.

73 {
74
75 MsgStream log(msgSvc(), name());
76 log << MSG::INFO << "in execute()" << endreq;
77
78 // Part 1: Get the event header, print out event and run number
79
80 int event, run;
81
82
83 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
84 if (!eventHeader) {
85 log << MSG::FATAL << "Could not find Event Header" << endreq;
86 return( StatusCode::FAILURE);
87 }
88 log << MSG::INFO << "RootIoAlg: retrieved event: " << eventHeader->eventNumber() << " run: " << eventHeader->runNumber() << endreq;
89
90
91 int digiId;
92
93 //Part 3: Retrieve MDC digi
94 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
95 if (!mdcDigiCol) {
96 log << /*MSG::FATAL*/MSG::INFO << "Could not find MDC digi" << endreq;
97 //return( StatusCode::FAILURE);
98 }
99 else {
100 MdcDigiCol::iterator iter1 = mdcDigiCol->begin();
101 digiId = 0;
102 for (;iter1 != mdcDigiCol->end(); iter1++, digiId++) {
103 log << MSG::INFO << "MDC digit No: " << digiId << endreq;
104
105 log << MSG::INFO
106 << " time_channel = " << (*iter1)->getTimeChannel()
107 << " charge_channel = " << (*iter1)->getChargeChannel()
108 << endreq;
109 }
110 }
111
112
113 //Part 4: Retrieve TOF digi
114 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
115 if (!tofDigiCol) {
116 log <</* MSG::FATAL*/MSG::INFO << "Could not find TOF digi" << endreq;
117 // return( StatusCode::FAILURE);
118 }
119 else {
120 TofDigiCol::iterator iter2 = tofDigiCol->begin();
121 digiId = 0;
122 for (;iter2 != tofDigiCol->end(); iter2++, digiId++) {
123 log << MSG::INFO << "TOF digit No: " << digiId << endreq;
124 log << MSG::INFO
125 << " time_channel = " << (*iter2)->getTimeChannel()
126 << " charge_channel = " << (*iter2)->getChargeChannel()
127 << endreq;
128
129
130 }
131 }
132 //Part 5: Retrieve EMC digi
133 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
134 if (!emcDigiCol) {
135 log <</* MSG::FATAL*/MSG::INFO << "Could not find EMC digi" << endreq;
136 // return( StatusCode::FAILURE);
137 }
138 else {
139 EmcDigiCol::iterator iter3 = emcDigiCol->begin();
140 digiId = 0;
141 for (;iter3 != emcDigiCol->end(); iter3++, digiId++) {
142 log << MSG::INFO << "Emc digit No: " << digiId << endreq;
143
144 log << MSG::INFO
145 << " time_channel = " << (*iter3)->getTimeChannel()
146 << " charge_channel = " << (*iter3)->getChargeChannel()
147 << endreq;
148 }
149 }
150
151
152 //Part 6: Retrieve DST Tof Track
153 SmartDataPtr<DstTofTrackCol> dstTofTrackCol(eventSvc(),EventModel::Dst::DstTofTrackCol);
154 if (!dstTofTrackCol) {
155 log <</* MSG::FATAL*/MSG::INFO << "Could not find Dst Tof Track" << endreq;
156 // return( StatusCode::FAILURE);
157 }
158 else {
159 DstTofTrackCol::iterator iter4 = dstTofTrackCol->begin();
160 digiId = 0;
161 for (;iter4 != dstTofTrackCol->end(); iter4++, digiId++) {
162 log << MSG::INFO << "Dst Tof No: " << digiId << endreq;
163
164 log << MSG::INFO
165 <<" TrackID = " << (*iter4)->trackID()
166 <<" TofID = " <<(*iter4)->tofID()
167 <<" TofTrackID = " <<(*iter4)->tofTrackID()
168 <<" Beta = " << (*iter4)->beta()
169 << endreq;
170 }
171 }
172
173 //Part 7: Retrieve DST Emc Track
174 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol(eventSvc(),EventModel::Dst::DstEmcShowerCol);
175 if (!dstEmcShowerCol) {
176 log <</* MSG::FATAL*/MSG::INFO << "Could not find Dst Emc Track" << endreq;
177 // return( StatusCode::FAILURE);
178 }
179 else {
180 DstEmcShowerCol::iterator iter5 = dstEmcShowerCol->begin();
181 digiId = 0;
182 for (;iter5 != dstEmcShowerCol->end(); iter5++, digiId++) {
183 log << MSG::INFO << "Dst Emc No: " << digiId << endreq;
184
185 log << MSG::INFO
186 << " Track ID = " << (*iter5)->trackId()
187 <<" Cell ID = " << (*iter5)->cellId()
188 <<" Total energy observed in Emc = " << (*iter5)->energy()
189 << endreq ;
190 }
191 }
192
193//Part 8: Retrieve DST Mdc Track
194 SmartDataPtr<DstMdcTrackCol> dstMdcTrackCol(eventSvc(),EventModel::Dst::DstMdcTrackCol);
195 if (!dstMdcTrackCol) {
196 log <</* MSG::FATAL*/MSG::INFO << "Could not find Dst Mdc Track" << endreq;
197 // return( StatusCode::FAILURE);
198 }
199 else {
200 DstMdcTrackCol::iterator iter6 = dstMdcTrackCol->begin();
201 digiId = 0;
202 for (;iter6 != dstMdcTrackCol->end(); iter6++, digiId++) {
203 log << MSG::INFO << "Dst Mdc No: " << digiId << endreq;
204
205 log << MSG::INFO
206 << " Track ID = " << (*iter6)->trackId()
207 <<" number of total hits contained = " << (*iter6)->nster()
208 <<"px = "<<(*iter6)->px()
209 <<"p = "<<(*iter6)->p()
210 <<endreq;
211 }
212 }
213
214//Part 9: Retrieve DST Dedx Track
215 SmartDataPtr<DstMdcDedxCol> dstMdcDedxCol(eventSvc(),EventModel::Dst::DstMdcDedxCol);
216 if (!dstMdcDedxCol) {
217 log << /*MSG::FATAL*/MSG::INFO << "Could not find Dst Mdc Dedx " << endreq;
218 // return( StatusCode::FAILURE);
219 }
220 else {
221 DstMdcDedxCol::iterator iter7 = dstMdcDedxCol->begin();
222 digiId = 0;
223 for (;iter7 != dstMdcDedxCol->end(); iter7++, digiId++) {
224 log << MSG::INFO << "Dst Mdc Dedx No: " << digiId << endreq;
225
226 log << MSG::INFO
227 << " Track ID = " << (*iter7)->trackId()
228 <<"Chi of E = " << (*iter7)->chi(0)
229 <<"Chi of Mu = " << (*iter7)->chi(1)
230 <<"Chi of Pi = " << (*iter7)->chi(2)
231 <<endreq;
232 }
233 }
234
235//Part 9: Retrieve DST Muc Track
236 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(eventSvc(),EventModel::Dst::DstMucTrackCol);
237 if (!dstMucTrackCol) {
238 log <</* MSG::FATAL*/MSG::INFO << "Could not find Muc Track " << endreq;
239 // return( StatusCode::FAILURE);
240 }
241 else {
242 DstMucTrackCol::iterator iter8 = dstMucTrackCol->begin();
243 digiId = 0;
244 for (;iter8 != dstMucTrackCol->end(); iter8++, digiId++) {
245 log << MSG::INFO << "Dst Muc Track No: " << digiId << endreq;
246
247 log << MSG::INFO
248 << " Track ID = " << (*iter8)->trackId()
249 <<" Number of hits on track = " << (*iter8)->numHits()
250 <<" maxHitsInLayer " << (*iter8)->maxHitsInLayer()
251 <<" xPos = " << (*iter8)->xPos()
252 <<" yPos = " << (*iter8)->yPos()
253 <<" zPos = " << (*iter8)->zPos()
254 << endreq;
255 }
256 }
257
258//Part 10: Retrieve DST Ext Track
259 SmartDataPtr<DstExtTrackCol> dstExtTrackCol(eventSvc(),EventModel::Dst::DstExtTrackCol);
260 if (!dstExtTrackCol) {
261 log <</* MSG::FATAL*/MSG::INFO << "Could not find DstExt Track " << endreq;
262 // return( StatusCode::FAILURE);
263 }
264 else {
265 DstExtTrackCol::iterator iter9 = dstExtTrackCol->begin();
266
267 digiId = 0;
268 for (;iter9 != dstExtTrackCol->end(); iter9++, digiId++) {
269 log << MSG::INFO << "Dst Ext Track No: " << digiId << endreq;
270 log << MSG::INFO
271 << "volume name of Tof1= "<< (*iter9)->tof1VolumeName()
272 << "volume number of Tof1 = "<< (*iter9)->tof1VolumeNumber()
273 << "Tof1 = "<< (*iter9)->tof1()
274 <<endreq;
275 log << MSG::INFO
276 << "volume name of Tof2= "<< (*iter9)->tof2VolumeName()
277 << "volume number of Tof2 = "<< (*iter9)->tof2VolumeNumber()
278 << "Tof2 = "<< (*iter9)->tof2()
279 <<endreq;
280 log << MSG::INFO
281 <<" Ext Tof1 Error Z = " << (*iter9)->tof1PosSigmaAlongZ()
282 <<" Ext Tof2 Error Z = " << (*iter9)->tof2PosSigmaAlongZ()
283 <<" Ext Emc Error theta = " << (*iter9)->emcPosSigmaAlongTheta()
284 <<" Ext Muc Error Z = " << (*iter9)->mucPosSigmaAlongZ()
285 << endreq;
286 }
287 }
288//Part 11: Retrieve MdcKal Track
289 SmartDataPtr<DstMdcKalTrackCol> dstMdcKalTrackCol(eventSvc(),EventModel::Dst::DstMdcKalTrackCol);
290 if (!dstMdcKalTrackCol) {
291 log <</* MSG::FATAL*/MSG::INFO << "Could not find DstMdcKal Track " << endreq;
292 }
293 else {
294 DstMdcKalTrackCol::iterator iter10 = dstMdcKalTrackCol->begin();
295 digiId = 0;
296 for (;iter10 != dstMdcKalTrackCol->end(); iter10++, digiId++) {
297 //log << MSG::INFO << "Dst MdcKal Track No: " << digiId << endreq;
298 //log << MSG::INFO
299 // << " stat of the fit of pid=0:" << (*iter10)->getStat(0) <<endreq;
300 //log << MSG::INFO
301 // << "mass assumption during the fit of pid =0 :" << ((*iter10)->getZHelix(0)) <<endreq;
302//
303 }
304 }
305
306/*
307 // register ReconEvent Data Object to TDS;
308 //ReconEvent* recevt = new ReconEvent;
309 //StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
310
311 //Part 6: Retrieve Tof Track
312 // register Tof Track Data Object to TDS;
313 int trackID = 0;
314 DstTofTrackCol* dstTofTrackCol = new DstTofTrackCol();
315
316 for (trackID = 0;trackID < 10 ; trackID++) {
317 log << MSG::INFO << "Tof Track No: " << trackID << endreq;
318
319 DstTofTrack* dstTofTrack = new DstTofTrack();
320
321 dstTofTrack->setId(trackID*100);
322 dstTofTrack->setFlightTime(trackID*1.1);
323 dstTofTrack->setBeta(trackID*1.11);
324
325 log << MSG::INFO
326 <<" Counter Number = " << dstTofTrack->id()
327 <<" Time of Flight = " << dstTofTrack->flightTime()
328 <<" Beta = " << dstTofTrack->beta()
329 << endreq;
330
331 (*dstTofTrackCol).push_back(dstTofTrack);
332 }
333 StatusCode sc = eventSvc()->registerObject("/Event/Digi/DstTofTrackCol",dstTofTrackCol);
334
335 //Part 7: Retrieve Mdc Track
336 // register Mdc Track Data Object to TDS;
337 trackID = 0;
338 DstMdcTrackCol* dstMdcTrackCol = new DstMdcTrackCol();
339
340 for ( trackID = 0;trackID < 10 ; trackID++) {
341 log << MSG::INFO << "Mdc Track No: " << trackID << endreq;
342
343 DstMdcTrack* dstMdcTrack = new DstMdcTrack();
344
345 dstMdcTrack->setCharge(trackID*100);
346 dstMdcTrack->setPxy(trackID*1.1);
347 dstMdcTrack->setPx(trackID*1.11);
348
349 log << MSG::INFO
350 <<" Charge = " << dstMdcTrack->charge()
351 <<" Pxy = " << dstMdcTrack->pxy()
352 <<" Px = " << dstMdcTrack->px()
353 << endreq;
354
355 (*dstMdcTrackCol).push_back(dstMdcTrack);
356 }
357 sc = eventSvc()->registerObject("/Event/Digi/DstMdcTrackCol",dstMdcTrackCol);
358
359//Part 8: Retrieve Emc Track
360 // register Tof Track Data Object to TDS;
361 trackID = 0;
362 DstEmcShowerCol* dstEmcShowerCol = new DstEmcShowerCol();
363
364 for ( trackID = 0;trackID < 10 ; trackID++) {
365 log << MSG::INFO << "Emc Track No: " << trackID << endreq;
366
367 DstEmcShower* dstEmcShower = new DstEmcShower();
368
369 dstEmcShower->setNumHits(trackID*100);
370 dstEmcShower->setX(trackID*1.1);
371 dstEmcShower->setDx(trackID*1.11);
372
373 log << MSG::INFO
374 <<" NumHits = " << dstEmcShower->numHits()
375 <<" X = " << dstEmcShower->x()
376 <<" Dx = " << dstEmcShower->dx()
377 << endreq;
378
379 (*dstEmcShowerCol).push_back(dstEmcShower);
380 }
381 sc = eventSvc()->registerObject("/Event/Digi/DstEmcShowerCol",dstEmcShowerCol);
382
383 //Part 9: Retrieve Muc Track
384 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(eventSvc(),"/Event/Digi/DstMucTrackCol");
385 if (!dstMucTrackCol) {
386 log << MSG::FATAL << "Could not find Dst Muc Track " << endreq;
387 return( StatusCode::FAILURE);
388 }
389 trackID = 0;
390 DstMucTrackCol::iterator iter9 = dstMucTrackCol->begin();
391
392 for (;iter9 != dstMucTrackCol->end(); iter9++, trackID++) {
393 log << MSG::INFO << "Dst Muc Track No.: " << trackID << endreq;
394 log << MSG::INFO
395 << " Projected x = " << (*iter9)->xProj()
396 << " Projected y = " << (*iter9)->yProj()
397 << " Projected z = " << (*iter9)->zProj()
398 << endreq;
399 }
400
401
402 //Part 10: Retrieve Dedx
403 // register Dedx Data Object to TDS;
404 trackID = 0;
405 DstDedxCol* dstDedxCol = new DstDedxCol();
406
407 for ( trackID = 0;trackID < 10 ; trackID++) {
408 log << MSG::INFO << "Dedx No: " << trackID << endreq;
409
410 DstDedx* dstDedx = new DstDedx();
411
412 dstDedx->setParticleId(trackID*100);
413 dstDedx->setNumSigmaE(trackID*1.1);
414 dstDedx->setNumSigmaMu(trackID*1.11);
415
416 log << MSG::INFO
417 <<" Particle ID from De/Dx fit = " << dstDedx->particleId()
418 <<" Number of sigama from e = " << dstDedx->numSigmaE()
419 <<" Number of sigama from muon = " << dstDedx->numSigmaMu()
420 << endreq;
421
422 (*dstDedxCol).push_back(dstDedx);
423 }
424 sc = eventSvc()->registerObject("/Event/Digi/DstDedxCol",dstDedxCol);
425*/
426 return StatusCode::SUCCESS;
427}

◆ execute() [2/2]

StatusCode RootIoAlg::execute ( )

◆ finalize() [1/2]

StatusCode RootIoAlg::finalize ( )

Definition at line 430 of file RootIoAlg.cxx.

430 {
431
432 MsgStream log(msgSvc(), name());
433 log << MSG::INFO << "in finalize()" << endreq;
434
435 return StatusCode::SUCCESS;
436}

◆ finalize() [2/2]

StatusCode RootIoAlg::finalize ( )

◆ initialize() [1/2]

StatusCode RootIoAlg::initialize ( )

Definition at line 53 of file RootIoAlg.cxx.

53 {
54
55 MsgStream log(msgSvc(), name());
56 log << MSG::INFO << "in initialize()" << endreq;
57/*
58 IMdcGeomSvc* mdcGeomSvc;
59 StatusCode sc = service("MdcGeomSvc", mdcGeomSvc);
60 if (sc == StatusCode::SUCCESS) {
61 std::cout <<"dump"<<std::endl;
62 mdcGeomSvc->Dump();
63 std::cout<<"Hi, event routine is running"<<std::endl;
64 std::cout<<"1st wire id:"<<mdcGeomSvc->Wire(0)->Id()<<std::endl;
65 } else {
66 return StatusCode::FAILURE;
67 }
68*/
69 return StatusCode::SUCCESS;
70}

◆ initialize() [2/2]

StatusCode RootIoAlg::initialize ( )

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