ATLAS Offline Software
NSWTP_ROD_Decoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "NSWTP_ROD_Decoder.h"
5 #include "Identifier/Identifier.h"
6 #include "eformat/Issue.h"
7 #include "eformat/SourceIdentifier.h"
12 
13 
14 namespace Muon {
15 
16 using namespace nsw::STGTPSegments;
19 
20 //=====================================================================
21 NSWTP_ROD_Decoder::NSWTP_ROD_Decoder(const std::string& type, const std::string& name, const IInterface* parent)
23 {
24  declareInterface<INSWTP_ROD_Decoder>(this);
25 }
26 
28  ATH_CHECK(m_idHelperSvc.retrieve());
29  return StatusCode::SUCCESS;
30 }
31 
32 //=====================================================================
34 {
35  try {
36  fragment.check();
37  } catch (const eformat::Issue& ex) {
38  ATH_MSG_ERROR(ex.what());
39  return StatusCode::FAILURE;
40  }
41 
42  Muon::nsw::NSWTriggerCommonDecoder nsw_trigger_decoder (fragment, "STGL1A");
43 
44  for(const auto& baseLink: nsw_trigger_decoder.get_elinks()){
46  xAOD::NSWTPRDO* rdo = new xAOD::NSWTPRDO();
47  rdoContainer.push_back(rdo);
48  const auto link = std::dynamic_pointer_cast<Muon::nsw::NSWTriggerSTGL1AElink>(baseLink);
49 
50  const std::shared_ptr<Muon::nsw::NSWResourceId>& elinkID = link->elinkId ();
51 
52  uint32_t moduleID{0};
55  encodeIdentifierProperty(ModuleIDProperty::stationEta, std::abs(elinkID->station_eta()) , moduleID );
57  rdo->set_moduleID(moduleID);
58 
59  // now filling all the header data
60  rdo->set_ROD_L1ID(fragment.rod_lvl1_id ());
61  rdo->set_sectID(link->head_sectID());
62  rdo->set_EC(link->head_EC());
63  rdo->set_BCID(link->head_BCID());
64  rdo->set_L1ID(link->L1ID());
65  rdo->set_window_open_bcid(link->l1a_open_BCID());
66  rdo->set_l1a_request_bcid(link->l1a_req_BCID());
67  rdo->set_window_close_bcid(link->l1a_close_BCID());
68  rdo->set_config_window_open_bcid_offset(link->l1a_open_BCID_offset());
69  rdo->set_config_l1a_request_bcid_offset(link->l1a_req_BCID_offset());
70  rdo->set_config_window_close_bcid_offset(link->l1a_close_BCID_offset());
71 
72 
73 
74 
75 
76 
77 
78  // now we are filling all the pad segment variables
79 
80  const std::vector<STGTPPadPacket>& pad_packets = link->pad_packets();
81  for(uint i_packetIndex = 0; i_packetIndex<pad_packets.size(); i_packetIndex++){
82  const STGTPPadPacket& pad_packet = pad_packets.at(i_packetIndex);
83  for(uint i_candidateIndex=0; i_candidateIndex < 4; i_candidateIndex++){ // we have at most 4 candidates in the input
84  if(pad_packet.BandID(i_candidateIndex) == 255 && pad_packet.PhiID(i_candidateIndex) == 63) continue; // ignore candidates that the trigger processor flags as invalid
85  uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
86  rdo->pad_candidateNumber().push_back(candidateNumber);
87  rdo->pad_phiID().push_back(pad_packet.PhiID(i_candidateIndex));
88  rdo->pad_bandID().push_back(pad_packet.BandID(i_candidateIndex));
89  }
90  rdo->pad_BCID().push_back(pad_packet.BCID());
91  rdo->pad_idleFlag().push_back(pad_packet.PadIdleFlag());
92  rdo->pad_coincidence_wedge().push_back(pad_packet.CoincidenceWedge());
93 
94  }
95 
96  // and finally lets fill the output segments (merged)
97  const std::vector<STGTPSegmentPacket>& segment_packets = link->segment_packet();
98  for(uint i_packetIndex = 0; i_packetIndex<segment_packets.size(); i_packetIndex++){
99  const STGTPSegmentPacket& segment_packet = segment_packets.at(i_packetIndex);
100  uint8_t i_candidateIndex{0};
101  for (const STGTPSegmentPacket::SegmentData& payload : segment_packet.Segments()){
102  // we have at most 8 candidates in the output
103  if(payload.dTheta == 16) {
104  ++i_candidateIndex;
105  continue; // ignore candidates that the trigger processor flags as invalid
106  }
107  uint32_t word{0}; // word containing all information about the candidate
109  encodeSegmentProperty(MergedSegmentProperty::Spare, payload.spare ,word);
115  uint8_t candidateNumber = (i_packetIndex<<4) | i_candidateIndex;
116  ++i_candidateIndex;
117 
118  rdo->merge_segments().push_back(word);
119  rdo->merge_candidateNumber().push_back(candidateNumber);
120  }
121  // the first 12 bit are used for the bcid and the last 4 for sector ID
122  uint16_t merge_BCID_sectorID = (segment_packet.BCID() << 4) | segment_packet.SectorID();
123  rdo->merge_BCID_sectorID().push_back(merge_BCID_sectorID);
124  rdo->merge_valid_segmentSelector().push_back(segment_packet.ValidSegmentSelector());
125  rdo->merge_nsw_segmentSelector().push_back(segment_packet.NSW_SegmentSelector());
126  rdo->merge_LUT_choiceSelection().push_back(segment_packet.LUT_ChoiceSelection());
127  }
128  }
129  return StatusCode::SUCCESS;
130 
131 }
132 } // namespace Muon
Muon::nsw::STGTPSegments::moduleIDBits::detectorSite
constexpr uint8_t detectorSite
Side 0 for A / 1 for C.
Definition: NSWSTGTPDecodeBitmaps.h:125
Muon::nsw::STGTPSegments::ModuleIDProperty::stationPhi
@ stationPhi
NSWTriggerCommonDecoder.h
Muon::nsw::STGTPSegments::encodeIdentifierProperty
constexpr void encodeIdentifierProperty(const ModuleIDProperty prop, const uint32_t word, uint32_t &buffer)
Definition: NSWSTGTPDecodeBitmaps.h:145
Muon::STGTPPadPacket
nsw::STGTPPadPacket STGTPPadPacket
Definition: NSWTP_ROD_Decoder.cxx:18
Muon::nsw::STGTPPadPacket::BCID
std::uint32_t BCID() const
Definition: STGTPPackets.h:20
Muon::NSWTP_ROD_Decoder::initialize
StatusCode initialize() override
Definition: NSWTP_ROD_Decoder.cxx:27
Muon::nsw::STGTPSegments::MergedSegmentProperty::phiID
@ phiID
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Issue
Configuration Issue
Definition: PscIssues.h:31
Muon::nsw::STGTPSegmentPacket::SectorID
std::uint32_t SectorID() const
Definition: STGTPPackets.h:57
NSWSTGTPDecodeBitmaps.h
Muon::nsw::NSWResourceId::station_eta
int8_t station_eta() const
Definition: NSWResourceId.h:99
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::nsw::STGTPSegments::ModuleIDProperty::stationID
@ stationID
STGTPPackets.h
Muon::nsw::NSWTriggerCommonDecoder::get_elinks
const std::vector< std::shared_ptr< Muon::nsw::NSWTriggerElink > > & get_elinks() const
Definition: NSWTriggerCommonDecoder.h:29
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
Muon::nsw::STGTPSegments::MergedSegmentProperty::phiRes
@ phiRes
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::nsw::STGTPSegmentPacket::ValidSegmentSelector
std::uint32_t ValidSegmentSelector() const
Definition: STGTPPackets.h:51
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
Muon::nsw::STGTPPadPacket::BandID
std::uint32_t BandID(const std::size_t num) const
Definition: STGTPPackets.h:21
Muon::NSWTP_ROD_Decoder::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: NSWTP_ROD_Decoder.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::NSWTPRDO
NSWTPRDO_v1 NSWTPRDO
Define the version of the NRPC RDO class.
Definition: NSWTPRDO.h:13
Muon::nsw::NSWResourceId::is_large_station
bool is_large_station() const
Definition: NSWResourceId.h:93
Muon::nsw::STGTPPadPacket::CoincidenceWedge
std::uint32_t CoincidenceWedge() const
Definition: STGTPPackets.h:24
Muon::nsw::STGTPSegmentPacket::BCID
std::uint32_t BCID() const
Definition: STGTPPackets.h:56
Muon::nsw::NSWResourceId::station_phi
uint8_t station_phi() const
Definition: NSWResourceId.h:114
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::nsw::STGTPSegmentPacket::NSW_SegmentSelector
std::uint32_t NSW_SegmentSelector() const
Definition: STGTPPackets.h:50
Muon::nsw::STGTPSegmentPacket::Segments
const std::array< SegmentData, STGTPSegments::num_segments > & Segments() const
Definition: STGTPPackets.h:53
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Muon::nsw::STGTPPadPacket::PadIdleFlag
std::uint32_t PadIdleFlag() const
Definition: STGTPPackets.h:23
xAOD::NSWTPRDO_v1
Definition: NSWTPRDO_v1.h:22
Muon::nsw::STGTPSegments::ModuleIDProperty::stationEta
@ stationEta
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Muon::NSWTP_ROD_Decoder::fillCollection
StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &fragment, xAOD::NSWTPRDOContainer &rdoContainer) const override
Definition: NSWTP_ROD_Decoder.cxx:33
NSWTP_ROD_Decoder.h
Muon::nsw::STGTPPadPacket::PhiID
std::uint32_t PhiID(const std::size_t num) const
Definition: STGTPPackets.h:22
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::nsw::STGTPSegments::MergedSegmentProperty::dTheta
@ dTheta
Muon::nsw::STGTPSegmentPacket::LUT_ChoiceSelection
std::uint32_t LUT_ChoiceSelection() const
Definition: STGTPPackets.h:49
Muon::NSWTP_ROD_Decoder::NSWTP_ROD_Decoder
NSWTP_ROD_Decoder(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NSWTP_ROD_Decoder.cxx:21
Muon::STGTPSegmentPacket
nsw::STGTPSegmentPacket STGTPSegmentPacket
Definition: NSWTP_ROD_Decoder.cxx:17
Muon::nsw::STGTPSegments::MergedSegmentProperty::Monitor
@ Monitor
AthAlgTool
Definition: AthAlgTool.h:26
Muon::nsw::STGTPSegmentPacket::SegmentData
Definition: STGTPPackets.h:36
Muon::nsw::STGTPPadPacket
Definition: STGTPPackets.h:16
Muon::nsw::NSWTriggerCommonDecoder
Definition: NSWTriggerCommonDecoder.h:21
Muon::nsw::STGTPSegments::MergedSegmentProperty::lowRes
@ lowRes
Muon::nsw::STGTPSegmentPacket
Definition: STGTPPackets.h:34
Muon::nsw::STGTPSegments::encodeSegmentProperty
constexpr void encodeSegmentProperty(const MergedSegmentProperty prop, const uint32_t word, uint32_t &buffer)
Definition: NSWSTGTPDecodeBitmaps.h:112
Muon::nsw::STGTPSegments::MergedSegmentProperty::rIndex
@ rIndex