2#define MdcMcHitCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
29 MsgStream log(
msgSvc(),
"MdcMcHitCnv");
40 MsgStream log(
msgSvc(),
"MdcMcHitCnv");
41 log << MSG::DEBUG <<
"MdcMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
46 refpObject=mdcMcTdsCol;
50 if (!m_mdcMcHitCol)
return sc;
51 TIter mdcMcIter(m_mdcMcHitCol);
53 while ((mdcMcRoot = (
TMdcMc*)mdcMcIter.Next())) {
54 unsigned int id = mdcMcRoot ->
getId();
75 mdcMcTdsCol->push_back(mdcMcTds);
80 return StatusCode::SUCCESS;
85 MsgStream log(
msgSvc(),
"MdcMcHitCnv");
86 log << MSG::DEBUG <<
"MdcMcHitCnv::DataObjectToTObject" << endreq;
87 StatusCode sc=StatusCode::SUCCESS;
90 if (!mdcMcHitCnvTds) {
91 log << MSG::ERROR <<
"Could not downcast to MdcMcHitCol" << endreq;
92 return StatusCode::FAILURE;
98 log << MSG::ERROR <<
"Could not get McEvent in TDS " << endreq;
99 return StatusCode::FAILURE;
103 log << MSG::ERROR <<
"MdcMcHitCnv:Could not downcast to TDS McEvent" << endreq;
105 IOpaqueAddress *addr;
111 if (!m_mdcMcHitCol)
return sc;
113 MdcMcHitCol::const_iterator mdcMcTds;
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();
128 mdcMcRoot->
setId(
id);
140 return StatusCode::SUCCESS;
void setPositionFlag(int posFlag)
void setPositionZ(double positionZ)
void setDepositEnergy(double depositEnergy)
void setIdentifier(unsigned int id)
void setPositionY(double positionY)
void setTrackIndex(unsigned int trackIndex)
void setDriftDistance(double driftDistance)
void setPositionX(double positionX)
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
MdcMcHitCnv(ISvcLocator *svc)
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
IDataProviderSvc * m_eds
pointer to eventdataservice
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addMdcMc(TMdcMc *mcHit)
Mdc.
const TObjArray * getMdcMcHitCol() const
Double_t getDepositEnergy() const
Double_t getPositionZ() const
void setPositionZ(Double_t positionZ)
Double_t getDriftDistance() const
void setTrackIndex(UInt_t trackIndex)
UInt_t getTrackIndex() const
void setDepositEnergy(Double_t depositEnergy)
Int_t getPositionFlag() const
Double_t getPositionX() const
void setPositionX(Double_t positionX)
void setPositionFlag(Int_t posFlag)
Double_t getPositionY() const
void setPositionY(Double_t positionY)
void setDriftDistance(Double_t driftDistance)
static std::map< const TObject *, const MdcMcHit * > m_rootMdcMcHitMap
_EXTERN_ std::string Event
ObjectVector< MdcMcHit > MdcMcHitCol