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;
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();
79 log << MSG::INFO <<
"My Message::CgemDigiCnv::TObjectToDataObject: "
82 <<
",charge=" << charge
83 <<
",overflow=" << overflow << endreq;
90 cgemDigiTdsCol->push_back(cgemDigiTds);
97 log << MSG::INFO <<
"My Message::CgemDigiCnv::TObjectToDataObject()-finished" << endreq;
99 return StatusCode::SUCCESS;
104 MsgStream log(
msgSvc(),
"CgemDigiCnv");
106 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()" << endreq;
108 log << MSG::DEBUG <<
"CgemDigiCnv::DataObjectToTObject" << endreq;
109 StatusCode sc=StatusCode::SUCCESS;
112 if (!cgemDigiColTds) {
113 log << MSG::ERROR <<
"Could not downcast to CgemDigiCol" << endreq;
115 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
117 return StatusCode::FAILURE;
123 log << MSG::ERROR <<
"Could not get DigiEvent in TDS " << endreq;
125 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
127 return StatusCode::FAILURE;
132 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
134 log << MSG::ERROR <<
"CgemDigiCnv:Could not downcast to TDS DigiEvent" << endreq;
137 IOpaqueAddress *addr;
147 if (!m_cgemDigiCol)
return sc;
149 CgemDigiCol::const_iterator cgemDigiTds;
151 for (cgemDigiTds=cgemDigiColTds->begin(); cgemDigiTds!=cgemDigiColTds->end(); cgemDigiTds++)
153 UInt_t overflow = (*cgemDigiTds)->getOverflow();
154 UInt_t
time = (*cgemDigiTds)->getTimeChannel();
155 UInt_t charge = (*cgemDigiTds)->getChargeChannel();
156 UInt_t
id = (*cgemDigiTds)->getIntId();
157 Int_t trackIndex = (*cgemDigiTds)->getTrackIndex();
162 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject: "
165 <<
",charge=" << charge
166 <<
",overflow=" << overflow << endreq;
175 log << MSG::INFO <<
"My Message::CgemDigiCnv::DataObjectToTObject()-finished" << endreq;
177 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 setOverflow(const unsigned int overflow)
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
std::vector< void * > m_adresses
each converter knows the corresponding adresses
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.
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