ATLAS Offline Software
Loading...
Searching...
No Matches
NSWCandData_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
6
8#include <iostream>
9
10namespace {
11 static const std::string preFixStr{"L0Mu_"};
12}
13
14namespace xAOD
15{
16
17 // cppcheck-suppress unknownMacro
19
20 // cppcheck-suppress unknownMacro
21 IMPLEMENT_SETTER_GETTER( NSWCandData_v1, uint8_t, nSegments, setNSegments )
22
23 // cppcheck-suppress unknownMacro
24 IMPLEMENT_SETTER_GETTER( NSWCandData_v1, uint8_t, fiberId, setFiberId )
25
26 // cppcheck-suppress unknownMacro
27 IMPLEMENT_SETTER_GETTER( NSWCandData_v1, uint8_t, boardId, setBoardId )
28
30 static const SG::AuxElement::Accessor<uint8_t> acc(preFixStr + "overflow");
31 return acc(*this);
32 }
33
34 void NSWCandData_v1::setOverflow(bool value) {
35 static const SG::AuxElement::Accessor<uint8_t> acc(preFixStr + "overflow");
36 acc(*this) = value;
37 }
38
39 // Get the complete vector of packed 32-bit segment words
40 const std::vector<uint32_t>& NSWCandData_v1::segmentWords() const {
41 static const SG::AuxElement::Accessor<std::vector<uint32_t>> acc{preFixStr + "segmentWord"};
42 return acc(*this);
43 }
44
45 // Getting Element-by-Element
49
53
57
61
66
67 float NSWCandData_v1::segPhi(size_t i) const {
69 }
70
71 // Add Segment
72 void NSWCandData_v1::addSegment(uint16_t etaIndex, uint16_t phiIndex, uint8_t deltaThetaIndex, uint8_t quality) {
73 static const SG::AuxElement::Accessor<std::vector<uint32_t>> accWord{preFixStr + "segmentWord"};
74
75 // Pack the fields into a single 32-bit container word
76 uint32_t packedWord = 0;
79 packedWord |= (static_cast<uint32_t>(deltaThetaIndex) & L0Muon::NSWTPBits::RUN4_NSWTP_DTH_MASK) << L0Muon::NSWTPBits::RUN4_NSWTP_DTH_SHIFT;
81
82 accWord(*this).push_back(packedWord);
83 }
84
85 // Clear segments
87 static const SG::AuxElement::Accessor<std::vector<uint32_t>> accWord{preFixStr + "segmentWord"};
88 accWord(*this).clear();
89 }
90
91 // Debugging
92 std::ostream& operator<<(std::ostream& os, const NSWCandData_v1& obj){
93 os << "\n*BEGIN* xAOD::NSWCandData" << std::endl;
94 os << " BCID: " << obj.bcid() << std::endl;
95 os << " Board ID: " << static_cast<int>(obj.boardId()) << std::endl;
96 os << " Fiber ID: " << static_cast<int>(obj.fiberId()) << std::endl;
97 os << " Number of Segments: " << static_cast<int>(obj.nSegments()) << std::endl;
98 os << " Overflow Flag: " << (obj.overflow() ? "TRUE" : "FALSE") << std::endl;
99
100 const auto& words = obj.segmentWords();
101 os << " Stored Packed Segment Count: " << words.size() << std::endl;
102
103 for (size_t i = 0; i < words.size(); ++i) {
104 os << " -- Segment #" << i << std::endl;
105 os << " Eta Index: " << obj.segEtaIndex(i) << " (eta ~ " << obj.segEta(i) << ")" << std::endl;
106 os << " Phi Index: " << obj.segPhiIndex(i) << " (phi ~ " << obj.segPhi(i) << ")" << std::endl;
107 os << " Delta Theta Index: " << static_cast<int>(obj.segDeltaThetaIndex(i)) << std::endl;
108 os << " Quality Flag: " << static_cast<int>(obj.segQuality(i)) << std::endl;
109 }
110 os << "*END* xAOD::NSWCandData" << std::endl;
111 return os;
112 }
113
114} // namespace xAOD
#define IMPLEMENT_SETTER_GETTER(DTYPE, GETTER, SETTER)
Data class describing the L0 muon candidates from NSW-TP to TGC SL.
bool overflow() const
Check if the segment candidate limit has been exceeded.
float segEta(size_t i) const
Retrieve the decoded physical eta coordinate for a specific segment.
uint16_t segEtaIndex(size_t i) const
Element-by-Element Index.
void clearSegments()
Clear all recorded segment vectors.
NSWCandData_v1()=default
void addSegment(uint16_t etaIndex, uint16_t phiIndex, uint8_t deltaThetaIndex, uint8_t quality)
Pack and append a single segment.
uint16_t segPhiIndex(size_t i) const
Retrieve the phi index for a specific segment.
const std::vector< uint32_t > & segmentWords() const
Segments.
float segPhi(size_t i) const
Retrieve the decoded physical phi coordinate for a specific segment.
uint8_t segDeltaThetaIndex(size_t i) const
Retrieve the delta theta index for a specific segment.
void setOverflow(bool ovf)
Set the segment total capacity overflow state flag.
uint8_t segQuality(size_t i) const
Retrieve the quality flag for a specific segment.
constexpr uint32_t RUN4_NSWTP_DTH_MASK
Definition NSWTPBits.h:30
constexpr uint32_t RUN4_NSWTP_DTH_SHIFT
Angular deviation of the locally defined segment from the infinite momentum track.
Definition NSWTPBits.h:29
constexpr float ETA_MAX
Definition NSWTPBits.h:17
constexpr float ETA_MAX_RAW
Definition NSWTPBits.h:15
constexpr uint32_t RUN4_NSWTP_PHI_SHIFT
Segment position in phi.
Definition NSWTPBits.h:21
constexpr float ETA_MIN
Definition NSWTPBits.h:16
constexpr float PHI_MAX
Definition NSWTPBits.h:24
constexpr uint32_t RUN4_NSWTP_ETA_SHIFT
Segment position in eta.
Definition NSWTPBits.h:13
constexpr float PHI_MAX_RAW
Definition NSWTPBits.h:23
constexpr uint32_t RUN4_NSWTP_QUAL_SHIFT
Valid flag and detector information.
Definition NSWTPBits.h:35
constexpr uint32_t RUN4_NSWTP_ETA_MASK
Definition NSWTPBits.h:14
constexpr uint32_t RUN4_NSWTP_QUAL_MASK
Definition NSWTPBits.h:36
constexpr uint32_t RUN4_NSWTP_PHI_MASK
Definition NSWTPBits.h:22
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setBGCode setTAP setLVL2ErrorBits bool
setEventNumber setTimeStamp bcid
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
setWord1 uint16_t
setEventNumber uint32_t
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.