20 if ( energyMeV % energyResolutionMeV != 0 ) {
21 throw std::runtime_error(
"Energy " + std::to_string(energyMeV) +
" MeV is not a multiple of the energy resolution " + std::to_string(energyResolutionMeV));
23 return energyMeV / energyResolutionMeV;
27std::shared_ptr<TrigConf::L1Threshold>
29 std::weak_ptr<L1ThrExtraInfoBase> extraInfo,
const ptree &
data )
32 return std::make_shared<L1Threshold_EM>(
name,
type, extraInfo,
data );
35 return std::make_shared<L1Threshold_TAU>(
name,
type, extraInfo,
data );
38 return std::make_shared<L1Threshold_XE>(
name,
type, extraInfo,
data );
41 return std::make_shared<L1Threshold_JET>(
name,
type, extraInfo,
data );
44 return std::make_shared<L1Threshold_XS>(
name,
type, extraInfo,
data );
47 return std::make_shared<L1Threshold_TE>(
name,
type, extraInfo,
data );
50 return std::make_shared<L1Threshold_eEM>(
name,
type, extraInfo,
data );
53 return std::make_shared<L1Threshold_jEM>(
name,
type, extraInfo,
data );
56 return std::make_shared<L1Threshold_eTAU>(
name,
type, extraInfo,
data );
59 return std::make_shared<L1Threshold_jTAU>(
name,
type, extraInfo,
data );
62 return std::make_shared<L1Threshold_cTAU>(
name,
type, extraInfo,
data );
65 return std::make_shared<L1Threshold_jJ>(
name,
type, extraInfo,
data );
68 return std::make_shared<L1Threshold_jLJ>(
name,
type, extraInfo,
data );
71 return std::make_shared<L1Threshold_gJ>(
name,
type, extraInfo,
data );
74 return std::make_shared<L1Threshold_gLJ>(
name,
type, extraInfo,
data );
77 return std::make_shared<L1Threshold_jXE>(
name,
type, extraInfo,
data );
80 return std::make_shared<L1Threshold_jTE>(
name,
type, extraInfo,
data );
83 return std::make_shared<L1Threshold_gXE>(
name,
type, extraInfo,
data );
86 return std::make_shared<L1Threshold_gTE>(
name,
type, extraInfo,
data );
89 return std::make_shared<L1Threshold_MU>(
name,
type, extraInfo,
data );
92 return std::make_shared<L1Threshold_ZB>(
name,
type, extraInfo,
data );
94 if(
type ==
"ZBTopo" )
95 return std::make_shared<L1Threshold_ZBTopo>(
name,
type, extraInfo,
data );
97 static const std::string NIMtypes[] = {
"BCM",
"BCMCMB",
"LUCID",
"ZDC",
"BPTX",
"CALREQ",
"MBTS",
"MBTSSI",
"NIM" };
98 bool isNIMtype = std::find(std::begin(NIMtypes), std::end(NIMtypes),
type) != std::end(NIMtypes);
101 return std::make_shared<L1Threshold_NIM>(
name,
type, extraInfo,
data );
103 if(
type ==
"internal" )
104 return std::make_shared<L1Threshold_internal>(
name,
type, extraInfo,
data );
106 static const std::string noSpecialImp[] = {
"JET",
"XS",
"TOPO",
"MULTTOPO",
"MUTOPO",
"R2TOPO",
"ALFA",
"NSWMon",
"LArSat"};
107 bool useBaseClass = std::find(std::begin(noSpecialImp), std::end(noSpecialImp),
type) != std::end(noSpecialImp);
110 return std::make_shared<L1Threshold>(
name,
type, extraInfo,
data );
112 throw std::runtime_error(
"Threshold " +
name +
" is not of a valid L1 threshold type: " +
type);
117 std::weak_ptr<L1ThrExtraInfoBase> extraInfo,
const boost::property_tree::ptree &
data)
140 if(
type() ==
"internal" ) {
165 for(
auto & content :
data() ) {
166 if( content.first ==
"type" ||
167 content.first ==
"thresholds" ) {
172 std::forward_as_tuple(content.first),
173 std::forward_as_tuple(content.second));
198std::optional<std::reference_wrapper<const TrigConf::DataStructure>>
202 return hasKey ? std::optional<std::reference_wrapper<const TrigConf::DataStructure>>{
m_extraInfo.at(key)} : std::nullopt;
214 std::weak_ptr<L1ThrExtraInfoBase> extraInfo,
const boost::property_tree::ptree &
data)
229 unsigned int gev2MeVThrVal(
double gevVal) {
230 unsigned int mev_i = std::lround( 1000 * gevVal );
231 if( gevVal != (mev_i / 1000.) ) {
232 std::runtime_error(
"Value conversion failed");
243 if(
type() ==
"internal" ) {
248 if(
const auto & thrVs =
data().get_child_optional(
"thrValues") ) {
249 for(
auto &
x : thrVs.get() ) {
250 auto value = gev2MeVThrVal(
x.second.get_child(
"value").get_value<
float>() );
251 auto etamin =
x.second.get_child(
"etamin").get_value<
unsigned int>();
252 auto etamax =
x.second.get_child(
"etamax").get_value<
unsigned int>();
253 auto priority =
x.second.get_child(
"priority").get_value<
unsigned int>();
257 if(
const auto & ranges =
data().get_child_optional(
"ranges") ) {
259 for(
auto &
x : ranges.get() ) {
260 auto etamin =
x.second.get_child(
"etamin").get_value<
unsigned int>();
261 auto etamax =
x.second.get_child(
"etamax").get_value<
unsigned int>();
297 thresholdValuesGeV.addRangeValue(
r.value() / 1000.0f,
r.etaMin(),
r.etaMax(),
r.priority(),
r.symmetric());
299 return thresholdValuesGeV;
328 m_isobit = pt.get_child(
"isobit").get_value<
int>();
329 m_offset = pt.get_child(
"offset").get_value<
int>();
330 m_slope = pt.get_child(
"slope").get_value<
int>();
331 m_mincut = pt.get_child(
"mincut").get_value<
int>();
332 m_upperlimit = pt.get_child(
"upperlimit").get_value<
int>();
333 m_etamin = pt.get_child(
"etamin").get_value<
int>();
334 m_etamax = pt.get_child(
"etamax").get_value<
int>();
335 m_priority = pt.get_child(
"priority").get_value<
int>();
340 os <<
"isolation bit " << iso.
isobit() <<
": offset=" << iso.
offset() <<
", slope=" << iso.
slope()
342 <<
", etamin=" << iso.
etamin() <<
", etamax=" << iso.
etamax() <<
", priority=" << iso.
priority();
401 throw std::runtime_error(
"Unknown working point " + std::to_string(
int(wp)));
409 if (wpStr ==
"Loose")
411 if (wpStr ==
"Medium")
413 if (wpStr ==
"Tight")
415 if (wpStr ==
"HadLoose")
417 if (wpStr ==
"HadMedium")
419 if (wpStr ==
"HadTight")
423 if (wpStr ==
"Loose12")
425 if (wpStr ==
"Loose20")
427 if (wpStr ==
"Loose30")
429 if (wpStr ==
"Loose35")
431 if (wpStr ==
"Loose50")
433 if (wpStr ==
"Loose55")
435 if (wpStr ==
"Medium12")
437 if (wpStr ==
"Medium20")
439 if (wpStr ==
"Medium30")
441 if (wpStr ==
"Medium35")
443 if (wpStr ==
"Medium50")
445 if (wpStr ==
"Medium55")
447 if (wpStr ==
"Tight12")
449 if (wpStr ==
"Tight20")
451 if (wpStr ==
"Tight30")
453 if (wpStr ==
"Tight35")
455 if (wpStr ==
"Tight50")
457 if (wpStr ==
"Tight55")
459 throw std::runtime_error(
"Unknown working point name " + wpStr);
Scalar eta() const
pseudorapidity method
char data[hepevt_bytes_allocation_ATLAS]
static const Attributes_t empty
virtual const std::string & name() const final
bool isInitialized() const
const ptree & data() const
Access to the underlying data, if needed.
bool hasAttribute(const std::string &key) const
Check for attribute.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
boost::property_tree::ptree ptree
IsolationLegacy()=default
virtual void update() override
Update the internal data after modification of the data object.
L1Threshold_Calo()=delete
Constructor.
virtual const ValueWithEtaDependence< unsigned int > & thrValuesMeV() const
access to the list of ThresholdValues in MeV
virtual float thrValue(int eta=0) const override
Accessor to the threshold value for eta-dependent threholds.
virtual ValueWithEtaDependence< unsigned int > thrValues100MeV() const
access to the list of ThresholdValues in 100 MeV (for L1Topo multiplicity)
virtual ValueWithEtaDependence< float > thrValues() const
access to the list of ThresholdValues in GeV
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
unsigned int m_thrValue
threshold value in MeV
virtual ValueWithEtaDependence< unsigned int > thrValuesCounts() const
access to the list of ThresholdValues in energy units
virtual unsigned int thrValue100MeV(int eta=0) const
as above above but in 100 MeV
virtual void update() override
Update the internal data after modification of the data object.
std::string m_type
threshold type
L1Threshold()=default
Constructor.
virtual float thrValue(int eta=0) const
Accessor to the threshold value for eta-dependent threholds.
const std::string & type() const
Accessor to the threshold type.
unsigned int m_mapping
unique identifier amongst thresholds of the same type
static std::shared_ptr< L1Threshold > createThreshold(const std::string &name, const std::string &type, std::weak_ptr< L1ThrExtraInfoBase > extraInfo, const ptree &data)
static method to create type-specific L1Thresholds
std::weak_ptr< L1ThrExtraInfoBase > m_extraInfo
static std::string wpToString(WP)
static WP stringToWP(const std::string &)
class to implement a L1 threshold cut that varies with eta
unsigned int energyInCounts(unsigned int energyMeV, unsigned int energyResolutionMeV)
helper funtion to translate energies into counts
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)