CGEM BOSS 6.6.5.g
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.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
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()
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

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
Definition: EventModel.cxx:449

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 451 of file EvtRecTrackCnv.cxx.

451 {
452 MsgStream log(msgSvc(), "EvtRecTrackCnv");
453 log << MSG::DEBUG << "EvtRecTrackCnv::DataObjectToTObject" << endreq;
454
455 EvtRecTrackCol* evtRecTrackCol = dynamic_cast<EvtRecTrackCol*> (obj);
456 if ( ! evtRecTrackCol ) {
457 log << MSG::ERROR << "Could not downcast to EvtRecTrackCol" << endreq;
458 return StatusCode::FAILURE;
459 }
460
461 DataObject* evt = NULL;
462 StatusCode sc = m_eds->findObject(EventModel::EvtRec::Event, evt);
463 if ( sc.isFailure() ) {
464 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
465 return StatusCode::FAILURE;
466 }
467 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
468 if ( ! devtTds ) {
469 log << MSG::ERROR << "EvtRecTrackCnv: Could not downcast to TDS EvtRecObject" << endreq;
470 }
471
472 IOpaqueAddress *addr;
473 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
475
476 const TObjArray* m_evtRecTrackCol = recEvt->getEvtRecTrackCol();
477 if ( ! m_evtRecTrackCol ) return StatusCode::SUCCESS;
478
479 IDataProviderSvc* dataSvc = 0;
480 sc = serviceLocator()->getService("EventDataSvc",
481 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
482 if ( sc.isFailure() ) {
483 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecTrackCnv" << endreq;
484 return sc;
485 }
486
487 RecMdcTrackCol::iterator mdcTrackColbegin, mdcTrackColend;
488 RecMdcKalTrackCol::iterator mdcKalTrackColbegin, mdcKalTrackColend;
489 RecMdcDedxCol::iterator mdcDedxColbegin, mdcDedxColend;
490 RecCgemSegmentCol::iterator cgemSegmentColbegin, cgemSegmentColend;
491 RecCgemTrackCol::iterator cgemTrackColbegin, cgemTrackColend;
492 RecCgemKalTrackCol::iterator cgemKalTrackColbegin, cgemKalTrackColend;
493 RecCgemDedxCol::iterator cgemDedxColbegin, cgemDedxColend;
494 RecExtTrackCol::iterator extTrackColbegin, extTrackColend;
495 RecTofTrackCol::iterator tofTrackColbegin, tofTrackColend;
496 RecEmcShowerCol::iterator emcShowerColbegin, emcShowerColend;
497 RecMucTrackCol::iterator mucTrackColbegin, mucTrackColend;
498
499 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(dataSvc, EventModel::Recon::RecMdcTrackCol);
500 if ( ! mdcTrackCol ) {
501 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq;
502 }
503 else {
504 mdcTrackColbegin = mdcTrackCol->begin();
505 mdcTrackColend = mdcTrackCol->end();
506 }
507
508 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(dataSvc, EventModel::Recon::RecMdcKalTrackCol);
509 if ( ! mdcKalTrackCol ) {
510 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endreq;
511 }
512 else {
513 mdcKalTrackColbegin = mdcKalTrackCol->begin();
514 mdcKalTrackColend = mdcKalTrackCol->end();
515 }
516
517 SmartDataPtr<RecMdcDedxCol> mdcDedxCol(dataSvc, EventModel::Recon::RecMdcDedxCol);
518 if ( ! mdcDedxCol ) {
519 log << MSG::INFO << "Could not find RecMdcDedxCol" << endreq;
520 }
521 else {
522 mdcDedxColbegin = mdcDedxCol->begin();
523 mdcDedxColend = mdcDedxCol->end();
524 }
525
526 SmartDataPtr<RecCgemSegmentCol> cgemSegmentCol(dataSvc, EventModel::Recon::RecCgemSegmentCol);
527 if ( ! cgemSegmentCol ) {
528 log << MSG::INFO << "Could not find RecCgemSegmentCol" << endreq;
529 }
530 else {
531 cgemSegmentColbegin = cgemSegmentCol->begin();
532 cgemSegmentColend = cgemSegmentCol->end();
533 }
534
535 SmartDataPtr<RecCgemTrackCol> cgemTrackCol(dataSvc, EventModel::Recon::RecCgemTrackCol);
536 if ( ! cgemTrackCol ) {
537 log << MSG::INFO << "Could not find RecCgemTrackCol" << endreq;
538 }
539 else {
540 cgemTrackColbegin = cgemTrackCol->begin();
541 cgemTrackColend = cgemTrackCol->end();
542 }
543
544 SmartDataPtr<RecCgemKalTrackCol> cgemKalTrackCol(dataSvc, EventModel::Recon::RecCgemKalTrackCol);
545 if ( ! cgemKalTrackCol ) {
546 log << MSG::INFO << "Could not find RecCgemKalTrackCol" << endreq;
547 }
548 else {
549 cgemKalTrackColbegin = cgemKalTrackCol->begin();
550 cgemKalTrackColend = cgemKalTrackCol->end();
551 }
552
553 SmartDataPtr<RecCgemDedxCol> cgemDedxCol(dataSvc, EventModel::Recon::RecCgemDedxCol);
554 if ( ! cgemDedxCol ) {
555 log << MSG::INFO << "Could not find RecCgemDedxCol" << endreq;
556 }
557 else {
558 cgemDedxColbegin = cgemDedxCol->begin();
559 cgemDedxColend = cgemDedxCol->end();
560 }
561
562 SmartDataPtr<RecExtTrackCol> extTrackCol(dataSvc, EventModel::Recon::RecExtTrackCol);
563 if ( ! extTrackCol ) {
564 log << MSG::INFO << "Could not find RecExtTrackCol" << endreq;
565 }
566 else {
567 extTrackColbegin = extTrackCol->begin();
568 extTrackColend = extTrackCol->end();
569 }
570
571 SmartDataPtr<RecTofTrackCol> tofTrackCol(dataSvc, EventModel::Recon::RecTofTrackCol);
572 if ( ! tofTrackCol ) {
573 log << MSG::INFO << "Could not find RecTofTrackCol" << endreq;
574 }
575 else {
576 tofTrackColbegin = tofTrackCol->begin();
577 tofTrackColend = tofTrackCol->end();
578 }
579
580 SmartDataPtr<RecEmcShowerCol> emcShowerCol(dataSvc, EventModel::Recon::RecEmcShowerCol);
581 if ( ! emcShowerCol ) {
582 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
583 }
584 else {
585 emcShowerColbegin = emcShowerCol->begin();
586 emcShowerColend = emcShowerCol->end();
587 }
588
589 SmartDataPtr<RecMucTrackCol> mucTrackCol(dataSvc, EventModel::Recon::RecMucTrackCol);
590 if ( ! mucTrackCol ) {
591 log << MSG::INFO << "Could not find RecMucTrackCol" << endreq;
592 }
593 else {
594 mucTrackColbegin = mucTrackCol->begin();
595 mucTrackColend = mucTrackCol->end();
596 }
597
598 // convert
599 recEvt->clearEvtRecTrackCol();
600 EvtRecTrackCol::const_iterator evtRecTrack = evtRecTrackCol->begin();
601
602 for ( ; evtRecTrack != evtRecTrackCol->end(); evtRecTrack++) {
603 EvtRecTrack* ptr = *evtRecTrack;
604 TEvtRecTrack* evtRecTrackRoot = new TEvtRecTrack();
605 // set ...
606 evtRecTrackRoot->setTrackId( ptr->trackId() );
607 evtRecTrackRoot->setPartId( ptr->partId() );
608 evtRecTrackRoot->setQuality( ptr->quality() );
609
610 if ( ptr->isMdcTrackValid() ) {
611 RecMdcTrackCol::iterator it = find(mdcTrackColbegin, mdcTrackColend, ptr->mdcTrack());
612 evtRecTrackRoot->setMdcTrackId( it - mdcTrackColbegin );
613 }
614 if ( ptr->isMdcKalTrackValid() ) {
615 RecMdcKalTrackCol::iterator it = find(mdcKalTrackColbegin, mdcKalTrackColend, ptr->mdcKalTrack());
616 evtRecTrackRoot->setMdcKalTrackId( it - mdcKalTrackColbegin );
617 }
618 if ( ptr->isMdcDedxValid() ) {
619 RecMdcDedxCol::iterator it = find(mdcDedxColbegin, mdcDedxColend, ptr->mdcDedx());
620 evtRecTrackRoot->setMdcDedxId( it - mdcDedxColbegin );
621 }
622 if ( ptr->isCgemTrackValid() ) {
623 RecCgemTrackCol::iterator it = find(cgemTrackColbegin, cgemTrackColend, ptr->cgemTrack());
624 evtRecTrackRoot->setCgemTrackId( it - cgemTrackColbegin );
625 }
626 if ( ptr->isCgemSegmentValid() ) {
627 RecCgemSegmentCol::iterator it = find(cgemSegmentColbegin, cgemSegmentColend, ptr->cgemSegment());
628 evtRecTrackRoot->setCgemSegmentId( it - cgemSegmentColbegin );
629 }
630 if ( ptr->isCgemKalTrackValid() ) {
631 RecCgemKalTrackCol::iterator it = find(cgemKalTrackColbegin, cgemKalTrackColend, ptr->cgemKalTrack());
632 evtRecTrackRoot->setCgemKalTrackId( it - cgemKalTrackColbegin );
633 }
634 if ( ptr->isCgemDedxValid() ) {
635 RecCgemDedxCol::iterator it = find(cgemDedxColbegin, cgemDedxColend, ptr->cgemDedx());
636 evtRecTrackRoot->setCgemDedxId( it - cgemDedxColbegin );
637 }
638 if ( ptr->isExtTrackValid() ) {
639 RecExtTrackCol::iterator it = find(extTrackColbegin, extTrackColend, ptr->extTrack());
640 evtRecTrackRoot->setExtTrackId( it - extTrackColbegin );
641 }
642 if ( ptr->isTofTrackValid() ) {
643 SmartRefVector<RecTofTrack> tofTrackVec = ptr->tofTrack();
644 for ( unsigned int i = 0; i < tofTrackVec.size(); i++ ) {
645 RecTofTrackCol::iterator it = find(tofTrackColbegin, tofTrackColend, tofTrackVec[i]);
646 evtRecTrackRoot->addTofTrackId( it - tofTrackColbegin );
647 }
648 }
649 if ( ptr->isEmcShowerValid() ) {
650 RecEmcShowerCol::iterator it = find(emcShowerColbegin, emcShowerColend, ptr->emcShower());
651 evtRecTrackRoot->setEmcShowerId( it - emcShowerColbegin );
652 }
653 if ( ptr->isMucTrackValid() ) {
654 RecMucTrackCol::iterator it = find(mucTrackColbegin, mucTrackColend, ptr->mucTrack());
655 evtRecTrackRoot->setMucTrackId( it - mucTrackColbegin );
656 }
657
658 recEvt->addEvtRecTrack(evtRecTrackRoot);
659 }
660
661 return StatusCode::SUCCESS;
662}
ObjectVector< EvtRecTrack > EvtRecTrackCol
Definition: EvtRecTrack.h:129
IMessageSvc * msgSvc()
static TEvtRecObject * getWriteObject()
Definition: EvtRecCnv.h:26
bool isMdcDedxValid()
Definition: EvtRecTrack.h:49
int quality() const
Definition: EvtRecTrack.h:38
RecCgemSegment * cgemSegment()
Definition: EvtRecTrack.h:65
int trackId() const
Definition: EvtRecTrack.h:36
RecMucTrack * mucTrack()
Definition: EvtRecTrack.h:71
RecCgemKalTrack * cgemKalTrack()
Definition: EvtRecTrack.h:66
RecCgemDedx * cgemDedx()
Definition: EvtRecTrack.h:67
int partId() const
Definition: EvtRecTrack.h:37
RecMdcDedx * mdcDedx()
Definition: EvtRecTrack.h:63
bool isExtTrackValid()
Definition: EvtRecTrack.h:57
bool isCgemSegmentValid()
Definition: EvtRecTrack.h:51
RecExtTrack * extTrack()
Definition: EvtRecTrack.h:68
bool isMdcKalTrackValid()
Definition: EvtRecTrack.h:48
bool isMucTrackValid()
Definition: EvtRecTrack.h:56
bool isCgemTrackValid()
Definition: EvtRecTrack.h:50
SmartRefVector< RecTofTrack > tofTrack()
Definition: EvtRecTrack.h:69
bool isTofTrackValid()
Definition: EvtRecTrack.h:54
RecEmcShower * emcShower()
Definition: EvtRecTrack.h:70
RecCgemTrack * cgemTrack()
Definition: EvtRecTrack.h:64
bool isMdcTrackValid()
Definition: EvtRecTrack.h:47
bool isCgemDedxValid()
Definition: EvtRecTrack.h:53
bool isEmcShowerValid()
Definition: EvtRecTrack.h:55
RecMdcTrack * mdcTrack()
Definition: EvtRecTrack.h:61
bool isCgemKalTrackValid()
Definition: EvtRecTrack.h:52
RecMdcKalTrack * mdcKalTrack()
Definition: EvtRecTrack.h:62
EvtRecCnv * getEvtRecCnv()
Definition: RootCnvSvc.h:152
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()
Definition: TEvtRecObject.h:36
void addEvtRecTrack(TEvtRecTrack *track)
const TObjArray * getEvtRecTrackCol() const
Definition: TEvtRecObject.h:33
void addTofTrackId(const int tofTrackId)
Definition: TEvtRecTrack.h:45
void setTrackId(const int trackId)
Definition: TEvtRecTrack.h:30
void setCgemTrackId(const int cgemTrackId)
Definition: TEvtRecTrack.h:36
void setMdcTrackId(const int mdcTrackId)
Definition: TEvtRecTrack.h:33
void setCgemKalTrackId(const int cgemKalTrackId)
Definition: TEvtRecTrack.h:38
void setMdcDedxId(const int mdcDedxId)
Definition: TEvtRecTrack.h:35
void setMucTrackId(const int mucTrackId)
Definition: TEvtRecTrack.h:42
void setCgemSegmentId(const int cgemSegmentId)
Definition: TEvtRecTrack.h:37
void setMdcKalTrackId(const int mdcKalTrackId)
Definition: TEvtRecTrack.h:34
void setEmcShowerId(const int emcShowerId)
Definition: TEvtRecTrack.h:41
void setPartId(const int partId)
Definition: TEvtRecTrack.h:31
void setExtTrackId(const int extTrackId)
Definition: TEvtRecTrack.h:40
void setCgemDedxId(const int cgemDedxId)
Definition: TEvtRecTrack.h:39
void setQuality(const int quality)
Definition: TEvtRecTrack.h:32
_EXTERN_ std::string Event
Definition: EventModel.h:133
_EXTERN_ std::string RecCgemTrackCol
Definition: EventModel.h:118
_EXTERN_ std::string RecExtTrackCol
Definition: EventModel.h:99
_EXTERN_ std::string RecCgemDedxCol
Definition: EventModel.h:121
_EXTERN_ std::string RecMdcDedxCol
Definition: EventModel.h:94
_EXTERN_ std::string RecTofTrackCol
Definition: EventModel.h:103
_EXTERN_ std::string RecCgemKalTrackCol
Definition: EventModel.h:123
_EXTERN_ std::string RecCgemSegmentCol
Definition: EventModel.h:119
_EXTERN_ std::string RecMdcTrackCol
Definition: EventModel.h:92
_EXTERN_ std::string RecMdcKalTrackCol
Definition: EventModel.h:96
_EXTERN_ std::string RecMucTrackCol
Definition: EventModel.h:112
_EXTERN_ std::string RecEmcShowerCol
Definition: EventModel.h:109

◆ 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 // Retrieve Cgem Track
157 SmartDataPtr<RecCgemTrackCol> cgemTrackCol(dataSvc, EventModel::Recon::RecCgemTrackCol);
158 if(!cgemTrackCol)
159 {
160 log << MSG::INFO << "Could not find RecCgemTrackCol" << endreq;
161 SmartDataPtr<DstCgemTrackCol> dstCgemTrackCol(dataSvc,"/Event/Dst/DstCgemTrackCol");
162 if (!dstCgemTrackCol) {
163 log << MSG::INFO << "Could not find DstCgemTrackCol" << endreq;
164 }
165 else {
166 RecCgemTrackCol* cgemTrackCol = new RecCgemTrackCol();
167 DstCgemTrackCol::iterator iter_cgem = dstCgemTrackCol->begin();
168 trackID = 0;
169 for (;iter_cgem != dstCgemTrackCol->end(); iter_cgem++, trackID++) {
170 RecCgemTrack* recCgemTrack = new RecCgemTrack();
171 *recCgemTrack = **iter_cgem;
172 (*cgemTrackCol).push_back(recCgemTrack);
173 log << MSG::INFO
174 << " Cgem Track ID = " << trackID
175 << endreq;
176 }
177 sc = dataSvc->registerObject(EventModel::Recon::RecCgemTrackCol,cgemTrackCol);
178 }
179 }
180
181 // Retrieve Cgem segment ; add by sunxh
182 SmartDataPtr<RecCgemSegmentCol> cgemSegmentCol(dataSvc, EventModel::Recon::RecCgemSegmentCol);
183 if(!cgemSegmentCol)
184 {
185 log << MSG::INFO << "Could not find RecCgemSegmentCol" << endreq;
186 SmartDataPtr<DstCgemSegmentCol> dstCgemSegmentCol(dataSvc,"/Event/Dst/DstCgemSegmentCol");
187 if (!dstCgemSegmentCol) {
188 log << MSG::INFO << "Could not find DstCgemSegmentCol" << endreq;
189 }
190 else {
191 RecCgemSegmentCol* cgemSegmentCol = new RecCgemSegmentCol();
192 DstCgemSegmentCol::iterator iter_cgem = dstCgemSegmentCol->begin();
193 trackID = 0;
194 for (;iter_cgem != dstCgemSegmentCol->end(); iter_cgem++, trackID++) {
195 RecCgemSegment* recCgemSegment = new RecCgemSegment();
196 *recCgemSegment = **iter_cgem;
197 (*cgemSegmentCol).push_back(recCgemSegment);
198 log << MSG::INFO
199 << " Cgem Track ID = " << trackID
200 << endreq;
201 }
202 sc = dataSvc->registerObject(EventModel::Recon::RecCgemSegmentCol,cgemSegmentCol);
203 }
204 }
205
206 // Retrieve CgemKal track
207 SmartDataPtr<RecCgemKalTrackCol> cgemKalTrackCol(dataSvc, EventModel::Recon::RecCgemKalTrackCol);
208 if (!cgemKalTrackCol) {
209 log << MSG::INFO << "Could not find RecCgemKalTrackCol" << endreq;
210 SmartDataPtr<DstCgemKalTrackCol> dstCgemKalTrackCol(dataSvc,"/Event/Dst/DstCgemKalTrackCol");
211 if(!dstCgemKalTrackCol) {
212 log << MSG::INFO << "Could not find DstCgemKalTrackCol" << endreq;
213 }
214 else {
215 RecCgemKalTrackCol* cgemKalTrackCol = new RecCgemKalTrackCol();
216 DstCgemKalTrackCol::iterator iter_cgem = dstCgemKalTrackCol->begin();
217 trackID = 0;
218 for (;iter_cgem != dstCgemKalTrackCol->end(); iter_cgem++, trackID++) {
219 RecCgemKalTrack* recCgemKalTrack = new RecCgemKalTrack();
220 *recCgemKalTrack = **iter_cgem;
221 (*cgemKalTrackCol).push_back(recCgemKalTrack);
222 log << MSG::INFO
223 << " CgemKalTrack ID = " << trackID
224 << " CgemKalTrack poca = " << (*iter_cgem)->poca()
225 << endreq;
226 }
227 sc = dataSvc->registerObject(EventModel::Recon::RecCgemKalTrackCol, cgemKalTrackCol);
228 }
229 }
230
231 // Retrieve CgemDedx
232 SmartDataPtr<RecCgemDedxCol> cgemDedxCol(dataSvc, EventModel::Recon::RecCgemDedxCol);
233 if (!cgemDedxCol) {
234 log <<MSG::INFO << "Could not find RecCgemDedxCol" << endreq;
235 SmartDataPtr<DstCgemDedxCol> dstCgemDedxCol(dataSvc,"/Event/Dst/DstCgemDedxCol");
236 if(!dstCgemDedxCol) {
237 log <<MSG::INFO << "Could not find DstCgemDedxCol" << endreq;
238 }
239 else {
240 RecCgemDedxCol* cgemDedxCol = new RecCgemDedxCol();
241 DstCgemDedxCol::iterator iter_cgem = dstCgemDedxCol->begin();
242 trackID=0;
243 for (;iter_cgem != dstCgemDedxCol->end(); iter_cgem++, trackID++) {
244 RecCgemDedx* recCgemDedx = new RecCgemDedx();
245 *recCgemDedx= **iter_cgem;
246 (*cgemDedxCol).push_back(recCgemDedx);
247 log << MSG::INFO
248 << " CgemDedx ID = " << trackID
249 << " CgemDedx "
250 << endreq;
251 }
252 sc = dataSvc->registerObject(EventModel::Recon::RecCgemDedxCol, cgemDedxCol);
253 }
254 }
255
256 // Retrieve Ext track
257 SmartDataPtr<RecExtTrackCol> extTrackCol(dataSvc, EventModel::Recon::RecExtTrackCol);
258 if (!extTrackCol) {
259 log <<MSG::INFO << "Could not find RecExtTrackCol" << endreq;
260 SmartDataPtr<DstExtTrackCol> dstExtTrackCol(dataSvc,"/Event/Dst/DstExtTrackCol");
261 if(!dstExtTrackCol) {
262 log <<MSG::INFO << "Could not find DstExtTrackCol" << endreq;
263 }
264 else {
265 RecExtTrackCol* extTrackCol = new RecExtTrackCol();
266 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
267 trackID=0;
268 for (;iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++) {
269 RecExtTrack* recExtTrack = new RecExtTrack();
270 *recExtTrack = **iter_ext;
271 (*extTrackCol).push_back(recExtTrack);
272 log << MSG::INFO
273 << " ExtTrack ID = " << trackID
274 << endreq;
275 }
276 sc = dataSvc->registerObject(EventModel::Recon::RecExtTrackCol, extTrackCol);
277 }
278 }
279
280 // Retrieve Tof Track
281 SmartDataPtr<RecTofTrackCol> tofTrackCol(dataSvc, EventModel::Recon::RecTofTrackCol);
282 if ( !tofTrackCol ) {
283 log << MSG::INFO << "Could not find TofTrackCol" << endreq;
284 SmartDataPtr<DstTofTrackCol> dstTofTrackCol(dataSvc,"/Event/Dst/DstTofTrackCol");
285 if(!dstTofTrackCol) {
286 log << MSG::INFO << "Could not find DstTofTrackCol" << endreq;
287 }
288 else {
289 RecTofTrackCol* tofTrackCol = new RecTofTrackCol();
290 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
291 for (;iter_tof != dstTofTrackCol->end(); iter_tof++) {
292 RecTofTrack* recTofTrack = new RecTofTrack();
293 *recTofTrack = **iter_tof;
294 (*tofTrackCol).push_back(recTofTrack);
295 log << MSG::INFO
296 << "Tof Track ID = " << (*iter_tof)->tofTrackID()
297 << " Track ID = " << (*iter_tof)->trackID()
298 << " Tof Counter ID = "<<(*iter_tof)->tofID()
299 << " Quality = "<< (*iter_tof)->quality()
300 << endreq;
301 }
302 sc = dataSvc->registerObject(EventModel::Recon::RecTofTrackCol, tofTrackCol);
303 }
304 }
305
306
307 // Retrieve Emc shower
308 SmartDataPtr<RecEmcShowerCol> emcShowerCol(dataSvc, EventModel::Recon::RecEmcShowerCol);
309 if (!emcShowerCol) {
310 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
311 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol(dataSvc,"/Event/Dst/DstEmcShowerCol");
312 if(!dstEmcShowerCol) {
313 log << MSG::INFO << "Could not find DstEmcShowerCol" << endreq;
314 }
315 else {
316 RecEmcShowerCol* emcShowerCol = new RecEmcShowerCol();
317 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
318 trackID=0;
319 for (;iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++) {
320 RecEmcShower* recEmcShower = new RecEmcShower();
321 *recEmcShower = **iter_emc;
322 (*emcShowerCol).push_back(recEmcShower);
323 log << MSG::INFO
324 << " EmcShower ID = " << trackID
325 << " EmcShower energy = " << (*iter_emc)->energy()
326 << endreq;
327 }
328 sc = dataSvc->registerObject(EventModel::Recon::RecEmcShowerCol, emcShowerCol);
329 }
330 }
331
332 // Retrieve Muc Track
333 SmartDataPtr<RecMucTrackCol> mucTrackCol(dataSvc, EventModel::Recon::RecMucTrackCol);
334 if (!mucTrackCol) {
335 log <<MSG::INFO << "Could not find RecMucTrackCol" << endreq;
336 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(dataSvc,"/Event/Dst/DstMucTrackCol");
337 if(!dstMucTrackCol) {
338 log <<MSG::INFO << "Could not find DstMucTrackCol" << endreq;
339 }
340 else {
341 RecMucTrackCol* mucTrackCol = new RecMucTrackCol();
342 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
343 trackID=0;
344 for (;iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++) {
345 RecMucTrack* recMucTrack = new RecMucTrack();
346 *recMucTrack = **iter_muc;
347 (*mucTrackCol).push_back(recMucTrack);
348 log << MSG::INFO
349 << " MucTrack ID = "<< trackID
350 <<endreq;
351 }
352 sc = dataSvc->registerObject(EventModel::Recon::RecMucTrackCol, mucTrackCol);
353 }
354 }
355
356 // convert
357 TIter evtRecTrackIter(m_evtRecTrackCol);
358 TEvtRecTrack* evtRecTrackRoot = 0;
359 while ( (evtRecTrackRoot = (TEvtRecTrack*)evtRecTrackIter.Next() ) ) {
360 EvtRecTrack* evtRecTrack = new EvtRecTrack();
361 m_common.m_rootEvtRecTrackMap[evtRecTrackRoot] = evtRecTrack;
362 // set ....
363 evtRecTrack->setTrackId( evtRecTrackRoot->trackId() );
364 evtRecTrack->setPartId( evtRecTrackRoot->partId() );
365 evtRecTrack->setQuality( evtRecTrackRoot->quality() );
366
367 int mdcTrackId = evtRecTrackRoot->mdcTrackId();
368 if ( mdcTrackId >= 0 ) {
369 evtRecTrack->setMdcTrack(
370 dynamic_cast<RecMdcTrack*>(mdcTrackCol->containedObject(mdcTrackId))
371 );
372 }
373
374 int mdcKalTrackId = evtRecTrackRoot->mdcKalTrackId();
375 if ( mdcKalTrackId >= 0 ) {
376 evtRecTrack->setMdcKalTrack(
377 dynamic_cast<RecMdcKalTrack*>(mdcKalTrackCol->containedObject(mdcKalTrackId))
378 );
379 }
380
381 int mdcDedxId = evtRecTrackRoot->mdcDedxId();
382 if ( mdcDedxId >= 0 ) {
383 evtRecTrack->setMdcDedx(
384 dynamic_cast<RecMdcDedx*>(mdcDedxCol->containedObject(mdcDedxId))
385 );
386 }
387
388 int cgemSegmentId = evtRecTrackRoot->cgemSegmentId();
389 if ( cgemSegmentId >= 0 ) {
390 evtRecTrack->setCgemSegment(
391 dynamic_cast<RecCgemSegment*>(cgemSegmentCol->containedObject(cgemSegmentId))
392 );
393 }
394
395 int cgemTrackId = evtRecTrackRoot->cgemTrackId();
396 if ( cgemTrackId >= 0 ) {
397 evtRecTrack->setCgemTrack(
398 dynamic_cast<RecCgemTrack*>(cgemTrackCol->containedObject(cgemTrackId))
399 );
400 }
401
402 int cgemKalTrackId = evtRecTrackRoot->cgemKalTrackId();
403 if ( cgemKalTrackId >= 0 ) {
404 evtRecTrack->setCgemKalTrack(
405 dynamic_cast<RecCgemKalTrack*>(cgemKalTrackCol->containedObject(cgemKalTrackId))
406 );
407 }
408
409 int cgemDedxId = evtRecTrackRoot->cgemDedxId();
410 if ( cgemDedxId >= 0 ) {
411 evtRecTrack->setCgemDedx(
412 dynamic_cast<RecCgemDedx*>(cgemDedxCol->containedObject(cgemDedxId))
413 );
414 }
415
416 int extTrackId = evtRecTrackRoot->extTrackId();
417 if ( extTrackId >= 0 ) {
418 evtRecTrack->setExtTrack(
419 dynamic_cast<RecExtTrack*>(extTrackCol->containedObject(extTrackId))
420 );
421 }
422
423 const std::vector<int>& tofTrackIds = evtRecTrackRoot->tofTrackIds();
424 for ( unsigned int i = 0; i < tofTrackIds.size(); i++) {
425 RecTofTrack* tofTrack = dynamic_cast<RecTofTrack*>(tofTrackCol->containedObject(tofTrackIds[i]));
426 evtRecTrack->addTofTrack(tofTrack);
427 }
428
429 int emcShowerId = evtRecTrackRoot->emcShowerId();
430 if ( emcShowerId >= 0 ) {
431 evtRecTrack->setEmcShower(
432 dynamic_cast<RecEmcShower*>(emcShowerCol->containedObject(emcShowerId))
433 );
434 }
435
436 int mucTrackId = evtRecTrackRoot->mucTrackId();
437 if ( mucTrackId >= 0 ) {
438 evtRecTrack->setMucTrack(
439 dynamic_cast<RecMucTrack*>(mucTrackCol->containedObject(mucTrackId))
440 );
441 }
442
443 evtRecTrackCol->push_back(evtRecTrack);
444 }
445
446 delete m_evtRecTrackCol;
447 m_evtRecTrackCol = 0;
448 return StatusCode::SUCCESS;
449}
ObjectVector< RecCgemDedx > RecCgemDedxCol
Definition: RecCgemDedx.h:120
ObjectVector< RecCgemKalTrack > RecCgemKalTrackCol
ObjectVector< RecCgemSegment > RecCgemSegmentCol
ObjectVector< RecCgemTrack > RecCgemTrackCol
Definition: RecCgemTrack.h:79
ObjectVector< RecEmcShower > RecEmcShowerCol
Definition: RecEmcShower.h:171
ObjectVector< RecExtTrack > RecExtTrackCol
Definition: RecExtTrack.h:209
ObjectVector< RecMdcDedx > RecMdcDedxCol
Definition: RecMdcDedx.h:132
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
Definition: RecMdcTrack.h:102
ObjectVector< RecMucTrack > RecMucTrackCol
Definition: RecMucTrack.h:394
ObjectVector< RecTofTrack > RecTofTrackCol
Definition: RecTofTrack.h:33
const HepPoint3D poca() const
double energy() const
Definition: DstEmcShower.h:45
const int nster() const
const int nster() const
Definition: DstMdcTrack.h:68
int tofTrackID() const
Definition: DstTofTrack.h:40
void setCgemTrack(const RecCgemTrack *trk)
Definition: EvtRecTrack.h:91
void setCgemDedx(const RecCgemDedx *trk)
Definition: EvtRecTrack.h:94
void setMucTrack(const RecMucTrack *trk)
Definition: EvtRecTrack.h:99
void setQuality(const int quality)
Definition: EvtRecTrack.h:78
void setPartId(const int partId)
Definition: EvtRecTrack.h:77
void setMdcTrack(const RecMdcTrack *trk)
Definition: EvtRecTrack.h:88
void setCgemSegment(const RecCgemSegment *trk)
Definition: EvtRecTrack.h:92
void setTrackId(const int trkId)
Definition: EvtRecTrack.h:76
void setMdcKalTrack(const RecMdcKalTrack *trk)
Definition: EvtRecTrack.h:89
void setCgemKalTrack(const RecCgemKalTrack *trk)
Definition: EvtRecTrack.h:93
void setMdcDedx(const RecMdcDedx *trk)
Definition: EvtRecTrack.h:90
void setEmcShower(const RecEmcShower *shower)
Definition: EvtRecTrack.h:98
void addTofTrack(const SmartRef< RecTofTrack > trk)
Definition: EvtRecTrack.h:97
void setExtTrack(const RecExtTrack *trk)
Definition: EvtRecTrack.h:95
Int_t extTrackId() const
Definition: TEvtRecTrack.h:24
Int_t cgemTrackId() const
Definition: TEvtRecTrack.h:20
Int_t cgemSegmentId() const
Definition: TEvtRecTrack.h:21
Int_t cgemDedxId() const
Definition: TEvtRecTrack.h:23
Int_t mdcTrackId() const
Definition: TEvtRecTrack.h:17
Int_t quality() const
Definition: TEvtRecTrack.h:16
Int_t trackId() const
Definition: TEvtRecTrack.h:14
Int_t partId() const
Definition: TEvtRecTrack.h:15
Int_t mdcDedxId() const
Definition: TEvtRecTrack.h:19
Int_t emcShowerId() const
Definition: TEvtRecTrack.h:25
Int_t mdcKalTrackId() const
Definition: TEvtRecTrack.h:18
const std::vector< Int_t > & tofTrackIds() const
Definition: TEvtRecTrack.h:28
Int_t cgemKalTrackId() const
Definition: TEvtRecTrack.h:22
Int_t mucTrackId() const
Definition: TEvtRecTrack.h:26
static std::map< const TObject *, const EvtRecTrack * > m_rootEvtRecTrackMap
Definition: commonData.h:329

Friends And Related Function 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: