Convert ROBFragments to RDOs.
53{
54
55
56 try {
57 robFrag.check();
58 } catch (const eformat::Issue &ex) {
60 return StatusCode::SUCCESS;
61 }
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 const Nsw_CablingMap* sTgcCablingMap{nullptr};
75 SG::ReadCondHandle<Nsw_CablingMap> readCondHandle{
m_cablingKey, ctx};
78 return StatusCode::FAILURE;
79 }
80 sTgcCablingMap = readCondHandle.
cptr();
81 }
82
84
85 if (!muonGeoMgrHandle.
isValid()) {
86 ATH_MSG_FATAL(
"Failed to retrieve the detector manager from the conditions store");
87 return StatusCode::FAILURE;
88 }
89
90 const MuonGM::MuonDetectorManager* muonGeoMgr = *muonGeoMgrHandle;
91
92
93 bool seeded_mode(!rdoIdhVect.empty());
94
95
96 Muon::nsw::NSWCommonDecoder common_decoder(robFrag);
97 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.get_elinks();
99 if (elinks.empty()) return StatusCode::SUCCESS;
100
101
102
103 for (auto* elink : elinks) {
104
105
106 if (elink->isNull()) continue;
107
108
109
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();
115 Identifier module_ID =
m_stgcIdHelper->elementID(station_name, station_eta, station_phi);
116
117 IdentifierHash module_hashID;
120
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);
124
125
126 const std::vector<Muon::nsw::VMMChannel*>&
channels = elink->get_channels();
127 for (auto *channel : channels) {
128 unsigned int channel_number =
channel->channel_number();
130 if (channel_number == 0) continue;
131
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");
137 continue;
138 }
139 channel_ID = (*correctedChannelId);
140 }
141 bool isOuterQ1{false};
142 if(std::abs(station_eta)==1 && dcsData){
144 if (!roElement->
stripPosition(channel_ID, localPos))
continue;
145 isOuterQ1 = !(roElement->
isEtaZero(channel_ID, localPos));
146 }
147
148 if (dcsData && !dcsData->
isGood(ctx, channel_ID, isOuterQ1))
continue;
149 bool timeAndChargeInCounts = true;
150 rdo->push_back(
new STGC_RawData(channel_ID,
channel->rel_bcid(),
channel->tdo(),
channel->pdo(),
false,timeAndChargeInCounts));
151 }
152 }
153
154 return StatusCode::SUCCESS;
155}
#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
const_pointer_type cptr()
Eigen::Matrix< double, 2, 1 > Vector2D
str station_name
Simple script to generate a BIS78 cabling map as used for the Monte Carlo processing.