ATLAS Offline Software
Loading...
Searching...
No Matches
L1ThrExtraInfo.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <cmath>
8
9
10using namespace std;
11
12std::unique_ptr<TrigConf::L1ThrExtraInfoBase>
13TrigConf::L1ThrExtraInfo::createExtraInfo(const std::string & thrTypeName, const boost::property_tree::ptree & data) {
14 std::unique_ptr<TrigConf::L1ThrExtraInfoBase> extraInfo(nullptr);
15
16 if( thrTypeName == "EM" )
17 return std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data);
18
19 if( thrTypeName == "TAU" )
20 return std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data);
21
22 if( thrTypeName == "JET" )
23 return std::make_unique<L1ThrExtraInfo_JETLegacy>(thrTypeName, data);
24
25 if( thrTypeName == "XS" )
26 return std::make_unique<L1ThrExtraInfo_XSLegacy>(thrTypeName, data);
27
28 if( thrTypeName == "MU" )
29 return std::make_unique<L1ThrExtraInfo_MU>(thrTypeName, data);
30
31 if( thrTypeName == "eEM" )
32 return std::make_unique<L1ThrExtraInfo_eEM>(thrTypeName, data);
33
34 if( thrTypeName == "jEM" )
35 return std::make_unique<L1ThrExtraInfo_jEM>(thrTypeName, data);
36
37 if( thrTypeName == "eTAU" )
38 return std::make_unique<L1ThrExtraInfo_eTAU>(thrTypeName, data);
39
40 if( thrTypeName == "jTAU" )
41 return std::make_unique<L1ThrExtraInfo_jTAU>(thrTypeName, data);
42
43 if( thrTypeName == "cTAU" )
44 return std::make_unique<L1ThrExtraInfo_cTAU>(thrTypeName, data);
45
46 if( thrTypeName == "jJ" )
47 return std::make_unique<L1ThrExtraInfo_jJ>(thrTypeName, data);
48
49 if( thrTypeName == "jLJ" )
50 return std::make_unique<L1ThrExtraInfo_jLJ>(thrTypeName, data);
51
52 if( thrTypeName == "gJ" )
53 return std::make_unique<L1ThrExtraInfo_gJ>(thrTypeName, data);
54
55 if( thrTypeName == "gLJ" )
56 return std::make_unique<L1ThrExtraInfo_gLJ>(thrTypeName, data);
57
58 if( thrTypeName == "jXE" )
59 return std::make_unique<L1ThrExtraInfo_jXE>(thrTypeName, data);
60
61 if( thrTypeName == "jTE" )
62 return std::make_unique<L1ThrExtraInfo_jTE>(thrTypeName, data);
63
64 if( thrTypeName == "gXE" )
65 return std::make_unique<L1ThrExtraInfo_gXE>(thrTypeName, data);
66
67 if( thrTypeName == "gTE" )
68 return std::make_unique<L1ThrExtraInfo_gTE>(thrTypeName, data);
69
70 if( thrTypeName == "cXE" )
71 return std::make_unique<L1ThrExtraInfo_cXE>(thrTypeName, data);
72
73 // if no special extra information is supplied for the threshold type return base class
74 return std::make_unique<L1ThrExtraInfoBase>(thrTypeName, data);
75}
76
77void
82
83
84std::weak_ptr<TrigConf::L1ThrExtraInfoBase>
85TrigConf::L1ThrExtraInfo::addExtraInfo(const std::string & thrTypeName, const boost::property_tree::ptree & data) {
86 try {
87 if( auto extraInfo = L1ThrExtraInfo::createExtraInfo( thrTypeName, data) ) {
88 auto success = m_thrExtraInfo.emplace(thrTypeName, std::shared_ptr<TrigConf::L1ThrExtraInfoBase>(std::move(extraInfo)));
89 return std::weak_ptr<TrigConf::L1ThrExtraInfoBase>( success.first->second );
90 }
91 }
92 catch(std::exception & ex) {
93 std::cerr << "L1ThrExtraInfo::addExtraInfo: exception occured when building extra info for " << thrTypeName << std::endl;
94 throw;
95 }
96 return std::weak_ptr<TrigConf::L1ThrExtraInfoBase>( m_emptyInfo );
97}
98
99bool
100TrigConf::L1ThrExtraInfo::hasInfo(const std::string & typeName) const
101{
102 return ( m_thrExtraInfo.find(typeName) != m_thrExtraInfo.end() );
103}
104
107 return dynamic_cast<const TrigConf::L1ThrExtraInfo_EMTAULegacy&>( * m_thrExtraInfo.at("EM") );
108}
109
112 return dynamic_cast<const TrigConf::L1ThrExtraInfo_EMTAULegacy&>( * m_thrExtraInfo.at("TAU") );
113}
114
117 return dynamic_cast<const TrigConf::L1ThrExtraInfo_XSLegacy&>( * m_thrExtraInfo.at("XS") );
118}
119
122 return dynamic_cast<const TrigConf::L1ThrExtraInfo_JETLegacy&>( * m_thrExtraInfo.at("JET") );
123}
124
127 return dynamic_cast<const TrigConf::L1ThrExtraInfo_eEM&>( * m_thrExtraInfo.at("eEM") );
128}
129
132 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jEM&>( * m_thrExtraInfo.at("jEM") );
133}
134
137 return dynamic_cast<const TrigConf::L1ThrExtraInfo_eTAU&>( * m_thrExtraInfo.at("eTAU") );
138}
139
142 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jTAU&>( * m_thrExtraInfo.at("jTAU") );
143}
144
147 return dynamic_cast<const TrigConf::L1ThrExtraInfo_cTAU&>( * m_thrExtraInfo.at("cTAU") );
148}
149
152 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jJ&>( * m_thrExtraInfo.at("jJ") );
153}
154
157 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jLJ&>( * m_thrExtraInfo.at("jLJ") );
158}
159
162 return dynamic_cast<const TrigConf::L1ThrExtraInfo_gJ&>( * m_thrExtraInfo.at("gJ") );
163}
164
167 return dynamic_cast<const TrigConf::L1ThrExtraInfo_gLJ&>( * m_thrExtraInfo.at("gLJ") );
168}
169
172 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jXE&>( * m_thrExtraInfo.at("jXE") );
173}
174
177 return dynamic_cast<const TrigConf::L1ThrExtraInfo_jTE&>( * m_thrExtraInfo.at("jTE") );
178}
179
182 return dynamic_cast<const TrigConf::L1ThrExtraInfo_gXE&>( * m_thrExtraInfo.at("gXE") );
183}
184
187 return dynamic_cast<const TrigConf::L1ThrExtraInfo_gTE&>( * m_thrExtraInfo.at("gTE") );
188}
189
192 return dynamic_cast<const TrigConf::L1ThrExtraInfo_cXE&>( * m_thrExtraInfo.at("cXE") );
193}
194
197 return dynamic_cast<const TrigConf::L1ThrExtraInfo_MU&>( * m_thrExtraInfo.at("MU") );
198}
199
201TrigConf::L1ThrExtraInfo::thrExtraInfo(const std::string & thrTypeName) const
202{
203 try {
204 return * m_thrExtraInfo.at(thrTypeName);
205 }
206 catch(std::exception & ex) {
207 std::cerr << "Threshold type " << thrTypeName << " does not have extra info defined" << endl;
208 throw;
209 }
210}
211
216TrigConf::L1ThrExtraInfo_EMTAULegacy::isolation(std::string_view thrType, size_t bit) const
217{
218 if(bit<1 or bit>5) {
219 throw std::out_of_range("When accessing the legacy L1Calo EM or TAU isolation bit must be between 1 and 5, but bit="
220 + std::to_string(bit) + " was requested");
221 }
222 auto it = m_isolation.find(thrType);
223 if (it == m_isolation.end()){
224 std::cerr << "Threshold type " << name() << " does not have isolation parameters for type " << thrType << endl;
225 throw std::out_of_range("No isolation parameters for threshold type " + std::string(thrType));
226 }
227 return it->second[bit - 1];
228}
229
230void
232{
233 for( auto & x : m_extraInfo ) {
234 if( x.first == "ptMinToTopo" ) {
235 m_ptMinToTopoMeV = std::lround( 1000 * x.second.getValue<float>() );
236 } else if( x.first == "isolation" ) {
237 for( auto & y : x.second.data() ) {
238 auto & isoV = m_isolation[y.first] = std::vector<IsolationLegacy>(5);
239 for(auto & c : y.second.get_child("Parametrization") ) {
240 auto iso = IsolationLegacy(c.second);
241 isoV[iso.isobit()-1] = iso;
242 }
243 }
244 }
245 }
246}
247
248
249void
251{
252 if( hasExtraInfo("significance") ) {
253 auto & sig = m_extraInfo["significance"];
254 m_xeMin = sig.getAttribute<unsigned int>("xeMin");
255 m_xeMax = sig.getAttribute<unsigned int>("xeMax");
256 m_teSqrtMin = sig.getAttribute<unsigned int>("teSqrtMin");
257 m_teSqrtMax = sig.getAttribute<unsigned int>("teSqrtMax");
258 m_xsSigmaScale = sig.getAttribute<unsigned int>("xsSigmaScale");
259 m_xsSigmaOffset = sig.getAttribute<unsigned int>("xsSigmaOffset");
260 }
261}
262
263
264
268void
270{
271 for( auto & x : m_extraInfo ) {
272 if( x.first == "ptMinToTopoLargeWindow" ) {
273 m_ptMinToTopoLargeWindowMeV = std::lround( 1000 * x.second.getValue<float>() );
274 } else if( x.first == "ptMinToTopoSmallWindow" ) {
275 m_ptMinToTopoSmallWindowMeV = std::lround( 1000 * x.second.getValue<float>() );
276 }
277 }
278}
279
280
281/***********************************
282 *
283 * Extra info for new thresholds
284 *
285 ***********************************/
286
287/*******
288 * eEM
289 *******/
291 m_isDefined = true;
292 m_reta_d = pt.get_optional<float>("reta").get_value_or(0);
293 m_wstot_d = pt.get_optional<float>("wstot").get_value_or(0);
294 m_rhad_d = pt.get_optional<float>("rhad").get_value_or(0);
295 m_reta_fw = pt.get_optional<int>("reta_fw").get_value_or(0);
296 m_wstot_fw = pt.get_optional<int>("wstot_fw").get_value_or(0);
297 m_rhad_fw = pt.get_optional<int>("rhad_fw").get_value_or(0);
298}
299
300std::ostream &
302 os << "reta_fw=" << iso.reta_fw() << ", wstot_fw=" << iso.wstot_fw() << ", rhad_fw=" << iso.rhad_fw();
303 return os;
304}
305
306void
308{
309 for( auto & x : m_extraInfo ) {
310 if( x.first == "maxEt" ){
311 m_maxEt = 1000*x.second.getValue<unsigned int>();
312 } else if( x.first == "ptMinToTopo" ) {
313 m_ptMinToTopoMeV = lround(1000 * x.second.getValue<float>());
314 } else if( x.first == "workingPoints" ) {
315 for( auto & y : x.second.data() ) {
316 auto wp = Selection::stringToWP(y.first);
317 auto & iso = m_isolation.emplace(wp, string("eEM_WP_" + y.first)).first->second;
318 for(auto & c : y.second ) {
319 int etamin = c.second.get_optional<int>("etamin").get_value_or(-49);
320 int etamax = c.second.get_optional<int>("etamax").get_value_or(49);
321 unsigned int priority = c.second.get_optional<unsigned int>("priority").get_value_or(0);
322 iso.addRangeValue(WorkingPoints_eEM(c.second), etamin, etamax, priority, /*symmetric=*/ false);
323 }
324 }
325 } else if (x.first == "algoVersion") {
326 m_algoVersion = x.second.getValue<unsigned int>();
327 }
328 }
329}
330
331/*******
332 * jEM
333 *******/
335 m_isDefined = true;
336 m_iso_d = pt.get_optional<float>("iso").get_value_or(0);
337 m_frac_d = pt.get_optional<float>("frac").get_value_or(0);
338 m_frac2_d = pt.get_optional<float>("frac2").get_value_or(0);
339 m_iso_fw = pt.get_optional<int>("iso_fw").get_value_or(0);
340 m_frac_fw = pt.get_optional<int>("frac_fw").get_value_or(0);
341 m_frac2_fw = pt.get_optional<int>("frac2_fw").get_value_or(0);
342}
343
344std::ostream &
346 os << "iso_fw=" << iso.iso_fw() << ", frac_fw=" << iso.frac_fw() << ", frac2_fw=" << iso.frac2_fw();
347 return os;
348}
349
350void
352{
353 for( auto & x : m_extraInfo ) {
354 if( x.first == "maxEt" ){
355 m_maxEt = 1000*x.second.getValue<unsigned int>();
356 } else if( x.first == "ptMinToTopo1" ) {
357 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
358 } else if( x.first == "ptMinToTopo2" ){
359 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
360 } else if( x.first == "ptMinToTopo3" ){
361 m_ptMinToTopoMeV3 = 1000*x.second.getValue<unsigned int>();
362 } else if( x.first == "ptMinxTOB1" ){
363 m_ptMinxTOBMeV1 = 1000*x.second.getValue<unsigned int>();
364 } else if( x.first == "ptMinxTOB2" ){
365 m_ptMinxTOBMeV2 = 1000*x.second.getValue<unsigned int>();
366 } else if( x.first == "ptMinxTOB3" ){
367 m_ptMinxTOBMeV3 = 1000*x.second.getValue<unsigned int>();
368 } else if( x.first == "workingPoints" ) {
369 for( auto & y : x.second.data() ) {
370 auto wp = Selection::stringToWP(y.first);
371 auto & iso = m_isolation.emplace(wp, string("jEM_WP_" + y.first)).first->second;
372 for(auto & c : y.second ) {
373 int etamin = c.second.get_optional<int>("etamin").get_value_or(-49);
374 int etamax = c.second.get_optional<int>("etamax").get_value_or(49);
375 unsigned int priority = c.second.get_optional<unsigned int>("priority").get_value_or(0);
376 iso.addRangeValue(WorkingPoints_jEM(c.second), etamin, etamax, priority, /*symmetric=*/ false);
377 }
378 }
379 }
380 }
381}
382
383/*******
384 * eTAU
385 *******/
387 m_isDefined = true;
388 m_rCore_d = pt.get_optional<float>("rCore").get_value_or(0);
389 m_rHad_d = pt.get_optional<float>("rHad").get_value_or(0);
390 m_rCore_fw = pt.get_optional<float>("rCore_fw").get_value_or(0);
391 m_rHad_fw = pt.get_optional<float>("rHad_fw").get_value_or(0);
392}
393
394std::ostream &
396 os << "rCore_fw=" << iso.rCore_fw() << ", rHad_fw=" << iso.rHad_fw() ;
397 return os;
398}
399
400void
402{
403 for( auto & x : m_extraInfo ) {
404 if( x.first == "maxEt" ){
405 m_maxEt = 1000*x.second.getValue<unsigned int>(); // Original in units of GeV
406 } else if( x.first == "minIsoEt" ){
407 m_minIsoEt = lround(1000 * x.second.getValue<float>()); // Original in units of GeV
408 } else if( x.first == "ptMinToTopo" ) {
409 m_ptMinToTopoMeV = lround(1000 * x.second.getValue<float>());
410 } else if( x.first == "workingPoints" ) {
411 for( auto & y : x.second.data() ) {
412 auto wp = TrigConf::Selection::stringToWP(y.first);
413 auto & iso = m_isolation.emplace(wp, string("eTAU_WP_" + y.first)).first->second;
414 for(auto & c : y.second ) {
415 int etamin = c.second.get_optional<int>("etamin").get_value_or(-49);
416 int etamax = c.second.get_optional<int>("etamax").get_value_or(49);
417 unsigned int priority = c.second.get_optional<unsigned int>("priority").get_value_or(0);
418 iso.addRangeValue(WorkingPoints_eTAU(c.second), etamin, etamax, priority, /*symmetric=*/ false);
419 }
420 }
421 } else if (x.first == "algoVersion") {
422 m_algoVersion = x.second.getValue<unsigned int>();
423 }
424 }
425}
426
427/*******
428 * jTAU
429 *******/
431 m_isDefined = true;
432 m_isolation_d = pt.get_optional<float>("isolation").get_value_or(0);
433 m_isolation_fw = pt.get_optional<float>("isolation_fw").get_value_or(0);
434}
435
436std::ostream &
438 os << "isolation_fw=" << iso.isolation_fw() ;
439 return os;
440}
441
442void
444{
445 for( auto & x : m_extraInfo ) {
446 if( x.first == "maxEt" ){
447 m_maxEt = 1000*x.second.getValue<unsigned int>();
448 } else if( x.first == "ptMinToTopo1" ) {
449 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
450 } else if( x.first == "ptMinToTopo2" ){
451 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
452 } else if( x.first == "ptMinToTopo3" ){
453 m_ptMinToTopoMeV3 = 1000*x.second.getValue<unsigned int>();
454 } else if( x.first == "ptMinxTOB1" ){
455 m_ptMinxTOBMeV1 = 1000*x.second.getValue<unsigned int>();
456 } else if( x.first == "ptMinxTOB2" ){
457 m_ptMinxTOBMeV2 = 1000*x.second.getValue<unsigned int>();
458 } else if( x.first == "ptMinxTOB3" ){
459 m_ptMinxTOBMeV3 = 1000*x.second.getValue<unsigned int>();
460 } else if( x.first == "workingPoints" ) {
461 for( auto & y : x.second.data() ) {
462 auto wp = TrigConf::Selection::stringToWP(y.first);
463 auto & iso = m_isolation.emplace(wp, string("jTAU_WP_" + y.first)).first->second;
464 for(auto & c : y.second ) {
465 int etamin = c.second.get_optional<int>("etamin").get_value_or(-49);
466 int etamax = c.second.get_optional<int>("etamax").get_value_or(49);
467 unsigned int priority = c.second.get_optional<unsigned int>("priority").get_value_or(0);
468 iso.addRangeValue(WorkingPoints_jTAU(c.second), etamin, etamax, priority, /*symmetric=*/ false);
469 }
470 }
471 }
472 }
473}
474
475/*******
476 * cTAU
477 *******/
479 m_isDefined = true;
480 m_isolation_d = pt.get_optional<float>("isolation").get_value_or(0);
481 m_isolation_fw = pt.get_optional<unsigned int>("isolation_fw").get_value_or(0);
482 m_isolation_jTAUCoreScale_d = pt.get_optional<float>("isolation_jTAUCoreScale").get_value_or(0);
483 m_isolation_jTAUCoreScale_fw = pt.get_optional<unsigned int>("isolation_jTAUCoreScale_fw").get_value_or(0);
484 m_eTAU_rCoreMin_WP_d = pt.get_optional<float>("eTAU_rCoreMin").get_value_or(0);
485 m_eTAU_rCoreMin_WP_fw = pt.get_optional<unsigned int>("eTAU_rCoreMin_WP_fw").get_value_or(0);
486 m_eTAU_rHadMin_WP_d = pt.get_optional<float>("eTAU_rHadMin").get_value_or(0);
487 m_eTAU_rHadMin_WP_fw = pt.get_optional<unsigned int>("eTAU_rHadMin_WP_fw").get_value_or(0);
488}
489
490std::ostream &
492 os << "isolation_fw=" << iso.isolation_fw() << ", isolation_jTAUCoreScale_fw=" << iso.isolation_jTAUCoreScale_fw();
493 os << ", eTAU_rCoreMin_WP_fw=" << iso.eTAU_rCoreMin_WP_fw() << ", eTAU_rHadMin_WP_fw=" << iso.eTAU_rHadMin_WP_fw();
494 return os;
495}
496
497void
499{
500 for( auto & x : m_extraInfo ) {
501 if( x.first == "workingPoints" ) {
502 for( auto & y : x.second.data() ) {
503 auto wp = TrigConf::Selection::stringToWP(y.first);
504 auto & iso = m_isolation.emplace(wp, string("cTAU_WP_" + y.first)).first->second;
505 for(auto & c : y.second ) {
506 int etamin = c.second.get_optional<int>("etamin").get_value_or(-49);
507 int etamax = c.second.get_optional<int>("etamax").get_value_or(49);
508 unsigned int priority = c.second.get_optional<unsigned int>("priority").get_value_or(0);
509 iso.addRangeValue(WorkingPoints_cTAU(c.second), etamin, etamax, priority, /*symmetric=*/ false);
510 }
511 }
512 }
513 }
514}
515
516
517/*******
518 * jJ
519 *******/
520void
522{
523 for( auto & x : m_extraInfo ) {
524 if( x.first == "ptMinToTopo1" ) {
525 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
526 } else if( x.first == "ptMinToTopo2" ){
527 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
528 } else if( x.first == "ptMinToTopo3" ){
529 m_ptMinToTopoMeV3 = 1000*x.second.getValue<unsigned int>();
530 } else if( x.first == "ptMinxTOB1" ){
531 m_ptMinxTOBMeV1 = 1000*x.second.getValue<unsigned int>();
532 } else if( x.first == "ptMinxTOB2" ){
533 m_ptMinxTOBMeV2 = 1000*x.second.getValue<unsigned int>();
534 } else if( x.first == "ptMinxTOB3" ){
535 m_ptMinxTOBMeV3 = 1000*x.second.getValue<unsigned int>();
536 } else if( x.first == "seedThreshold1" ){
537 m_seedThresholdMeV1 = int(1000*x.second.getValue<float>());
538 } else if( x.first == "seedThreshold2" ){
539 m_seedThresholdMeV2 = int(1000*x.second.getValue<float>());
540 } else if( x.first == "seedThreshold3" ){
541 m_seedThresholdMeV3 = int(1000*x.second.getValue<float>());
542 }
543 }
544}
545
546/*******
547 * jLJ
548 *******/
549void
551{
552 for( auto & x : m_extraInfo ) {
553 if( x.first == "ptMinToTopo1" ) {
554 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
555 } else if( x.first == "ptMinToTopo2" ){
556 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
557 } else if( x.first == "ptMinToTopo3" ){
558 m_ptMinToTopoMeV3 = 1000*x.second.getValue<unsigned int>();
559 } else if( x.first == "ptMinxTOB1" ){
560 m_ptMinxTOBMeV1 = 1000*x.second.getValue<unsigned int>();
561 } else if( x.first == "ptMinxTOB2" ){
562 m_ptMinxTOBMeV2 = 1000*x.second.getValue<unsigned int>();
563 } else if( x.first == "ptMinxTOB3" ){
564 m_ptMinxTOBMeV3 = 1000*x.second.getValue<unsigned int>();
565 }
566 }
567}
568
569/*******
570 * gJ
571 *******/
572void
574{
575 for( auto & x : m_extraInfo ) {
576 if( x.first == "ptMinToTopo1" ) {
577 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
578 } else if( x.first == "ptMinToTopo2" ){
579 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
580 }
581 }
582}
583
584/*******
585 * gLJ
586 *******/
587void
589{
590 for( auto & x : m_extraInfo ) {
591 if( x.first == "ptMinToTopo1" ) {
592 m_ptMinToTopoMeV1 = 1000*x.second.getValue<unsigned int>();
593 } else if( x.first == "ptMinToTopo2" ){
594 m_ptMinToTopoMeV2 = 1000*x.second.getValue<unsigned int>();
595 } else if( x.first == "seedThrA" ){
596 m_seedThrMeVA = 1000*x.second.getValue<unsigned int>();
597 } else if( x.first == "seedThrB" ){
598 m_seedThrMeVB = 1000*x.second.getValue<unsigned int>();
599 } else if( x.first == "seedThrC" ){
600 m_seedThrMeVC = 1000*x.second.getValue<unsigned int>();
601 } else if( x.first == "rhoTowerMinA" ){
602 float rhoTower_tmp = 1000*x.second.getValue<float>();
603 if( (int)rhoTower_tmp != rhoTower_tmp)
604 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
605 m_rhoTowerMinMeVA = (int)rhoTower_tmp;
606 } else if( x.first == "rhoTowerMinB" ){
607 float rhoTower_tmp = 1000*x.second.getValue<float>();
608 if( (int)rhoTower_tmp != rhoTower_tmp)
609 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
610 m_rhoTowerMinMeVB = (int)rhoTower_tmp;
611 } else if( x.first == "rhoTowerMinC" ){
612 float rhoTower_tmp = 1000*x.second.getValue<float>();
613 if( (int)rhoTower_tmp != rhoTower_tmp)
614 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
615 m_rhoTowerMinMeVC = (int)rhoTower_tmp;
616 } else if( x.first == "rhoTowerMaxA" ){
617 float rhoTower_tmp = 1000*x.second.getValue<float>();
618 if( (int)rhoTower_tmp != rhoTower_tmp)
619 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
620 m_rhoTowerMaxMeVA = (int)rhoTower_tmp;
621 } else if( x.first == "rhoTowerMaxB" ){
622 float rhoTower_tmp = 1000*x.second.getValue<float>();
623 if( (int)rhoTower_tmp != rhoTower_tmp)
624 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
625 m_rhoTowerMaxMeVB = (int)rhoTower_tmp;
626 } else if( x.first == "rhoTowerMaxC" ){
627 float rhoTower_tmp = 1000*x.second.getValue<float>();
628 if( (int)rhoTower_tmp != rhoTower_tmp)
629 throw std::runtime_error("gLJ: rhoTower param " + std::to_string(rhoTower_tmp/1000.) + " cannot be converted in MeV" );
630 m_rhoTowerMaxMeVC = (int)rhoTower_tmp;
631 }
632 }
633}
634
635/*******
636 * jXE
637 *******/
638void
642
643/*******
644 * jTE
645 *******/
646void
648{
649 for( auto & x : m_extraInfo ) {
650 if( x.first == "etaBoundary1" ) {
651 m_etaBoundary1 = x.second.getValue<unsigned int>();
652 } else if( x.first == "etaBoundary1_fw" ) {
653 m_etaBoundary1_fw = x.second.getValue<unsigned int>();
654 } else if( x.first == "etaBoundary2" ) {
655 m_etaBoundary2 = x.second.getValue<unsigned int>();
656 } else if( x.first == "etaBoundary2_fw" ) {
657 m_etaBoundary2_fw = x.second.getValue<unsigned int>();
658 } else if( x.first == "etaBoundary3" ) {
659 m_etaBoundary3 = x.second.getValue<unsigned int>();
660 } else if( x.first == "etaBoundary3_fw" ) {
661 m_etaBoundary3_fw = x.second.getValue<unsigned int>();
662 }
663 }
664}
665
666/*******
667 * gXE
668 *******/
669void
671{
672 for( auto & x : m_extraInfo ) {
673 if( x.first == "seedThrA" ){
674 m_seedThrMeVA = 200*x.second.getValue<unsigned int>();
675 } else if( x.first == "seedThrB" ){
676 m_seedThrMeVB = 200*x.second.getValue<unsigned int>();
677 } else if( x.first == "seedThrC" ){
678 m_seedThrMeVC = 200*x.second.getValue<unsigned int>();
679 } else if( x.first == "XERHO_sigmaPosA" ){
680 m_XERHO_sigmaPosA = x.second.getValue<unsigned int>();
681 } else if( x.first == "XERHO_sigmaPosB" ){
682 m_XERHO_sigmaPosB = x.second.getValue<unsigned int>();
683 } else if( x.first == "XERHO_sigmaPosC" ){
684 m_XERHO_sigmaPosC = x.second.getValue<unsigned int>();
685 } else if( x.first == "XERHO_sigmaNegA" ){
686 m_XERHO_sigmaNegA = x.second.getValue<unsigned int>();
687 } else if( x.first == "XERHO_sigmaNegB" ){
688 m_XERHO_sigmaNegB = x.second.getValue<unsigned int>();
689 } else if( x.first == "XERHO_sigmaNegC" ){
690 m_XERHO_sigmaNegC = x.second.getValue<unsigned int>();
691 } else if( x.first == "XEJWOJ_a_A" ){
692 m_XEJWOJ_a_A = x.second.getValue<unsigned int>();
693 } else if( x.first == "XEJWOJ_a_B" ){
694 m_XEJWOJ_a_B = x.second.getValue<unsigned int>();
695 } else if( x.first == "XEJWOJ_a_C" ){
696 m_XEJWOJ_a_C = x.second.getValue<unsigned int>();
697 } else if( x.first == "XEJWOJ_b_A" ){
698 m_XEJWOJ_b_A = x.second.getValue<unsigned int>();
699 } else if( x.first == "XEJWOJ_b_B" ){
700 m_XEJWOJ_b_B = x.second.getValue<unsigned int>();
701 } else if( x.first == "XEJWOJ_b_C" ){
702 m_XEJWOJ_b_C = x.second.getValue<unsigned int>();
703 } else if( x.first == "XEJWOJ_c_A" ){
704 m_XEJWOJ_c_A = x.second.getValue<unsigned int>();
705 } else if( x.first == "XEJWOJ_c_B" ){
706 m_XEJWOJ_c_B = x.second.getValue<unsigned int>();
707 } else if( x.first == "XEJWOJ_c_C" ){
708 m_XEJWOJ_c_C = x.second.getValue<unsigned int>();
709 } else if( x.first == "XENOISECUT_noiseCutThrA" ){
710 m_noiseCutThrA = x.second.getValue<unsigned int>();
711 } else if( x.first == "XENOISECUT_noiseCutThrB" ){
712 m_noiseCutThrB = x.second.getValue<unsigned int>();
713 } else if( x.first == "XENOISECUT_noiseCutThrC" ){
714 m_noiseCutThrC = x.second.getValue<unsigned int>();
715 }
716 }
717}
718
719/*******
720 * gTE
721 *******/
722void
726
727/*******
728 * cXE
729 *******/
730void
732{
733 for( auto & x : m_extraInfo ) {
734 if( x.first == "jXeWeight" ){
735 m_jXeWeight = x.second.getValue<float>();
736 } else if( x.first == "gXeWeight" ){
737 m_gXeWeight = x.second.getValue<float>();
738 }
739 }
740}
741
742/*******
743 * MU
744 *******/
745unsigned int
747{
748 try {
749 return m_rpcPtMap.at(pt);
750 }
751 catch(std::exception & ex) {
752 std::cerr << "No RPC index defined for pt " << pt << endl;
753 throw;
754 }
755}
756
757
758unsigned int
760{
761 try {
762 return m_tgcPtMap.at(pt);
763 }
764 catch(std::exception & ex) {
765 std::cerr << "No TGC index defined for pt " << pt << endl;
766 throw;
767 }
768}
769
770unsigned int
772{
773
774 for(auto & x : m_rpcPtMap){
775 if(x.second==idx) return x.first;
776 }
777 throw std::runtime_error("index "+std::to_string(idx)+" not found for RPC roads");
778
779}
780
781unsigned int
783{
784
785 for(auto & x : m_tgcPtMap){
786 if(x.second==idx) return x.first;
787 }
788 throw std::runtime_error("index "+std::to_string(idx)+" not found for TGC roads");
789
790}
791
792unsigned int
794{
795
796 int ptValue = ptForRpcIdx(rpcIdx);
797 return tgcIdxForPt(ptValue);
798}
799
800std::vector<unsigned int>
802{
803 std::vector<unsigned int> ptValues;
804 for( auto & x : m_rpcPtMap ) {
805 ptValues.emplace_back(x.first);
806 }
807 return ptValues;
808}
809
810std::vector<unsigned int>
812{
813 std::vector<unsigned int> ptValues;
814 for( auto & x : m_tgcPtMap ) {
815 ptValues.emplace_back(x.first);
816 }
817 return ptValues;
818}
819
820
821std::vector<std::string>
823{
824 std::vector<std::string> listNames;
825 for( auto & x : m_roiExclusionLists ) {
826 listNames.emplace_back(x.first);
827 }
828 return listNames;
829}
830
831
832const std::map<std::string, std::vector<unsigned int> > &
833TrigConf::L1ThrExtraInfo_MU::exclusionList(const std::string & listName) const
834{
835 try {
836 return m_roiExclusionLists.at(listName);
837 }
838 catch(std::exception & ex) {
839 std::cerr << "No exclusion list '" << listName << "' defined in MU threshold exlusionLists" << endl;
840 throw;
841 }
842}
843
844void
846{
847 {
848 DataStructure ds = m_extraInfo["roads"].getObject("rpc");
849 for( const auto & x : ds.data() ) {
850 m_rpcPtMap.emplace( static_cast<unsigned int>(std::stoul(x.first)),
851 static_cast<unsigned int>(std::stoul(x.second.data())));
852 }
853 }
854 {
855 DataStructure ds = m_extraInfo["roads"].getObject("tgc");
856 for( auto & x : ds.data() ) {
857 m_tgcPtMap.emplace( static_cast<unsigned int>(std::stoul(x.first)),
858 static_cast<unsigned int>(std::stoul(x.second.data())));
859 }
860 }
861 for( auto & x : m_extraInfo["exclusionLists"].data() ) {
862 const std::string & listName = x.first;
863 std::map<std::string, std::vector<unsigned int>> roisBySector;
864 for( auto & list : x.second ) {
865 const std::string & sectorName = list.second.get_child("sectorName").get_value<std::string>();
866 std::vector<unsigned int> rois;
867 for( auto & roi : list.second.get_child("rois") ) {
868 rois.push_back( static_cast<unsigned int>(std::stoul( roi.second.data() )) );
869 }
870 roisBySector.emplace(sectorName, std::move(rois));
871 }
872 m_roiExclusionLists.emplace(listName, std::move(roisBySector));
873 }
874}
875
876
#define y
#define x
Base class for Trigger configuration data and wrapper around underlying representation.
const ptree & data() const
Access to the underlying data, if needed.
L1 extra information for certain threshold types.
std::map< std::string, DataStructure > m_extraInfo
bool hasExtraInfo(const std::string &key="") const
const IsolationLegacy & isolation(std::string_view thrType, size_t bit) const
EM legacy extra info.
void load()
Update the internal members.
std::map< std::string, std::vector< IsolationLegacy >, std::less<> > m_isolation
unsigned int m_ptMinToTopoMeV
EM specific data.
void load()
Update the internal members.
unsigned int m_ptMinToTopoLargeWindowMeV
JET specific data.
const std::map< std::string, std::vector< unsigned int > > & exclusionList(const std::string &listName) const
std::map< unsigned int, unsigned int > m_rpcPtMap
MU specific data.
std::vector< std::string > exclusionListNames() const
unsigned int rpcIdxForPt(unsigned int pt) const
unsigned int ptForTgcIdx(unsigned int idx) const
std::map< unsigned int, unsigned int > m_tgcPtMap
std::vector< unsigned int > knownTgcPtValues() const
unsigned int tgcIdxForRpcIdx(unsigned int rpcIdx) const
unsigned int tgcIdxForPt(unsigned int pt) const
std::vector< unsigned int > knownRpcPtValues() const
unsigned int ptForRpcIdx(unsigned int idx) const
std::map< std::string, std::map< std::string, std::vector< unsigned int > > > m_roiExclusionLists
void load()
Update the internal members.
unsigned int m_xeMin
XS specific data.
void load()
Update the internal members.
WorkingPoints_cTAU(const boost::property_tree::ptree &)
std::map< TrigConf::Selection::WP, ValueWithEtaDependence< WorkingPoints_cTAU > > m_isolation
cTAU specific data
void load()
Update the internal members.
void load()
Update the internal members.
float m_jXeWeight
cXE specific data
std::map< TrigConf::Selection::WP, ValueWithEtaDependence< WorkingPoints_eEM > > m_isolation
void load()
Update the internal members.
unsigned int m_ptMinToTopoMeV
eEM specific data
WorkingPoints_eTAU(const boost::property_tree::ptree &)
void load()
Update the internal members.
unsigned int m_minIsoEt
eTAU specific data
std::map< TrigConf::Selection::WP, ValueWithEtaDependence< WorkingPoints_eTAU > > m_isolation
unsigned int m_ptMinToTopoMeV1
gJ specific data
void load()
Update the internal members.
unsigned int m_ptMinToTopoMeV1
gLJ specific data
void load()
Update the internal members.
void load()
Update the internal members.
void load()
Update the internal members.
unsigned int m_XERHO_sigmaPosA
gXE specific data
unsigned int m_maxEt
jEM specific data
std::map< TrigConf::Selection::WP, ValueWithEtaDependence< WorkingPoints_jEM > > m_isolation
void load()
Update the internal members.
void load()
Update the internal members.
unsigned int m_ptMinToTopoMeV1
jJ specific data
void load()
Update the internal members.
unsigned int m_ptMinToTopoMeV1
jLJ specific data
WorkingPoints_jTAU(const boost::property_tree::ptree &)
unsigned int m_maxEt
jTAU specific data
std::map< TrigConf::Selection::WP, ValueWithEtaDependence< WorkingPoints_jTAU > > m_isolation
void load()
Update the internal members.
void load()
Update the internal members.
unsigned int m_etaBoundary1
jTE specific data
void load()
Update the internal members.
const L1ThrExtraInfo_eTAU & eTAU() const
const L1ThrExtraInfo_gXE & gXE() const
const L1ThrExtraInfo_jEM & jEM() const
std::map< std::string, std::shared_ptr< TrigConf::L1ThrExtraInfoBase > > m_thrExtraInfo
const L1ThrExtraInfo_XSLegacy & XS() const
const L1ThrExtraInfo_MU & MU() const
std::shared_ptr< TrigConf::L1ThrExtraInfoBase > m_emptyInfo
const L1ThrExtraInfoBase & thrExtraInfo(const std::string &thrTypeName) const
const L1ThrExtraInfo_jJ & jJ() const
const L1ThrExtraInfo_jLJ & jLJ() const
const L1ThrExtraInfo_cTAU & cTAU() const
const L1ThrExtraInfo_JETLegacy & JET() const
const L1ThrExtraInfo_EMTAULegacy & TAU() const
const L1ThrExtraInfo_gLJ & gLJ() const
std::weak_ptr< TrigConf::L1ThrExtraInfoBase > addExtraInfo(const std::string &thrTypeName, const boost::property_tree::ptree &data)
static std::unique_ptr< L1ThrExtraInfoBase > createExtraInfo(const std::string &thrTypeName, const boost::property_tree::ptree &data)
const L1ThrExtraInfo_gJ & gJ() const
const L1ThrExtraInfo_gTE & gTE() const
const L1ThrExtraInfo_eEM & eEM() const
const L1ThrExtraInfo_jTE & jTE() const
const L1ThrExtraInfo_jTAU & jTAU() const
const L1ThrExtraInfo_jXE & jXE() const
const L1ThrExtraInfo_EMTAULegacy & EM() const
bool hasInfo(const std::string &typeName) const
const L1ThrExtraInfo_cXE & cXE() const
static WP stringToWP(const std::string &)
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
STL namespace.