BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecTrackCnv Class Reference

#include <EvtRecTrackCnv.h>

+ Inheritance diagram for EvtRecTrackCnv:

Public Member Functions

virtual ~EvtRecTrackCnv ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 EvtRecTrackCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtRecTrackCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_cnvSvc
 
std::vector< RootCnvSvc::Leafm_leaves
 
RootInterfacem_rootInterface
 pointer to the RootInterface
 
IDataProviderSvc * m_eds
 pointer to eventdataservice
 
int m_branchNr
 the branchNr of this converter for writing
 
int m_branchNrDst
 
int m_branchNrMc
 
int m_branchNrRecon
 
int m_branchNrEvtRec
 
int m_branchNrEvtHeader
 
int m_branchNrEvtNavigator
 
TObject * m_objRead
 the object that was read
 
CLID CLID_top
 the CLID of the upper converter if any
 
TArrayS * m_branchNumbers
 array with number of branches for reading
 
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
 
std::string m_rootTreename
 each converter knows it's treename
 
std::string m_currentFileName
 
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
 
RootEvtSelectorm_evtsel
 

Detailed Description

Definition at line 14 of file EvtRecTrackCnv.h.

Constructor & Destructor Documentation

◆ ~EvtRecTrackCnv()

virtual EvtRecTrackCnv::~EvtRecTrackCnv ( )
inlinevirtual

Definition at line 21 of file EvtRecTrackCnv.h.

21{}

◆ EvtRecTrackCnv()

EvtRecTrackCnv::EvtRecTrackCnv ( ISvcLocator * svc)
protected

Definition at line 15 of file EvtRecTrackCnv.cxx.

17{
18 m_rootBranchname = "m_evtRecTrackCol";
19 m_adresses.push_back(&m_evtRecTrackCol);
20 m_evtRecTrackCol = 0;
21}
static const CLID & classID()
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

Member Function Documentation

◆ classID()

static const CLID & EvtRecTrackCnv::classID ( )
inlinestatic

Definition at line 19 of file EvtRecTrackCnv.h.

19{ return CLID_EvtRecTrackCol; }
const CLID & CLID_EvtRecTrackCol

◆ DataObjectToTObject()

StatusCode EvtRecTrackCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
protectedvirtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 324 of file EvtRecTrackCnv.cxx.

324 {
325 MsgStream log(msgSvc(), "EvtRecTrackCnv");
326 log << MSG::DEBUG << "EvtRecTrackCnv::DataObjectToTObject" << endreq;
327
328 EvtRecTrackCol* evtRecTrackCol = dynamic_cast<EvtRecTrackCol*> (obj);
329 if ( ! evtRecTrackCol ) {
330 log << MSG::ERROR << "Could not downcast to EvtRecTrackCol" << endreq;
331 return StatusCode::FAILURE;
332 }
333
334 DataObject* evt = NULL;
335 StatusCode sc = m_eds->findObject(EventModel::EvtRec::Event, evt);
336 if ( sc.isFailure() ) {
337 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
338 return StatusCode::FAILURE;
339 }
340 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
341 if ( ! devtTds ) {
342 log << MSG::ERROR << "EvtRecTrackCnv: Could not downcast to TDS EvtRecObject" << endreq;
343 }
344
345 IOpaqueAddress *addr;
346 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
348
349 const TObjArray* m_evtRecTrackCol = recEvt->getEvtRecTrackCol();
350 if ( ! m_evtRecTrackCol ) return StatusCode::SUCCESS;
351
352 IDataProviderSvc* dataSvc = 0;
353 sc = serviceLocator()->getService("EventDataSvc",
354 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
355 if ( sc.isFailure() ) {
356 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecTrackCnv" << endreq;
357 return sc;
358 }
359
360 RecMdcTrackCol::iterator mdcTrackColbegin, mdcTrackColend;
361 RecMdcKalTrackCol::iterator mdcKalTrackColbegin, mdcKalTrackColend;
362 RecMdcDedxCol::iterator mdcDedxColbegin, mdcDedxColend;
363 RecExtTrackCol::iterator extTrackColbegin, extTrackColend;
364 RecTofTrackCol::iterator tofTrackColbegin, tofTrackColend;
365 RecEmcShowerCol::iterator emcShowerColbegin, emcShowerColend;
366 RecMucTrackCol::iterator mucTrackColbegin, mucTrackColend;
367
368 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(dataSvc, EventModel::Recon::RecMdcTrackCol);
369 if ( ! mdcTrackCol ) {
370 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq;
371 }
372 else {
373 mdcTrackColbegin = mdcTrackCol->begin();
374 mdcTrackColend = mdcTrackCol->end();
375 }
376
377 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(dataSvc, EventModel::Recon::RecMdcKalTrackCol);
378 if ( ! mdcKalTrackCol ) {
379 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endreq;
380 }
381 else {
382 mdcKalTrackColbegin = mdcKalTrackCol->begin();
383 mdcKalTrackColend = mdcKalTrackCol->end();
384 }
385
386 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(dataSvc, EventModel::Recon::RecMdcDedxCol);
387 if ( ! mdcDedxCol ) {
388 log << MSG::INFO << "Could not find RecMdcDedxCol" << endreq;
389 }
390 else {
391 mdcDedxColbegin = mdcDedxCol->begin();
392 mdcDedxColend = mdcDedxCol->end();
393 }
394
395 SmartDataPtr<RecExtTrackCol> extTrackCol(dataSvc, EventModel::Recon::RecExtTrackCol);
396 if ( ! extTrackCol ) {
397 log << MSG::INFO << "Could not find RecExtTrackCol" << endreq;
398 }
399 else {
400 extTrackColbegin = extTrackCol->begin();
401 extTrackColend = extTrackCol->end();
402 }
403
404 SmartDataPtr<RecTofTrackCol> tofTrackCol(dataSvc, EventModel::Recon::RecTofTrackCol);
405 if ( ! tofTrackCol ) {
406 log << MSG::INFO << "Could not find RecTofTrackCol" << endreq;
407 }
408 else {
409 tofTrackColbegin = tofTrackCol->begin();
410 tofTrackColend = tofTrackCol->end();
411 }
412
413 SmartDataPtr<RecEmcShowerCol> emcShowerCol(dataSvc, EventModel::Recon::RecEmcShowerCol);
414 if ( ! emcShowerCol ) {
415 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
416 }
417 else {
418 emcShowerColbegin = emcShowerCol->begin();
419 emcShowerColend = emcShowerCol->end();
420 }
421
422 SmartDataPtr<RecMucTrackCol> mucTrackCol(dataSvc, EventModel::Recon::RecMucTrackCol);
423 if ( ! mucTrackCol ) {
424 log << MSG::INFO << "Could not find RecMucTrackCol" << endreq;
425 }
426 else {
427 mucTrackColbegin = mucTrackCol->begin();
428 mucTrackColend = mucTrackCol->end();
429 }
430
431 // convert
432 recEvt->clearEvtRecTrackCol();
433 EvtRecTrackCol::const_iterator evtRecTrack = evtRecTrackCol->begin();
434
435 for ( ; evtRecTrack != evtRecTrackCol->end(); evtRecTrack++) {
436 EvtRecTrack* ptr = *evtRecTrack;
437 TEvtRecTrack* evtRecTrackRoot = new TEvtRecTrack();
438 // set ...
439 evtRecTrackRoot->setTrackId( ptr->trackId() );
440 evtRecTrackRoot->setPartId( ptr->partId() );
441 evtRecTrackRoot->setQuality( ptr->quality() );
442
443 if ( ptr->isMdcTrackValid() ) {
444 RecMdcTrackCol::iterator it = find(mdcTrackColbegin, mdcTrackColend, ptr->mdcTrack());
445 evtRecTrackRoot->setMdcTrackId( it - mdcTrackColbegin );
446 }
447 if ( ptr->isMdcKalTrackValid() ) {
448 RecMdcKalTrackCol::iterator it = find(mdcKalTrackColbegin, mdcKalTrackColend, ptr->mdcKalTrack());
449 evtRecTrackRoot->setMdcKalTrackId( it - mdcKalTrackColbegin );
450 }
451 if ( ptr->isMdcDedxValid() ) {
452 RecMdcDedxCol::iterator it = find(mdcDedxColbegin, mdcDedxColend, ptr->mdcDedx());
453 evtRecTrackRoot->setMdcDedxId( it - mdcDedxColbegin );
454 }
455 if ( ptr->isExtTrackValid() ) {
456 RecExtTrackCol::iterator it = find(extTrackColbegin, extTrackColend, ptr->extTrack());
457 evtRecTrackRoot->setExtTrackId( it - extTrackColbegin );
458 }
459 if ( ptr->isTofTrackValid() ) {
460 SmartRefVector<RecTofTrack> tofTrackVec = ptr->tofTrack();
461 for ( unsigned int i = 0; i < tofTrackVec.size(); i++ ) {
462 RecTofTrackCol::iterator it = find(tofTrackColbegin, tofTrackColend, tofTrackVec[i]);
463 evtRecTrackRoot->addTofTrackId( it - tofTrackColbegin );
464 }
465 }
466 if ( ptr->isEmcShowerValid() ) {
467 RecEmcShowerCol::iterator it = find(emcShowerColbegin, emcShowerColend, ptr->emcShower());
468 evtRecTrackRoot->setEmcShowerId( it - emcShowerColbegin );
469 }
470 if ( ptr->isMucTrackValid() ) {
471 RecMucTrackCol::iterator it = find(mucTrackColbegin, mucTrackColend, ptr->mucTrack());
472 evtRecTrackRoot->setMucTrackId( it - mucTrackColbegin );
473 }
474
475 recEvt->addEvtRecTrack(evtRecTrackRoot);
476 }
477
478 return StatusCode::SUCCESS;
479}
ObjectVector< EvtRecTrack > EvtRecTrackCol
IMessageSvc * msgSvc()
#define NULL
static TEvtRecObject * getWriteObject()
Definition EvtRecCnv.h:26
bool isMdcDedxValid()
Definition EvtRecTrack.h:45
int quality() const
Definition EvtRecTrack.h:34
int trackId() const
Definition EvtRecTrack.h:32
RecMucTrack * mucTrack()
Definition EvtRecTrack.h:59
int partId() const
Definition EvtRecTrack.h:33
RecMdcDedx * mdcDedx()
Definition EvtRecTrack.h:55
bool isExtTrackValid()
Definition EvtRecTrack.h:49
RecExtTrack * extTrack()
Definition EvtRecTrack.h:56
bool isMdcKalTrackValid()
Definition EvtRecTrack.h:44
bool isMucTrackValid()
Definition EvtRecTrack.h:48
SmartRefVector< RecTofTrack > tofTrack()
Definition EvtRecTrack.h:57
bool isTofTrackValid()
Definition EvtRecTrack.h:46
RecEmcShower * emcShower()
Definition EvtRecTrack.h:58
bool isMdcTrackValid()
Definition EvtRecTrack.h:43
bool isEmcShowerValid()
Definition EvtRecTrack.h:47
RecMdcTrack * mdcTrack()
Definition EvtRecTrack.h:53
RecMdcKalTrack * mdcKalTrack()
Definition EvtRecTrack.h:54
EvtRecCnv * getEvtRecCnv()
Definition RootCnvSvc.h:159
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void clearEvtRecTrackCol()
void addEvtRecTrack(TEvtRecTrack *track)
const TObjArray * getEvtRecTrackCol() const
void addTofTrackId(const int tofTrackId)
void setTrackId(const int trackId)
void setMdcTrackId(const int mdcTrackId)
void setMdcDedxId(const int mdcDedxId)
void setMucTrackId(const int mucTrackId)
void setMdcKalTrackId(const int mdcKalTrackId)
void setEmcShowerId(const int emcShowerId)
void setPartId(const int partId)
void setExtTrackId(const int extTrackId)
void setQuality(const int quality)
_EXTERN_ std::string Event
Definition EventModel.h:115
_EXTERN_ std::string RecExtTrackCol
Definition EventModel.h:93
_EXTERN_ std::string RecMdcDedxCol
Definition EventModel.h:88
_EXTERN_ std::string RecTofTrackCol
Definition EventModel.h:97
_EXTERN_ std::string RecMdcTrackCol
Definition EventModel.h:86
_EXTERN_ std::string RecMdcKalTrackCol
Definition EventModel.h:90
_EXTERN_ std::string RecMucTrackCol
Definition EventModel.h:106
_EXTERN_ std::string RecEmcShowerCol
Definition EventModel.h:103

◆ TObjectToDataObject()

StatusCode EvtRecTrackCnv::TObjectToDataObject ( DataObject *& obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 23 of file EvtRecTrackCnv.cxx.

23 {
24 // creation of TDS object from root object
25 MsgStream log(msgSvc(), "EvtRecTrackCnv");
26 log << MSG::DEBUG << "EvtRecTrackCnv::TObjectToDataObject" << endreq;
27
28 // create the TDS location for the EvtRecTrack Collection
29 EvtRecTrackCol* evtRecTrackCol = new EvtRecTrackCol;
30 refpObject = evtRecTrackCol;
31
32 if ( ! m_evtRecTrackCol ) return StatusCode::SUCCESS;
33
34 IDataProviderSvc* dataSvc = 0;
35 StatusCode sc = serviceLocator()->getService("EventDataSvc",
36 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
37 if ( sc.isFailure() ) {
38 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecTrackCnv" << endreq;
39 return sc;
40 }
41
42 /*SmartDataPtr<RecMdcTrackCol> mdcTrackCol(dataSvc, EventModel::Recon::RecMdcTrackCol);
43 if ( ! mdcTrackCol ) {
44 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq;
45 }
46
47 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(dataSvc, EventModel::Recon::RecMdcKalTrackCol);
48 if ( ! mdcKalTrackCol ) {
49 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endreq;
50 }
51
52 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(dataSvc, EventModel::Recon::RecMdcDedxCol);
53 if ( ! mdcDedxCol ) {
54 log << MSG::INFO << "Could not find RecMdcDedxCol" << endreq;
55 }
56
57 SmartDataPtr<RecExtTrackCol> extTrackCol(dataSvc, EventModel::Recon::RecExtTrackCol);
58 if ( ! extTrackCol ) {
59 log << MSG::INFO << "Could not find RecExtTrackCol" << endreq;
60 }
61
62 SmartDataPtr<RecTofTrackCol> tofTrackCol(dataSvc, EventModel::Recon::RecTofTrackCol);
63 if ( ! tofTrackCol ) {
64 log << MSG::INFO << "Could not find RecTofTrackCol" << endreq;
65 }
66
67 SmartDataPtr<RecEmcShowerCol> emcShowerCol(dataSvc, EventModel::Recon::RecEmcShowerCol);
68 if ( ! emcShowerCol ) {
69 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
70 }
71
72 SmartDataPtr<RecMucTrackCol> mucTrackCol(dataSvc, EventModel::Recon::RecMucTrackCol);
73 if ( ! mucTrackCol ) {
74 log << MSG::INFO << "Could not find RecMucTrackCol" << endreq;
75 }*/
76
77 //-----------------Dst to Rec convert in case of no Rec data in TDS
78 int trackID;
79
80 // Retrieve Mdc Track
81 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(dataSvc, EventModel::Recon::RecMdcTrackCol);
82 if(!mdcTrackCol)
83 {
84 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq;
85 SmartDataPtr<DstMdcTrackCol> dstMdcTrackCol(dataSvc,"/Event/Dst/DstMdcTrackCol");
86 if (!dstMdcTrackCol) {
87 log << MSG::INFO << "Could not find DstMdcTrackCol" << endreq;
88 }
89 else {
90 RecMdcTrackCol* mdcTrackCol = new RecMdcTrackCol();
91 DstMdcTrackCol::iterator iter_mdc = dstMdcTrackCol->begin();
92 trackID = 0;
93 for (;iter_mdc != dstMdcTrackCol->end(); iter_mdc++, trackID++) {
94 RecMdcTrack* recMdcTrack = new RecMdcTrack();
95 *recMdcTrack = **iter_mdc;
96 (*mdcTrackCol).push_back(recMdcTrack);
97 log << MSG::INFO
98 << " Mdc Track ID = " << trackID
99 << " Mdc Track Nster = " << (*iter_mdc)->nster()
100 << endreq;
101 }
102 sc = dataSvc->registerObject(EventModel::Recon::RecMdcTrackCol,mdcTrackCol);
103 }
104 }
105
106 // Retrieve MdcKal track
107 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(dataSvc, EventModel::Recon::RecMdcKalTrackCol);
108 if (!mdcKalTrackCol) {
109 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endreq;
110 SmartDataPtr<DstMdcKalTrackCol> dstMdcKalTrackCol(dataSvc,"/Event/Dst/DstMdcKalTrackCol");
111 if(!dstMdcKalTrackCol) {
112 log << MSG::INFO << "Could not find DstMdcKalTrackCol" << endreq;
113 }
114 else {
115 RecMdcKalTrackCol* mdcKalTrackCol = new RecMdcKalTrackCol();
116 DstMdcKalTrackCol::iterator iter_mdc = dstMdcKalTrackCol->begin();
117 trackID = 0;
118 for (;iter_mdc != dstMdcKalTrackCol->end(); iter_mdc++, trackID++) {
119 RecMdcKalTrack* recMdcKalTrack = new RecMdcKalTrack();
120 *recMdcKalTrack = **iter_mdc;
121 (*mdcKalTrackCol).push_back(recMdcKalTrack);
122 log << MSG::INFO
123 << " MdcKalTrack ID = " << trackID
124 << " MdcKalTrack Nster = " << (*iter_mdc)->nster()
125 << " MdcKalTrack poca = " << (*iter_mdc)->poca()
126 << endreq;
127 }
128 sc = dataSvc->registerObject(EventModel::Recon::RecMdcKalTrackCol, mdcKalTrackCol);
129 }
130 }
131
132 // Retrieve MdcDedx
133 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(dataSvc, EventModel::Recon::RecMdcDedxCol);
134 if (!mdcDedxCol) {
135 log <<MSG::INFO << "Could not find RecMdcDedxCol" << endreq;
136 SmartDataPtr<DstMdcDedxCol> dstMdcDedxCol(dataSvc,"/Event/Dst/DstMdcDedxCol");
137 if(!dstMdcDedxCol) {
138 log <<MSG::INFO << "Could not find DstMdcDedxCol" << endreq;
139 }
140 else {
141 RecMdcDedxCol* mdcDedxCol = new RecMdcDedxCol();
142 DstMdcDedxCol::iterator iter_mdc = dstMdcDedxCol->begin();
143 trackID=0;
144 for (;iter_mdc != dstMdcDedxCol->end(); iter_mdc++, trackID++) {
145 RecMdcDedx* recMdcDedx = new RecMdcDedx();
146 *recMdcDedx= **iter_mdc;
147 (*mdcDedxCol).push_back(recMdcDedx);
148 log << MSG::INFO
149 << " MdcDedx ID = " << trackID
150 << " MdcDedx "
151 << endreq;
152 }
153 sc = dataSvc->registerObject(EventModel::Recon::RecMdcDedxCol, mdcDedxCol);
154 }
155 }
156
157 // Retrieve Ext track
158 SmartDataPtr<RecExtTrackCol> extTrackCol(dataSvc, EventModel::Recon::RecExtTrackCol);
159 if (!extTrackCol) {
160 log <<MSG::INFO << "Could not find RecExtTrackCol" << endreq;
161 SmartDataPtr<DstExtTrackCol> dstExtTrackCol(dataSvc,"/Event/Dst/DstExtTrackCol");
162 if(!dstExtTrackCol) {
163 log <<MSG::INFO << "Could not find DstExtTrackCol" << endreq;
164 }
165 else {
166 RecExtTrackCol* extTrackCol = new RecExtTrackCol();
167 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
168 trackID=0;
169 for (;iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++) {
170 RecExtTrack* recExtTrack = new RecExtTrack();
171 *recExtTrack = **iter_ext;
172 (*extTrackCol).push_back(recExtTrack);
173 log << MSG::INFO
174 << " ExtTrack ID = " << trackID
175 << endreq;
176 }
177 sc = dataSvc->registerObject(EventModel::Recon::RecExtTrackCol, extTrackCol);
178 }
179 }
180
181 // Retrieve Tof Track
182 SmartDataPtr<RecTofTrackCol> tofTrackCol(dataSvc, EventModel::Recon::RecTofTrackCol);
183 if ( !tofTrackCol ) {
184 log << MSG::INFO << "Could not find TofTrackCol" << endreq;
185 SmartDataPtr<DstTofTrackCol> dstTofTrackCol(dataSvc,"/Event/Dst/DstTofTrackCol");
186 if(!dstTofTrackCol) {
187 log << MSG::INFO << "Could not find DstTofTrackCol" << endreq;
188 }
189 else {
190 RecTofTrackCol* tofTrackCol = new RecTofTrackCol();
191 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
192 for (;iter_tof != dstTofTrackCol->end(); iter_tof++) {
193 RecTofTrack* recTofTrack = new RecTofTrack();
194 *recTofTrack = **iter_tof;
195 (*tofTrackCol).push_back(recTofTrack);
196 log << MSG::INFO
197 << "Tof Track ID = " << (*iter_tof)->tofTrackID()
198 << " Track ID = " << (*iter_tof)->trackID()
199 << " Tof Counter ID = "<<(*iter_tof)->tofID()
200 << " Quality = "<< (*iter_tof)->quality()
201 << endreq;
202 }
203 sc = dataSvc->registerObject(EventModel::Recon::RecTofTrackCol, tofTrackCol);
204 }
205 }
206
207
208 // Retrieve Emc shower
209 SmartDataPtr<RecEmcShowerCol> emcShowerCol(dataSvc, EventModel::Recon::RecEmcShowerCol);
210 if (!emcShowerCol) {
211 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
212 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol(dataSvc,"/Event/Dst/DstEmcShowerCol");
213 if(!dstEmcShowerCol) {
214 log << MSG::INFO << "Could not find DstEmcShowerCol" << endreq;
215 }
216 else {
217 RecEmcShowerCol* emcShowerCol = new RecEmcShowerCol();
218 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
219 trackID=0;
220 for (;iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++) {
221 RecEmcShower* recEmcShower = new RecEmcShower();
222 *recEmcShower = **iter_emc;
223 (*emcShowerCol).push_back(recEmcShower);
224 log << MSG::INFO
225 << " EmcShower ID = " << trackID
226 << " EmcShower energy = " << (*iter_emc)->energy()
227 << endreq;
228 }
229 sc = dataSvc->registerObject(EventModel::Recon::RecEmcShowerCol, emcShowerCol);
230 }
231 }
232
233 // Retrieve Muc Track
234 SmartDataPtr<RecMucTrackCol> mucTrackCol(dataSvc, EventModel::Recon::RecMucTrackCol);
235 if (!mucTrackCol) {
236 log <<MSG::INFO << "Could not find RecMucTrackCol" << endreq;
237 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(dataSvc,"/Event/Dst/DstMucTrackCol");
238 if(!dstMucTrackCol) {
239 log <<MSG::INFO << "Could not find DstMucTrackCol" << endreq;
240 }
241 else {
242 RecMucTrackCol* mucTrackCol = new RecMucTrackCol();
243 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
244 trackID=0;
245 for (;iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++) {
246 RecMucTrack* recMucTrack = new RecMucTrack();
247 *recMucTrack = **iter_muc;
248 (*mucTrackCol).push_back(recMucTrack);
249 log << MSG::INFO
250 << " MucTrack ID = "<< trackID
251 <<endreq;
252 }
253 sc = dataSvc->registerObject(EventModel::Recon::RecMucTrackCol, mucTrackCol);
254 }
255 }
256
257 // convert
258 TIter evtRecTrackIter(m_evtRecTrackCol);
259 TEvtRecTrack* evtRecTrackRoot = 0;
260 while ( (evtRecTrackRoot = (TEvtRecTrack*)evtRecTrackIter.Next() ) ) {
261 EvtRecTrack* evtRecTrack = new EvtRecTrack();
262 m_common.m_rootEvtRecTrackMap[evtRecTrackRoot] = evtRecTrack;
263 // set ....
264 evtRecTrack->setTrackId( evtRecTrackRoot->trackId() );
265 evtRecTrack->setPartId( evtRecTrackRoot->partId() );
266 evtRecTrack->setQuality( evtRecTrackRoot->quality() );
267
268 int mdcTrackId = evtRecTrackRoot->mdcTrackId();
269 if ( mdcTrackId >= 0 ) {
270 evtRecTrack->setMdcTrack(
271 dynamic_cast<RecMdcTrack*>(mdcTrackCol->containedObject(mdcTrackId))
272 );
273 }
274
275 int mdcKalTrackId = evtRecTrackRoot->mdcKalTrackId();
276 if ( mdcKalTrackId >= 0 ) {
277 evtRecTrack->setMdcKalTrack(
278 dynamic_cast<RecMdcKalTrack*>(mdcKalTrackCol->containedObject(mdcKalTrackId))
279 );
280 }
281
282 int mdcDedxId = evtRecTrackRoot->mdcDedxId();
283 if ( mdcDedxId >= 0 ) {
284 evtRecTrack->setMdcDedx(
285 dynamic_cast<RecMdcDedx*>(mdcDedxCol->containedObject(mdcDedxId))
286 );
287 }
288
289 int extTrackId = evtRecTrackRoot->extTrackId();
290 if ( extTrackId >= 0 ) {
291 evtRecTrack->setExtTrack(
292 dynamic_cast<RecExtTrack*>(extTrackCol->containedObject(extTrackId))
293 );
294 }
295
296 const std::vector<int>& tofTrackIds = evtRecTrackRoot->tofTrackIds();
297 for ( unsigned int i = 0; i < tofTrackIds.size(); i++) {
298 RecTofTrack* tofTrack = dynamic_cast<RecTofTrack*>(tofTrackCol->containedObject(tofTrackIds[i]));
299 evtRecTrack->addTofTrack(tofTrack);
300 }
301
302 int emcShowerId = evtRecTrackRoot->emcShowerId();
303 if ( emcShowerId >= 0 ) {
304 evtRecTrack->setEmcShower(
305 dynamic_cast<RecEmcShower*>(emcShowerCol->containedObject(emcShowerId))
306 );
307 }
308
309 int mucTrackId = evtRecTrackRoot->mucTrackId();
310 if ( mucTrackId >= 0 ) {
311 evtRecTrack->setMucTrack(
312 dynamic_cast<RecMucTrack*>(mucTrackCol->containedObject(mucTrackId))
313 );
314 }
315
316 evtRecTrackCol->push_back(evtRecTrack);
317 }
318
319 delete m_evtRecTrackCol;
320 m_evtRecTrackCol = 0;
321 return StatusCode::SUCCESS;
322}
ObjectVector< RecEmcShower > RecEmcShowerCol
ObjectVector< RecExtTrack > RecExtTrackCol
ObjectVector< RecMdcDedx > RecMdcDedxCol
Definition RecMdcDedx.h:132
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
Definition RecMdcTrack.h:79
ObjectVector< RecMucTrack > RecMucTrackCol
ObjectVector< RecTofTrack > RecTofTrackCol
Definition RecTofTrack.h:33
double energy() const
const int nster() const
const int nster() const
Definition DstMdcTrack.h:68
int tofTrackID() const
Definition DstTofTrack.h:40
void setMucTrack(const RecMucTrack *trk)
Definition EvtRecTrack.h:83
void setQuality(const int quality)
Definition EvtRecTrack.h:66
void setPartId(const int partId)
Definition EvtRecTrack.h:65
void setMdcTrack(const RecMdcTrack *trk)
Definition EvtRecTrack.h:76
void setTrackId(const int trkId)
Definition EvtRecTrack.h:64
void setMdcKalTrack(const RecMdcKalTrack *trk)
Definition EvtRecTrack.h:77
void setMdcDedx(const RecMdcDedx *trk)
Definition EvtRecTrack.h:78
void setEmcShower(const RecEmcShower *shower)
Definition EvtRecTrack.h:82
void addTofTrack(const SmartRef< RecTofTrack > trk)
Definition EvtRecTrack.h:81
void setExtTrack(const RecExtTrack *trk)
Definition EvtRecTrack.h:79
Int_t extTrackId() const
Int_t mdcTrackId() const
Int_t quality() const
Int_t trackId() const
Int_t partId() const
Int_t mdcDedxId() const
Int_t emcShowerId() const
Int_t mdcKalTrackId() const
const std::vector< Int_t > & tofTrackIds() const
Int_t mucTrackId() const
static std::map< const TObject *, const EvtRecTrack * > m_rootEvtRecTrackMap
Definition commonData.h:269

Friends And Related Symbol Documentation

◆ CnvFactory< EvtRecTrackCnv >

friend class CnvFactory< EvtRecTrackCnv >
friend

Definition at line 9 of file EvtRecTrackCnv.h.


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