1#ifndef RecMdcHitCnv_CXX
2#define RecMdcHitCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
10#include "EventModel/EventModel.h"
12#include "ReconEvent/ReconEvent.h"
13#include "MdcRecEvent/RecMdcHit.h"
14#include "Identifier/Identifier.h"
16#include "RootEventData/TRecMdcHit.h"
17#include "RootEventData/TRecTrackEvent.h"
19#include "RootCnvSvc/Rec/RecTrackCnv.h"
20#include "RootCnvSvc/Rec/RecMdcHitCnv.h"
21#include "RootCnvSvc/RootAddress.h"
33 MsgStream log(
msgSvc(),
"RecMdcHitCnv");
36 m_rootBranchname =
"m_recMdcHitCol";
38 m_adresses.push_back(&m_recMdcHitCol);
44 MsgStream log(
msgSvc(),
"RecMdcHitCnv");
45 log << MSG::DEBUG <<
"RecMdcHitCnv::TObjectToDataObject" << endreq;
49 refpObject = recMdcHitCol;
52 if (!m_recMdcHitCol)
return StatusCode::SUCCESS;
53 TIter mdcHitIter(m_recMdcHitCol);
55 while ((recMdcHitRoot = (
TRecMdcHit*)mdcHitIter.Next())) {
56 int id = recMdcHitRoot->
getId();
57 int trackId = recMdcHitRoot->
getTrkId();
64 int stat = recMdcHitRoot->
getStat();
65 long int mdcId(recMdcHitRoot->
getMdcId());
66 double tdc = recMdcHitRoot->
getTdc();
67 double adc = recMdcHitRoot->
getAdc();
68 double driftT = recMdcHitRoot->
getDriftT();
69 double doca = recMdcHitRoot->
getDoca();
70 double entra = recMdcHitRoot->
getEntra();
71 double zhit = recMdcHitRoot->
getZhit();
72 double fltLen = recMdcHitRoot->
getFltLen();
77 recMdcHit->
setId(
id );
95 recMdcHitCol->push_back(recMdcHit);
97 return StatusCode::SUCCESS;
102 MsgStream log(
msgSvc(),
"RecMdcHitCnv");
103 log << MSG::DEBUG <<
"RecMdcHitCnv::DataObjectToTObject" << endreq;
107 log << MSG::ERROR <<
"Could not downcast to RecMdcHitCol" << endreq;
108 return StatusCode::FAILURE;
114 log << MSG::ERROR <<
"Could not get ReconEvent in TDS " << endreq;
115 return StatusCode::FAILURE;
120 log << MSG::ERROR <<
"RecMdcHitCnv:Could not downcast to TDS ReconEvent" << endreq;
123 IOpaqueAddress *addr;
129 if (!m_recMdcHitCol)
return StatusCode::SUCCESS;
132 RecMdcHitCol::const_iterator recMdcHit;
133 for (recMdcHit = mdcHitColTds->begin(); recMdcHit != mdcHitColTds->end(); recMdcHit++) {
134 Bool_t isGrouped =(*recMdcHit)->
isGrouped();
135 Int_t
id =(*recMdcHit)->getId();
136 Int_t trackId =(*recMdcHit)->getTrkId();
137 Double_t driftDistLeft =(*recMdcHit)->getDriftDistLeft();
138 Double_t driftDistRight =(*recMdcHit)->getDriftDistRight();
139 Double_t errDriftDistLeft =(*recMdcHit)->getErrDriftDistLeft();
140 Double_t errDriftDistRight =(*recMdcHit)->getErrDriftDistRight();
141 Double_t chisqAdd =(*recMdcHit)->getChisqAdd();
142 Int_t flagLR =(*recMdcHit)->getFlagLR();
143 Int_t stat =(*recMdcHit)->getStat();
144 UInt_t mdcId =(*recMdcHit)->getMdcId().get_value();
145 Double_t tdc =(*recMdcHit)->getTdc();
146 Double_t adc =(*recMdcHit)->getAdc();
147 Double_t driftT =(*recMdcHit)->getDriftT();
148 Double_t doca =(*recMdcHit)->getDoca();
149 Double_t entra =(*recMdcHit)->getEntra();
150 Double_t zhit =(*recMdcHit)->getZhit();
151 Double_t fltLen =(*recMdcHit)->getFltLen();
157 recMdcHitRoot->
setId(
id );
168 recMdcHitRoot->
setStat( stat );
170 recMdcHitRoot->
setTdc( tdc );
171 recMdcHitRoot->
setAdc( adc );
173 recMdcHitRoot->
setDoca( doca );
175 recMdcHitRoot->
setZhit( zhit );
180 return StatusCode::SUCCESS;
ObjectVector< RecMdcHit > RecMdcHitCol
RecMdcHitCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setMdcId(Identifier mdcid)
void setErrDriftDistRight(double erddr)
void setFltLen(double fltLen)
void setErrDriftDistLeft(double erddl)
void setDriftDistLeft(double ddl)
void setDoca(double doca)
void setChisqAdd(double pChisq)
void setZhit(double zhit)
void setDriftT(double driftT)
void setDriftDistRight(double ddr)
void setEntra(double entra)
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
RecTrackCnv * getRecTrackCnv()
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setFltLen(Double_t fltLen)
const Double_t getDriftT(void) const
void setIsGrouped(Bool_t isGrouped)
const Double_t getDriftDistLeft(void) const
void setErrDriftDistLeft(Double_t erddl)
const Double_t getErrDriftDistRight(void) const
void setDriftDistLeft(Double_t ddl)
const UInt_t getMdcId() const
const Double_t getEntra(void) const
const Int_t getId(void) const
void setDriftDistRight(Double_t ddr)
const Double_t getDoca(void) const
const Double_t getFltLen(void) const
const Int_t getStat(void) const
const Double_t getErrDriftDistLeft(void) const
const Double_t getZhit(void) const
const Int_t getFlagLR(void) const
void setTdc(Double_t tdc)
const Int_t getTrkId(void) const
void setAdc(Double_t adc)
void setTrkId(Int_t trkid)
void setDriftT(Double_t driftT)
const Double_t getChisqAdd(void) const
const Double_t getAdc(void) const
void setErrDriftDistRight(Double_t erddr)
void setZhit(Double_t zhit)
void setDoca(Double_t doca)
void setEntra(Double_t entra)
const Double_t getTdc(void) const
void setChisqAdd(Double_t pChisq)
void setMdcId(UInt_t mdcid)
const Double_t getDriftDistRight(void) const
void addRecMdcHit(TRecMdcHit *Hit)
Add a Rec Mdc Hit into the Mdc data collection.
void clearRecMdcHitCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data
static std::map< const TObject *, const RecMdcHit * > m_rootRecMdcHitMap
_EXTERN_ std::string Event