46{
47
48
49 try {
50 robFrag.check();
51 } catch (const eformat::Issue &ex) {
53 return StatusCode::SUCCESS;
54 }
55
56 const NswDcsDbData* dcsData{nullptr};
58
59 const Nsw_CablingMap* sTgcCablingMap{nullptr};
61
62 const MuonGM::MuonDetectorManager* muonGeoMgr{};
64
65
66 bool seeded_mode(!rdoIdhVect.empty());
67
68
69 Muon::nsw::NSWCommonDecoder common_decoder(robFrag);
70 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.get_elinks();
72 if (elinks.empty()) {
73 return StatusCode::SUCCESS;
74 }
76
77
78 for (auto* elink : elinks) {
79
80
81 if (elink->isNull()) {
82 continue;
83 }
84
85
86 const char*
station_name = elink->elinkId()->is_large_station() ?
"STL" :
"STS";
88 unsigned int station_phi = (
unsigned int)elink->elinkId()->station_phi();
89 unsigned int multi_layer = (
unsigned int)elink->elinkId()->multi_layer();
90 unsigned int gas_gap = (
unsigned int)elink->elinkId()->gas_gap();
91 Identifier module_ID =
m_stgcIdHelper->elementID(station_name, station_eta, station_phi);
92
93 IdentifierHash module_hashID{};
96
97 if (seeded_mode && std::ranges::find(rdoIdhVect, module_hashID) == rdoIdhVect.end()) {
98 continue;
99 }
100 std::unique_ptr<STGC_RawDataCollection>& rdo = rdo_map[module_hashID];
101 if (!rdo) rdo = std::make_unique<STGC_RawDataCollection>(module_hashID);
102
103
104 const std::vector<Muon::nsw::VMMChannel*>&
channels = elink->get_channels();
105 for (auto *channel : channels) {
106 unsigned int channel_number =
channel->channel_number();
108 if (channel_number == 0) continue;
109
110 Identifier channel_ID =
m_stgcIdHelper->channelID(module_ID, multi_layer, gas_gap, channel_type, channel_number);
111 if (sTgcCablingMap) {
112 std::optional<Identifier> correctedChannelId = sTgcCablingMap->
correctChannel(channel_ID, msgStream());
113 if (!correctedChannelId) {
114 ATH_MSG_DEBUG(
"Channel was shifted outside its connector and is therefore not decoded into and RDO");
115 continue;
116 }
117 channel_ID = (*correctedChannelId);
118 }
119 bool isOuterQ1{false};
120 if(std::abs(station_eta)==1 && dcsData){
122 if (!roElement->
stripPosition(channel_ID, localPos))
continue;
123 isOuterQ1 = !(roElement->
isEtaZero(channel_ID, localPos));
124 }
125
126 if (dcsData && !dcsData->
isGood(ctx, channel_ID, isOuterQ1))
continue;
127 bool timeAndChargeInCounts = true;
128 rdo->push_back(std::make_unique<STGC_RawData>(channel_ID,
channel->rel_bcid(),
channel->tdo(),
channel->pdo(),
false,timeAndChargeInCounts));
129 }
130 }
131
132 return StatusCode::SUCCESS;
133}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
bool isEtaZero(const Identifier &id, const Amg::Vector2D &localPosition) const
is eta=0 of QL1 or QS1?
SG::ReadCondHandleKey< NswDcsDbData > m_dscKey
SG::ReadCondHandleKey< Nsw_CablingMap > m_cablingKey
const sTgcIdHelper * m_stgcIdHelper
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
bool isGood(const EventContext &ctx, const Identifier &channelId, bool issTgcQ1OuterHv=false) const
Returns whether the channel is alive, i.e. DCS state on, etc...
std::optional< Identifier > correctChannel(const Identifier &id, MsgStream &msg) const
Eigen::Matrix< double, 2, 1 > Vector2D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
str station_name
Simple script to generate a BIS78 cabling map as used for the Monte Carlo processing.