14#include "GaudiKernel/MsgStream.h"
15#include "GaudiKernel/SmartDataPtr.h"
17#include "GaudiKernel/ThreadGaudi.h"
20#include "EventModel/EventModel.h"
21#include "Identifier/Identifier.h"
22#include "Identifier/MucID.h"
23#include "McTruth/MucMcHit.h"
24#include "RawDataCnv/EventManagement/RAWEVENT.h"
25#include "RawDataCnv/EventManagement/RawEvent.h"
26#include "RawDataCnv/RawDataInputSvc.h"
27#include "RawDataCnv/RawDataMucMcHitCnv.h"
53 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
54 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
55 std::string RawDataMucMcHitCnv_Name(
"RawDataMucMcHitCnv");
60 SmartIF<IService> pCnvSvc(conversionSvc());
61 if (isGaudiThreaded(pCnvSvc->name())){
62 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
63 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
64 RawDataMucMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
69 MsgStream log(messageService(), RawDataMucMcHitCnv_Name.c_str());
72 if (StatusCode::SUCCESS != sc) {
73 log << MSG::ERROR <<
"RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
79 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc,
true);
80 if (sc != StatusCode::SUCCESS) {
81 log << MSG::ERROR <<
"Cant get PackedRawDataCnvSvc" << endreq;
85 if (m_RawDataAccess == 0 ) {
86 log << MSG::ERROR <<
"RawDataMucCnv: Cant cast to RawDataCnvSvc " << endreq;
87 return StatusCode::FAILURE;
90 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
91 if (sc != StatusCode::SUCCESS ) {
92 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
97 if (m_inputSvc == 0 ) {
98 log << MSG::WARNING <<
"Cant cast to RawDataInputSvc " << endreq;
99 return StatusCode::FAILURE ;
102 return StatusCode::SUCCESS;
112 return Converter::updateObj(pAddr, pObj);
121 MucMcHitCol *mucMcHitCol =
new MucMcHitCol;
127 return StatusCode::FAILURE;
135 std::vector<uint32_t>::const_iterator
iter = evt->
getMucTruth().begin();
136 std::vector<uint32_t>::const_iterator eiter = evt->
getMucTruth().end();
138 for (
int mucMcHitId = 0;
iter != eiter; mucMcHitId++) {
140 m_mucMcHitBuilder.
unPack(
iter, eiter, m_MucTruth);
146 m_MucTruth.
x/(m_mucMcHitBuilder.
m_xCoeff*1.0),
147 m_MucTruth.
y/(m_mucMcHitBuilder.
m_yCoeff*1.0),
148 m_MucTruth.
z/(m_mucMcHitBuilder.
m_zCoeff*1.0),
153 mucMcHitCol->push_back(mucMcHit);
156 return StatusCode::SUCCESS;
169 return StatusCode::FAILURE;
176 return StatusCode::FAILURE;
179 StatusCode sc = m_mucMcHitBuilder.
pack(mcHitCol, re);
const CLID & CLID_MucMcHitCol
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_MucMcHitCol
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, MucTruth_t &)
virtual StatusCode pack(MucMcHitCol *mucMcHitCol, WriteRawEvent *&re)
virtual WriteRawEvent *& getRawEvent()
const int_vector & getMucTruth() const
RawDataMucMcHitCnv(ISvcLocator *svc)
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
static const CLID & classID()
_EXTERN_ std::string MucMcHitCol
ObjectVector< MucMcHit > MucMcHitCol