ATLAS Offline Software
Loading...
Searching...
No Matches
L1Threshold.cxx
Go to the documentation of this file.
1/* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration */
2
5#include <charconv>
6#include <stdexcept>
7
8
9/******************************************
10 *
11 * Legacy L1Calo thresholds
12 *
13 ******************************************/
14
18void
20 // read the isolation
21 if( const auto & thrVs = data().get_child_optional("thrValues") ) {
22 for( auto & x : thrVs.get() ) {
23 auto isobits = x.second.get_child("isobits").get_value<std::string>();
24 auto etamin = x.second.get_child("etamin").get_value<unsigned int>();
25 auto etamax = x.second.get_child("etamax").get_value<unsigned int>();
26 auto priority = x.second.get_child("priority").get_value<unsigned int>();
27 // turn bin string into uint, e.g. "01001" -> 9
28 uint16_t isomask(0);
29 auto [ptr, ec] = std::from_chars(isobits.data(),
30 isobits.data() + isobits.size(), isomask, 2);
31 if (ec != std::errc{} || ptr != isobits.data() + isobits.size()) {
32 throw std::invalid_argument("Invalid isobits value: " + isobits);
33 }
34 m_isolationMask.addRangeValue(isomask, etamin, etamax, priority, /*symmetric=*/ false);
35 }
36 }
37}
38
39void
40TrigConf::L1Threshold_EM::print(std::ostream & os) const {
41 os << "EM threshold " << name() << " with mapping " << mapping() << std::endl;
42 for( int eta = -49; eta<49; eta++ ) {
43 auto value = thrValue(eta);
44 auto valueMeV = thrValueMeV(eta);
45 auto counts = thrValueCounts(eta);
46 auto value100MeV = thrValue100MeV(eta);
47 auto iso = isolationMask(eta);
48 os << " eta = " << eta << " : " << value << " GeV " << valueMeV << " MeV " << value100MeV << " 100MeV "
49 << counts << " counts , isoMaks " << iso << std::endl;
50 }
51}
52
56void
58 const std::string isobits = getAttribute("isobits");
59 auto [ptr, ec] = std::from_chars(isobits.data(),
60 isobits.data() + isobits.size(),
62 2);
63 if (ec != std::errc{} || ptr != isobits.data() + isobits.size()) {
64 throw std::invalid_argument("Invalid isobits value: " + isobits);
65 }
66}
67
71void
73{
74 // allowed values for eta-range boundaries are 0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.8, 3.1, 4.9 and their negatives
75
76 static const std::vector<int> allowedBoundaries{0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 28, 31, 49};
77 if( const auto & thrVs = data().get_child_optional("thrValues") ) {
78 for( auto & x : thrVs.get() ) {
79 auto etamin = x.second.get_child("etamin").get_value<int>();
80 // will be re-enabled once we have the faulty configurations in the TriggerDB removed
81 // if(std::find(begin(allowedBoundaries), end(allowedBoundaries), abs(etamin)) == allowedBoundaries.end()) {
82 // throw std::runtime_error(name() + ": etamin value " + std::to_string(etamin) + " not an allowed value for legacy JETs");
83 // }
84 auto etamax = x.second.get_child("etamax").get_value<int>();
85 // will be re-enabled once we have the faulty configurations in the TriggerDB removed
86 // if(std::find(begin(allowedBoundaries), end(allowedBoundaries), abs(etamax)) == allowedBoundaries.end()) {
87 // throw std::runtime_error(name() + ": etamax value " + std::to_string(etamax) + " not an allowed value for legacy JETs");
88 // }
89 auto priority = x.second.get_child("priority").get_value<unsigned int>();
90 auto window = x.second.get_child("window").get_value<unsigned int>();
91 m_etaDepWindow.addRangeValue(window, etamin, etamax, priority, /*symmetric=*/ false);
92 }
93 }
94}
95unsigned int
99
103void
110
114void
127
128/******************************************
129 *
130 * New L1Calo thresholds
131 *
132 ******************************************/
133
134void
136{
137 // read the isolation requirements
141 // reject TOBs outside explicitly defined eta ranges
142 // by requiring an impossibly high threshold
143 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
144}
145
146void
148{
149 // read the isolation requirements
153 // reject TOBs outside explicitly defined eta ranges
154 // by requiring an impossibly high threshold
155 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
156}
157
158void
160{
161 // read the isolation requirements
164 // Correction for older L1 menus which used the HAD WPs that don't fit in L1Topo bits
165 // This will result in no rHad isolation being applied, but there were no
166 // active L1 items (eTAU40HA threshold defined but unused) -- ATR-25329
168 // reject TOBs outside explicitly defined eta ranges
169 // by requiring an impossibly high threshold
170 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
171}
172
173const std::shared_ptr<TrigConf::L1ThrExtraInfo_jTAU>
175{
176 return dynamic_pointer_cast<TrigConf::L1ThrExtraInfo_jTAU>(m_extraInfo.lock());
177}
178
179void
181{
182 // read the isolation requirements
184 // reject TOBs outside explicitly defined eta ranges
185 // by requiring an impossibly high threshold
186 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
187}
188
189const std::shared_ptr<TrigConf::L1ThrExtraInfo_cTAU>
191{
192 return dynamic_pointer_cast<TrigConf::L1ThrExtraInfo_cTAU>(m_extraInfo.lock());
193}
194
195void
197{
198 // read the isolation requirements
200 // reject TOBs outside explicitly defined eta ranges
201 // by requiring an impossibly high threshold
202 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
203}
204
205void
207{
208 // reject TOBs outside explicitly defined eta ranges
209 // by requiring an impossibly high threshold
210 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
211}
212
213void
215{
216 // reject TOBs outside explicitly defined eta ranges
217 // by requiring an impossibly high threshold
218 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
219}
220
221void
223{
224 // reject TOBs outside explicitly defined eta ranges
225 // by requiring an impossibly high threshold
226 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
227}
228
229void
231{
232 // reject TOBs outside explicitly defined eta ranges
233 // by requiring an impossibly high threshold
234 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
235}
236
237void
240
241void
244
245void
248
249void
252
253/******************************************
254 *
255 * Muon threshold
256 *
257 ******************************************/
258
262float
264{
265 return static_cast<float>(m_ptBarrel);
266}
267
268void
270{
271 auto muInfo = std::dynamic_pointer_cast<L1ThrExtraInfo_MU>(m_extraInfo.lock());
272
276 m_idxBarrel = muInfo->rpcIdxForPt(m_ptBarrel);
277 m_idxEndcap = muInfo->tgcIdxForPt(m_ptEndcap);
278 m_idxForward = muInfo->tgcIdxForPt(m_ptForward);
279
280 m_rpcExclROIList = getAttribute("rpcExclROIList", true, "");
281 m_tgcFlags = getAttribute("tgcFlags");
282 m_rpcFlags = getAttribute_optional<std::string>("rpcFlags").value_or("");
283 m_region = getAttribute("region");
284}
285
286
287
288
Scalar eta() const
pseudorapidity method
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define x
const ptree & data() const
Access to the underlying data, if needed.
std::optional< T > getAttribute_optional(const std::string &key) const
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
virtual float thrValue(int eta=0) const override
Accessor to the threshold value for eta-dependent threholds.
ValueWithEtaDependence< unsigned int > m_etaDepThrValue
eta-dependent threshold value in MeV
virtual unsigned int thrValueMeV(int eta=0) const
virtual unsigned int thrValueCounts(int eta=0) const
virtual unsigned int thrValue100MeV(int eta=0) const
as above above but in 100 MeV
uint16_t isolationMask(int eta) const
Definition L1Threshold.h:29
void print(std::ostream &os=std::cout) const override
ValueWithEtaDependence< uint16_t > m_isolationMask
Definition L1Threshold.h:38
ValueWithEtaDependence< unsigned int > m_etaDepWindow
eta-dependent threshold value in MeV
Definition L1Threshold.h:73
unsigned int window(int eta=0) const
float thrValue(int eta=0) const override
this function is only to satisfy the base class interface.
std::string m_region
comma-separated list of BA, EC, FW or the string ALL
std::string m_tgcFlags
a logical expression like 'F & C | F & H | C & H'
std::string m_rpcFlags
a logical expression like 'M'
std::string m_rpcExclROIList
a string sepcifying the list of ROIs to be excluded (the lists are defined in the extraInfo_MU)
unsigned int m_seedMultiplicity
const std::shared_ptr< L1ThrExtraInfo_cTAU > getExtraInfo() const
const std::shared_ptr< L1ThrExtraInfo_jTAU > getExtraInfo() const
unsigned int mapping() const
Accessor to the mapping number The mapping is unique within a type.
std::weak_ptr< L1ThrExtraInfoBase > m_extraInfo
static WP stringToWP(const std::string &)