![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/ISvcLocator.h"
14 #include "GaudiKernel/Bootstrap.h"
25 ISvcLocator* svcLocator = Gaudi::svcLocator();
30 return StatusCode::FAILURE;
35 sc = svcLocator->service(
"DetectorStore",
detStore);
38 return StatusCode::FAILURE;
47 return StatusCode::FAILURE;
54 return StatusCode::FAILURE;
58 return StatusCode::SUCCESS;
62 if (!cnv_tool)
return nullptr;
68 if (this->
initialize(log) != StatusCode::SUCCESS) {
90 TRANS::const_iterator it_Coll = transCont->
begin();
91 TRANS::const_iterator it_CollEnd = transCont->
end();
92 unsigned int pcollIndex = 0;
93 unsigned int pcollBegin = 0;
94 unsigned int pcollEnd = 0;
100 for (pcollIndex = 0; it_Coll != it_CollEnd; ++pcollIndex, ++it_Coll) {
107 pcollBegin = pcollEnd;
108 pcollEnd += collection.
size();
115 persCont->
m_prds.resize(pcollEnd);
118 unsigned int lastPRDIdHash = 0;
119 for (
unsigned int i = 0;
i < collection.
size(); ++
i) {
120 unsigned int pchanIndex=
i+pcollBegin;
124 unsigned int clusIdCompact =
chan->identify().get_identifier32().get_compact();
126 int diff = clusIdCompact - collIdCompact;
127 persCont->
m_prdDeltaId[pchanIndex]=clusIdCompact - collIdCompact;
132 if (temp!=
chan->identify() )
133 log << MSG::WARNING <<
"PRD ids differ! Transient:"<<
chan->identify()<<
", From persistent:"<<temp<<
" diff = "<<
chan->identify().get_compact()-temp.
get_compact()<<
endmsg;
136 if (lastPRDIdHash && lastPRDIdHash !=
chan->collectionHash() )
log << MSG::WARNING <<
"Collection Identifier hashes differ!"<<
endmsg;
137 lastPRDIdHash =
chan->collectionHash();
139 if (
chan->collectionHash()!= collection.
identifyHash() )
log << MSG::WARNING <<
"Collection's idHash does not match PRD collection hash!"<<
endmsg;
140 if (
chan->detectorElement() != getReadOutElement(
chan->identify()))
141 log << MSG::WARNING <<
"Getting de from identity didn't work!"<<
endmsg;
144 if (
chan->detectorElement() != getReadOutElement(temp))
log << MSG::WARNING <<
"Getting de from reconstructed identity didn't work!"<<
endmsg;
173 unsigned int pchanIndex(0);
177 for (
unsigned int pcollIndex = 0; pcollIndex < pCollEnd; ++pcollIndex) {
188 unsigned int pchanEnd = pchanIndex+pcoll.
m_size;
189 unsigned int chanIndex = 0;
193 for (; pchanIndex < pchanEnd; ++ pchanIndex, ++chanIndex) {
197 if ( !m_CscId->valid(clusId) ) {
199 log << MSG::WARNING <<
"Csc PRD has invalid Identifier of "<< m_CscId->show_to_string(clusId)
200 <<
" and will be skipped!" <<
endmsg;
206 int result = m_CscId->get_detectorElement_hash(clusId, deIDHash);
209 log << MSG::WARNING<<
" Muon::CscPrepDataContainerCnv_p2::persToTrans: problem converting Identifier to DE hash "<<
endmsg;
213 if (
log.level() <= MSG::WARNING)
214 log << MSG::WARNING<<
"Muon::CscPrepDataContainerCnv_p2::persToTrans: could not get valid det element for PRD with id="<<clusId<<
". Skipping."<<
endmsg;
218 auto chan = std::make_unique<CscPrepData>
225 chan->setHashAndIndex(collIDHash, chanIndex);
231 if (
sc.isFailure()) {
232 throw std::runtime_error(
"Failed to add collection to Identifiable Container");
235 log <<
MSG::DEBUG <<
"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = " << (
int) collIDHash <<
" / " <<
246 if(!m_isInitialized) {
247 if (this->
initialize(log) != StatusCode::SUCCESS) {
253 persToTrans(persObj, trans.get(),
log);
254 return(trans.release());
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
virtual Muon::CscPrepDataContainer * createTransient(const Muon::CscPrepDataContainer_p2 *persObj, MsgStream &log)
void transToPers(const Muon::CscPrepData *transObj, Muon::CscPrepData_p2 *persObj, MsgStream &log)
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,...
std::vector< PRD > m_prds
virtual void persToTrans(const Muon::CscPrepDataContainer_p2 *persCont, Muon::CscPrepDataContainer *transCont, MsgStream &log)
const CscIdHelper * m_CscId
virtual void setIdentifier(Identifier id)
The Athena Transient Store API.
const MuonGM::CscReadoutElement * getReadOutElement(const Identifier &id) const
virtual IdentifierHash identifyHash() const override final
virtual size_t numberOfCollections() const override final
return number of collections
unsigned short m_size
Collection size into master collection Note I use a short.
value_type get_compact(void) const
Get the compact id.
Class representing clusters from the CSC.
StatusCode initialize(MsgStream &log)
::StatusCode StatusCode
StatusCode definition for legacy code.
Class to hold the persistent representation of MuonPRD_Collection.
virtual Identifier identify() const override final
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
std::vector< MuonPRD_Collection_p2 > m_collections
Template to hold collections of MuonPrepRawData objects.
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
Class to contain the Muon Prep Raw Data.
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
value_type push_back(value_type pElem)
Add an element to the end of the collection.
static Muon::CscPrepData createCscPrepData(const Muon::CscPrepData_p2 *persObj, const Identifier &clusId, const MuonGM::CscReadoutElement *detEl, MsgStream &log)
unsigned int m_hashId
Hash Identifier of this collection.
We don't write out (from Trk::PrepRawData) m_indexAndHash (can be recomputed), m_clusId (can be recom...
std::vector< unsigned short > m_prdDeltaId
The delta identifiers of the PRD i.e.
value_type get_compact(void) const
Get the compact id.
virtual void transToPers(const Muon::CscPrepDataContainer *transCont, Muon::CscPrepDataContainer_p2 *persCont, MsgStream &log)
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
size_type size() const noexcept
Returns the number of elements in the collection.
StoreGateSvc * m_storeGate
unsigned int m_id
Identifier of this collection.