15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/Bootstrap.h"
28 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
29 CHECK( detStore.isValid() );
36 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG <<
"Converter initialized." <<
endmsg;
37 return StatusCode::SUCCESS;
42 if (!cnv_tool)
return nullptr;
67 TRANS::const_iterator it_Coll = transCont->
begin();
68 TRANS::const_iterator it_CollEnd = transCont->
end();
69 unsigned int pcollIndex =0;
70 unsigned int pcollBegin = 0;
71 unsigned int pcollEnd = 0;
75 if (log.level() <= MSG::DEBUG)
76 log << MSG::DEBUG<<
" Preparing " << persCont->
m_collections.size() <<
"Collections" <<
endmsg;
77 for (pcollIndex = 0; it_Coll != it_CollEnd; ++pcollIndex, ++it_Coll) {
79 if (log.level() <= MSG::DEBUG)
80 log << MSG::DEBUG<<
"New collection"<<
endmsg;
84 pcollBegin = pcollEnd;
85 pcollEnd += collection.
size();
92 persCont->
m_prds.resize(pcollEnd);
95 for (
unsigned int i = 0; i < collection.
size(); ++i) {
96 unsigned int pchanIndex=i+pcollBegin;
104 if (log.level() <= MSG::DEBUG)
105 log << MSG::DEBUG<<
" *** Writing MdtPrepDataContainer ***" <<
endmsg;
128 unsigned int pchanIndex(0);
130 if (log.level() <= MSG::DEBUG)
131 log << MSG::DEBUG<<
" Reading " << pCollEnd <<
"Collections" <<
endmsg;
132 for (
unsigned int pcollIndex = 0; pcollIndex < pCollEnd; ++pcollIndex) {
142 unsigned int pchanEnd = pchanIndex+pcoll.
m_size;
143 unsigned int chanIndex = 0;
147 for (; pchanIndex < pchanEnd; ++ pchanIndex, ++chanIndex) {
154 int result =
m_MdtId->get_detectorElement_hash(clusId, deIDHash);
155 if (
result&&log.level() <= MSG::WARNING)
156 log << MSG::WARNING<<
" Muon::MdtPrepDataContainerCnv_p2::persToTrans: problem converting Identifier to DE hash "<<
endmsg;
159 auto chan = std::make_unique<MdtPrepData>
165 chan->setHashAndIndex(collIDHash, chanIndex);
171 if (
sc.isFailure()) {
172 throw std::runtime_error(
"Failed to add collection to Identifiable Container");
174 if (log.level() <= MSG::DEBUG) {
175 log << MSG::DEBUG <<
"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = " << (int) collIDHash <<
" / " <<
180 if (log.level() <= MSG::DEBUG)
181 log << MSG::DEBUG<<
" *** Reading MdtPrepDataContainer ***" <<
endmsg;
190 if (this->
initialize(log) != StatusCode::SUCCESS) {
191 log << MSG::FATAL <<
"Could not initialize MdtPrepDataContainerCnv_p2 " <<
endmsg;
197 return(trans.release());
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
void reserve(size_type n)
value_type push_back(value_type pElem)
size_type size() const noexcept
const_iterator end() const
return const_iterator for end of container
virtual size_t numberOfCollections() const override final
return number of collections
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
const_iterator begin() const
return const_iterator for first entry
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
void transToPers(const Muon::MdtPrepData *transObj, Muon::MdtPrepData_p2 *persObj, MsgStream &log)
static Muon::MdtPrepData createMdtPrepData(const Muon::MdtPrepData_p2 *persObj, const Identifier &id, const MuonGM::MdtReadoutElement *detEl, MsgStream &log)
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
virtual Muon::MdtPrepDataContainer * createTransient(const Muon::MdtPrepDataContainer_p2 *persObj, MsgStream &log)
const MuonGM::MdtReadoutElement * getReadOutElement(const Identifier &id) const
virtual void transToPers(const Muon::MdtPrepDataContainer *transCont, Muon::MdtPrepDataContainer_p2 *persCont, MsgStream &log)
StatusCode initialize(MsgStream &log)
virtual void persToTrans(const Muon::MdtPrepDataContainer_p2 *persCont, Muon::MdtPrepDataContainer *transCont, MsgStream &log)
const MdtIdHelper * m_MdtId
Persistent representation of the transient Muon::MdtPrepData class.
Class to represent measurements from the Monitored Drift Tubes.
Class to hold the persistent representation of MuonPRD_Collection.
unsigned short m_size
Collection size into master collection Note I use a short.
unsigned int m_hashId
Hash Identifier of this collection.
unsigned int m_id
Identifier of this collection.
std::vector< MuonPRD_Collection_p2 > m_collections
std::vector< unsigned short > m_prdDeltaId
The delta identifiers of the PRD i.e.
std::vector< PRD > m_prds
virtual Identifier identify() const override final
virtual void setIdentifier(Identifier id)
virtual IdentifierHash identifyHash() const override final
MuonPRD_Container_p2< MdtPrepData_p2 > MdtPrepDataContainer_p2
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection