ATLAS Offline Software
Loading...
Searching...
No Matches
L1Muon::NSWEncoding Namespace Reference

Quantisation of NSW segment quantities into the Run 4 NSW-TP -> TGC-SL segment word (L1Muon interface document, EDMS 2377909, Section 4.2, Figure 13). More...

Functions

double wrapTwoPi (double phi)
 Map any angle to [0, 2pi).
uint16_t etaIndex (double eta, bool &inRange)
double etaValue (uint16_t idx)
uint16_t phiIndex (double phi)
double phiValue (uint16_t idx)
uint8_t dthetaIndex (double dtheta, double step, double range, bool &inRange)
double dthetaValue (uint8_t idx, double step)
uint16_t boardID (int sectorPhi, bool isSideC)

Variables

constexpr double kTwoPi = 2. * std::numbers::pi
constexpr unsigned kDthMagMax = 15
constexpr uint8_t kDthSignBit = 0x10
constexpr uint8_t kQualityMM = 3

Detailed Description

Quantisation of NSW segment quantities into the Run 4 NSW-TP -> TGC-SL segment word (L1Muon interface document, EDMS 2377909, Section 4.2, Figure 13).

Kept outside the xAOD class (which only packs/unpacks bits) and outside the trigger tools (which produce physics values), so that MM and later sTGC segments share one encoding. Each xxxIndex() has a matching xxxValue() that returns the value the index stands for, used for validation.

Function Documentation

◆ boardID()

uint16_t L1Muon::NSWEncoding::boardID ( int sectorPhi,
bool isSideC )
inline

Definition at line 99 of file NSWEncoding.h.

99 {
100 return static_cast<uint16_t>((isSideC ? 16 : 0) + (sectorPhi - 1));
101 }

◆ dthetaIndex()

uint8_t L1Muon::NSWEncoding::dthetaIndex ( double dtheta,
double step,
double range,
bool & inRange )
inline

Definition at line 76 of file NSWEncoding.h.

76 {
77 inRange = std::abs(dtheta) <= range;
78 const double mag = std::min(std::round(std::abs(dtheta) / step), static_cast<double>(kDthMagMax));
79 const uint8_t sign = (dtheta < 0. && mag > 0.) ? kDthSignBit : 0;
80 return sign | static_cast<uint8_t>(mag);
81 }
Scalar mag() const
mag method
bool inRange(const double *boundaries, const double value, const double tolerance=0.02)
int sign(int a)
constexpr unsigned kDthMagMax
Definition NSWEncoding.h:73
constexpr uint8_t kDthSignBit
Definition NSWEncoding.h:74

◆ dthetaValue()

double L1Muon::NSWEncoding::dthetaValue ( uint8_t idx,
double step )
inline

Definition at line 82 of file NSWEncoding.h.

82 {
83 const double mag = (idx & 0xF) * step;
84 return (idx & kDthSignBit) ? -mag : mag;
85 }

◆ etaIndex()

uint16_t L1Muon::NSWEncoding::etaIndex ( double eta,
bool & inRange )
inline

Definition at line 38 of file NSWEncoding.h.

38 {
39 using namespace L1Muon::NSWTPBits;
40 const double x = (eta - ETA_MIN) / (ETA_MAX - ETA_MIN) * ETA_MAX_RAW;
41 inRange = (x >= -0.5 && x <= ETA_MAX_RAW + 0.5);
42 return static_cast<uint16_t>(std::clamp(std::round(x), 0., static_cast<double>(ETA_MAX_RAW)));
43 }
Scalar eta() const
pseudorapidity method
#define x
constexpr float ETA_MAX
Definition NSWTPBits.h:17
constexpr float ETA_MIN
Definition NSWTPBits.h:16
constexpr float ETA_MAX_RAW
Definition NSWTPBits.h:15

◆ etaValue()

double L1Muon::NSWEncoding::etaValue ( uint16_t idx)
inline

Definition at line 44 of file NSWEncoding.h.

44 {
45 using namespace L1Muon::NSWTPBits;
46 return ETA_MIN + (idx / static_cast<double>(ETA_MAX_RAW)) * (ETA_MAX - ETA_MIN);
47 }

◆ phiIndex()

uint16_t L1Muon::NSWEncoding::phiIndex ( double phi)
inline

Definition at line 55 of file NSWEncoding.h.

55 {
56 using namespace L1Muon::NSWTPBits;
57 const double x = wrapTwoPi(phi) / PHI_MAX * PHI_MAX_RAW;
58 return static_cast<uint16_t>(std::clamp(std::round(x), 0., static_cast<double>(PHI_MAX_RAW)));
59 }
Scalar phi() const
phi method
double wrapTwoPi(double phi)
Map any angle to [0, 2pi).
Definition NSWEncoding.h:29
constexpr float PHI_MAX
Definition NSWTPBits.h:24
constexpr float PHI_MAX_RAW
Definition NSWTPBits.h:23

◆ phiValue()

double L1Muon::NSWEncoding::phiValue ( uint16_t idx)
inline

Definition at line 60 of file NSWEncoding.h.

60 {
61 using namespace L1Muon::NSWTPBits;
62 return (idx / static_cast<double>(PHI_MAX_RAW)) * PHI_MAX;
63 }

◆ wrapTwoPi()

double L1Muon::NSWEncoding::wrapTwoPi ( double phi)
inline

Map any angle to [0, 2pi).

Definition at line 29 of file NSWEncoding.h.

29 {
30 phi = std::fmod(phi, kTwoPi);
31 return (phi < 0.) ? phi + kTwoPi : phi;
32 }
constexpr double kTwoPi
Definition NSWEncoding.h:26

Variable Documentation

◆ kDthMagMax

unsigned L1Muon::NSWEncoding::kDthMagMax = 15
constexpr

Definition at line 73 of file NSWEncoding.h.

◆ kDthSignBit

uint8_t L1Muon::NSWEncoding::kDthSignBit = 0x10
constexpr

Definition at line 74 of file NSWEncoding.h.

◆ kQualityMM

uint8_t L1Muon::NSWEncoding::kQualityMM = 3
constexpr

Definition at line 90 of file NSWEncoding.h.

◆ kTwoPi

double L1Muon::NSWEncoding::kTwoPi = 2. * std::numbers::pi
constexpr

Definition at line 26 of file NSWEncoding.h.