37{
38 try {
39 fragment.check();
40 } catch (const eformat::Issue& ex) {
42 return StatusCode::FAILURE;
43 }
44
45 Muon::nsw::NSWTriggerCommonDecoder nsw_trigger_decoder (fragment, "STGL1A");
46
47 if (nsw_trigger_decoder.has_error()) {
48 ATH_MSG_DEBUG(
"NSW sTGC TP Common Decoder found exceptions while reading this STGL1A fragment from " + std::to_string(fragment.rob_source_id()) +
". Skipping. Error id: "+std::to_string(nsw_trigger_decoder.error_id()));
49 return StatusCode::SUCCESS;
50 }
51
52 if (nsw_trigger_decoder.get_elinks().size()==1) {
53 if (static_cast<Muon::nsw::NSWTriggerSTGL1AElink*>(nsw_trigger_decoder.get_elinks()[0].get())->l1a_versionID() >= 3){
54 ATH_MSG_DEBUG(
"NSW sTGC TP Common Decoder found only one elink in output but inconsistent L1A version: something off with this fragment. Skipping.");
55 return StatusCode::SUCCESS;
56 }
57 } else if (nsw_trigger_decoder.get_elinks().size()<3 || nsw_trigger_decoder.get_elinks().size()>5) {
58
59
60
61 ATH_MSG_DEBUG(
"NSW sTGC TP Common Decoder didn't give 3, 4 or 5 elinks in output for: something off with this fragment. Skipping.");
62 return StatusCode::SUCCESS;
63 }
64
65 bool consistent = true;
66 const auto l0 =
static_cast<Muon::nsw::NSWTriggerSTGL1AElink*
>(nsw_trigger_decoder.get_elinks()[0].
get());
67 for(const auto& baseLink: nsw_trigger_decoder.get_elinks()) {
68 const auto l =
static_cast<Muon::nsw::NSWTriggerSTGL1AElink*
>(baseLink.get());
69 if (
l0->head_sectID() !=
l->head_sectID()) {consistent =
false;
break;}
70 if (
l0->L1ID() !=
l->L1ID()) {consistent =
false;
break;}
71 if (
l0->l1a_versionID() !=
l->l1a_versionID()) {consistent =
false;
break;}
72 if (
l0->l1a_req_BCID() !=
l->l1a_req_BCID()) {consistent =
false;
break;}
73 }
74 if (!consistent) {
75 ATH_MSG_WARNING(
"NSW sTGC TP Common Decoder found inconsistent header parameters in the elinks: something off with this fragment. Skipping.");
76 return StatusCode::SUCCESS;
77 }
78
81
82 for(const auto& baseLink: nsw_trigger_decoder.get_elinks()){
84 const auto link = static_cast<Muon::nsw::NSWTriggerSTGL1AElink*>(baseLink.get());
85 const std::shared_ptr<Muon::nsw::NSWResourceId>& elinkID = link->elinkId ();
86
92 rdo->set_moduleID(moduleID);
93
94
95 rdo->set_ROD_L1ID(fragment.rod_lvl1_id ());
96 rdo->set_sectID(link->head_sectID());
97 rdo->set_EC(link->head_EC());
98 rdo->set_BCID(link->head_BCID());
99 rdo->set_L1ID(link->L1ID());
100 rdo->set_window_open_bcid(link->l1a_open_BCID());
101 rdo->set_l1a_request_bcid(link->l1a_req_BCID());
102 rdo->set_window_close_bcid(link->l1a_close_BCID());
103 rdo->set_config_window_open_bcid_offset(link->l1a_open_BCID_offset());
104 rdo->set_config_l1a_request_bcid_offset(link->l1a_req_BCID_offset());
105 rdo->set_config_window_close_bcid_offset(link->l1a_close_BCID_offset());
106
107
108 const std::vector<STGTPPadPacket>& pad_packets = link->pad_packets();
109 for(
uint i_packetIndex = 0; i_packetIndex<pad_packets.size(); i_packetIndex++){
111 for(
uint i_candidateIndex=0; i_candidateIndex < 4; i_candidateIndex++){
113 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
114 rdo->pad_candidateNumber().push_back(candidateNumber);
115 rdo->pad_phiID().push_back(pad_packet.PhiID(i_candidateIndex));
116 rdo->pad_bandID().push_back(pad_packet.BandID(i_candidateIndex));
117 }
118 rdo->pad_BCID().push_back(pad_packet.BCID());
119 rdo->pad_idleFlag().push_back(pad_packet.PadIdleFlag());
120 rdo->pad_coincidence_wedge().push_back(pad_packet.CoincidenceWedge());
121
122 }
123
124
125 const std::vector<STGTPSegmentPacket>& segment_packets = link->segment_packet();
126 for(
uint i_packetIndex = 0; i_packetIndex<segment_packets.size(); i_packetIndex++){
130
132 ++i_candidateIndex;
133 continue;
134 }
143 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
144 ++i_candidateIndex;
145
146 rdo->merge_segments().push_back(word);
147 rdo->merge_candidateNumber().push_back(candidateNumber);
148 }
149
150 uint16_t merge_BCID_sectorID = (segment_packet.BCID() << 4) | segment_packet.SectorID();
151 rdo->merge_BCID_sectorID().push_back(merge_BCID_sectorID);
152 rdo->merge_valid_segmentSelector().push_back(segment_packet.ValidSegmentSelector());
153 rdo->merge_nsw_segmentSelector().push_back(segment_packet.NSW_SegmentSelector());
154 rdo->merge_LUT_choiceSelection().push_back(segment_packet.LUT_ChoiceSelection());
155 }
156
157 if (link->l1a_versionID() < 3){
158 return StatusCode::SUCCESS;
159 }
160
161 const std::vector<STGTPMMPacket>& mm_packets = link->mm_packet();
162 for(
uint i_packetIndex = 0; i_packetIndex<mm_packets.size(); i_packetIndex++){
163 const STGTPMMPacket& mm_packet = mm_packets.at(i_packetIndex);
166
168 ++i_candidateIndex;
169 continue;
170 }
179 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
180 ++i_candidateIndex;
181
184 }
185
187 }
188
189
190 const std::vector<STGTPStripPacket>& strip_packets = link->strip_packet();
191 for(
uint i_packetIndex = 0; i_packetIndex < strip_packets.size(); i_packetIndex++){
193
194
195 for(std::size_t i_strip = 0; i_strip <
num_strips; ++i_strip) {
197
202
204 }
205
206
207 for(std::size_t i_offset = 0; i_offset <
num_offsets; ++i_offset) {
209
213
215 }
216
217
218 }
219
220 }
221 return StatusCode::SUCCESS;
222
223}
#define ATH_MSG_WARNING(x)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const std::vector< uint8_t > & NSWTP_strip_bands_HLbit() const
const std::vector< uint32_t > & NSWTP_strip_centroids_offset() const
const std::vector< uint16_t > & NSWTP_strip_bands_BCID() const
const std::vector< uint8_t > & NSWTP_strip_bands_bandID() const
const std::vector< uint32_t > & NSWTP_mm_BCID() const
const std::vector< uint8_t > & NSWTP_strip_bands_layer() const
const std::vector< uint32_t > & NSWTP_strip_centroids_bandID() const
const std::vector< uint32_t > & NSWTP_mm_segments() const
Encode the Monitoring, Spare, lowRes, phiRes, dTheta, phiID, rIndex information of each candidate.
const std::vector< uint8_t > & NSWTP_strip_bands_phiID() const
const std::vector< uint8_t > & NSWTP_mm_candidateNumber() const
const std::vector< uint32_t > & NSWTP_strip_centroids_layer() const
const std::vector< uint32_t > & NSWTP_strip_centroids_phiID() const
const std::vector< uint32_t > & NSWTP_strip_centroids_loc() const
const std::vector< uint8_t > & NSWTP_strip_bands_charge() const
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
constexpr int mm_stream_invalid_dTheta
constexpr int pad_stream_invalid_band_id
constexpr int merge_stream_invalid_dTheta
constexpr void encodeSegmentProperty(const MergedSegmentProperty prop, const uint32_t word, uint32_t &buffer)
constexpr void encodeIdentifierProperty(const ModuleIDProperty prop, const uint32_t word, uint32_t &buffer)
constexpr std::size_t num_strips
constexpr std::size_t num_offsets
nsw::STGTPPadPacket STGTPPadPacket
nsw::STGTPSegmentPacket STGTPSegmentPacket
nsw::STGTPMMPacket STGTPMMPacket
nsw::STGTPStripPacket STGTPStripPacket
l
Printing final latex table to .tex output file.
NSWTPRDO_v1 NSWTPRDO
Define the version of the NRPC RDO class.