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

#include <TofMcHitCnv.h>

+ Inheritance diagram for TofMcHitCnv:

Public Member Functions

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

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

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

◆ ~TofMcHitCnv() [1/3]

virtual TofMcHitCnv::~TofMcHitCnv ( )
inlinevirtual

◆ TofMcHitCnv() [1/3]

TofMcHitCnv::TofMcHitCnv ( ISvcLocator *  svc)
protected

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

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

◆ ~TofMcHitCnv() [2/3]

virtual TofMcHitCnv::~TofMcHitCnv ( )
inlinevirtual

◆ TofMcHitCnv() [2/3]

TofMcHitCnv::TofMcHitCnv ( ISvcLocator *  svc)
protected

◆ ~TofMcHitCnv() [3/3]

virtual TofMcHitCnv::~TofMcHitCnv ( )
inlinevirtual

◆ TofMcHitCnv() [3/3]

TofMcHitCnv::TofMcHitCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & TofMcHitCnv::classID ( )
inlinestatic

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

25 {
26 return CLID_TofMcHitCol;
27 }
const CLID & CLID_TofMcHitCol
Definition: EventModel.cxx:239

◆ classID() [2/3]

static const CLID & TofMcHitCnv::classID ( )
inlinestatic

◆ classID() [3/3]

static const CLID & TofMcHitCnv::classID ( )
inlinestatic

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

25 {
26 return CLID_TofMcHitCol;
27 }

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 89 of file bak_RootCnvSvc-04-01-14/src/Mc/TofMcHitCnv.cxx.

89 {
90
91 MsgStream log(msgSvc(), "TofMcHitCnv");
92 log << MSG::DEBUG << "TofMcHitCnv::DataObjectToTObject" << endreq;
93 StatusCode sc=StatusCode::SUCCESS;
94
95 TofMcHitCol * tofMcHitCnvTds=dynamic_cast<TofMcHitCol *> (obj);
96 if (!tofMcHitCnvTds) {
97 log << MSG::ERROR << "Could not downcast to TofMcHitCol" << endreq;
98 return StatusCode::FAILURE;
99 }
100
101 DataObject *evt;
102 m_eds->findObject(EventModel::MC::Event,evt);
103 if (evt==NULL) {
104 log << MSG::ERROR << "Could not get McEvent in TDS " << endreq;
105 return StatusCode::FAILURE;
106 }
107 McEvent * devtTds=dynamic_cast<McEvent *> (evt);
108 if (!devtTds) {
109 log << MSG::ERROR << "TofMcHitCnv:Could not downcast to TDS McEvent" << endreq;
110 }
111 IOpaqueAddress *addr;
112
113 m_cnvSvc->getMcCnv()->createRep(evt,addr);
115
116 const TObjArray *m_tofMcHitCol = McEvt->getTofMcHitCol();
117 if (!m_tofMcHitCol) return sc;
118 McEvt->clearTofMcHitCol(); //necessary in case there is I/O at the same time since array is static
119 TofMcHitCol::const_iterator tofMcTds;
120
121 for (tofMcTds = tofMcHitCnvTds->begin(); tofMcTds != tofMcHitCnvTds->end(); tofMcTds++) {
122 UInt_t id = ((*tofMcTds)->identify()).get_value() ;
123 UInt_t trackIndex = (*tofMcTds) ->getTrackIndex();
124 Double_t xPosition = (*tofMcTds) ->getPositionX() ;
125 Double_t yPosition = (*tofMcTds) ->getPositionY() ;
126 Double_t zPosition = (*tofMcTds) ->getPositionZ() ;
127 Double_t px= (*tofMcTds) ->getPx() ;
128 Double_t py = (*tofMcTds) ->getPy() ;
129 Double_t pz = (*tofMcTds) ->getPz() ;
130 Double_t trackLength = (*tofMcTds) ->getTrackLength() ;
131 Double_t flightTime = (*tofMcTds) ->getFlightTime() ;
132
133 TTofMc *tofMcRoot = new TTofMc();
134 //m_common.m_tofMcHitMap[(*tofMcTds)] = tofMcRoot;
135
136 tofMcRoot->setId(id);
137 tofMcRoot->setTrackIndex(trackIndex);
138 tofMcRoot->setPositionX(xPosition);
139 tofMcRoot->setPositionY(yPosition);
140 tofMcRoot->setPositionZ(zPosition);
141 tofMcRoot->setPx(px);
142 tofMcRoot->setPy(py);
143 tofMcRoot->setPz(pz);
144 tofMcRoot->setTrackLength(trackLength);
145 tofMcRoot->setFlightTime(flightTime);
146
147 McEvt->addTofMc(tofMcRoot);
148 }
149
150 return StatusCode::SUCCESS;
151}
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 addTofMc(TTofMc *mcHit)
Tof.
ObjectVector< TofMcHit > TofMcHitCol

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

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

37 {
38 // creation of TDS object from root object
39
40 MsgStream log(msgSvc(), "TofMcHitCnv");
41 log << MSG::DEBUG << "TofMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44 // create the TDS location for the MdcMc Collection
45 TofMcHitCol* tofMcTdsCol = new TofMcHitCol;
46 refpObject=tofMcTdsCol;
47
48
49 // now convert
50 if (!m_tofMcHitCol) return sc;
51 TIter tofMcIter(m_tofMcHitCol);
52 TTofMc *tofMcRoot = 0;
53 while ((tofMcRoot = (TTofMc*)tofMcIter.Next())) {
54 unsigned int id = tofMcRoot ->getId();
55 unsigned int trackIndex = tofMcRoot ->getTrackIndex();
56 double xPosition = tofMcRoot ->getPositionX() ;
57 double yPosition = tofMcRoot ->getPositionY() ;
58 double zPosition = tofMcRoot ->getPositionZ() ;
59 double px= tofMcRoot ->getPx() ;
60 double py = tofMcRoot ->getPy() ;
61 double pz = tofMcRoot ->getPz() ;
62 double trackLength = tofMcRoot->getTrackLength() ;
63 double flightTime = tofMcRoot->getFlightTime() ;
64
65
66 TofMcHit *tofMcTds = new TofMcHit;
67 m_common.m_rootTofMcHitMap[tofMcRoot] = tofMcTds;
68
69 tofMcTds->setIdentifier(id);
70 tofMcTds->setTrackIndex(trackIndex);
71 tofMcTds->setPositionX(xPosition);
72 tofMcTds->setPositionY(yPosition);
73 tofMcTds->setPositionZ(zPosition);
74 tofMcTds->setPx(px);
75 tofMcTds->setPy(py);
76 tofMcTds->setPz(pz);
77 tofMcTds->setTrackLength(trackLength);
78 tofMcTds->setFlightTime(flightTime);
79
80
81 tofMcTdsCol->push_back(tofMcTds);
82 }
83 //m_tofMcHitCol->Delete(); // wensp add 2005/12/30
84 delete m_tofMcHitCol;
85 m_tofMcHitCol = 0;
86 return StatusCode::SUCCESS;
87}
static std::map< const TObject *, const TofMcHit * > m_rootTofMcHitMap

◆ TObjectToDataObject() [2/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< TofMcHitCnv >


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