1#ifndef CgemSegmentCnv_CXX
2#define CgemSegmentCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
28 MsgStream log(
msgSvc(),
"CgemSegmentCnv");
36 MsgStream log(
msgSvc(),
"CgemSegmentCnv");
38 log << MSG::INFO <<
"My Message::CgemSegmentCnv::TObjectToDataObject()"<<endreq;
40 log << MSG::DEBUG <<
"CgemSegmentCnv::TObjectToDataObject" << endreq;
41 StatusCode sc=StatusCode::SUCCESS;
45 refpObject=cgemSegmentTdsCol;
48 if (!m_cgemSegmentCol)
return sc;
49 TIter cgemSegmentIter(m_cgemSegmentCol);
51 while ((cgemSegmentRoot = (
TCgemSegment*)cgemSegmentIter.Next())) {
55 int match = cgemSegmentRoot->
getmatch();
61 for(
int i = 0; i < 5; i++){
62 helix[i] = cgemSegmentRoot->
gethelix(i);
64 for(
int i = 0; i < 15; i++){
69 log << MSG::INFO <<
"My Message::CgemSegmentCnv::TObjectToDataObject::charge:"<<endreq;
83 cgemSegmentTdsCol->push_back(cgemSegmentTds);
86 delete m_cgemSegmentCol;
89 log << MSG::INFO <<
"My Message::CgemSegmentCnv::TObjectToDataObject()-finished"<<endreq;
91 return StatusCode::SUCCESS;
96 MsgStream log(
msgSvc(),
"CgemSegmentCnv");
98 log << MSG::INFO <<
"My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->
getTreename()<<
")"<<endreq;
100 log << MSG::DEBUG <<
"CgemSegmentCnv::DataObjectToTObject" << endreq;
101 StatusCode sc=StatusCode::SUCCESS;
104 if (!cgemSegmentColTds) {
105 log << MSG::ERROR <<
"Could not downcast to CgemSegmentCol" << endreq;
107 log << MSG::INFO <<
"My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->
getTreename()<<
")-finished"<<endreq;
109 return StatusCode::FAILURE;
115 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
117 log << MSG::INFO <<
"My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->
getTreename()<<
")-finished"<<endreq;
119 return StatusCode::FAILURE;
123 log << MSG::ERROR <<
"CgemSegmentCnv:Could not downcast to TDS DstEvent" << endreq;
125 IOpaqueAddress *addr;
128 log << MSG::INFO <<
"My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->
getTreename()<<
")::DstCnv"<<endreq;
134 if (!m_cgemSegmentCol)
return sc;
136 DstCgemSegmentCol::const_iterator cgemSegmentTds;
138 for (cgemSegmentTds = cgemSegmentColTds->begin(); cgemSegmentTds != cgemSegmentColTds->end(); cgemSegmentTds++) {
139 Int_t segmentId = (*cgemSegmentTds)->getsegmentid();
140 Int_t eventId = (*cgemSegmentTds)->geteventid();
141 Int_t match = (*cgemSegmentTds)->getmatch();
142 Int_t clusterId_1 = (*cgemSegmentTds)->getclusterid_1();
143 Int_t clusterId_2 = (*cgemSegmentTds)->getclusterid_2();
144 Int_t clusterId_3 = (*cgemSegmentTds)->getclusterid_3();
146 Double_t helix_err[15];
147 for(
int i = 0; i < 5; i++){
148 helix[i] = (*cgemSegmentTds)->gethelix(i);
150 for(
int i = 0; i < 15; i++){
151 helix_err[i] = (*cgemSegmentTds)->gethelix_err(i);
169 log << MSG::INFO <<
"My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->
getTreename()<<
")-finished"<<endreq;
171 return StatusCode::SUCCESS;
ObjectVector< DstCgemSegment > DstCgemSegmentCol
CgemSegmentCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setclusterid_2(const int clusterId_2)
void setmatch(const int match)
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])
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
std::string getTreename() const
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
IDataProviderSvc * m_eds
pointer to eventdataservice
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.
Double_t gethelix(Int_t i) const
void sethelix(Double_t helix[5])
void setclusterid_3(Int_t clusterid_3)
void setmatch(Int_t match)
void setsegmentid(Int_t segmentid)
void setclusterid_1(Int_t clusterid_1)
Int_t getclusterid_1(void) const
Int_t geteventid(void) const
void setclusterid_2(Int_t clusterid_2)
Double_t gethelix_err(Int_t i) const
Int_t getmatch(void) const
Int_t getclusterid_3(void) const
Int_t getclusterid_2(void) const
Int_t getsegmentid(void) const
void seteventid(Int_t eventid)
void sethelix_err(Double_t helix_err[15])
const TObjArray * getCgemSegmentCol() const
retrieve the whole TObjArray of CgemSegment Data
void clearCgemSegmentCol()
clear the whole array (necessary because of the consts-s)
void addCgemSegment(TCgemSegment *Segment)
Add a segment into the Cgem data collection.
static std::map< const TObject *, const DstCgemSegment * > m_rootCgemSegmentMap
_EXTERN_ std::string Event