2#define MucMcHitCnv_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(),
"MucMcHitCnv");
40 MsgStream log(
msgSvc(),
"MucMcHitCnv");
41 log << MSG::DEBUG <<
"MucMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
46 refpObject=mucMcTdsCol;
50 if (!m_mucMcHitCol)
return sc;
51 TIter mucMcIter(m_mucMcHitCol);
53 while ((mucMcRoot = (
TMucMc*)mucMcIter.Next())) {
54 unsigned int id = mucMcRoot ->
getId();
59 double px= mucMcRoot ->
getPx() ;
60 double py = mucMcRoot ->
getPy() ;
61 double pz = mucMcRoot ->
getPz() ;
75 mucMcTdsCol->push_back(mucMcTds);
80 return StatusCode::SUCCESS;
85 MsgStream log(
msgSvc(),
"MucMcHitCnv");
86 log << MSG::DEBUG <<
"MucMcHitCnv::DataObjectToTObject" << endreq;
87 StatusCode sc=StatusCode::SUCCESS;
90 if (!mucMcHitCnvTds) {
91 log << MSG::ERROR <<
"Could not downcast to MucMcHitCol" << endreq;
92 return StatusCode::FAILURE;
98 log << MSG::ERROR <<
"Could not get McEvent in TDS " << endreq;
99 return StatusCode::FAILURE;
103 log << MSG::ERROR <<
"MucMcHitCnv:Could not downcast to TDS McEvent" << endreq;
105 IOpaqueAddress *addr;
111 if (!m_mucMcHitCol)
return sc;
113 MucMcHitCol::const_iterator mucMcTds;
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() ;
128 mucMcRoot->
setId(
id);
133 mucMcRoot->
setPx(px);
134 mucMcRoot->
setPy(py);
135 mucMcRoot->
setPz(pz);
140 return StatusCode::SUCCESS;
void setPositionX(double positionX)
void setIdentifier(unsigned id)
void setPositionZ(double positionZ)
void setPositionY(double positionY)
void setTrackIndex(unsigned int trackIndex)
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
MucMcHitCnv(ISvcLocator *svc)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
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 addMucMc(TMucMc *mcHit)
Muc.
const TObjArray * getMucMcHitCol() const
UInt_t getTrackIndex() const
void setPositionX(Double_t positionX)
Double_t getPositionY() const
Double_t getPositionZ() const
void setTrackIndex(UInt_t trackIndex)
void setPositionY(Double_t positionY)
void setPositionZ(Double_t positionZ)
Double_t getPositionX() const
static std::map< const TObject *, const MucMcHit * > m_rootMucMcHitMap
_EXTERN_ std::string Event
ObjectVector< MucMcHit > MucMcHitCol