BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMdcHitCnv Class Reference

#include <RecMdcHitCnv.h>

Inheritance diagram for RecMdcHitCnv:

Public Member Functions

virtual ~RecMdcHitCnv ()
 RecMdcHitCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~RecMdcHitCnv ()
 RecMdcHitCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~RecMdcHitCnv ()
 RecMdcHitCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
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
 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
 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
destinationoperator (const source &) const
destinationoperator (const source &) const

Static Public Member Functions

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

Friends

class CnvFactory< RecMdcHitCnv >

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RootEventBaseCnv
IRootCnvSvcm_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

Constructor & Destructor Documentation

◆ ~RecMdcHitCnv() [1/3]

virtual RecMdcHitCnv::~RecMdcHitCnv ( )
inlinevirtual

◆ RecMdcHitCnv() [1/3]

RecMdcHitCnv::RecMdcHitCnv ( ISvcLocator * svc)

Definition at line 27 of file RecMdcHitCnv.cxx.

27 : RootEventBaseCnv( classID(), svc ) {
28
29 // Here we associate this converter with the /Event path on the TDS.
30 MsgStream log( msgSvc(), "RecMdcHitCnv" );
31 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
32 // m_rootTreename ="Rec";
33 m_rootBranchname = "m_recMdcHitCol";
34 // declareObject(EventModel::Recon::RecMdcHitCol, objType(), m_rootTreename,
35 // m_rootBranchname);
36 m_adresses.push_back( &m_recMdcHitCol );
37 m_recMdcHitCol = 0;
38}
IMessageSvc * msgSvc()
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)

◆ ~RecMdcHitCnv() [2/3]

virtual RecMdcHitCnv::~RecMdcHitCnv ( )
inlinevirtual

◆ RecMdcHitCnv() [2/3]

RecMdcHitCnv::RecMdcHitCnv ( ISvcLocator * svc)

◆ ~RecMdcHitCnv() [3/3]

virtual RecMdcHitCnv::~RecMdcHitCnv ( )
inlinevirtual

◆ RecMdcHitCnv() [3/3]

RecMdcHitCnv::RecMdcHitCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & RecMdcHitCnv::classID ( )
inlinestatic

Definition at line 19 of file Event/RootCnvSvc/include/RootCnvSvc/Rec/RecMdcHitCnv.h.

19{ return CLID_RecMdcHitCol; }
const CLID & CLID_RecMdcHitCol

Referenced by RootCnvSvc::createConverter(), and RecMdcHitCnv().

◆ classID() [2/3]

const CLID & RecMdcHitCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & RecMdcHitCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

StatusCode RecMdcHitCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 99 of file RecMdcHitCnv.cxx.

99 {
100
101 MsgStream log( msgSvc(), "RecMdcHitCnv" );
102 log << MSG::DEBUG << "RecMdcHitCnv::DataObjectToTObject" << endmsg;
103
104 RecMdcHitCol* mdcHitColTds = dynamic_cast<RecMdcHitCol*>( obj );
105 if ( !mdcHitColTds )
106 {
107 log << MSG::ERROR << "Could not downcast to RecMdcHitCol" << endmsg;
108 return StatusCode::FAILURE;
109 }
110
111 DataObject* evt;
112 m_eds->findObject( EventModel::Recon::Event, evt );
113 if ( evt == NULL )
114 {
115 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endmsg;
116 return StatusCode::FAILURE;
117 }
118
119 ReconEvent* devtTds = dynamic_cast<ReconEvent*>( evt );
120 if ( !devtTds )
121 { log << MSG::ERROR << "RecMdcHitCnv:Could not downcast to TDS ReconEvent" << endmsg; }
122
123 IOpaqueAddress* addr;
124
125 m_cnvSvc->getRecTrackCnv()->createRep( evt, addr );
126 TRecTrackEvent* recEvt = m_cnvSvc->getRecTrackCnv()->getWriteObject();
127
128 const TObjArray* m_recMdcHitCol = recEvt->getRecMdcHitCol();
129 if ( !m_recMdcHitCol ) return StatusCode::SUCCESS;
130 recEvt->clearRecMdcHitCol(); // necessary in case there is I/O at the same time since array
131 // is static
132
133 RecMdcHitCol::const_iterator recMdcHit;
134 for ( recMdcHit = mdcHitColTds->begin(); recMdcHit != mdcHitColTds->end(); recMdcHit++ )
135 {
136 Bool_t isGrouped = ( *recMdcHit )->isGrouped();
137 Int_t id = ( *recMdcHit )->getId();
138 Int_t trackId = ( *recMdcHit )->getTrkId();
139 Double_t driftDistLeft = ( *recMdcHit )->getDriftDistLeft();
140 Double_t driftDistRight = ( *recMdcHit )->getDriftDistRight();
141 Double_t errDriftDistLeft = ( *recMdcHit )->getErrDriftDistLeft();
142 Double_t errDriftDistRight = ( *recMdcHit )->getErrDriftDistRight();
143 Double_t chisqAdd = ( *recMdcHit )->getChisqAdd();
144 Int_t flagLR = ( *recMdcHit )->getFlagLR();
145 Int_t stat = ( *recMdcHit )->getStat();
146 UInt_t mdcId = ( *recMdcHit )->getMdcId().get_value();
147 Double_t tdc = ( *recMdcHit )->getTdc();
148 Double_t adc = ( *recMdcHit )->getAdc();
149 Double_t driftT = ( *recMdcHit )->getDriftT();
150 Double_t doca = ( *recMdcHit )->getDoca();
151 Double_t entra = ( *recMdcHit )->getEntra();
152 Double_t zhit = ( *recMdcHit )->getZhit();
153 Double_t fltLen = ( *recMdcHit )->getFltLen();
154
155 TRecMdcHit* recMdcHitRoot = new TRecMdcHit();
156 // m_common.m_recMdcHitMap[(*recMdcHit)] = recMdcHitRoot;
157
158 recMdcHitRoot->setIsGrouped( isGrouped );
159 recMdcHitRoot->setId( id );
160 recMdcHitRoot->setTrkId( trackId );
161 recMdcHitRoot->setDriftDistLeft( driftDistLeft );
162 recMdcHitRoot->setDriftDistRight( driftDistRight );
163 recMdcHitRoot->setErrDriftDistLeft( errDriftDistLeft );
164 recMdcHitRoot->setErrDriftDistRight( errDriftDistRight );
165 log << MSG::INFO << " recMdcHitRoot.ddl: " << recMdcHitRoot->getDriftDistLeft()
166 << " recMdcHitRoot.erddl: " << recMdcHitRoot->getErrDriftDistLeft() << endmsg;
167 recMdcHitRoot->setChisqAdd( chisqAdd );
168 recMdcHitRoot->setFlagLR( flagLR );
169 recMdcHitRoot->setStat( stat );
170 recMdcHitRoot->setMdcId( mdcId );
171 recMdcHitRoot->setTdc( tdc );
172 recMdcHitRoot->setAdc( adc );
173 recMdcHitRoot->setDriftT( driftT );
174 recMdcHitRoot->setDoca( doca );
175 recMdcHitRoot->setEntra( entra );
176 recMdcHitRoot->setZhit( zhit );
177 recMdcHitRoot->setFltLen( fltLen );
178
179 recEvt->addRecMdcHit( recMdcHitRoot );
180 }
181 return StatusCode::SUCCESS;
182}
IDataProviderSvc * m_eds
pointer to eventdataservice
void addRecMdcHit(TRecMdcHit *Hit)
Add a Rec Mdc Hit into the Mdc data collection.
void clearRecMdcHitCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data

◆ DataObjectToTObject() [2/3]

virtual StatusCode RecMdcHitCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

virtual StatusCode RecMdcHitCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode RecMdcHitCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 40 of file RecMdcHitCnv.cxx.

40 {
41 // creation of TDS object from root object
42 MsgStream log( msgSvc(), "RecMdcHitCnv" );
43 log << MSG::DEBUG << "RecMdcHitCnv::TObjectToDataObject" << endmsg;
44
45 // create the TDS location for the RecMdcHit Collection
46 RecMdcHitCol* recMdcHitCol = new RecMdcHitCol;
47 refpObject = recMdcHitCol;
48
49 // now convert
50 if ( !m_recMdcHitCol ) return StatusCode::SUCCESS;
51 TIter mdcHitIter( m_recMdcHitCol );
52 TRecMdcHit* recMdcHitRoot = 0;
53 while ( ( recMdcHitRoot = (TRecMdcHit*)mdcHitIter.Next() ) )
54 {
55 int id = recMdcHitRoot->getId();
56 int trackId = recMdcHitRoot->getTrkId();
57 double driftDistLeft = recMdcHitRoot->getDriftDistLeft();
58 double driftDistRight = recMdcHitRoot->getDriftDistRight();
59 double errDriftDistLeft = recMdcHitRoot->getErrDriftDistLeft();
60 double errDriftDistRight = recMdcHitRoot->getErrDriftDistRight();
61 double chisqAdd = recMdcHitRoot->getChisqAdd();
62 int flagLR = recMdcHitRoot->getFlagLR();
63 int stat = recMdcHitRoot->getStat();
64 long int mdcId( recMdcHitRoot->getMdcId() );
65 double tdc = recMdcHitRoot->getTdc();
66 double adc = recMdcHitRoot->getAdc();
67 double driftT = recMdcHitRoot->getDriftT();
68 double doca = recMdcHitRoot->getDoca();
69 double entra = recMdcHitRoot->getEntra();
70 double zhit = recMdcHitRoot->getZhit();
71 double fltLen = recMdcHitRoot->getFltLen();
72
73 RecMdcHit* recMdcHit = new RecMdcHit();
74 m_common.m_rootRecMdcHitMap[recMdcHitRoot] = recMdcHit;
75
76 recMdcHit->setId( id );
77 recMdcHit->setTrkId( trackId );
78 recMdcHit->setDriftDistLeft( driftDistLeft );
79 recMdcHit->setDriftDistRight( driftDistRight );
80 recMdcHit->setErrDriftDistLeft( errDriftDistLeft );
81 recMdcHit->setErrDriftDistRight( errDriftDistRight );
82 recMdcHit->setChisqAdd( chisqAdd );
83 recMdcHit->setFlagLR( flagLR );
84 recMdcHit->setStat( stat );
85 recMdcHit->setMdcId( Identifier( mdcId ) );
86 recMdcHit->setTdc( tdc );
87 recMdcHit->setAdc( adc );
88 recMdcHit->setDriftT( driftT );
89 recMdcHit->setDoca( doca );
90 recMdcHit->setEntra( entra );
91 recMdcHit->setZhit( zhit );
92 recMdcHit->setFltLen( fltLen );
93
94 recMdcHitCol->push_back( recMdcHit );
95 }
96 return StatusCode::SUCCESS;
97}

◆ TObjectToDataObject() [2/3]

virtual StatusCode RecMdcHitCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode RecMdcHitCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< RecMdcHitCnv >

friend class CnvFactory< RecMdcHitCnv >
friend

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