ATLAS Offline Software
L1Threshold.cxx
Go to the documentation of this file.
1 /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */
2 
5 
6 
7 /******************************************
8  *
9  * Legacy L1Calo thresholds
10  *
11  ******************************************/
12 
16 void
18 {
19  // read the isolation
20  if( const auto & thrVs = data().get_child_optional("thrValues") ) {
21  for( auto & x : thrVs.get() ) {
22  auto isobits = x.second.get_child("isobits").get_value<std::string>();
23  auto etamin = x.second.get_child("etamin").get_value<unsigned int>();
24  auto etamax = x.second.get_child("etamax").get_value<unsigned int>();
25  auto priority = x.second.get_child("priority").get_value<unsigned int>();
26  // turn bin string into uint, e.g. "01001" -> 9
27  uint16_t isomask(0);
28  for(char c: isobits) {
29  isomask <<= 1;
30  if(c=='1') isomask += 1;
31  }
32  m_isolationMask.addRangeValue(isomask, etamin, etamax, priority, /*symmetric=*/ false);
33  }
34  }
35 }
36 
37 void
38 TrigConf::L1Threshold_EM::print(std::ostream & os) const {
39  os << "EM threshold " << name() << " with mapping " << mapping() << std::endl;
40  for( int eta = -49; eta<49; eta++ ) {
41  auto value = thrValue(eta);
42  auto valueMeV = thrValueMeV(eta);
43  auto counts = thrValueCounts(eta);
44  auto value100MeV = thrValue100MeV(eta);
45  auto iso = isolationMask(eta);
46  os << " eta = " << eta << " : " << value << " GeV " << valueMeV << " MeV " << value100MeV << " 100MeV "
47  << counts << " counts , isoMaks " << iso << std::endl;
48  }
49 }
50 
54 void
56 {
57  // read the isolation
58  std::string isobits = getAttribute("isobits");
59  m_isolationMask = 0;
60  for(char c: isobits) {
61  m_isolationMask <<= 1;
62  if(c=='1') m_isolationMask += 1;
63  }
64 }
65 
69 void
71 {
72  // 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
73 
74  static const std::vector<int> allowedBoundaries{0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 28, 31, 49};
75  if( const auto & thrVs = data().get_child_optional("thrValues") ) {
76  for( auto & x : thrVs.get() ) {
77  auto etamin = x.second.get_child("etamin").get_value<int>();
78  // will be re-enabled once we have the faulty configurations in the TriggerDB removed
79  // if(std::find(begin(allowedBoundaries), end(allowedBoundaries), abs(etamin)) == allowedBoundaries.end()) {
80  // throw std::runtime_error(name() + ": etamin value " + std::to_string(etamin) + " not an allowed value for legacy JETs");
81  // }
82  auto etamax = x.second.get_child("etamax").get_value<int>();
83  // will be re-enabled once we have the faulty configurations in the TriggerDB removed
84  // if(std::find(begin(allowedBoundaries), end(allowedBoundaries), abs(etamax)) == allowedBoundaries.end()) {
85  // throw std::runtime_error(name() + ": etamax value " + std::to_string(etamax) + " not an allowed value for legacy JETs");
86  // }
87  auto priority = x.second.get_child("priority").get_value<unsigned int>();
88  auto window = x.second.get_child("window").get_value<unsigned int>();
89  m_etaDepWindow.addRangeValue(window, etamin, etamax, priority, /*symmetric=*/ false);
90  }
91  }
92 }
93 unsigned int
95  return m_etaDepWindow.at(eta);
96 }
97 
101 void
103 {
104  m_seed = getAttribute("seed");
105  m_seedBcdelay = getAttribute<unsigned int>("seedBcdelay");
106  m_seedMultiplicity = getAttribute<unsigned int>("seedMultiplicity");
107 }
108 
112 void
114 {
115  m_mask0 = getAttribute<unsigned int>("mask0");
116  m_mask1 = getAttribute<unsigned int>("mask1");
117  m_mask2 = getAttribute<unsigned int>("mask2");
118  m_mask3 = getAttribute<unsigned int>("mask3");
119  m_mask4 = getAttribute<unsigned int>("mask4");
120  m_mask5 = getAttribute<unsigned int>("mask5");
121 
122  m_seedBcdelay = getAttribute<unsigned int>("delay");
123 
124 }
125 
126 /******************************************
127  *
128  * New L1Calo thresholds
129  *
130  ******************************************/
131 
132 void
134 {
135  // read the isolation requirements
136  m_reta = Selection::stringToWP(getAttribute_optional<std::string>("reta").value_or("None"));
137  m_rhad = Selection::stringToWP(getAttribute_optional<std::string>("rhad").value_or("None"));
138  m_wstot = Selection::stringToWP(getAttribute_optional<std::string>("wstot").value_or("None"));
139  // reject TOBs outside explicitly defined eta ranges
140  // by requiring an impossibly high threshold
141  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
142 }
143 
144 void
146 {
147  // read the isolation requirements
148  m_iso = Selection::stringToWP(getAttribute_optional<std::string>("iso").value_or("None"));
149  m_frac = Selection::stringToWP(getAttribute_optional<std::string>("frac").value_or("None"));
150  m_frac2 = Selection::stringToWP(getAttribute_optional<std::string>("frac2").value_or("None"));
151  // reject TOBs outside explicitly defined eta ranges
152  // by requiring an impossibly high threshold
153  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
154 }
155 
156 void
158 {
159  // read the isolation requirements
160  m_rCore = Selection::stringToWP(getAttribute_optional<std::string>("rCore").value_or("None"));
161  m_rHad = Selection::stringToWP(getAttribute_optional<std::string>("rHad").value_or("None"));
162  // Correction for older L1 menus which used the HAD WPs that don't fit in L1Topo bits
163  // This will result in no rHad isolation being applied, but there were no
164  // active L1 items (eTAU40HA threshold defined but unused) -- ATR-25329
165  if(m_rHad == Selection::WP::HADMEDIUM) {m_rHad = Selection::WP::MEDIUM;}
166  // reject TOBs outside explicitly defined eta ranges
167  // by requiring an impossibly high threshold
168  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
169 }
170 
171 const std::shared_ptr<TrigConf::L1ThrExtraInfo_jTAU>
173 {
174  return dynamic_pointer_cast<TrigConf::L1ThrExtraInfo_jTAU>(m_extraInfo.lock());
175 }
176 
177 void
179 {
180  // read the isolation requirements
181  m_isolation = Selection::stringToWP(getAttribute_optional<std::string>("isolation").value_or("None"));
182  // reject TOBs outside explicitly defined eta ranges
183  // by requiring an impossibly high threshold
184  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
185 }
186 
187 const std::shared_ptr<TrigConf::L1ThrExtraInfo_cTAU>
189 {
190  return dynamic_pointer_cast<TrigConf::L1ThrExtraInfo_cTAU>(m_extraInfo.lock());
191 }
192 
193 void
195 {
196  // read the isolation requirements
197  m_isolation = Selection::stringToWP(getAttribute_optional<std::string>("isolation").value_or("None"));
198  // reject TOBs outside explicitly defined eta ranges
199  // by requiring an impossibly high threshold
200  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
201 }
202 
203 void
205 {
206  // reject TOBs outside explicitly defined eta ranges
207  // by requiring an impossibly high threshold
208  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
209 }
210 
211 void
213 {
214  // reject TOBs outside explicitly defined eta ranges
215  // by requiring an impossibly high threshold
216  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
217 }
218 
219 void
221 {
222  // reject TOBs outside explicitly defined eta ranges
223  // by requiring an impossibly high threshold
224  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
225 }
226 
227 void
229 {
230  // reject TOBs outside explicitly defined eta ranges
231  // by requiring an impossibly high threshold
232  m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, 14000000));
233 }
234 
235 void
237 {}
238 
239 void
241 {}
242 
243 void
245 {}
246 
247 void
249 {}
250 
251 /******************************************
252  *
253  * Muon threshold
254  *
255  ******************************************/
256 
260 float
262 {
263  return static_cast<float>(m_ptBarrel);
264 }
265 
266 void
268 {
269  auto muInfo = std::dynamic_pointer_cast<L1ThrExtraInfo_MU>(m_extraInfo.lock());
270 
271  m_ptBarrel = getAttribute<unsigned int>("baThr");
272  m_ptEndcap = getAttribute<unsigned int>("ecThr");
273  m_ptForward = getAttribute<unsigned int>("fwThr");
274  m_idxBarrel = muInfo->rpcIdxForPt(m_ptBarrel);
275  m_idxEndcap = muInfo->tgcIdxForPt(m_ptEndcap);
276  m_idxForward = muInfo->tgcIdxForPt(m_ptForward);
277 
278  m_rpcExclROIList = getAttribute("rpcExclROIList", true, "");
279  m_tgcFlags = getAttribute("tgcFlags");
280  m_rpcFlags = getAttribute_optional<std::string>("rpcFlags").value_or("");
281  m_region = getAttribute("region");
282 }
283 
284 
285 
286 
TrigConf::DataStructure::data
const ptree & data() const
Access to the underlying data, if needed.
Definition: DataStructure.h:83
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TrigConf::L1Threshold_cTAU::load
void load()
Definition: L1Threshold.cxx:194
TrigConf::L1Threshold_MU::load
void load()
Definition: L1Threshold.cxx:267
TrigConf::L1Threshold_JET::window
unsigned int window(int eta=0) const
Definition: L1Threshold.cxx:94
TrigConf::L1Threshold_jTAU::load
void load()
Definition: L1Threshold.cxx:178
TrigConf::Selection::stringToWP
static WP stringToWP(const std::string &)
Definition: L1ThresholdBase.cxx:393
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
athena.value
value
Definition: athena.py:122
python.selector.AtlRunQuerySelectorLhcOlc.priority
priority
Definition: AtlRunQuerySelectorLhcOlc.py:611
TrigConf::L1Threshold_gTE::load
void load()
Definition: L1Threshold.cxx:248
x
#define x
L1Threshold.h
find_tgc_unfilled_channelids.mapping
mapping
Definition: find_tgc_unfilled_channelids.py:17
TrigConf::L1Threshold_ZBTopo::load
void load()
ZBTopo.
Definition: L1Threshold.cxx:113
TrigConf::L1Threshold_JET::load
void load()
JET.
Definition: L1Threshold.cxx:70
TrigConf::L1Threshold_MU::thrValue
float thrValue(int eta=0) const override
this function is only to satisfy the base class interface.
Definition: L1Threshold.cxx:261
TrigConf::L1Threshold_jXE::load
void load()
Definition: L1Threshold.cxx:236
TrigConf::L1Threshold_eEM::load
void load()
Definition: L1Threshold.cxx:133
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TrigConf::L1Threshold_jJ::load
void load()
Definition: L1Threshold.cxx:204
TrigConf::L1Threshold_gJ::load
void load()
Definition: L1Threshold.cxx:220
TrigConf::L1Threshold_EM::load
void load()
EM.
Definition: L1Threshold.cxx:17
TrigConf::L1Threshold_cTAU::getExtraInfo
const std::shared_ptr< L1ThrExtraInfo_cTAU > getExtraInfo() const
Definition: L1Threshold.cxx:188
TrigConf::L1Threshold_ZB::load
void load()
ZB.
Definition: L1Threshold.cxx:102
TrigConf::L1Threshold_jEM::load
void load()
Definition: L1Threshold.cxx:145
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConf::L1Threshold_jTE::load
void load()
Definition: L1Threshold.cxx:240
TrigConf::L1Threshold_jTAU::getExtraInfo
const std::shared_ptr< L1ThrExtraInfo_jTAU > getExtraInfo() const
Definition: L1Threshold.cxx:172
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TrigConf::L1Threshold_EM::m_isolationMask
ValueWithEtaDependence< uint16_t > m_isolationMask
Definition: L1Threshold.h:37
TrigConf::L1Threshold_TAU::load
void load()
TAU.
Definition: L1Threshold.cxx:55
TrigConf::Selection::WP::MEDIUM
@ MEDIUM
TrigConf::Selection::WP::HADMEDIUM
@ HADMEDIUM
TrigConf::ValueWithEtaDependence::addRangeValue
void addRangeValue(const T &value, int etaMin, int etaMax, unsigned int priority, bool symmetric=true)
TrigConf::L1Threshold_gLJ::load
void load()
Definition: L1Threshold.cxx:228
TrigConf::L1Threshold_jLJ::load
void load()
Definition: L1Threshold.cxx:212
TrigConf::L1Threshold_gXE::load
void load()
Definition: L1Threshold.cxx:244
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
TrigConf::L1Threshold_eTAU::load
void load()
Definition: L1Threshold.cxx:157
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:54
python.compressB64.c
def c
Definition: compressB64.py:93
L1ThrExtraInfo.h
TrigConf::L1Threshold_EM::print
void print(std::ostream &os=std::cout) const override
Definition: L1Threshold.cxx:38