1#ifndef RecCgemHitCnv_CXX
2#define RecCgemHitCnv_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/RecCgemHit.h"
14#include "Identifier/Identifier.h"
16#include "RootEventData/TRecCgemHit.h"
17#include "RootEventData/TRecTrackEvent.h"
19#include "RootCnvSvc/Rec/RecTrackCnv.h"
20#include "RootCnvSvc/Rec/RecCgemHitCnv.h"
21#include "RootCnvSvc/RootAddress.h"
33 MsgStream log(
msgSvc(),
"RecCgemHitCnv");
36 m_rootBranchname =
"m_recCgemHitCol";
38 m_adresses.push_back(&m_recCgemHitCol);
44 MsgStream log(
msgSvc(),
"RecCgemHitCnv");
45 log << MSG::DEBUG <<
"RecCgemHitCnv::TObjectToDataObject" << endreq;
49 refpObject = recCgemHitCol;
52 if (!m_recCgemHitCol)
return StatusCode::SUCCESS;
53 TIter cgemHitIter(m_recCgemHitCol);
55 while ((recCgemHitRoot = (
TRecCgemHit*)cgemHitIter.Next())) {
56 int id = recCgemHitRoot->
getId();
57 int trackId = recCgemHitRoot->
getTrkId();
59 int stat = recCgemHitRoot->
getStat();
62 unsigned int cgemId=recCgemHitRoot->
getCgemId();
63 double tdc = recCgemHitRoot->
getTdc();
64 double adc = recCgemHitRoot->
getAdc();
65 double doca = recCgemHitRoot->
getDoca();
66 double entra = recCgemHitRoot->
getEntra();
67 double zhit = recCgemHitRoot->
getZhit();
68 double fltLen = recCgemHitRoot->
getFltLen();
73 recCgemHit->
setId(
id );
86 recCgemHitCol->push_back(recCgemHit);
88 return StatusCode::SUCCESS;
93 MsgStream log(
msgSvc(),
"RecCgemHitCnv");
94 log << MSG::DEBUG <<
"RecCgemHitCnv::DataObjectToTObject" << endreq;
98 log << MSG::ERROR <<
"Could not downcast to RecCgemHitCol" << endreq;
99 return StatusCode::FAILURE;
105 log << MSG::ERROR <<
"Could not get ReconEvent in TDS " << endreq;
106 return StatusCode::FAILURE;
111 log << MSG::ERROR <<
"RecCgemHitCnv:Could not downcast to TDS ReconEvent" << endreq;
114 IOpaqueAddress *addr;
120 if (!m_recCgemHitCol)
return StatusCode::SUCCESS;
123 RecCgemHitCol::const_iterator recCgemHit;
124 for (recCgemHit = cgemHitColTds->begin(); recCgemHit != cgemHitColTds->end(); recCgemHit++) {
125 Bool_t isGrouped =(*recCgemHit)->
isGrouped();
126 Int_t
id =(*recCgemHit)->getId();
127 Int_t trackId =(*recCgemHit)->getTrkId();
128 Double_t chisqAdd =(*recCgemHit)->getChisqAdd();
129 Int_t stat =(*recCgemHit)->getStat();
132 UInt_t cgemId =(*recCgemHit)->getCgemId().get_value();
133 Double_t tdc =(*recCgemHit)->getTdc();
134 Double_t adc =(*recCgemHit)->getAdc();
135 Double_t doca =(*recCgemHit)->getDoca();
136 Double_t entra =(*recCgemHit)->getEntra();
137 Double_t zhit =(*recCgemHit)->getZhit();
138 Double_t fltLen =(*recCgemHit)->getFltLen();
144 recCgemHitRoot->
setId(
id );
145 recCgemHitRoot->
setTrkId( trackId );
147 recCgemHitRoot->
setStat( stat );
151 recCgemHitRoot->
setTdc( tdc );
152 recCgemHitRoot->
setAdc( adc );
153 recCgemHitRoot->
setDoca( doca );
155 recCgemHitRoot->
setZhit( zhit );
160 return StatusCode::SUCCESS;
ObjectVector< RecCgemHit > RecCgemHitCol
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
RecCgemHitCnv(ISvcLocator *svc)
void setDoca(double doca)
void setChisqAdd(double pChisq)
void setEntra(double entra)
void setCgemId(Identifier cgemid)
void setZhit(double zhit)
void setFltLen(double fltLen)
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.
const Double_t getChisqAdd(void) const
const Double_t getEntra(void) const
void setChisqAdd(Double_t pChisq)
const Double_t getZhit(void) const
const Int_t getId(void) const
void setZhit(Double_t zhit)
void setTdc(Double_t tdc)
const Int_t getStat(void) const
void setCgemId(UInt_t cgemid)
const Double_t getAdc(void) const
const Double_t getDoca(void) const
void setFltLen(Double_t fltLen)
const UInt_t getCgemId() const
const Double_t getFltLen(void) const
const Int_t getTrkId(void) const
void setEntra(Double_t entra)
void setDoca(Double_t doca)
void setIsGrouped(Bool_t isGrouped)
void setTrkId(Int_t trkid)
const Double_t getTdc(void) const
void setAdc(Double_t adc)
const TObjArray * getRecCgemHitCol() const
retrieve the whole TObjArray of RecCgemHit Data
void addRecCgemHit(TRecCgemHit *Hit)
Add a Rec Cgem Hit into the Cgem data collection.
void clearRecCgemHitCol()
clear the whole array (necessary because of the consts-s)
static std::map< const TObject *, const RecCgemHit * > m_rootRecCgemHitMap
_EXTERN_ std::string Event