14#include "GaudiKernel/MsgStream.h"
15#include "GaudiKernel/SmartDataPtr.h"
17#include "GaudiKernel/ThreadGaudi.h"
55 std::string PackedRawDataCnvSvc_Name(
"PackedRawDataCnvSvc");
56 std::string RawDataInputSvc_Name(
"RawDataInputSvc");
57 std::string RawDataTofMcHitCnv_Name(
"RawDataTofMcHitCnv");
62 SmartIF<IService> pCnvSvc(conversionSvc());
63 if (isGaudiThreaded(pCnvSvc->name())){
64 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
65 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
66 RawDataTofMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
70 MsgStream log(messageService(), RawDataTofMcHitCnv_Name.c_str());
73 if (StatusCode::SUCCESS != sc) {
74 log << MSG::ERROR <<
"RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
80 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc,
true);
81 if (sc != StatusCode::SUCCESS) {
82 log << MSG::ERROR <<
"Cant get PackedRawDataCnvSvc" << endreq;
86 if (m_RawDataAccess == 0 ) {
87 log << MSG::ERROR <<
"RawDataTofCnv: Cant cast to RawDataCnvSvc " << endreq;
88 return StatusCode::FAILURE;
91 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
92 if (sc != StatusCode::SUCCESS ) {
93 log << MSG::WARNING <<
"Cant get RawDataInputSvc " << endreq;
98 if (m_inputSvc == 0 ) {
99 log << MSG::WARNING <<
"Cant cast to RawDataInputSvc " << endreq;
100 return StatusCode::FAILURE ;
103 return StatusCode::SUCCESS;
113 return Converter::updateObj(pAddr, pObj);
122 TofMcHitCol *tofMcHitCol =
new TofMcHitCol;
128 return StatusCode::FAILURE;
136 std::vector<uint32_t>::const_iterator
iter = evt->
getTofTruth().begin();
137 std::vector<uint32_t>::const_iterator eiter = evt->
getTofTruth().end();
139 for (
int tofMcHitId = 0;
iter != eiter; tofMcHitId++) {
141 m_tofMcHitBuilder.
unPack(
iter, eiter, m_TofTruth);
143 unsigned int layer = 0;
144 unsigned int barrel_ec = m_TofTruth.
partId;
159 if(barrel_ec==0 || barrel_ec==1 || barrel_ec==2 )
178 m_TofTruth.
x/(m_tofMcHitBuilder.
m_xCoeff*1.0),
179 m_TofTruth.
y/(m_tofMcHitBuilder.
m_yCoeff*1.0),
180 m_TofTruth.
z/(m_tofMcHitBuilder.
m_zCoeff*1.0),
187 tofMcHitCol->push_back(tofMcHit);
190 return StatusCode::SUCCESS;
203 return StatusCode::FAILURE;
210 return StatusCode::FAILURE;
213 StatusCode sc = m_tofMcHitBuilder.
pack(mcHitCol, re);
unsigned const long PACKEDRAWEVENT_StorageType
const CLID & CLID_TofMcHitCol
const CLID & CLID_TofMcHitCol
static G4int Produce_unique_identifier(G4int module_mrpc_f, G4int readoutstripnumber_f)
static G4int Calculate_Readoutstrip_number_continuum(G4double x_mm, G4double y_mm, G4int partId_f, G4int module_mrpc_f)
virtual WriteRawEvent *& getRawEvent()
const int_vector & getTofTruth() const
static const CLID & classID()
RawDataTofMcHitCnv(ISvcLocator *svc)
virtual StatusCode updateObj(IOpaqueAddress *, DataObject *)
override the RawDataBaseCnv version
StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Convert the transient object to the requested representation.
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
static value_type getPHI_BARREL_MAX()
static bool is_barrel(const Identifier &id)
Test for barrel.
static Identifier cell_id_mrpc_mc(int partID, int scinNum)
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, TofTruth_t &)
uint64_t m_trackLengthCoeff
virtual StatusCode pack(TofMcHitCol *tofMcHitCol, WriteRawEvent *&re)
_EXTERN_ std::string TofMcHitCol
ObjectVector< TofMcHit > TofMcHitCol