18#include "GaudiKernel/ISvcLocator.h"
19#include "GaudiKernel/Bootstrap.h"
32 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
33 CHECK( detStore.isValid() );
41 log << MSG::DEBUG <<
"Converter initialized." <<
endmsg;
42 return StatusCode::SUCCESS;
67 unsigned int pcollIndex;
68 unsigned int pcollBegin = 0;
69 unsigned int pcollEnd = 0;
72 log << MSG::DEBUG <<
" Preparing " << persCont->
m_collections.size() <<
"Collections" <<
endmsg;
73 for (pcollIndex = 0; it_Coll != it_CollEnd; ++pcollIndex, ++it_Coll) {
78 pcollBegin = pcollEnd;
79 pcollEnd += collection.
size();
87 persCont->
m_prds.resize(pcollEnd);
89 log << MSG::VERBOSE <<
"Reading collections with " << collection.
size() <<
"PRDs " <<
endmsg;
90 for (
unsigned int i = 0; i < collection.
size(); ++i) {
91 unsigned int pchanIndex=i+pcollBegin;
98 log << MSG::DEBUG <<
" *** Writing Muon::RpcCoinDataContainer" <<
endmsg;
121 unsigned int pchanIndex(0);
123 log << MSG::DEBUG <<
" Reading " << persCont->
m_collections.size() <<
"Collections" <<
endmsg;
124 for (
unsigned int pcollIndex = 0; pcollIndex < pCollEnd; ++pcollIndex) {
131 unsigned int pchanEnd = pchanIndex+pcoll.
m_size;
132 unsigned int chanIndex = 0;
136 for (; pchanIndex < pchanEnd; ++ pchanIndex, ++chanIndex) {
142 int result =
m_RpcId->get_detectorElement_hash(clusId, deIDHash);
143 if (
result) log << MSG::WARNING <<
" Muon::RpcCoinDataContainerCnv_p1::persToTrans: problem converting Identifier to DE hash "<<
endmsg;
147 auto chan = std::make_unique<Muon::RpcCoinData>
153 chan->setHashAndIndex(collIDHash, chanIndex);
154 (*coll)[chanIndex] = std::move(chan);
159 if (
sc.isFailure()) {
160 throw std::runtime_error(
"Failed to add collection to ID Container");
162 if (log.level() <= MSG::DEBUG) {
163 log << MSG::DEBUG <<
"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = " << (int) collIDHash <<
" / "
168 log << MSG::DEBUG <<
" *** Reading Muon::MuonCoinDataCollection<RpcCoinData>" <<
endmsg;
176 if (this->
initialize(log) != StatusCode::SUCCESS) {
177 log << MSG::FATAL <<
"Could not initialize RpcCoinDataContainerCnv_p1 " <<
endmsg;
183 return(trans.release());
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
void resize(size_type sz)
Resizes the collection to the specified number of elements.
size_type size() const noexcept
Returns the number of elements in the collection.
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.
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
IdentifierHash identifyHash() const
Identifier identify() const
void setIdentifier(Identifier id)
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
StatusCode initialize(MsgStream &log)
Muon::MuonPRD_Container_p2< RpcCoinData_p1 > PERS
Muon::RpcCoinDataContainer TRANS
const MuonGM::MuonDetectorManager * m_muonDetMgr
const RpcIdHelper * m_RpcId
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
virtual void persToTrans(const PERS *persCont, TRANS *transCont, MsgStream &log)
virtual void transToPers(const TRANS *transCont, PERS *persCont, MsgStream &log)
Persistent representation of the transient Muon::RpcCoinData class.
void transToPers(const Muon::RpcCoinData *transObj, Muon::RpcCoinData_p1 *persObj, MsgStream &log)
static Muon::RpcCoinData createRpcCoinData(const Muon::RpcCoinData_p1 *persObj, const Identifier &id, const MuonGM::RpcReadoutElement *detEl, MsgStream &log)
MuonCoinDataCollection< RpcCoinData > RpcCoinDataCollection
MuonCoinDataContainer< RpcCoinDataCollection > RpcCoinDataContainer