|
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "GaudiKernel/ISvcLocator.h"
16 #include "GaudiKernel/Bootstrap.h"
28 SmartIF<StoreGateSvc>
detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
37 return StatusCode::SUCCESS;
41 if (!cnv_tool)
return nullptr;
48 if(!m_isInitialized) {
49 if (this->
initialize(log) != StatusCode::SUCCESS) {
72 TRANS::const_iterator it_Coll = transCont->
begin();
73 TRANS::const_iterator it_CollEnd = transCont->
end();
74 unsigned int pcollIndex = 0;
75 unsigned int pcollBegin = 0;
76 unsigned int pcollEnd = 0;
83 for (pcollIndex = 0; it_Coll != it_CollEnd; ++pcollIndex, ++it_Coll) {
90 pcollBegin = pcollEnd;
91 pcollEnd += collection.
size();
98 persCont->
m_prds.resize(pcollEnd);
101 unsigned int lastPRDIdHash = 0;
102 for (
unsigned int i = 0;
i < collection.
size(); ++
i) {
103 unsigned int pchanIndex=
i+pcollBegin;
112 int multilayer = (m_sTgcId->multilayer(
chan->identify())-1);
113 int gasGap = (m_sTgcId->gasGap(
chan->identify())-1);
114 int channelType = (m_sTgcId->channelType(
chan->identify()));
118 unsigned short diff = (
channel << 5 | channelType << 3 |
gasGap << 1 | multilayer) ;
119 log <<
MSG::DEBUG <<
"Translated id=" <<
chan->identify().get_compact() <<
" (multilayer=" << multilayer
127 if (temp!=
chan->identify() )
128 log << MSG::WARNING <<
"PRD ids differ! Transient:"<<
chan->identify()<<
", From persistent:"<<temp<<
" diff = "<<
chan->identify().get_compact()-temp.
get_compact()<<
endmsg;
131 if (lastPRDIdHash && lastPRDIdHash !=
chan->collectionHash() )
log << MSG::WARNING <<
"Collection Identifier hashes differ!"<<
endmsg;
132 lastPRDIdHash =
chan->collectionHash();
135 if (
chan->collectionHash()!= collection.
identifyHash() )
log << MSG::WARNING <<
"Collection's idHash does not match PRD collection hash!"<<
endmsg;
136 if (
chan->detectorElement() !=getReadOutElement(
chan->identify()))
137 log << MSG::WARNING <<
"Getting de from identity didn't work!"<<
endmsg;
140 if (
chan->detectorElement() !=getReadOutElement(temp))
log << MSG::WARNING <<
"Getting de from reconstructed identity didn't work!"<<
endmsg;
169 unsigned int pchanIndex(0);
173 for (
unsigned int pcollIndex = 0; pcollIndex < pCollEnd; ++pcollIndex) {
179 unsigned int pchanEnd = pchanIndex+pcoll.
m_size;
180 unsigned int chanIndex = 0;
184 for (; pchanIndex < pchanEnd; ++ pchanIndex, ++chanIndex) {
191 int channelType = ( 3 & (
diff>>3) );
193 int multilayer = ( 1 &
diff );
197 << multilayer <<
", gasGap=" <<
gasGap <<
", channelType=" << channelType
200 if ( !m_sTgcId->valid(clusId) ) {
202 log << MSG::WARNING <<
"Tgc PRD has invalid Identifier of "<< m_sTgcId->show_to_string(clusId)<<
" - are you sure you have the correct geometry loaded, and NSW enabled?"<<
endmsg;
207 int result = m_sTgcId->get_detectorElement_hash(clusId, deIDHash);
209 log << MSG::WARNING<<
" Muon::sTgcPrepDataContainerCnv_p3::persToTrans: problem converting Identifier to DE hash "<<
endmsg;
211 getReadOutElement(clusId);
213 log << MSG::WARNING<<
"Muon::sTgcPrepDataContainerCnv_p3::persToTrans: could not get valid det element for PRD with id="<<clusId<<
". Skipping."<<
endmsg;
217 auto chan = std::make_unique<sTgcPrepData>
223 chan->setHashAndIndex(collIDHash, chanIndex);
229 if (
sc.isFailure()) {
230 throw std::runtime_error(
"Failed to add collection to Identifiable Container");
233 log <<
MSG::DEBUG <<
"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = " << (
int) collIDHash <<
" / " <<
247 if(!m_isInitialized) {
248 if (this->
initialize(log) != StatusCode::SUCCESS) {
254 persToTrans(persObj, trans.get(),
log);
255 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).
void transToPers(const Muon::sTgcPrepData *transObj, Muon::sTgcPrepData_p3 *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
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
value_type get_compact() const
Get the compact id.
virtual void transToPers(const Muon::sTgcPrepDataContainer *transCont, Muon::sTgcPrepDataContainer_p3 *persCont, MsgStream &log)
virtual void setIdentifier(Identifier id)
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
value_type get_compact() const
Get the compact id.
virtual IdentifierHash identifyHash() const override final
static Muon::sTgcPrepData createsTgcPrepData(const Muon::sTgcPrepData_p3 *persObj, const Identifier clusId, const MuonGM::sTgcReadoutElement *m_detEl, MsgStream &log)
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.
virtual Muon::sTgcPrepDataContainer * createTransient(const Muon::sTgcPrepDataContainer_p3 *persObj, MsgStream &log)
::StatusCode StatusCode
StatusCode definition for legacy code.
Class to hold the persistent representation of MuonPRD_Collection.
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
virtual Identifier identify() const override final
const_iterator end() const
return const_iterator for end of container
#define CHECK(...)
Evaluate an expression and check for errors.
virtual void persToTrans(const Muon::sTgcPrepDataContainer_p3 *persCont, Muon::sTgcPrepDataContainer *transCont, MsgStream &log)
const_iterator begin() const
return const_iterator for first entry
std::vector< MuonPRD_Collection_p2 > m_collections
Template to hold collections of MuonPrepRawData objects.
Class to contain the Muon Prep Raw Data.
Helpers for checking error return status codes and reporting errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
unsigned int m_hashId
Hash Identifier of this collection.
const sTgcIdHelper * m_sTgcId
std::vector< unsigned short > m_prdDeltaId
The delta identifiers of the PRD i.e.
MuonPrepDataCollection< sTgcPrepData > sTgcPrepDataCollection
const MuonGM::sTgcReadoutElement * getReadOutElement(const Identifier &id) const
StatusCode initialize(MsgStream &log)
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Class to represent sTgc measurements.
size_type size() const noexcept
Returns the number of elements in the collection.
unsigned int m_id
Identifier of this collection.