2#define CgemDigiCnv_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"
11#include "RawEvent/DigiEvent.h"
12#include "CgemRawEvent/CgemDigi.h"
13#include "RootEventData/TCgemDigi.h"
14#include "RootEventData/TDigiEvent.h"
15#include "RootCnvSvc/Digi/DigiCnv.h"
16#include "RootCnvSvc/Digi/CgemDigiCnv.h"
17#include "RootCnvSvc/RootAddress.h"
29 MsgStream log(
msgSvc(),
"CgemDigiCnv");
31 log << MSG::INFO <<
"My Message::CgemDigiCnv:RootEventBaseCnv" << endreq;
34 m_rootBranchname =
"m_cgemDigiCol";
36 m_adresses.push_back(&m_cgemDigiCol);
40 log << MSG::INFO <<
"My Message::CgemDigiCnv:RootEventBaseCnv-finished" << endreq;
47 MsgStream log(
msgSvc(),
"CgemDigiCnv");
49 log << MSG::INFO <<
"My Message::CgemDigiCnv::TObjectToDataObject()" << endreq;
51 log << MSG::DEBUG <<
"CgemDigiCnv::TObjectToDataObject" << endreq;
52 StatusCode sc=StatusCode::SUCCESS;
56 refpObject=cgemDigiTdsCol;
64 if (!m_cgemDigiCol)
return sc;
65 TIter cgemDigiIter(m_cgemDigiCol);
67 while ((cgemDigiRoot = (
TCgemDigi*)cgemDigiIter.Next()))
69 unsigned int id = cgemDigiRoot->
getIntId();
72 unsigned int overflow = cgemDigiRoot->
getOverflow();
81 log << MSG::INFO <<
"My Message::CgemDigiCnv::TObjectToDataObject: "
84 <<
",charge=" << charge
85 <<
",overflow=" << overflow << endreq;
94 cgemDigiTdsCol->push_back(cgemDigiTds);
101 log << MSG::INFO <<
"My Message::CgemDigiCnv::TObjectToDataObject()-finished" << endreq;
103 return StatusCode::SUCCESS;
108 MsgStream log(
msgSvc(),
"CgemDigiCnv");
110 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()" << endreq;
112 log << MSG::DEBUG <<
"CgemDigiCnv::DataObjectToTObject" << endreq;
113 StatusCode sc=StatusCode::SUCCESS;
116 if (!cgemDigiColTds) {
117 log << MSG::ERROR <<
"Could not downcast to CgemDigiCol" << endreq;
119 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
121 return StatusCode::FAILURE;
127 log << MSG::ERROR <<
"Could not get DigiEvent in TDS " << endreq;
129 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
131 return StatusCode::FAILURE;
136 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
138 log << MSG::ERROR <<
"CgemDigiCnv:Could not downcast to TDS DigiEvent" << endreq;
141 IOpaqueAddress *addr;
151 if (!m_cgemDigiCol)
return sc;
153 CgemDigiCol::const_iterator cgemDigiTds;
155 for (cgemDigiTds=cgemDigiColTds->begin(); cgemDigiTds!=cgemDigiColTds->end(); cgemDigiTds++)
158 UInt_t
time = (*cgemDigiTds)->getTimeChannel();
159 UInt_t charge = (*cgemDigiTds)->getChargeChannel();
160 UInt_t
id = (*cgemDigiTds)->getIntId();
161 Int_t trackIndex = (*cgemDigiTds)->getTrackIndex();
162 Double_t time_ns = (*cgemDigiTds)->getTime_ns();
163 Double_t charge_fC= (*cgemDigiTds)->getCharge_fc();
169 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject: "
172 <<
",charge=" << charge
173 <<
",overflow=" << overflow << endreq;
184 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
186 return StatusCode::SUCCESS;
ObjectVector< CgemDigi > CgemDigiCol
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
CgemDigiCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
void setCharge_fc(double q)
void setOverflow(const unsigned int overflow)
unsigned int getOverflow() const
void setTime_ns(double t)
static TDigiEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
void setTrackIndex(const int trackIndex)
void setChargeChannel(const unsigned int chargeChannel)
void setTimeChannel(const unsigned int timeChannel)
Definition of a Root address, derived from IOpaqueAddress.
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 setTime_ns(Double_t t)
void setCharge_fc(Double_t q)
UInt_t getOverflow() const
void setOverflow(const UInt_t overflow)
void clearCgemDigiCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getCgemDigiCol() const
retrieve the whole TObjArray of TkrDigi Data
void addCgemDigi(TCgemDigi *digi)
Add a TkrDigi into the TKR data collection.
void initialize(UInt_t id, UInt_t time=0, UInt_t charge=0)
void setTrackIndex(const int trackIndex)
int getTrackIndex() const
UInt_t getChargeChannel() const
UInt_t getTimeChannel() const
static std::map< const TObject *, const CgemDigi * > m_rootCgemDigiMap
_EXTERN_ std::string Event