5 #include "Identifier/Identifier.h"
6 #include "eformat/Issue.h"
7 #include "eformat/SourceIdentifier.h"
16 using namespace nsw::STGTPSegments;
20 using namespace nsw::STGTPMMData;
25 declareInterface<INSWTP_ROD_Decoder>(
this);
30 return StatusCode::SUCCESS;
40 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
50 if (nsw_trigger_decoder.
get_elinks().size()==1) {
52 ATH_MSG_DEBUG(
"NSW sTGC TP Common Decoder found only one elink in output but incosistent L1A version: something off with this fragment. Skipping.");
53 return StatusCode::SUCCESS;
55 }
else if (nsw_trigger_decoder.
get_elinks().size()!=3 && nsw_trigger_decoder.
get_elinks().size()!=5) {
57 ATH_MSG_DEBUG(
"NSW sTGC TP Common Decoder didn't give 3 or 5 elinks in output for: something off with this fragment. Skipping.");
58 return StatusCode::SUCCESS;
61 bool consistent =
true;
63 for(
const auto& baseLink: nsw_trigger_decoder.
get_elinks()) {
65 if (
l0->head_sectID() !=
l->head_sectID()) {consistent =
false;
break;}
66 if (
l0->L1ID() !=
l->L1ID()) {consistent =
false;
break;}
67 if (
l0->l1a_versionID() !=
l->l1a_versionID()) {consistent =
false;
break;}
68 if (
l0->l1a_req_BCID() !=
l->l1a_req_BCID()) {consistent =
false;
break;}
71 ATH_MSG_WARNING(
"NSW sTGC TP Common Decoder found inconsistent header parameters in the elinks: something off with this fragment. Skipping.");
72 return StatusCode::SUCCESS;
78 for(
const auto& baseLink: nsw_trigger_decoder.
get_elinks()){
81 const std::shared_ptr<Muon::nsw::NSWResourceId>& elinkID = link->
elinkId ();
88 rdo->set_moduleID(moduleID);
91 rdo->set_ROD_L1ID(fragment.rod_lvl1_id ());
92 rdo->set_sectID(link->head_sectID());
93 rdo->set_EC(link->head_EC());
94 rdo->set_BCID(link->head_BCID());
95 rdo->set_L1ID(link->L1ID());
96 rdo->set_window_open_bcid(link->l1a_open_BCID());
97 rdo->set_l1a_request_bcid(link->l1a_req_BCID());
98 rdo->set_window_close_bcid(link->l1a_close_BCID());
99 rdo->set_config_window_open_bcid_offset(link->l1a_open_BCID_offset());
100 rdo->set_config_l1a_request_bcid_offset(link->l1a_req_BCID_offset());
101 rdo->set_config_window_close_bcid_offset(link->l1a_close_BCID_offset());
104 const std::vector<STGTPPadPacket>& pad_packets = link->pad_packets();
105 for(
uint i_packetIndex = 0; i_packetIndex<pad_packets.size(); i_packetIndex++){
107 for(
uint i_candidateIndex=0; i_candidateIndex < 4; i_candidateIndex++){
108 if(pad_packet.
BandID(i_candidateIndex) == 255 && pad_packet.
PhiID(i_candidateIndex) == 63)
continue;
109 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
110 rdo->pad_candidateNumber().push_back(candidateNumber);
111 rdo->pad_phiID().push_back(pad_packet.
PhiID(i_candidateIndex));
112 rdo->pad_bandID().push_back(pad_packet.
BandID(i_candidateIndex));
114 rdo->pad_BCID().push_back(pad_packet.
BCID());
115 rdo->pad_idleFlag().push_back(pad_packet.
PadIdleFlag());
121 const std::vector<STGTPSegmentPacket>& segment_packets = link->segment_packet();
122 for(
uint i_packetIndex = 0; i_packetIndex<segment_packets.size(); i_packetIndex++){
139 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
142 rdo->merge_segments().push_back(word);
143 rdo->merge_candidateNumber().push_back(candidateNumber);
147 rdo->merge_BCID_sectorID().push_back(merge_BCID_sectorID);
153 if (link->l1a_versionID() < 3){
154 return StatusCode::SUCCESS;
157 const std::vector<STGTPMMPacket>& mm_packets = link->mm_packet();
158 for(
uint i_packetIndex = 0; i_packetIndex<mm_packets.size(); i_packetIndex++){
159 const STGTPMMPacket& mm_packet = mm_packets.at(i_packetIndex);
175 uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
186 return StatusCode::SUCCESS;