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();
83 mdcMcTdsCol->push_back(mdcMcTds);
88 return StatusCode::SUCCESS;
93 MsgStream log(
msgSvc(),
"MdcMcHitCnv");
94 log << MSG::DEBUG <<
"MdcMcHitCnv::DataObjectToTObject" << endreq;
95 StatusCode sc=StatusCode::SUCCESS;
98 if (!mdcMcHitCnvTds) {
99 log << MSG::ERROR <<
"Could not downcast to MdcMcHitCol" << endreq;
100 return StatusCode::FAILURE;
106 log << MSG::ERROR <<
"Could not get McEvent in TDS " << endreq;
107 return StatusCode::FAILURE;
111 log << MSG::ERROR <<
"MdcMcHitCnv:Could not downcast to TDS McEvent" << endreq;
113 IOpaqueAddress *addr;
119 if (!m_mdcMcHitCol)
return sc;
121 MdcMcHitCol::const_iterator mdcMcTds;
123 for (mdcMcTds = mdcMcHitCnvTds->begin(); mdcMcTds != mdcMcHitCnvTds->end(); mdcMcTds++) {
124 UInt_t
id = ((*mdcMcTds)->identify()).get_value() ;
125 UInt_t trackIndex = (*mdcMcTds) ->getTrackIndex();
126 Double_t xPosition = (*mdcMcTds) ->getPositionX() ;
127 Double_t yPosition = (*mdcMcTds) ->getPositionY() ;
128 Double_t zPosition = (*mdcMcTds) ->getPositionZ() ;
129 Double_t driftDistance= (*mdcMcTds) ->getDriftDistance();
130 Double_t depositEnergy = (*mdcMcTds) ->getDepositEnergy() ;
131 Int_t positionFlag = (*mdcMcTds) ->getPositionFlag();
136 mdcMcRoot->
setId(
id);
151 mdcMcRoot->
setDigiIdx((*mdcMcTds)->getDigiIdx());
156 return StatusCode::SUCCESS;
void setMomentumZ(double momentumZ)
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 setCreatorProcess(std::string creatorProcess)
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 setCurrentTrackPID(Int_t currentTrackPID)
void setPositionZ(Double_t positionZ)
TString getCreatorProcess() const
void setIsSecondary(Int_t isSecondary)
Double_t getDriftDistance() const
void setDigiIdx(int digiIdx)
Double_t getFlightLength() const
Double_t getMomentumX() const
void setMomentumY(Double_t momentumY)
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
Double_t getIsSecondary() const
void setPositionX(Double_t positionX)
void setCreatorProcess(TString creatorProcess)
void setPositionFlag(Int_t posFlag)
Double_t getPositionY() const
Int_t getCurrentTrackPID() const
void setPositionY(Double_t positionY)
void setDriftDistance(Double_t driftDistance)
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