1#ifndef RecCgemDedxHitCnv_CXX
2#define RecCgemDedxHitCnv_CXX 1
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/DataObject.h"
5#include "GaudiKernel/ObjectVector.h"
6#include "TClonesArray.h"
7#include "EventModel/EventModel.h"
8#include "ReconEvent/ReconEvent.h"
9#include "CgemRecEvent/RecCgemDedxHit.h"
10#include "Identifier/Identifier.h"
12#include "RootEventData/TRecCgemDedxHit.h"
13#include "RootEventData/TRecTrackEvent.h"
15#include "RootCnvSvc/Rec/RecTrackCnv.h"
16#include "RootCnvSvc/Rec/RecCgemDedxHitCnv.h"
17#include "RootCnvSvc/RootAddress.h"
33 MsgStream log(
msgSvc(),
"RecCgemDedxHitCnv");
36 m_rootBranchname =
"m_recCgemDedxHitCol";
38 m_adresses.push_back(&m_recCgemDedxHitCol);
39 m_recCgemDedxHitCol=0;
44 MsgStream log(
msgSvc(),
"RecCgemDedxHitCnv");
45 log << MSG::DEBUG <<
"RecCgemDedxHitCnv::TObjectToDataObject" << endreq;
46 StatusCode sc=StatusCode::SUCCESS;
49 refpObject=recCgemDedxHitCol;
52 if (!m_recCgemDedxHitCol)
return sc;
53 TIter dedxIter(m_recCgemDedxHitCol);
56 int trackId = recCgemDedxHitRoot->
trkId();
59 unsigned int cgemId(recCgemDedxHitRoot->
cgemId());
60 double pathlength = recCgemDedxHitRoot->
pathLength();
61 log << MSG::DEBUG<<
"check Reconstrunction of dE/dx Hit root"<<
" pathlength is : "<<pathlength<<endreq;
69 recCgemDedxHitCol->push_back(recCgemDedxHit);
74 delete m_recCgemDedxHitCol;
75 m_recCgemDedxHitCol = 0;
77 return StatusCode::SUCCESS;
82 MsgStream log(
msgSvc(),
"RecCgemDedxHitCnv");
83 log << MSG::DEBUG <<
"RecCgemDedxHitCnv::DataObjectToTObject" << endreq;
84 StatusCode sc=StatusCode::SUCCESS;
86 if (!recCgemDedxHitCol) {
87 log << MSG::ERROR <<
"Could not downcast to RecCgemDedxHitCol" << endreq;
88 return StatusCode::FAILURE;
93 log << MSG::ERROR <<
"Could not get RecEvent in TDS " << endreq;
94 return StatusCode::FAILURE;
98 log << MSG::ERROR <<
"RecCgemDedxHitCnv:Could not downcast to TDS RecEvent" << endreq;
100 IOpaqueAddress *addr;
104 if (!m_recCgemDedxHitCol)
return sc;
106 RecCgemDedxHitCol::const_iterator recCgemDedxHit;
107 for (recCgemDedxHit = recCgemDedxHitCol->begin(); recCgemDedxHit != recCgemDedxHitCol->end(); recCgemDedxHit++) {
108 int trackId = (*recCgemDedxHit)->
getTrkId();
111 UInt_t cgemId =(*recCgemDedxHit)->getCgemId().get_value();
112 double pathlength = (*recCgemDedxHit)->getPathLength();
113 log << MSG::DEBUG<<
"check Reconstrunction of dE/dx Hit root"<<
" pathlength is : "<<pathlength<<endreq;
116 recCgemDedxHitRoot->
setTrkId(trackId);
122 log << MSG::DEBUG<<
"check Reconstrunction of dE/dx Hit root"<<
" pathlength 2 is : "<<(*recCgemDedxHit)->getPathLength()<<endreq;
126 return StatusCode::SUCCESS;
ObjectVector< RecCgemDedxHit > RecCgemDedxHitCol
RecCgemDedxHitCnv(ISvcLocator *svc)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
void setCgemId(Identifier cgemid)
void setPathLength(double pathlength)
const int getTrkId(void) const
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 setCgemId(UInt_t cgemid)
const UInt_t cgemId() const
const Double_t pathLength(void) const
void setTrkId(Int_t trkid)
void setPathLength(double pathlength)
const Int_t trkId(void) const
const TObjArray * getRecCgemDedxHitCol() const
retrieve the whole TObjArray of Dedx Data
void clearRecCgemDedxHitCol()
clear the whole array
void addRecCgemDedxHit(TRecCgemDedxHit *Track)
Add a Dedx into the TOF Data collection.
static std::map< const TObject *, const RecCgemDedxHit * > m_rootRecCgemDedxHitMap
_EXTERN_ std::string Event