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();
91 mdcMcTdsCol->push_back(mdcMcTds);
96 return StatusCode::SUCCESS;
101 MsgStream log(
msgSvc(),
"MdcMcHitCnv");
102 log << MSG::DEBUG <<
"MdcMcHitCnv::DataObjectToTObject" << endreq;
103 StatusCode sc=StatusCode::SUCCESS;
106 if (!mdcMcHitCnvTds) {
107 log << MSG::ERROR <<
"Could not downcast to MdcMcHitCol" << endreq;
108 return StatusCode::FAILURE;
114 log << MSG::ERROR <<
"Could not get McEvent in TDS " << endreq;
115 return StatusCode::FAILURE;
119 log << MSG::ERROR <<
"MdcMcHitCnv:Could not downcast to TDS McEvent" << endreq;
121 IOpaqueAddress *addr;
127 if (!m_mdcMcHitCol)
return sc;
129 MdcMcHitCol::const_iterator mdcMcTds;
131 for (mdcMcTds = mdcMcHitCnvTds->begin(); mdcMcTds != mdcMcHitCnvTds->end(); mdcMcTds++) {
132 UInt_t
id = ((*mdcMcTds)->identify()).get_value() ;
133 UInt_t trackIndex = (*mdcMcTds) ->getTrackIndex();
134 Double_t xPosition = (*mdcMcTds) ->getPositionX() ;
135 Double_t yPosition = (*mdcMcTds) ->getPositionY() ;
136 Double_t zPosition = (*mdcMcTds) ->getPositionZ() ;
137 Double_t driftDistance= (*mdcMcTds) ->getDriftDistance();
138 Double_t depositEnergy = (*mdcMcTds) ->getDepositEnergy() ;
139 Int_t positionFlag = (*mdcMcTds) ->getPositionFlag();
140 Double_t px = (*mdcMcTds)->getMomentumX();
141 Double_t py = (*mdcMcTds)->getMomentumY();
142 Double_t pz = (*mdcMcTds)->getMomentumZ();
143 Double_t trkLen = (*mdcMcTds)->getFlightLength();
144 TString creatorProcess = (*mdcMcTds)->getCreatorProcess();
145 Int_t trkIdx = (*mdcMcTds)->getDigiIdx();
146 Int_t pdgCode = (*mdcMcTds)->getCurrentTrackPID();
147 Int_t isSec = (*mdcMcTds)->getIsSecondary();
152 mdcMcRoot->
setId(
id);
172 return StatusCode::SUCCESS;
void setMomentumZ(double momentumZ)
void setCreatorProcess(string creatorProcess)
void setMomentumY(double momentumY)
void setPositionFlag(int posFlag)
void setPositionZ(double positionZ)
void setFlightLength(double flightLength)
void setDepositEnergy(double depositEnergy)
void setMomentumX(double momentumX)
void setIdentifier(unsigned int id)
void setPositionY(double positionY)
void setIsSecondary(int isSec)
void setTrackIndex(unsigned int trackIndex)
void setCurrentTrackPID(int currentTrackPID)
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
void setMomentumX(Double_t momentumX)
Double_t getDepositEnergy() const
Double_t getPositionZ() const
void setPositionZ(Double_t positionZ)
TString getCreatorProcess() const
Double_t getDriftDistance() const
void setDigiIdx(Int_t id)
Double_t getFlightLength() const
Double_t getMomentumX() const
void setMomentumY(Double_t momentumY)
void setPDGCode(Int_t code)
void setTrackIndex(UInt_t trackIndex)
void setFlightLength(Double_t flightLength)
UInt_t getTrackIndex() const
Double_t getMomentumZ() const
void setDepositEnergy(Double_t depositEnergy)
Int_t getPositionFlag() const
Double_t getPositionX() const
void setPositionX(Double_t positionX)
void setCreatorProcess(TString creatorProcess)
void setIsSecondary(Int_t isSec)
void setPositionFlag(Int_t posFlag)
Double_t getPositionY() const
void setPositionY(Double_t positionY)
void setDriftDistance(Double_t driftDistance)
Int_t getIsSecondary() const
Double_t getMomentumY() const
void setMomentumZ(Double_t momentumZ)
static std::map< const TObject *, const MdcMcHit * > m_rootMdcMcHitMap
_EXTERN_ std::string Event
ObjectVector< MdcMcHit > MdcMcHitCol