ATLAS Offline Software
Loading...
Searching...
No Matches
IL1CandData_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
7#include <cmath>
8#include <algorithm>
9
10namespace xAOD {
11 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( IL1CandData_v1, uint8_t, l1Threshold, setL1Threshold )
12 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( IL1CandData_v1, uint8_t, l1CandCharge, setL1CandCharge )
13 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( IL1CandData_v1, uint16_t, l1SubdetectorId, setL1SubdetectorId )
16
18 float etaClamped = std::clamp(eta, -s_etaRange, s_etaRange);
19 uint16_t etaBinary = static_cast<uint16_t>(std::lround((etaClamped + s_etaRange) / (2.0f * s_etaRange) * static_cast<float>(s_etaBitRange)));
20 static const SG::Accessor<uint16_t> acc("l1Eta");
21 acc(*this) = etaBinary;
22 }
23
25 static const SG::Accessor<uint16_t> acc("l1Eta");
26 return acc(*this);
27 }
28
30 uint16_t phiBinary = static_cast<uint16_t>(((phi + M_PI) / s_phiRange) * static_cast<float>(s_phiBitRange));
31 static const SG::Accessor<uint16_t> acc("l1Phi");
32 acc(*this) = phiBinary;
33 }
34
36 static const SG::Accessor<uint16_t> acc("l1Phi");
37 //return (static_cast<float>(acc(*this)) / static_cast<float>(s_phiBitRange)) * s_phiRange-M_PI;
38 return acc(*this);
39 }
40
42 const float ptClamped = std::clamp(pt, 0.0F, s_ptRange);
43 const uint8_t ptBinary = static_cast<uint8_t>(
44 std::lround(ptClamped / s_ptResolution));
45 static const SG::Accessor<uint8_t> acc("l1Pt");
46 acc(*this) = ptBinary;
47 }
48
50 static const SG::Accessor<uint8_t> acc("l1Pt");
51 return acc(*this);
52 }
53
55 uint8_t coinTypeBin = cointype & COINTYPE_BIT_MASK;
56 static const SG::Accessor<uint8_t> acc("coinType");
57 acc(*this) = coinTypeBin;
58 }
59
61 static const SG::Accessor<uint8_t> acc("coinType");
62 return acc(*this);
63 }
64
66 static const SG::Accessor<uint8_t> acc("tcId");
67 acc(*this) = value & TC_ID_BIT_MASK;
68 }
69
71 static const SG::ConstAccessor<uint8_t> acc("tcId");
72 return acc(*this) & TC_ID_BIT_MASK;
73 }
74
76 setL1SubdetectorId(subdetectorId);
77 setL1SectorId(sectorId);
79 }
80
81} // namespace xAOD
#define M_PI
Scalar eta() const
pseudorapidity method
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
unsigned bcTag(unsigned bcBitMap)
Helper class to provide type-safe access to aux data.
Helper class to provide constant type-safe access to aux data.
base class providing a common interface with shared variables for the L0 muon candidates from RPC/TGC...
IL1CandData_v1()=default
Default constructor.
void setL1Pt(float pt)
Set the candidate pT.
void initialize(uint16_t subdetectorId, uint16_t sectorId, uint16_t bcTag)
Initialize candidate with basic properties.
static constexpr float s_etaRange
Variables range.
void setCoinType(uint8_t coinType)
Set the coincidence type.
uint8_t coinType() const
Retrieve the coincidence type.
void setTcId(uint8_t value)
Set the trigger-candidate identifier.
static constexpr float s_ptRange
static constexpr uint16_t s_etaBitRange
Variables bit size 14 bits for eta, 9 bits for phi, 8 bits for pt.
void setL1Eta(float eta)
Set the eta.
uint16_t bcTag() const
Retrieve the bunch crossing tag.
static constexpr uint8_t TC_ID_BIT_MASK
Bit mask for the trigger-candidate identifier.
uint8_t l1Pt() const
Retrieve the encoded candidate pT.
static constexpr uint8_t COINTYPE_BIT_MASK
Bit mask for Coincidence Types.
void setL1Phi(float phi)
Set the phi.
uint16_t l1Eta() const
Retrieve the eta.
uint8_t tcId() const
Retrieve the trigger-candidate identifier.
void setL1SectorId(uint16_t sectorId)
Set the sector id.
void setBcTag(uint16_t bcTag)
Set the bunch crossing tag.
uint16_t l1Phi() const
Retrieve the phi.
static constexpr float s_ptResolution
GeV per pT code.
static constexpr uint16_t s_phiBitRange
void setL1SubdetectorId(uint16_t subdetectorId)
Set the sub detector id.
static constexpr float s_phiRange
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setRcore setEtHad setFside pt
setWord1 uint16_t
static const SG::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.