CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcMcHitCnv Class Reference

#include <MdcMcHitCnv.h>

+ Inheritance diagram for MdcMcHitCnv:

Public Member Functions

virtual ~MdcMcHitCnv ()
 
virtual ~MdcMcHitCnv ()
 
virtual ~MdcMcHitCnv ()
 
- 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
 
 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
 
 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
 
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.
 

Protected Member Functions

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

Friends

class CnvFactory< MdcMcHitCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
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

Constructor & Destructor Documentation

◆ ~MdcMcHitCnv() [1/3]

virtual MdcMcHitCnv::~MdcMcHitCnv ( )
inlinevirtual

◆ MdcMcHitCnv() [1/3]

MdcMcHitCnv::MdcMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 25 of file bak_RootCnvSvc-04-01-14/src/Mc/MdcMcHitCnv.cxx.

27{
28 // Here we associate this converter with the /Event path on the TDS.
29 MsgStream log(msgSvc(), "MdcMcHitCnv");
30 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
31 m_rootBranchname ="m_mdcMcHitCol";
32 //declareObject(EventModel::MC::MdcMcHitCol, objType(), m_rootTreename, m_rootBranchname);
33 m_adresses.push_back(&m_mdcMcHitCol);
34 m_mdcMcHitCol=0;
35}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~MdcMcHitCnv() [2/3]

virtual MdcMcHitCnv::~MdcMcHitCnv ( )
inlinevirtual

◆ MdcMcHitCnv() [2/3]

MdcMcHitCnv::MdcMcHitCnv ( ISvcLocator *  svc)
protected

◆ ~MdcMcHitCnv() [3/3]

virtual MdcMcHitCnv::~MdcMcHitCnv ( )
inlinevirtual

◆ MdcMcHitCnv() [3/3]

MdcMcHitCnv::MdcMcHitCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & MdcMcHitCnv::classID ( )
inlinestatic

Definition at line 24 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Mc/MdcMcHitCnv.h.

25 {
26 return CLID_MdcMcHitCol;
27 }
const CLID & CLID_MdcMcHitCol
Definition: EventModel.cxx:236

◆ classID() [2/3]

static const CLID & MdcMcHitCnv::classID ( )
inlinestatic

◆ classID() [3/3]

static const CLID & MdcMcHitCnv::classID ( )
inlinestatic

Definition at line 24 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Mc/MdcMcHitCnv.h.

25 {
26 return CLID_MdcMcHitCol;
27 }

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 83 of file bak_RootCnvSvc-04-01-14/src/Mc/MdcMcHitCnv.cxx.

83 {
84
85 MsgStream log(msgSvc(), "MdcMcHitCnv");
86 log << MSG::DEBUG << "MdcMcHitCnv::DataObjectToTObject" << endreq;
87 StatusCode sc=StatusCode::SUCCESS;
88
89 MdcMcHitCol * mdcMcHitCnvTds=dynamic_cast<MdcMcHitCol *> (obj);
90 if (!mdcMcHitCnvTds) {
91 log << MSG::ERROR << "Could not downcast to MdcMcHitCol" << endreq;
92 return StatusCode::FAILURE;
93 }
94
95 DataObject *evt;
96 m_eds->findObject(EventModel::MC::Event,evt);
97 if (evt==NULL) {
98 log << MSG::ERROR << "Could not get McEvent in TDS " << endreq;
99 return StatusCode::FAILURE;
100 }
101 McEvent * devtTds=dynamic_cast<McEvent *> (evt);
102 if (!devtTds) {
103 log << MSG::ERROR << "MdcMcHitCnv:Could not downcast to TDS McEvent" << endreq;
104 }
105 IOpaqueAddress *addr;
106
107 m_cnvSvc->getMcCnv()->createRep(evt,addr);
109
110 const TObjArray *m_mdcMcHitCol = McEvt->getMdcMcHitCol();
111 if (!m_mdcMcHitCol) return sc;
112 McEvt->clearMdcMcHitCol(); //necessary in case there is I/O at the same time since array is static
113 MdcMcHitCol::const_iterator mdcMcTds;
114
115 for (mdcMcTds = mdcMcHitCnvTds->begin(); mdcMcTds != mdcMcHitCnvTds->end(); mdcMcTds++) {
116 UInt_t id = ((*mdcMcTds)->identify()).get_value() ;
117 UInt_t trackIndex = (*mdcMcTds) ->getTrackIndex();
118 Double_t xPosition = (*mdcMcTds) ->getPositionX() ;
119 Double_t yPosition = (*mdcMcTds) ->getPositionY() ;
120 Double_t zPosition = (*mdcMcTds) ->getPositionZ() ;
121 Double_t driftDistance= (*mdcMcTds) ->getDriftDistance();
122 Double_t depositEnergy = (*mdcMcTds) ->getDepositEnergy() ;
123 Int_t positionFlag = (*mdcMcTds) ->getPositionFlag();
124
125 TMdcMc *mdcMcRoot = new TMdcMc();
126 //m_common.m_mdcMcHitMap[(*mdcMcTds)] = mdcMcRoot;
127
128 mdcMcRoot->setId(id);
129 mdcMcRoot->setTrackIndex(trackIndex);
130 mdcMcRoot->setPositionX(xPosition);
131 mdcMcRoot->setPositionY(yPosition);
132 mdcMcRoot->setPositionZ(zPosition);
133 mdcMcRoot->setDriftDistance(driftDistance);
134 mdcMcRoot->setDepositEnergy(depositEnergy);
135 mdcMcRoot->setPositionFlag(positionFlag);
136
137 McEvt->addMdcMc(mdcMcRoot);
138 }
139
140 return StatusCode::SUCCESS;
141}
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addMdcMc(TMdcMc *mcHit)
Mdc.
ObjectVector< MdcMcHit > MdcMcHitCol

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 37 of file bak_RootCnvSvc-04-01-14/src/Mc/MdcMcHitCnv.cxx.

37 {
38 // creation of TDS object from root object
39
40 MsgStream log(msgSvc(), "MdcMcHitCnv");
41 log << MSG::DEBUG << "MdcMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44 // create the TDS location for the MdcMc Collection
45 MdcMcHitCol* mdcMcTdsCol = new MdcMcHitCol;
46 refpObject=mdcMcTdsCol;
47
48
49 // now convert
50 if (!m_mdcMcHitCol) return sc;
51 TIter mdcMcIter(m_mdcMcHitCol);
52 TMdcMc *mdcMcRoot = 0;
53 while ((mdcMcRoot = (TMdcMc*)mdcMcIter.Next())) {
54 unsigned int id = mdcMcRoot ->getId();
55 unsigned int trackIndex = mdcMcRoot ->getTrackIndex();
56 double xPosition = mdcMcRoot ->getPositionX() ;
57 double yPosition = mdcMcRoot ->getPositionY() ;
58 double zPosition = mdcMcRoot ->getPositionZ() ;
59 double driftDistance= mdcMcRoot ->getDriftDistance() ;
60 double depositEnergy = mdcMcRoot ->getDepositEnergy() ;
61 int positionFlag = mdcMcRoot->getPositionFlag();
62
63 MdcMcHit *mdcMcTds = new MdcMcHit;
64 m_common.m_rootMdcMcHitMap[mdcMcRoot] = mdcMcTds;
65
66 mdcMcTds->setIdentifier(id);
67 mdcMcTds->setTrackIndex(trackIndex);
68 mdcMcTds->setPositionX(xPosition);
69 mdcMcTds->setPositionY(yPosition);
70 mdcMcTds->setPositionZ(zPosition);
71 mdcMcTds->setDriftDistance(driftDistance);
72 mdcMcTds->setDepositEnergy(depositEnergy);
73 mdcMcTds->setPositionFlag(positionFlag);
74
75 mdcMcTdsCol->push_back(mdcMcTds);
76 }
77 //m_mdcMcHitCol->Delete(); // wensp add 2005/12/30
78 delete m_mdcMcHitCol;
79 m_mdcMcHitCol = 0;
80 return StatusCode::SUCCESS;
81}
static std::map< const TObject *, const MdcMcHit * > m_rootMdcMcHitMap

◆ TObjectToDataObject() [2/3]

virtual StatusCode MdcMcHitCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode MdcMcHitCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< MdcMcHitCnv >


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