1#ifndef RECCGEMSEGMENTCNV_CXX
2#define RECCGEMSEGMENTCNV_CXX
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/RecCgemSegment.h"
15#include "RootEventData/TRecCgemSegment.h"
16#include "RootEventData/TRecTrackEvent.h"
18#include "RootCnvSvc/Rec/RecTrackCnv.h"
19#include "RootCnvSvc/Rec/RecCgemSegmentCnv.h"
20#include "RootCnvSvc/RootAddress.h"
30 MsgStream log(
msgSvc(),
"RecCgemSegmentCnv");
31 log << MSG::INFO <<
" RecCgemSegmentCnv ------ " << endreq;
32 m_rootBranchname =
"m_recCgemSegmentCol";
33 m_adresses.push_back(&m_recCgemSegmentCol);
34 m_recCgemSegmentCol = 0;
38 MsgStream log(
msgSvc(),
"RecCgemSegmentCnv");
39 log << MSG::DEBUG <<
"RecCgemSegmentCnv::TObjectToDataObject" << endreq;
43 refpObject = recCgemSegmentCol;
47 if (!m_recCgemSegmentCol)
return StatusCode::SUCCESS;
48 TIter cgemSegmentIter(m_recCgemSegmentCol);
55 int eventid = recCgemSegmentRoot->
geteventid();
56 int match = recCgemSegmentRoot->
getmatch();
60 for(
int i = 0; i < 5; i++){
61 helix[i] = (recCgemSegmentRoot)->gethelix(i);
63 for(
int i = 0; i < 15; i++){
64 helix_err[i] = (recCgemSegmentRoot)->gethelix_err(i);
79 recCgemSegmentCol->push_back(recCgemSegment);
81 return StatusCode::SUCCESS;
85 MsgStream log(
msgSvc(),
"RecCgemSegmentCnv");
86 log << MSG::DEBUG <<
"RecCgemSegmentCnv::DataObjectToTObject" << endreq;
89 if (!cgemSegmentColTds) {
90 log << MSG::ERROR <<
"Could not downcast to RecCgemSegmentCol" << endreq;
91 return StatusCode::FAILURE;
97 log << MSG::ERROR <<
"Could not get ReconEvent in TDS " << endreq;
98 return StatusCode::FAILURE;
103 log << MSG::ERROR <<
"RecCgemHitCnv:Could not downcast to TDS ReconEvent" << endreq;
106 IOpaqueAddress *addr;
114 if (!m_recCgemSegmentCol)
return StatusCode::SUCCESS;
117 RecCgemSegmentCol::const_iterator recCgemSegment;
118 for (recCgemSegment = cgemSegmentColTds->begin(); recCgemSegment != cgemSegmentColTds->end(); recCgemSegment++)
120 Int_t eventid = (*recCgemSegment)->
geteventid();
121 Int_t match = (*recCgemSegment)->getmatch();
122 Int_t segmentid = (*recCgemSegment)->getsegmentid();
123 Int_t clusterid_1 = (*recCgemSegment)->getclusterid_1();
124 Int_t clusterid_2 = (*recCgemSegment)->getclusterid_2();
125 Int_t clusterid_3 = (*recCgemSegment)->getclusterid_3();
127 Double_t helix_err[15];
128 for(
int i = 0; i < 5; i++){
129 helix[i] = (*recCgemSegment)->gethelix(i);
131 for(
int i = 0; i < 15; i++){
132 helix_err[i] = (*recCgemSegment)->gethelix_err(i);
138 recCgemSegmentRoot->
setmatch(match);
143 recCgemSegmentRoot->
sethelix( helix );
148 return StatusCode::SUCCESS;
ObjectVector< RecCgemSegment > RecCgemSegmentCol
void setclusterid_2(const int clusterId_2)
void setmatch(const int match)
const int geteventid() const
void setsegmentid(const int segmentId)
void setclusterid_1(const int clusterId_1)
void seteventid(const int eventId)
void setclusterid_3(const int clusterId_3)
void sethelix(double helix[5])
void sethelix_err(double helix_err[15])
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
Do the concrete conversion from TDS to ROOT.
virtual StatusCode TObjectToDataObject(DataObject *&obj)
Do the concrete conversion from ROOT to TDS.
RecCgemSegmentCnv(ISvcLocator *svc)
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.
Int_t geteventid(void) const
void setsegmentid(Int_t segmentid)
void sethelix_err(Double_t helix_err[15])
void seteventid(Int_t eventid)
void setmatch(Int_t match)
Int_t getclusterid_3(void) const
void sethelix(Double_t helix[5])
Int_t getmatch(void) const
void setclusterid_1(Int_t clusterid_1)
Int_t getsegmentid(void) const
Int_t getclusterid_2(void) const
void setclusterid_2(Int_t clusterid_2)
void setclusterid_3(Int_t clusterid_3)
Int_t getclusterid_1(void) const
void addRecCgemSegment(TRecCgemSegment *Segment)
Add a TkrSegment into the Cgem data collection.
const TObjArray * getRecCgemSegmentCol() const
retrieve the whole TObjArray of RecCgemSegment Data
void clearRecCgemSegmentCol()
clear the whole array (necessary because of the consts-s)
static std::map< const TObject *, const RecCgemSegment * > m_rootRecCgemSegmentMap
_EXTERN_ std::string Event