14#include "GaudiKernel/MsgStream.h"
15#include "GaudiKernel/SmartDataPtr.h"
17#include "GaudiKernel/ThreadGaudi.h"
52 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
53 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
54 std::string RawDataMdcMcHitCnv_Name(
"RawDataMdcMcHitCnv");
59 SmartIF<IService> pCnvSvc(conversionSvc());
60 if (isGaudiThreaded(pCnvSvc->name())){
61 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
62 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
63 RawDataMdcMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
67 MsgStream log(messageService(), RawDataMdcMcHitCnv_Name.c_str());
70 if (StatusCode::SUCCESS != sc) {
71 log << MSG::ERROR <<
"RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
77 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc,
true);
78 if (sc != StatusCode::SUCCESS) {
79 log << MSG::ERROR <<
"Cant get PackedRawDataCnvSvc" << endreq;
83 if (m_RawDataAccess == 0 ) {
84 log << MSG::ERROR <<
"RawDataMdcCnv: Cant cast to RawDataCnvSvc " << endreq;
85 return StatusCode::FAILURE;
89 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
90 if (sc != StatusCode::SUCCESS ) {
91 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
96 if (m_inputSvc == 0 ) {
97 log << MSG::WARNING <<
"Cant cast to RawDataInputSvc " << endreq;
98 return StatusCode::FAILURE ;
101 return StatusCode::SUCCESS;
111 return Converter::updateObj(pAddr, pObj);
120 MdcMcHitCol *mdcMcHitCol =
new MdcMcHitCol;
126 return StatusCode::FAILURE;
134 std::vector<uint32_t>::const_iterator
iter = evt->
getMdcTruth().begin();
135 std::vector<uint32_t>::const_iterator eiter = evt->
getMdcTruth().end();
137 for (
int mdcMcHitId = 0;
iter != eiter; mdcMcHitId++) {
139 m_mdcMcHitBuilder.
unPack(
iter, eiter, m_MdcTruth);
144 m_MdcTruth.
x/(m_mdcMcHitBuilder.
m_xCoeff*1.0),
145 m_MdcTruth.
y/(m_mdcMcHitBuilder.
m_yCoeff*1.0),
146 m_MdcTruth.
z/(m_mdcMcHitBuilder.
m_zCoeff*1.0),
151 mdcMcHitCol->push_back(mdcMcHit);
154 return StatusCode::SUCCESS;
166 return StatusCode::FAILURE;
171 if (mdcHitCol == 0) {
173 return StatusCode::FAILURE;
191 StatusCode sc = m_mdcMcHitBuilder.
pack(mdcHitCol, re);
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_MdcMcHitCol
const CLID & CLID_MdcMcHitCol
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
virtual StatusCode pack(MdcMcHitCol *mdcMcHitCol, WriteRawEvent *&re)
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, MdcTruth_t &)
virtual WriteRawEvent *& getRawEvent()
const int_vector & getMdcTruth() const
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
RawDataMdcMcHitCnv(ISvcLocator *svc)
static const CLID & classID()
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
_EXTERN_ std::string MdcMcHitCol
ObjectVector< MdcMcHit > MdcMcHitCol