CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
MucMcHitCnv Class Reference

#include <MucMcHitCnv.h>

+ Inheritance diagram for MucMcHitCnv:

Public Member Functions

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

 MucMcHitCnv (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< MucMcHitCnv >
 

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 19 of file MucMcHitCnv.h.

Constructor & Destructor Documentation

◆ ~MucMcHitCnv()

virtual MucMcHitCnv::~MucMcHitCnv ( )
inlinevirtual

Definition at line 29 of file MucMcHitCnv.h.

29{ };

◆ MucMcHitCnv()

MucMcHitCnv::MucMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 25 of file MucMcHitCnv.cxx.

27{
28 // Here we associate this converter with the /Event path on the TDS.
29 MsgStream log(msgSvc(), "MucMcHitCnv");
30 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
31 m_rootBranchname ="m_mucMcHitCol";
32 //declareObject(EventModel::MC::MucMcHitCol, objType(), m_rootTreename, m_rootBranchname);
33 m_adresses.push_back(&m_mucMcHitCol);
34 m_mucMcHitCol=0;
35}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: MucMcHitCnv.h:24
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 & MucMcHitCnv::classID ( )
inlinestatic

Definition at line 24 of file MucMcHitCnv.h.

25 {
26 return CLID_MucMcHitCol;
27 }
const CLID & CLID_MucMcHitCol
Definition: EventModel.cxx:245

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 83 of file MucMcHitCnv.cxx.

83 {
84
85 MsgStream log(msgSvc(), "MucMcHitCnv");
86 log << MSG::DEBUG << "MucMcHitCnv::DataObjectToTObject" << endreq;
87 StatusCode sc=StatusCode::SUCCESS;
88
89 MucMcHitCol * mucMcHitCnvTds=dynamic_cast<MucMcHitCol *> (obj);
90 if (!mucMcHitCnvTds) {
91 log << MSG::ERROR << "Could not downcast to MucMcHitCol" << 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 << "MucMcHitCnv:Could not downcast to TDS McEvent" << endreq;
104 }
105 IOpaqueAddress *addr;
106
107 m_cnvSvc->getMcCnv()->createRep(evt,addr);
109
110 const TObjArray *m_mucMcHitCol = McEvt->getMucMcHitCol();
111 if (!m_mucMcHitCol) return sc;
112 McEvt->clearMucMcHitCol(); //necessary in case there is I/O at the same time since array is static
113 MucMcHitCol::const_iterator mucMcTds;
114
115 for (mucMcTds = mucMcHitCnvTds->begin(); mucMcTds != mucMcHitCnvTds->end(); mucMcTds++) {
116 UInt_t id = ((*mucMcTds)->identify()).get_value() ;
117 UInt_t trackIndex = (*mucMcTds) ->getTrackIndex();
118 Double_t xPosition = (*mucMcTds) ->getPositionX() ;
119 Double_t yPosition = (*mucMcTds) ->getPositionY() ;
120 Double_t zPosition = (*mucMcTds) ->getPositionZ() ;
121 Double_t px= (*mucMcTds) ->getPx() ;
122 Double_t py = (*mucMcTds) ->getPy() ;
123 Double_t pz = (*mucMcTds) ->getPz() ;
124
125 TMucMc *mucMcRoot = new TMucMc();
126 //m_common.m_mucMcHitMap[(*mucMcTds)] = mucMcRoot;
127
128 mucMcRoot->setId(id);
129 mucMcRoot->setTrackIndex(trackIndex);
130 mucMcRoot->setPositionX(xPosition);
131 mucMcRoot->setPositionY(yPosition);
132 mucMcRoot->setPositionZ(zPosition);
133 mucMcRoot->setPx(px);
134 mucMcRoot->setPy(py);
135 mucMcRoot->setPz(pz);
136
137 McEvt->addMucMc(mucMcRoot);
138 }
139
140 return StatusCode::SUCCESS;
141}
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: McCnv.h:35
Definition: McEvent.h:8
McCnv * getMcCnv()
Definition: RootCnvSvc.h:149
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 clearMucMcHitCol()
Definition: TMcEvent.h:58
void addMucMc(TMucMc *mcHit)
Muc.
Definition: TMcEvent.cxx:157
const TObjArray * getMucMcHitCol() const
Definition: TMcEvent.h:55
Definition: TMucMc.h:8
void setPositionX(Double_t positionX)
Definition: TMucMc.h:42
void setPy(Double_t py)
Definition: TMucMc.h:46
void setId(UInt_t id)
Definition: TMucMc.h:40
void setTrackIndex(UInt_t trackIndex)
Definition: TMucMc.h:41
void setPositionY(Double_t positionY)
Definition: TMucMc.h:43
void setPz(Double_t pz)
Definition: TMucMc.h:47
void setPositionZ(Double_t positionZ)
Definition: TMucMc.h:44
void setPx(Double_t px)
Definition: TMucMc.h:45
_EXTERN_ std::string Event
Definition: EventModel.h:39
ObjectVector< MucMcHit > MucMcHitCol
Definition: MucMcHit.h:89

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 37 of file MucMcHitCnv.cxx.

37 {
38 // creation of TDS object from root object
39
40 MsgStream log(msgSvc(), "MucMcHitCnv");
41 log << MSG::DEBUG << "MucMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44 // create the TDS location for the MdcMc Collection
45 MucMcHitCol* mucMcTdsCol = new MucMcHitCol;
46 refpObject=mucMcTdsCol;
47
48
49 // now convert
50 if (!m_mucMcHitCol) return sc;
51 TIter mucMcIter(m_mucMcHitCol);
52 TMucMc *mucMcRoot = 0;
53 while ((mucMcRoot = (TMucMc*)mucMcIter.Next())) {
54 unsigned int id = mucMcRoot ->getId();
55 unsigned int trackIndex = mucMcRoot ->getTrackIndex();
56 double xPosition = mucMcRoot ->getPositionX() ;
57 double yPosition = mucMcRoot ->getPositionY() ;
58 double zPosition = mucMcRoot ->getPositionZ() ;
59 double px= mucMcRoot ->getPx() ;
60 double py = mucMcRoot ->getPy() ;
61 double pz = mucMcRoot ->getPz() ;
62
63 MucMcHit *mucMcTds = new MucMcHit;
64 m_common.m_rootMucMcHitMap[mucMcRoot] = mucMcTds;
65
66 mucMcTds->setIdentifier(id);
67 mucMcTds->setTrackIndex(trackIndex);
68 mucMcTds->setPositionX(xPosition);
69 mucMcTds->setPositionY(yPosition);
70 mucMcTds->setPositionZ(zPosition);
71 mucMcTds->setPx(px);
72 mucMcTds->setPy(py);
73 mucMcTds->setPz(pz);
74
75 mucMcTdsCol->push_back(mucMcTds);
76 }
77 //m_mucMcHitCol->Delete(); // wensp add 2005/12/30
78 delete m_mucMcHitCol;
79 m_mucMcHitCol = 0;
80 return StatusCode::SUCCESS;
81}
void setPositionX(double positionX)
Definition: MucMcHit.h:57
void setPx(double px)
Definition: MucMcHit.h:60
void setIdentifier(unsigned id)
Definition: MucMcHit.h:55
void setPz(double pz)
Definition: MucMcHit.h:62
void setPositionZ(double positionZ)
Definition: MucMcHit.h:59
void setPositionY(double positionY)
Definition: MucMcHit.h:58
void setPy(double py)
Definition: MucMcHit.h:61
void setTrackIndex(unsigned int trackIndex)
Definition: MucMcHit.h:56
UInt_t getTrackIndex() const
Definition: TMucMc.h:19
Double_t getPy() const
Definition: TMucMc.h:34
Double_t getPositionY() const
Definition: TMucMc.h:25
Double_t getPositionZ() const
Definition: TMucMc.h:28
Double_t getPx() const
Definition: TMucMc.h:31
UInt_t getId() const
Definition: TMucMc.h:16
Double_t getPz() const
Definition: TMucMc.h:37
Double_t getPositionX() const
Definition: TMucMc.h:22
static std::map< const TObject *, const MucMcHit * > m_rootMucMcHitMap
Definition: commonData.h:211

Friends And Related Function Documentation

◆ CnvFactory< MucMcHitCnv >

friend class CnvFactory< MucMcHitCnv >
friend

Definition at line 9 of file MucMcHitCnv.h.


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