1#ifndef RecCgemKalHelixSegCnv_CXX
2#define RecCgemKalHelixSegCnv_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 "CgemRecEvent/RecCgemKalHelixSeg.h"
14#include "Identifier/Identifier.h"
16#include "RootEventData/TRecCgemKalHelixSeg.h"
17#include "RootEventData/TRecTrackEvent.h"
19#include "RootCnvSvc/Rec/RecTrackCnv.h"
20#include "RootCnvSvc/Rec/RecCgemKalHelixSegCnv.h"
21#include "RootCnvSvc/RootAddress.h"
33 MsgStream log(
msgSvc(),
"RecCgemKalHelixSegCnv");
38 m_adresses.push_back(&m_recCgemKalHelixSegCol);
39 m_recCgemKalHelixSegCol=0;
44 MsgStream log(
msgSvc(),
"RecCgemKalHelixSegCnv");
45 log << MSG::DEBUG <<
"RecCgemKalHelixSegCnv::TObjectToDataObject" << endreq;
49 refpObject = recCgemKalHelixSegCol;
52 if (!m_recCgemKalHelixSegCol)
return StatusCode::SUCCESS;
53 TIter cgemHitIter(m_recCgemKalHelixSegCol);
56 int trackId = recCgemKalHelixSegRoot->
getTrackId();
61 double tdc = recCgemKalHelixSegRoot->
getTdc();
62 double adc = recCgemKalHelixSegRoot->
getAdc();
63 double zhit = recCgemKalHelixSegRoot->
getZhit();
64 double tof = recCgemKalHelixSegRoot->
getTof();
65 double docaIncl = recCgemKalHelixSegRoot->
getDocaIncl();
66 double docaExcl = recCgemKalHelixSegRoot->
getDocaExcl();
67 double entra = recCgemKalHelixSegRoot->
getEntra();
81 for(
int i=0, k=0; i<5; i++){
95 recCgemKalHelixSeg->
setTdc( tdc );
96 recCgemKalHelixSeg->
setAdc( adc );
97 recCgemKalHelixSeg->
setZhit( zhit );
98 recCgemKalHelixSeg->
setTof( tof );
101 recCgemKalHelixSeg->
setEntra( entra );
118 recCgemKalHelixSegCol->push_back(recCgemKalHelixSeg);
120 return StatusCode::SUCCESS;
125 MsgStream log(
msgSvc(),
"RecCgemKalHelixSegCnv");
126 log << MSG::DEBUG <<
"RecCgemKalHelixSegCnv::DataObjectToTObject" << endreq;
129 if (!cgemHitColTds) {
130 log << MSG::ERROR <<
"Could not downcast to RecCgemKalHelixSegCol" << endreq;
131 return StatusCode::FAILURE;
137 log << MSG::ERROR <<
"Could not get ReconEvent in TDS " << endreq;
138 return StatusCode::FAILURE;
143 log << MSG::ERROR <<
"RecCgemKalHelixSegCnv:Could not downcast to TDS ReconEvent" << endreq;
146 IOpaqueAddress *addr;
152 if (!m_recCgemKalHelixSegCol)
return StatusCode::SUCCESS;
155 RecCgemKalHelixSegCol::const_iterator recCgemKalHelixSeg;
156 for (recCgemKalHelixSeg = cgemHitColTds->begin(); recCgemKalHelixSeg != cgemHitColTds->end(); recCgemKalHelixSeg++) {
157 Int_t trackId =(*recCgemKalHelixSeg)->getTrackId();
160 UInt_t cgemId = (*recCgemKalHelixSeg)->getCgemId().get_value();
161 Double_t tdc = (*recCgemKalHelixSeg)->getTdc();
162 Double_t adc = (*recCgemKalHelixSeg)->getAdc();
163 Double_t zhit = (*recCgemKalHelixSeg)->getZhit();
164 Double_t tof = (*recCgemKalHelixSeg)->getTof();
165 Double_t docaIncl = (*recCgemKalHelixSeg)->getDocaIncl();
166 Double_t docaExcl = (*recCgemKalHelixSeg)->getDocaExcl();
167 Double_t entra = (*recCgemKalHelixSeg)->getEntra();
179 HepVector helixIncl_vct = (*recCgemKalHelixSeg)->getHelixIncl();
180 HepVector helixExcl_vct = (*recCgemKalHelixSeg)->getHelixExcl();
184 Double_t helixIncl[5], helixExcl[5];
185 for(Int_t i=0; i<5; i++){
186 helixIncl[i] = helixIncl_vct[i];
187 helixExcl[i] = helixExcl_vct[i];
199 recCgemKalHelixSegRoot->
setTrackId( trackId );
202 recCgemKalHelixSegRoot->
setCgemId( cgemId );
203 recCgemKalHelixSegRoot->
setTdc( tdc );
204 recCgemKalHelixSegRoot->
setAdc( adc );
205 recCgemKalHelixSegRoot->
setZhit( zhit );
206 recCgemKalHelixSegRoot->
setTof( tof );
209 recCgemKalHelixSegRoot->
setEntra( entra );
228 return StatusCode::SUCCESS;
ObjectVector< RecCgemKalHelixSeg > RecCgemKalHelixSegCol
RecCgemKalHelixSegCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setCgemId(Identifier cgemid)
void setTrackId(int trackid)
void setHelixExcl(const HepVector &helix)
void setDocaIncl(double doca)
void setDocaExcl(double doca)
void setZhit(double zhit)
void setEntra(double entra)
void setHelixIncl(const HepVector &helix)
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
std::vector< void * > m_adresses
each converter knows the corresponding adresses
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.
const Double_t getEntra(void) const
const Double_t getDocaIncl(void) const
const Int_t getTrackId(void) const
const Double_t getDocaExcl(void) const
void setZhit(Double_t zhit)
void setDocaIncl(Double_t docaincl)
void setHelixIncl(const Double_t helix[5])
void setEntra(Double_t entra)
const Double_t getHelixExcl(Int_t i) const
void setDocaExcl(Double_t docaexcl)
void setHelixExcl(const Double_t helix[5])
const Double_t getAdc(void) const
void setTof(Double_t tof)
const Double_t getHelixIncl(Int_t i) const
void setCgemId(UInt_t cgemid)
const Double_t getTof(void) const
const Double_t getTdc(void) const
const UInt_t getCgemId() const
void setTdc(Double_t tdc)
void setTrackId(Int_t trkid)
const Double_t getZhit(void) const
void setAdc(Double_t adc)
const TObjArray * getRecCgemKalHelixSegCol() const
void clearRecCgemKalHelixSegCol()
void addRecCgemKalHelixSeg(TRecCgemKalHelixSeg *Track)
static std::map< const TObject *, const RecCgemKalHelixSeg * > m_rootRecCgemKalHelixSegMap
_EXTERN_ std::string Event