1#ifndef RECCGEMCLUSTERCNV_CXX
2#define RECCGEMCLUSTERCNV_CXX
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
30 MsgStream log(
msgSvc(),
"RecCgemClusterCnv");
31 log << MSG::INFO <<
" RecCgemClusterCnv ------ " << endreq;
34 m_recCgemClusterCol = 0;
38 MsgStream log(
msgSvc(),
"RecCgemClusterCnv");
39 log << MSG::DEBUG <<
"RecCgemClusterCnv::TObjectToDataObject" << endreq;
43 refpObject = recCgemClusterCol;
47 if (!m_recCgemClusterCol)
return StatusCode::SUCCESS;
48 TIter cgemClusterIter(m_recCgemClusterCol);
53 int layerid = recCgemClusterRoot->
getlayerid();
54 int sheetid = recCgemClusterRoot->
getsheetid();
55 int flag = recCgemClusterRoot->
getflag();
57 double recphi = recCgemClusterRoot->
getrecphi();
59 double recv = recCgemClusterRoot->
getrecv();
61 double recZ = recCgemClusterRoot->
getRecZ();
62 int trkid = recCgemClusterRoot->
getTrkId();
80 recCgemCluster->
setclusterflag(clusterflag_first,clusterflag_second);
82 recCgemClusterCol->push_back(recCgemCluster);
84 return StatusCode::SUCCESS;
88 MsgStream log(
msgSvc(),
"RecCgemClusterCnv");
89 log << MSG::DEBUG <<
"RecCgemClusterCnv::DataObjectToTObject" << endreq;
92 if (!cgemClusterColTds) {
93 log << MSG::ERROR <<
"Could not downcast to RecCgemClusterCol" << endreq;
94 return StatusCode::FAILURE;
100 log << MSG::ERROR <<
"Could not get ReconEvent in TDS " << endreq;
101 return StatusCode::FAILURE;
106 log << MSG::ERROR <<
"RecCgemHitCnv:Could not downcast to TDS ReconEvent" << endreq;
109 IOpaqueAddress *addr;
115 if (!m_recCgemClusterCol)
return StatusCode::SUCCESS;
118 RecCgemClusterCol::const_iterator recCgemCluster;
119 for (recCgemCluster = cgemClusterColTds->begin(); recCgemCluster != cgemClusterColTds->end(); recCgemCluster++)
121 Int_t layerid = (*recCgemCluster)->getlayerid();
122 Int_t sheetid = (*recCgemCluster)->getsheetid();
123 Int_t clusterid = (*recCgemCluster)->getclusterid();
124 Int_t flag = (*recCgemCluster)->getflag();
125 Double_t energydeposit = (*recCgemCluster)->getenergydeposit();
126 Double_t recphi = (*recCgemCluster)->getrecphi();
128 Double_t recv = (*recCgemCluster)->getrecv();
130 Int_t trkid = (*recCgemCluster)->getTrkId();
131 Double_t recZ = (*recCgemCluster)->getRecZ();
132 Int_t clusterflag_b = (*recCgemCluster)->getclusterflagb();
133 Int_t clusterflag_e = (*recCgemCluster)->getclusterflage();
140 recCgemClusterRoot->
setflag(flag);
144 recCgemClusterRoot->
setrecv(recv);
146 recCgemClusterRoot->
setTrkId(trkid);
147 recCgemClusterRoot->
setRecZ(recZ);
149 Int_t stripid[2][2] = {-9999,-9999,-9999,-9999};
150 if(flag==0||flag==1){
151 stripid[flag][0] = clusterflag_b;
152 stripid[flag][1] = clusterflag_e;
153 }
else if(flag==2||flag==3){
154 for(RecCgemClusterCol::const_iterator
iter = cgemClusterColTds->begin();
iter != cgemClusterColTds->end();
iter++){
155 if((*iter)->getclusterid() == clusterflag_b || (*iter)->getclusterid() == clusterflag_e){
156 Int_t Flag = (*iter)->getflag();
157 if(Flag==0||Flag==1){
158 stripid[Flag][0] = (*iter)->getclusterflagb();
159 stripid[Flag][1] = (*iter)->getclusterflage();
168 return StatusCode::SUCCESS;
ObjectVector< RecCgemCluster > RecCgemClusterCol
virtual StatusCode TObjectToDataObject(DataObject *&obj)
Do the concrete conversion from ROOT to TDS.
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
Do the concrete conversion from TDS to ROOT.
RecCgemClusterCnv(ISvcLocator *svc)
void setsheetid(int sheetid)
void setlayerid(int layerid)
void setclusterid(int clusterid)
void setenergydeposit(double energydeposit)
void setrecv(double recv)
void setRecZ(double recZ)
void setclusterflag(int begin, int end)
void setrecphi(double recphi)
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.
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.
Int_t getTrkId(void) const
Int_t getclusterflagb(void) const
void setTrkId(Int_t trkid)
void setclusterflag(Int_t begin, Int_t end)
Int_t getsheetid(void) const
Double_t getenergydeposit(void) const
Int_t getlayerid(void) const
void setlayerid(Int_t layerid)
void setsheetid(Int_t sheetid)
void setrecphi(Double_t recphi)
Double_t getrecphi(void) const
Int_t getflag(void) const
void setRecZ(Double_t recZ)
Double_t getRecZ(void) const
void setstripid(Int_t type, Int_t i, Int_t value)
Double_t getrecv(void) const
void setrecv(Double_t recv)
Int_t getclusterid(void) const
void setclusterid(Int_t clusterid)
Int_t getclusterflage(void) const
void setenergydeposit(Double_t energydeposit)
void clearRecCgemClusterCol()
clear the whole array(necessary because of the consts-s)
const TObjArray * getRecCgemClusterCol() const
retrive the whole TObjArray of RecCgemCluster Data
void addRecCgemCluster(TRecCgemCluster *Cluster)
Add a Rec Cgem Cluster into the Cgem data collection.
static std::map< const TObject *, const RecCgemCluster * > m_rootRecCgemClusterMap
_EXTERN_ std::string Event