Convert ROBFragments to RDOs.
46{
47
48 try {
49 robFrag.check();
50 } catch (const eformat::Issue &ex) {
52 return StatusCode::SUCCESS;
53 }
54 const Nsw_CablingMap* mmCablingMap{nullptr};
56 SG::ReadCondHandle<Nsw_CablingMap> readCondHandle{
m_cablingKey, ctx};
59 return StatusCode::FAILURE;
60 }
61 mmCablingMap = readCondHandle.
cptr();
62 }
63 const NswDcsDbData* dcsData{nullptr};
65 SG::ReadCondHandle<NswDcsDbData> readCondHandle{
m_dscKey, ctx};
68 return StatusCode::FAILURE;
69 }
70 dcsData = readCondHandle.
cptr();
71 }
72
73
74
75 bool seeded_mode(!rdoIdhVect.empty());
76
77
78 Muon::nsw::NSWCommonDecoder common_decoder(robFrag);
79 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.get_elinks();
81 if (elinks.empty()) return StatusCode::SUCCESS;
82
83
84
85 for (auto* elink : elinks) {
86
87
88 if (elink->isNull()) continue;
89
90
91
92 const char*
station_name = elink->elinkId()->is_large_station() ?
"MML" :
"MMS";
94 unsigned int station_phi = (
unsigned int)elink->elinkId()->station_phi();
95 unsigned int multi_layer = (
unsigned int)elink->elinkId()->multi_layer();
96 unsigned int gas_gap = (
unsigned int)elink->elinkId()->gas_gap();
97 Identifier module_ID =
m_MmIdHelper->elementID(station_name, station_eta, station_phi);
98
99 IdentifierHash module_hashID{0};
100 m_MmIdHelper->get_module_hash(module_ID, module_hashID);
101
102
103 if (seeded_mode && std::find(rdoIdhVect.begin(), rdoIdhVect.end(), module_hashID) == rdoIdhVect.end()) continue;
104
105 std::unique_ptr<MM_RawDataCollection>& rdo = rdo_map[module_hashID];
106 if (!rdo) rdo = std::make_unique<MM_RawDataCollection>(module_hashID);
107
108
109 const std::vector<Muon::nsw::VMMChannel *>&
channels = elink->get_channels();
110 for (auto *channel : channels) {
111 unsigned int channel_number =
channel->channel_number();
112 if (channel_number == 0) continue;
113 Identifier channel_ID =
m_MmIdHelper->channelID(module_ID, multi_layer, gas_gap, channel_number);
114
115 if (mmCablingMap) {
116 std::optional<Identifier> correctedChannelId = mmCablingMap->
correctChannel(channel_ID, msgStream());
117 if (!correctedChannelId) {
118 ATH_MSG_DEBUG(
"Channel was shifted outside its connector and is therefore not decoded into and RDO");
119 continue;
120 }
121 channel_ID = (*correctedChannelId);
123 }
124 if (dcsData && !dcsData->
isGood(ctx,channel_ID))
continue;
125
126 rdo->push_back(
new MM_RawData(channel_ID, channel_number,
channel->tdo(),
128 }
129 }
130
131 return StatusCode::SUCCESS;
132}
#define ATH_MSG_WARNING(x)
SG::ReadCondHandleKey< Nsw_CablingMap > m_cablingKey
const MmIdHelper * m_MmIdHelper
SG::ReadCondHandleKey< NswDcsDbData > m_dscKey
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
const_pointer_type cptr()
str station_name
Simple script to generate a BIS78 cabling map as used for the Monte Carlo processing.