13#include "GaudiKernel/SmartDataPtr.h"
14#include "GaudiKernel/MsgStream.h"
16#include "GaudiKernel/ThreadGaudi.h"
19#include "EventModel/EventModel.h"
20#include "Identifier/Identifier.h"
21#include "Identifier/EmcID.h"
22#include "McTruth/EmcMcHit.h"
23#include "RawDataCnv/EventManagement/RAWEVENT.h"
24#include "RawDataCnv/EventManagement/RawEvent.h"
25#include "RawDataCnv/RawDataInputSvc.h"
26#include "RawDataCnv/RawDataEmcMcHitCnv.h"
49 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
50 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
51 std::string RawDataEmcMcHitCnv_Name(
"RawDataEmcMcHitCnv");
56 SmartIF<IService> pCnvSvc(conversionSvc());
57 if (isGaudiThreaded(pCnvSvc->name())){
58 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
59 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
60 RawDataEmcMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
64 MsgStream log(messageService(), RawDataEmcMcHitCnv_Name.c_str());
67 if (StatusCode::SUCCESS != sc) {
68 log << MSG::ERROR <<
"RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
74 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc,
true);
75 if (sc != StatusCode::SUCCESS) {
76 log << MSG::ERROR <<
"Cant get PackedRawDataCnvSvc" << endreq;
80 if (m_RawDataAccess == 0 ) {
81 log << MSG::ERROR <<
"RawDataEmcCnv: Cant cast to RawDataCnvSvc " << endreq;
82 return StatusCode::FAILURE;
85 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
86 if (sc != StatusCode::SUCCESS ) {
87 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
92 if (m_inputSvc == 0 ) {
93 log << MSG::WARNING <<
"Cant cast to RawDataInputSvc " << endreq;
94 return StatusCode::FAILURE ;
97 return StatusCode::SUCCESS;
107 return Converter::updateObj(pAddr, pObj);
115 EmcMcHitCol *emcMcHitCol =
new EmcMcHitCol;
122 return StatusCode::FAILURE;
130 std::vector<uint32_t>::const_iterator
iter = evt->
getEmcTruth().begin();
131 std::vector<uint32_t>::const_iterator eiter = evt->
getEmcTruth().end();
133 for (
int emcMcHitId = 0;
iter != eiter; emcMcHitId++) {
135 m_emcMcHitBuilder.
unPack(
iter, eiter, m_EmcTruth);
140 m_EmcTruth.
x/(m_emcMcHitBuilder.
m_xCoeff*1.0),
141 m_EmcTruth.
y/(m_emcMcHitBuilder.
m_yCoeff*1.0),
142 m_EmcTruth.
z/(m_emcMcHitBuilder.
m_zCoeff*1.0),
148 emcMcHitCol->push_back(emcMcHit);
151 return StatusCode::SUCCESS;
164 return StatusCode::FAILURE;
171 return StatusCode::FAILURE;
174 StatusCode sc = m_emcMcHitBuilder.
pack(mcHitCol, re);
const CLID & CLID_EmcMcHitCol
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_EmcMcHitCol
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
virtual StatusCode pack(EmcMcHitCol *emcMcHitCol, WriteRawEvent *&re)
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, EmcTruth_t &)
uint64_t m_totalEdepCoeff
virtual WriteRawEvent *& getRawEvent()
const int_vector & getEmcTruth() const
RawDataEmcMcHitCnv(ISvcLocator *svc)
static const CLID & classID()
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.
_EXTERN_ std::string EmcMcHitCol
ObjectVector< EmcMcHit > EmcMcHitCol