6 #include <unordered_map>
18 #include "Identifier/Identifier.h"
19 #include "eformat/Issue.h"
28 declareInterface<ISTGC_ROD_Decoder>(
this);
36 ATH_CHECK(m_DetectorManagerKey.initialize());
37 ATH_CHECK(m_dscKey.initialize(!m_dscKey.empty()));
38 ATH_CHECK(m_cablingKey.initialize(!m_cablingKey.empty()));
39 return StatusCode::SUCCESS;
51 const std::vector<IdentifierHash>& rdoIdhVect,
52 std::unordered_map<
IdentifierHash, std::unique_ptr<STGC_RawDataCollection>>& rdo_map)
const
60 return StatusCode::SUCCESS;
64 if(!m_dscKey.empty()) {
66 if(!readCondHandle.isValid()){
67 ATH_MSG_ERROR(
"Cannot find the NSW DcsCondDataObj "<<m_dscKey.fullKey());
68 return StatusCode::FAILURE;
70 dcsData = readCondHandle.cptr();
74 if (!m_cablingKey.empty()) {
76 if(!readCondHandle.isValid()){
78 return StatusCode::FAILURE;
80 sTgcCablingMap = readCondHandle.cptr();
85 if (!muonGeoMgrHandle.isValid()) {
86 ATH_MSG_FATAL(
"Failed to retrieve the detector manager from the conditions store");
87 return StatusCode::FAILURE;
93 bool seeded_mode(!rdoIdhVect.empty());
97 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.
get_elinks();
99 if (elinks.empty())
return StatusCode::SUCCESS;
103 for (
auto* elink : elinks) {
106 if (elink->isNull())
continue;
110 const char*
station_name = elink->elinkId()->is_large_station() ?
"STL" :
"STS";
112 unsigned int station_phi = (
unsigned int)elink->elinkId()->station_phi();
113 unsigned int multi_layer = (
unsigned int)elink->elinkId()->multi_layer();
114 unsigned int gas_gap = (
unsigned int)elink->elinkId()->gas_gap();
118 m_stgcIdHelper->get_module_hash(module_ID, module_hashID);
121 if (seeded_mode &&
std::find(rdoIdhVect.begin(), rdoIdhVect.end(), module_hashID) == rdoIdhVect.end())
continue;
122 std::unique_ptr<STGC_RawDataCollection>& rdo = rdo_map[module_hashID];
123 if (!rdo) rdo = std::make_unique<STGC_RawDataCollection>(module_hashID);
126 const std::vector<Muon::nsw::VMMChannel*>&
channels = elink->get_channels();
128 unsigned int channel_number =
channel->channel_number();
130 if (channel_number == 0)
continue;
132 Identifier channel_ID = m_stgcIdHelper->channelID(module_ID, multi_layer, gas_gap,
channel_type, channel_number);
133 if (sTgcCablingMap) {
134 std::optional<Identifier> correctedChannelId = sTgcCablingMap->correctChannel(channel_ID, msgStream());
135 if (!correctedChannelId) {
136 ATH_MSG_DEBUG(
"Channel was shifted outside its connector and is therefore not decoded into and RDO");
139 channel_ID = (*correctedChannelId);
141 bool isOuterQ1{
false};
144 if (!roElement->
stripPosition(channel_ID, localPos))
continue;
145 isOuterQ1 = !(roElement->
isEtaZero(channel_ID, localPos));
148 if (dcsData && !dcsData->isGood(ctx, channel_ID, isOuterQ1))
continue;
149 bool timeAndChargeInCounts =
true;
154 return StatusCode::SUCCESS;