ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::RPC_RawDataProviderTool Class Reference

#include <RPC_RawDataProviderTool.h>

Inheritance diagram for Muon::RPC_RawDataProviderTool:
Collaboration diagram for Muon::RPC_RawDataProviderTool:

Public Member Functions

virtual ~RPC_RawDataProviderTool ()=default
virtual StatusCode initialize () override
virtual StatusCode convert (const EventContext &) const override
 Decoding method - IMuonRawDataProviderTool interface (EventContext-based).
virtual StatusCode convert (const std::vector< IdentifierHash > &, const EventContext &) const override
virtual StatusCode convert (const std::vector< uint32_t > &, const EventContext &) const override

Private Member Functions

StatusCode convertIntoContainer (const ROBFragmentList &vecRobs, const std::vector< IdentifierHash > &collections, const EventContext &ctx) const
StatusCode convertIntoContainers (const ROBFragmentList &vecRobs, const std::vector< IdentifierHash > &collections, RpcPadContainer *pad, RpcSectorLogicContainer *logic, const bool &decodeSL, const EventContext &ctx) const
std::vector< IdentifierHashto_be_converted (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const std::vector< IdentifierHash > &coll) const

Private Attributes

SG::ReadCondHandleKey< RpcCablingCondDatam_readKey {this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}
ServiceHandle< IROBDataProviderSvcm_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
ToolHandle< IRpcROD_Decoderm_decoder {this, "Decoder", "Muon::RpcROD_Decoder/RpcROD_Decoder"}
SG::WriteHandleKey< RpcPadContainerm_containerKey {this, "RdoLocation", "RPCPAD", "Name of the RPCPAD produced by RawDataProvider"}
SG::WriteHandleKey< RpcSectorLogicContainerm_sec
SG::UpdateHandleKey< RpcPad_Cachem_rdoContainerCacheKey
 RPC container cache key.
Gaudi::Property< bool > m_WriteOutRpcSectorLogic {this, "WriteOutRpcSectorLogic", true, "Turn on/off RpcSectorLogic writing"}
 Turn on/off RpcSectorConfig writing.
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Detailed Description

Definition at line 24 of file RPC_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ ~RPC_RawDataProviderTool()

virtual Muon::RPC_RawDataProviderTool::~RPC_RawDataProviderTool ( )
virtualdefault

Member Function Documentation

◆ convert() [1/3]

StatusCode Muon::RPC_RawDataProviderTool::convert ( const EventContext & ctx) const
overridevirtual

Decoding method - IMuonRawDataProviderTool interface (EventContext-based).

Definition at line 96 of file RPC_RawDataProviderTool.cxx.

96 {
97 const RpcCablingCondData* readCdo{nullptr};
98 ATH_CHECK(SG::get(readCdo, m_readKey, ctx));
99 return convert(readCdo->giveFullListOfRobIds(), ctx);
100}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode convert(const EventContext &) const override
Decoding method - IMuonRawDataProviderTool interface (EventContext-based).
SG::ReadCondHandleKey< RpcCablingCondData > m_readKey
const std::vector< uint32_t > & giveFullListOfRobIds() const
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ convert() [2/3]

StatusCode Muon::RPC_RawDataProviderTool::convert ( const std::vector< IdentifierHash > & rdoIdhVect,
const EventContext & ctx ) const
overridevirtual

Definition at line 110 of file RPC_RawDataProviderTool.cxx.

111 {
112 const RpcCablingCondData* readCdo{nullptr};
113 ATH_CHECK(SG::get(readCdo, m_readKey, ctx));
114 ROBFragmentList vecOfRobf;
115 std::vector<uint32_t> robIds;
116 ATH_CHECK(readCdo->giveROB_fromRDO(rdoIdhVect, robIds));
117 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
118 return convertIntoContainer(vecOfRobf, rdoIdhVect, ctx);
119}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const std::vector< IdentifierHash > &collections, const EventContext &ctx) const
StatusCode giveROB_fromRDO(const IdentifierHash rdoHashId, uint32_t &robId) const

◆ convert() [3/3]

StatusCode Muon::RPC_RawDataProviderTool::convert ( const std::vector< uint32_t > & robIds,
const EventContext & ctx ) const
overridevirtual

Definition at line 102 of file RPC_RawDataProviderTool.cxx.

103 {
104 std::vector<IdentifierHash> collections;
105 ROBFragmentList vecOfRobf;
106 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
107 return convertIntoContainer(vecOfRobf, collections, ctx);
108}

◆ convertIntoContainer()

StatusCode Muon::RPC_RawDataProviderTool::convertIntoContainer ( const ROBFragmentList & vecRobs,
const std::vector< IdentifierHash > & collections,
const EventContext & ctx ) const
private

Definition at line 121 of file RPC_RawDataProviderTool.cxx.

123 {
124 SG::WriteHandle<RpcPadContainer> rdoContainerHandle(m_containerKey, ctx);
125 SG::WriteHandle<RpcSectorLogicContainer> logicHandle(m_sec, ctx);
126
127 // run 3 mode, here we always try to write the containers
128
129 // Split the methods to have one where we use the cache and one where we just setup the container
130 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
131 if (!externalCacheRDO) {
132 ATH_CHECK(rdoContainerHandle.record(std::make_unique<RpcPadContainer>(m_idHelperSvc->rpcIdHelper().module_hash_max())));
133 ATH_MSG_DEBUG("Created RpcPadContainer");
134 } else {
135 SG::UpdateHandle<RpcPad_Cache> update(m_rdoContainerCacheKey, ctx);
136 ATH_CHECK(update.isValid());
137 ATH_CHECK(rdoContainerHandle.record(std::make_unique<RpcPadContainer>(update.ptr())));
138 ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key());
139 }
140 RpcPadContainer* pad = rdoContainerHandle.ptr();
141
142 RpcSectorLogicContainer* logic = nullptr;
144 ATH_MSG_DEBUG("Writing out RpcSectorLogicContainer");
145 ATH_CHECK(logicHandle.record(std::make_unique<RpcSectorLogicContainer>()));
146 logic = logicHandle.ptr();
147 }
148
149 // pass the containers to the convertIntoContainers function
150 ATH_CHECK(convertIntoContainers(vecRobs, collections, pad, logic, true, ctx));
151
152 return StatusCode::SUCCESS;
153}
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcPadContainer
SG::WriteHandleKey< RpcPadContainer > m_containerKey
SG::WriteHandleKey< RpcSectorLogicContainer > m_sec
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::UpdateHandleKey< RpcPad_Cache > m_rdoContainerCacheKey
RPC container cache key.
StatusCode convertIntoContainers(const ROBFragmentList &vecRobs, const std::vector< IdentifierHash > &collections, RpcPadContainer *pad, RpcSectorLogicContainer *logic, const bool &decodeSL, const EventContext &ctx) const
Gaudi::Property< bool > m_WriteOutRpcSectorLogic
Turn on/off RpcSectorConfig writing.

◆ convertIntoContainers()

StatusCode Muon::RPC_RawDataProviderTool::convertIntoContainers ( const ROBFragmentList & vecRobs,
const std::vector< IdentifierHash > & collections,
RpcPadContainer * pad,
RpcSectorLogicContainer * logic,
const bool & decodeSL,
const EventContext & ctx ) const
private

Definition at line 46 of file RPC_RawDataProviderTool.cxx.

49 {
50 for (auto itFrag = vecRobs.begin(); itFrag != vecRobs.end(); itFrag++) {
51 // convert only if data payload is delivered
52 if ((**itFrag).rod_ndata() != 0) {
53 std::vector<IdentifierHash> coll = to_be_converted(**itFrag, collections);
54
55 if (m_decoder->fillCollections(ctx, **itFrag, *pad, coll, logic, decodeSL).isFailure()) {
56 // store the error conditions into the StatusCode and continue
57 }
58 } else {
59 if (msgLvl(MSG::DEBUG)) {
60 uint32_t sourceId = (**itFrag).source_id();
61 msg(MSG::DEBUG) << " ROB " << MSG::hex << sourceId << " is delivered with an empty payload" << MSG::dec << endmsg;
62 }
63 // store the error condition into the StatusCode and continue
64 }
65 }
66
67 ATH_MSG_DEBUG("After processing, number of collections in container : " << pad->numberOfCollections());
68
69 // in presence of errors return FAILURE
70 return StatusCode::SUCCESS;
71}
#define endmsg
virtual size_t numberOfCollections() const override final
return number of collections
ToolHandle< IRpcROD_Decoder > m_decoder
std::vector< IdentifierHash > to_be_converted(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const std::vector< IdentifierHash > &coll) const
setEventNumber uint32_t
MsgStream & msg
Definition testRead.cxx:32

◆ initialize()

StatusCode Muon::RPC_RawDataProviderTool::initialize ( )
overridevirtual

Definition at line 16 of file RPC_RawDataProviderTool.cxx.

16 {
17 // retrieve ROD decoder
18 ATH_CHECK(m_decoder.retrieve());
19
20 ATH_CHECK(m_containerKey.initialize());
21 ATH_CHECK(m_sec.initialize());
22
23 // get ROB data provider service
24 ATH_CHECK(m_robDataProvider.retrieve());
25
26 ATH_CHECK(m_readKey.initialize());
27
28 // Additional initialization from MT class
30 ATH_CHECK(m_idHelperSvc.retrieve());
31
32 // We should only turn off the sector logic when running with cached data a la trigger mode
35 "Cannot write out RpcSectorLogic while running with cached RpcPad containers"
36 " as the RpcSectorLogic is not cached at the same time and the written containers will desync."
37 " Please turn off RpcSectorLogic writing when running with cached bytestream container");
38 return StatusCode::FAILURE;
39 }
40
41 ATH_MSG_INFO("initialize() successful in " << name());
42
43 return StatusCode::SUCCESS;
44}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)

◆ to_be_converted()

std::vector< IdentifierHash > Muon::RPC_RawDataProviderTool::to_be_converted ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
const std::vector< IdentifierHash > & coll ) const
private

Definition at line 73 of file RPC_RawDataProviderTool.cxx.

74 {
75 SG::ReadCondHandle<RpcCablingCondData> readHandle{m_readKey};
76 const RpcCablingCondData* readCdo{*readHandle};
77
78 std::vector<IdentifierHash> to_return;
79 if (coll.empty()) {
80 // get SubdetectorId and ModuleId
81 uint32_t source_id = robFrag.rod_source_id();
82 SourceIdentifier sid(source_id);
83 to_return = (readCdo->rod2hash(sid.subdetector_id(), sid.module_id()));
84 } else {
85 uint32_t source_id = robFrag.rod_source_id();
86 std::vector<IdentifierHash>::const_iterator it = coll.begin();
87 to_return.reserve(coll.size());
88 for (; it != coll.end(); ++it) {
89 if (source_id == readCdo->hash2source(*it)) to_return.emplace_back(*it);
90 }
91 }
92
93 return to_return;
94}
std::vector< IdentifierHash > rod2hash(uint16_t subsystem, uint16_t rod) const
uint32_t hash2source(unsigned int h) const

Member Data Documentation

◆ m_containerKey

SG::WriteHandleKey<RpcPadContainer> Muon::RPC_RawDataProviderTool::m_containerKey {this, "RdoLocation", "RPCPAD", "Name of the RPCPAD produced by RawDataProvider"}
private

Definition at line 61 of file RPC_RawDataProviderTool.h.

61{this, "RdoLocation", "RPCPAD", "Name of the RPCPAD produced by RawDataProvider"};

◆ m_decoder

ToolHandle<IRpcROD_Decoder> Muon::RPC_RawDataProviderTool::m_decoder {this, "Decoder", "Muon::RpcROD_Decoder/RpcROD_Decoder"}
private

Definition at line 58 of file RPC_RawDataProviderTool.h.

58{this, "Decoder", "Muon::RpcROD_Decoder/RpcROD_Decoder"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::RPC_RawDataProviderTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 72 of file RPC_RawDataProviderTool.h.

72{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_rdoContainerCacheKey

SG::UpdateHandleKey<RpcPad_Cache> Muon::RPC_RawDataProviderTool::m_rdoContainerCacheKey
private
Initial value:
{this, "RpcContainerCacheKey",
"", "Optional external cache for the RPC container"}

RPC container cache key.

Definition at line 67 of file RPC_RawDataProviderTool.h.

67 {this, "RpcContainerCacheKey",
68 "", "Optional external cache for the RPC container"};

◆ m_readKey

SG::ReadCondHandleKey<RpcCablingCondData> Muon::RPC_RawDataProviderTool::m_readKey {this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}
private

Definition at line 52 of file RPC_RawDataProviderTool.h.

52{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"};

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> Muon::RPC_RawDataProviderTool::m_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
private

Definition at line 55 of file RPC_RawDataProviderTool.h.

55{this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

◆ m_sec

SG::WriteHandleKey<RpcSectorLogicContainer> Muon::RPC_RawDataProviderTool::m_sec
private
Initial value:
{this, "RPCSec", "RPC_SECTORLOGIC",
"Name of the RPC_SECTORLOGIC produced by RawDataProvider"}

Definition at line 63 of file RPC_RawDataProviderTool.h.

63 {this, "RPCSec", "RPC_SECTORLOGIC",
64 "Name of the RPC_SECTORLOGIC produced by RawDataProvider"};

◆ m_WriteOutRpcSectorLogic

Gaudi::Property<bool> Muon::RPC_RawDataProviderTool::m_WriteOutRpcSectorLogic {this, "WriteOutRpcSectorLogic", true, "Turn on/off RpcSectorLogic writing"}
private

Turn on/off RpcSectorConfig writing.

Definition at line 70 of file RPC_RawDataProviderTool.h.

70{this, "WriteOutRpcSectorLogic", true, "Turn on/off RpcSectorLogic writing"};

The documentation for this class was generated from the following files: