ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::L1Threshold_Calo Class Reference

#include <L1ThresholdBase.h>

Inherits TrigConf::L1Threshold.

Inherited by TrigConf::L1Threshold_EM, TrigConf::L1Threshold_JET, TrigConf::L1Threshold_TAU, TrigConf::L1Threshold_TE, TrigConf::L1Threshold_XE, TrigConf::L1Threshold_XS, TrigConf::L1Threshold_cTAU, TrigConf::L1Threshold_eEM, TrigConf::L1Threshold_eTAU, TrigConf::L1Threshold_gJ, TrigConf::L1Threshold_gLJ, TrigConf::L1Threshold_gTE, TrigConf::L1Threshold_gXE, TrigConf::L1Threshold_jEM, TrigConf::L1Threshold_jJ, TrigConf::L1Threshold_jLJ, TrigConf::L1Threshold_jTAU, TrigConf::L1Threshold_jTE, and TrigConf::L1Threshold_jXE.

Collaboration diagram for TrigConf::L1Threshold_Calo:

Public Types

using ptree = boost::property_tree::ptree

Public Member Functions

 L1Threshold_Calo ()=delete
 Constructor.
 L1Threshold_Calo (const std::string &name, const std::string &type, std::weak_ptr< L1ThrExtraInfoBase > extraInfo, const ptree &data)
 Constructor initialized with configuration data.
virtual ~L1Threshold_Calo () override=default
 Destructor.
virtual float thrValue (int eta=0) const override
 Accessor to the threshold value for eta-dependent threholds.
virtual unsigned int thrValueCounts (int eta=0) const
virtual unsigned int thrValueMeV (int eta=0) const
virtual unsigned int thrValue100MeV (int eta=0) const
 as above above but in 100 MeV
virtual ValueWithEtaDependence< float > thrValues () const
 access to the list of ThresholdValues in GeV
virtual const ValueWithEtaDependence< unsigned int > & thrValuesMeV () const
 access to the list of ThresholdValues in MeV
virtual ValueWithEtaDependence< unsigned int > thrValues100MeV () const
 access to the list of ThresholdValues in 100 MeV (for L1Topo multiplicity)
virtual ValueWithEtaDependence< unsigned int > thrValuesCounts () const
 access to the list of ThresholdValues in energy units
virtual std::string className () const override
 A string that is the name of the class.
const std::string & type () const
 Accessor to the threshold type.
unsigned int mapping () const
 Accessor to the mapping number The mapping is unique within a type.
void setData (const ptree &data)
 Setting the configuration data.
void setData (ptree &&data)
void setName (const std::string &n)
 Setting the configuration element name.
virtual const std::string & name () const final
virtual void clear ()
 Clearing the configuration data.
const ptreedata () const
 Access to the underlying data, if needed.
bool isValue () const
 Check for attribute.
std::string getValue () const
 Access to simple content.
template<class T>
getValue () const
template<class T>
std::optional< T > getValue_optional () const
 access to content of the note Will return false if the value could not be converted into T
bool hasAttribute (const std::string &key) const
 Check for attribute.
bool isNull (const std::string &key) const
 Check if an attribute is null.
bool hasChild (const std::string &path) const
 Check if child exists.
std::string operator[] (const std::string &key) const
 Access to simple attribute.
template<class T>
getAttribute (const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
 Access to simple attribute.
const std::string & getAttribute (const std::string &key, bool ignoreIfMissing=false, const std::string &def="") const
template<class T>
std::optional< T > getAttribute_optional (const std::string &key) const
std::vector< DataStructuregetList (const std::string &pathToChild, bool ignoreIfMissing=false) const
 Access to array structure.
std::optional< std::vector< DataStructure > > getList_optional (const std::string &pathToChild) const
DataStructure getObject (const std::string &pathToChild, bool ignoreIfMissing=false) const
 Access to configuration object.
std::optional< TrigConf::DataStructuregetObject_optional (const std::string &pathToChild) const
std::vector< std::string > getKeys () const
 Access to the keys of an DataStructure which presents a dictionary.
 operator bool () const
 Access to initialized state.
bool isValid () const
bool isInitialized () const
bool empty () const
 Check if children exist.
void printRaw (std::ostream &os=std::cout) const
virtual void print (std::ostream &os=std::cout) const
bool ownsData () const

Static Public Member Functions

static std::shared_ptr< L1ThresholdcreateThreshold (const std::string &name, const std::string &type, std::weak_ptr< L1ThrExtraInfoBase > extraInfo, const ptree &data)
 static method to create type-specific L1Thresholds
static void printElement (const std::string &key, const ptree &data, uint level=0, std::ostream &os=std::cout)
 Static function to print a ptree object.

Protected Member Functions

virtual void update () override
 Update the internal data after modification of the data object.

Protected Attributes

std::string m_input {""}
unsigned int m_thrValue {0}
 threshold value in MeV
ValueWithEtaDependence< unsigned int > m_etaDepThrValue {""}
 eta-dependent threshold value in MeV
std::weak_ptr< L1ThrExtraInfoBasem_extraInfo
bool m_initialized { false }
 if initialized, the underlying ptree is has been assigned to (can be empty)
std::shared_ptr< ptreem_dataSPtr { nullptr }
const ptreem_dataPtr { nullptr }
std::string m_name {""}

Private Member Functions

void load ()

Private Attributes

std::string m_type {""}
 threshold type
unsigned int m_mapping {0}
 unique identifier amongst thresholds of the same type

Detailed Description

Definition at line 188 of file L1ThresholdBase.h.

Member Typedef Documentation

◆ ptree

using TrigConf::DataStructure::ptree = boost::property_tree::ptree
inherited

Definition at line 40 of file DataStructure.h.

Constructor & Destructor Documentation

◆ L1Threshold_Calo() [1/2]

TrigConf::L1Threshold_Calo::L1Threshold_Calo ( )
delete

Constructor.

◆ L1Threshold_Calo() [2/2]

TrigConf::L1Threshold_Calo::L1Threshold_Calo ( const std::string & name,
const std::string & type,
std::weak_ptr< L1ThrExtraInfoBase > extraInfo,
const ptree & data )

Constructor initialized with configuration data.

L1Threshold_Calo base class.

Parameters
namethreshold name
typethreshold type name
extraInfoThe information that is specific for this threshold type
dataThe data containing the L1 threshold

Definition at line 213 of file L1ThresholdBase.cxx.

215 : L1Threshold(name, type, extraInfo, data),
216 m_etaDepThrValue(name + "#" + type + "_value")
217{
218 load();
219}
virtual const std::string & name() const final
const ptree & data() const
Access to the underlying data, if needed.
ValueWithEtaDependence< unsigned int > m_etaDepThrValue
eta-dependent threshold value in MeV
L1Threshold()=default
Constructor.
const std::string & type() const
Accessor to the threshold type.

◆ ~L1Threshold_Calo()

virtual TrigConf::L1Threshold_Calo::~L1Threshold_Calo ( )
overridevirtualdefault

Destructor.

Member Function Documentation

◆ className()

◆ clear()

void TrigConf::DataStructure::clear ( )
virtualinherited

Clearing the configuration data.

should be overloaded by derived object that have to clear data

leads to an uninitialized object

Reimplemented in L1BunchGroupSet, TrigConf::HLTMenu, TrigConf::HLTMonitoring, TrigConf::HLTPrescalesSet, TrigConf::L1BunchGroupSet, TrigConf::L1CTP, TrigConf::L1Menu, and TrigConf::L1PrescalesSet.

Definition at line 65 of file DataStructure.cxx.

66{
67 m_initialized = false;
68 m_dataSPtr = nullptr;
69 m_dataPtr = nullptr;
70}
std::shared_ptr< ptree > m_dataSPtr
bool m_initialized
if initialized, the underlying ptree is has been assigned to (can be empty)

◆ createThreshold()

std::shared_ptr< TrigConf::L1Threshold > TrigConf::L1Threshold::createThreshold ( const std::string & name,
const std::string & type,
std::weak_ptr< L1ThrExtraInfoBase > extraInfo,
const ptree & data )
staticinherited

static method to create type-specific L1Thresholds

Parameters
name[in] name of the threshold
type[in] type of the threshold (e.g. EM, TAU, JET, XE, TE, eEM, jJ, gXE, ...)
extraInfo[in] link to the extra info for the given type
data[in] the threshold definition (json wrapped into a ptree)
Returns
shared ptr of the created threshold (returns ownership)

Definition at line 28 of file L1ThresholdBase.cxx.

30{
31 if( type == "EM" )
32 return std::make_shared<L1Threshold_EM>( name, type, extraInfo, data );
33
34 if( type == "TAU" )
35 return std::make_shared<L1Threshold_TAU>( name, type, extraInfo, data );
36
37 if( type == "XE" )
38 return std::make_shared<L1Threshold_XE>( name, type, extraInfo, data );
39
40 if( type == "JET" || type == "JB" || type == "JF" ) // JB and JF are Run 1 thresholds
41 return std::make_shared<L1Threshold_JET>( name, type, extraInfo, data );
42
43 if( type == "XS" )
44 return std::make_shared<L1Threshold_XS>( name, type, extraInfo, data );
45
46 if( type == "TE" || type == "JE" ) // JE is a Run 1 threshold
47 return std::make_shared<L1Threshold_TE>( name, type, extraInfo, data );
48
49 if( type == "eEM" )
50 return std::make_shared<L1Threshold_eEM>( name, type, extraInfo, data );
51
52 if( type == "jEM" )
53 return std::make_shared<L1Threshold_jEM>( name, type, extraInfo, data );
54
55 if( type == "eTAU" )
56 return std::make_shared<L1Threshold_eTAU>( name, type, extraInfo, data );
57
58 if( type == "jTAU" )
59 return std::make_shared<L1Threshold_jTAU>( name, type, extraInfo, data );
60
61 if( type == "cTAU" )
62 return std::make_shared<L1Threshold_cTAU>( name, type, extraInfo, data );
63
64 if( type == "jJ" )
65 return std::make_shared<L1Threshold_jJ>( name, type, extraInfo, data );
66
67 if( type == "jLJ" )
68 return std::make_shared<L1Threshold_jLJ>( name, type, extraInfo, data );
69
70 if( type == "gJ" )
71 return std::make_shared<L1Threshold_gJ>( name, type, extraInfo, data );
72
73 if( type == "gLJ" )
74 return std::make_shared<L1Threshold_gLJ>( name, type, extraInfo, data );
75
76 if( type == "jXE" )
77 return std::make_shared<L1Threshold_jXE>( name, type, extraInfo, data );
78
79 if( type == "jTE" )
80 return std::make_shared<L1Threshold_jTE>( name, type, extraInfo, data );
81
82 if( type == "gXE" )
83 return std::make_shared<L1Threshold_gXE>( name, type, extraInfo, data );
84
85 if( type == "gTE" )
86 return std::make_shared<L1Threshold_gTE>( name, type, extraInfo, data );
87
88 if( type == "MU" )
89 return std::make_shared<L1Threshold_MU>( name, type, extraInfo, data );
90
91 if( type == "ZB" )
92 return std::make_shared<L1Threshold_ZB>( name, type, extraInfo, data );
93
94 if( type == "ZBTopo" )
95 return std::make_shared<L1Threshold_ZBTopo>( name, type, extraInfo, data );
96
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);
99
100 if( isNIMtype )
101 return std::make_shared<L1Threshold_NIM>( name, type, extraInfo, data );
102
103 if( type == "internal" )
104 return std::make_shared<L1Threshold_internal>( name, type, extraInfo, data );
105
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);
108
109 if( useBaseClass )
110 return std::make_shared<L1Threshold>( name, type, extraInfo, data );
111
112 throw std::runtime_error("Threshold " + name + " is not of a valid L1 threshold type: " + type);
113
114}

◆ data()

const ptree & TrigConf::DataStructure::data ( ) const
inlineinherited

Access to the underlying data, if needed.

Definition at line 83 of file DataStructure.h.

83 {
84 if( ! isInitialized() ) {
85 throw std::runtime_error("Trying to access data of uninitialized object of type " + className());
86 }
87 // Don't use ?: operator here: it confuses cppcheck.
88 if (ownsData()) {
89 return *m_dataSPtr.get();
90 }
91 return *m_dataPtr;
92 }
virtual std::string className() const
A string that is the name of the class.

◆ empty()

bool TrigConf::DataStructure::empty ( ) const
inlineinherited

Check if children exist.

Definition at line 219 of file DataStructure.h.

219{ return data().empty(); }

◆ getAttribute() [1/2]

const std::string & TrigConf::DataStructure::getAttribute ( const std::string & key,
bool ignoreIfMissing = false,
const std::string & def = "" ) const
inherited

Definition at line 135 of file DataStructure.cxx.

136{
137 const auto & obj = data().get_child_optional(key);
138 if( !obj ) {
139 if( ignoreIfMissing ) {
140 return def;
141 } else {
142 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' does not exist" );
143 }
144 }
145 // check if the key points to a plain string value
146 if ( !obj.get().empty() ) {
147 if ( obj.get().front().first.empty() ) {
148 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' is not a simple attribute but a list [], it needs to be accessed via getList(\"" + key + "\") -> vector<DataStructure>");
149 } else {
150 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' is not a simple attribute but an object {}, it needs to be accessed via getObject(\"" + key + "\") -> DataStructure");
151 }
152 }
153 return obj.get().data();
154}

◆ getAttribute() [2/2]

template<class T>
T TrigConf::DataStructure::getAttribute ( const std::string & key,
bool ignoreIfMissing = false,
const T & def = T() ) const
inlineinherited

Access to simple attribute.

Parameters
keyThe path to the attribute name, relative to the current one in form "path.to.child"
ignoreIfMissingControls the behavior in case of missing configuration child

Definition at line 152 of file DataStructure.h.

152 {
153 const auto & obj = data().get_child_optional(key);
154 if( !obj ) {
155 if( ignoreIfMissing ) {
156 return def;
157 } else {
158 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' does not exist" );
159 }
160 }
161 return obj.get().get_value<T>();
162 }
unsigned long long T

◆ getAttribute_optional()

template<class T>
std::optional< T > TrigConf::DataStructure::getAttribute_optional ( const std::string & key) const
inlineinherited

Definition at line 165 of file DataStructure.h.

165 {
166 const auto & obj = data().get_child_optional(key);
167 if( ! obj ) {
168 return std::nullopt;
169 }
170 auto v = obj.get().get_value_optional<T>();
171 return v ? std::optional(std::move(*v)) : std::nullopt;
172 }

◆ getKeys()

std::vector< std::string > TrigConf::DataStructure::getKeys ( ) const
inherited

Access to the keys of an DataStructure which presents a dictionary.

In case the DataStructure is a list or a simple attribute, an empty vector is returned

Definition at line 249 of file DataStructure.cxx.

250{
251 std::vector<std::string> keys;
252 if ( ! data().empty() &&
253 ! data().front().first.empty() )
254 {
255 keys.reserve(data().size());
256 for( auto & entry : data() ) {
257 keys.push_back(entry.first);
258 }
259 }
260 return keys;
261}
bool empty() const
Check if children exist.
bool first
Definition DeMoScan.py:534

◆ getList()

std::vector< TrigConf::DataStructure > TrigConf::DataStructure::getList ( const std::string & pathToChild,
bool ignoreIfMissing = false ) const
inherited

Access to array structure.

Parameters
pathToChildThe path to the configuration child, relative to the current one in form "path.to.child"
ignoreIfMissingControls the behavior in case of missing configuration child

In case the child is missing and ignoreIfMissing is set to true, and empty vector will be returned. Otherwise a runtime exception will be thrown.

Definition at line 157 of file DataStructure.cxx.

158{
159 std::vector<TrigConf::DataStructure> childList;
160 const auto & list = data().get_child_optional(pathToChild);
161 if( ! list ) {
162 if ( ignoreIfMissing ) {
163 return childList;
164 } else {
165 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' does not exist.");
166 }
167 }
168
169 // check if the pathToChild points to a list
170
171 // this check is not complete, because boost::ptree can not
172 // distinguish between and empty list and an empty string. In both cases
173 // the value is empty and there are no children
174
175 if ( list.get().empty() ) {
176 if ( list.get().get_value<std::string>() != "" ) {
177 // if the value is not empty, then it is for sure an attribute ("key" : "value")
178 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not a list [] but a simple attribute, it needs to be accessed via [\"" + pathToChild + "\"] -> string");
179 }
180 // else: if the value is empty, we can not say for sure and will not
181 // give this debugging hint (an empty list will be returned
182 } else if ( ! list.get().front().first.empty() ) {
183 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not a list [] but an object {}, it needs to be accessed via getObject(\"" + pathToChild + "\") -> DataStructure");
184 }
185
186 childList.reserve(list.get().size());
187
188 for( auto & childData : list.get() )
189 childList.emplace_back( childData.second );
190
191 return childList;
192}
list(name, path='/')
Definition histSizes.py:38

◆ getList_optional()

std::optional< std::vector< TrigConf::DataStructure > > TrigConf::DataStructure::getList_optional ( const std::string & pathToChild) const
inherited

Definition at line 196 of file DataStructure.cxx.

197{
198 if(data().find(pathToChild) == data().not_found()) {
199 return std::nullopt;
200 }
201 return std::optional<std::vector<TrigConf::DataStructure> >(getList(pathToChild));
202}
std::vector< DataStructure > getList(const std::string &pathToChild, bool ignoreIfMissing=false) const
Access to array structure.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ getObject()

TrigConf::DataStructure TrigConf::DataStructure::getObject ( const std::string & pathToChild,
bool ignoreIfMissing = false ) const
inherited

Access to configuration object.

Parameters
pathToChildThe path to the configuration child, relative to the current one
ignoreIfMissingControls the behavior in case of missing configuration child

In case the child is missing and ignoreIfMissing is set to true, an uninitialized DataStructure will be returned. Otherwise a runtime exception will be thrown.

*bool ignoreIfMissing = true;
*if( const DataStructure & child = ds.getObject("path.to.child", ignoreIfMissing) ) {
cout << child["key"] << endl;
}
Base class for Trigger configuration data and wrapper around underlying representation.

Definition at line 206 of file DataStructure.cxx.

207{
208 const auto & obj = data().get_child_optional(pathToChild);
209 if( ! obj ) {
210 if ( ignoreIfMissing ) {
211 return DataStructure();
212 } else {
213 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' does not exist.");
214 }
215 }
216 // check if the pathToChild is an attribute
217 if( obj.get().get_value<std::string>() != "" ) {
218 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not an object {} but a simple attribute, it needs to be accessed via [\"" + pathToChild + "\"] -> string");
219 }
220 // check if the pathToChild points to a list
221 if ( obj.get().front().first.empty() ) {
222 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not an object {} but a list [], it needs to be accessed via getList(\"" + pathToChild + "\") -> vector<DataStructure>");
223 }
224 return { obj.get() };
225}
DataStructure()
Default constructor, leading to an uninitialized configuration object.

◆ getObject_optional()

std::optional< TrigConf::DataStructure > TrigConf::DataStructure::getObject_optional ( const std::string & pathToChild) const
inherited

Definition at line 229 of file DataStructure.cxx.

230{
231
232 if(const auto & obj = data().get_child_optional(pathToChild)) {
233 // check if the pathToChild is an attribute
234 if( obj.get().get_value<std::string>() != "" ) {
235 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not an object {} but a simple attribute, it needs to be accessed via [\"" + pathToChild + "\"] -> string");
236 }
237 // check if the pathToChild points to a list
238 if ( obj.get().front().first.empty() ) {
239 throw std::runtime_error(className() + "#" + name() + ": structure '" + pathToChild + "' is not an object {} but a list [], it needs to be accessed via getList(\"" + pathToChild + "\") -> vector<DataStructure>");
240 }
241 return std::optional<TrigConf::DataStructure>(obj.get());
242 }
243 return std::nullopt;
244}

◆ getValue() [1/2]

std::string TrigConf::DataStructure::getValue ( ) const
inherited

Access to simple content.

Returns
string that is the content of the structure

For instance when the json structure contains an array of values (ptree only works with strings) which one retrieved via getList, then the values in the vector<DataStructure> can be accessed using getValue

Definition at line 80 of file DataStructure.cxx.

80 {
81 return data().get_value<std::string>();
82}

◆ getValue() [2/2]

template<class T>
T TrigConf::DataStructure::getValue ( ) const
inlineinherited

Definition at line 108 of file DataStructure.h.

108 {
109 return data().get_value<T>();
110 }

◆ getValue_optional()

template<class T>
std::optional< T > TrigConf::DataStructure::getValue_optional ( ) const
inlineinherited

access to content of the note Will return false if the value could not be converted into T

Definition at line 116 of file DataStructure.h.

116 {
117 auto v = data().get_value_optional<T>();
118 return v ? std::optional<T>(std::move(*v)) : std::nullopt;
119 }

◆ hasAttribute()

bool TrigConf::DataStructure::hasAttribute ( const std::string & key) const
inherited

Check for attribute.

Parameters
keyThe path to the attribute name, relative to the current one in form "path.to.child"
Returns
true if path key exists and is an attribute

Definition at line 85 of file DataStructure.cxx.

85 {
86 const auto & child = data().get_child_optional( key );
87 if( ! bool(child) ) // key does not exist
88 return false;
89 return child.get().empty(); // if empty then it is an attribute, otherwise a child note
90}

◆ hasChild()

bool TrigConf::DataStructure::hasChild ( const std::string & path) const
inherited

Check if child exists.

Parameters
pathThe path to the child, relative to the current one in form "path.to.child"
Returns
true if path exists

Definition at line 113 of file DataStructure.cxx.

113 {
114 const auto & child = data().get_child_optional( path );
115 return bool(child);
116}
setBGCode setTAP setLVL2ErrorBits bool

◆ isInitialized()

bool TrigConf::DataStructure::isInitialized ( ) const
inlineinherited

Definition at line 216 of file DataStructure.h.

216{ return m_initialized; }

◆ isNull()

bool TrigConf::DataStructure::isNull ( const std::string & key) const
inherited

Check if an attribute is null.

Parameters
keyThe path to the attribute name, relative to the current one in form "path.to.child"
Returns
true if path key exists and is null

If the attribute doesn't exist, the function returns false. To check if an attribute exists and is null, use it together with hasAttribute.

Definition at line 93 of file DataStructure.cxx.

93 {
94 auto child = data().get_child_optional( key );
95 if( ! child ) {
96 return false;
97 }
98 return child->get_value<std::string>() == "null";
99}

◆ isValid()

bool TrigConf::DataStructure::isValid ( ) const
inlineinherited

Definition at line 215 of file DataStructure.h.

215{ return m_initialized; }

◆ isValue()

bool TrigConf::DataStructure::isValue ( ) const
inherited

Check for attribute.

Returns
true if the structure is just a value

Definition at line 74 of file DataStructure.cxx.

74 {
75 return data().empty(); // just a key->value pair, no children
76}

◆ load()

void TrigConf::L1Threshold_Calo::load ( )
private

Definition at line 241 of file L1ThresholdBase.cxx.

242{
243 if( type() == "internal" ) {
244 return;
245 }
246 m_thrValue = gev2MeVThrVal( getAttribute<double>("value", true, 0) );
247 m_input = getAttribute("input", true, "");
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>();
254 m_etaDepThrValue.addRangeValue(value, etamin, etamax, priority, /*symmetric=*/ false);
255 }
256 }
257 if( const auto & ranges = data().get_child_optional("ranges") ) {
258 m_etaDepThrValue.setOutsideRangeValue(getAttribute("maxValue", true, std::numeric_limits<unsigned int>::max()));
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>();
262 m_etaDepThrValue.addRangeValue(m_thrValue, etamin, etamax, /*priority=*/ 1, /*symmetric=*/ false);
263 }
264 }
265}
#define x
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
unsigned int m_thrValue
threshold value in MeV

◆ mapping()

unsigned int TrigConf::L1Threshold::mapping ( ) const
inlineinherited

Accessor to the mapping number The mapping is unique within a type.

Definition at line 163 of file L1ThresholdBase.h.

164 { return m_mapping; }
unsigned int m_mapping
unique identifier amongst thresholds of the same type

◆ name()

const std::string & TrigConf::DataStructure::name ( ) const
finalvirtualinherited

Definition at line 108 of file DataStructure.cxx.

108 {
109 return m_name;
110}

◆ operator bool()

TrigConf::DataStructure::operator bool ( ) const
inlineexplicitinherited

Access to initialized state.

Definition at line 214 of file DataStructure.h.

214{ return m_initialized; }

◆ operator[]()

std::string TrigConf::DataStructure::operator[] ( const std::string & key) const
inherited

Access to simple attribute.

Parameters
keyThe path to the attribute name, relative to the current one in form "path.to.child"

Definition at line 120 of file DataStructure.cxx.

121{
122 const auto & obj = data().get_child(key);
123 // check if the key points to a plain string value
124 if ( !obj.empty() ) {
125 if ( obj.front().first.empty() ) {
126 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' is not a simple attribute but a list [], it needs to be accessed via getList(\"" + key + "\") -> vector<DataStructure>");
127 } else {
128 throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' is not a simple attribute but an object {}, it needs to be accessed via getObject(\"" + key + "\") -> DataStructure");
129 }
130 }
131 return obj.data();
132}

◆ ownsData()

bool TrigConf::DataStructure::ownsData ( ) const
inlineinherited

Definition at line 242 of file DataStructure.h.

242 {
243 return (bool)m_dataSPtr;
244 }

◆ print()

void TrigConf::DataStructure::print ( std::ostream & os = std::cout) const
virtualinherited

Reimplemented in TrigConf::L1Threshold_EM, and TrigConf::L1TopoAlgorithm.

Definition at line 271 of file DataStructure.cxx.

272{
273 printElement("", data(), 0, os);
274 os << std::endl;
275}
static void printElement(const std::string &key, const ptree &data, uint level=0, std::ostream &os=std::cout)
Static function to print a ptree object.

◆ printElement()

void TrigConf::DataStructure::printElement ( const std::string & key,
const ptree & data,
uint level = 0,
std::ostream & os = std::cout )
staticinherited

Static function to print a ptree object.

Parameters
keyThe key of this data as found in the parent structure
dataThe ptree to print
levelThe substruture level used to indent the output
osThe output stream

Definition at line 278 of file DataStructure.cxx.

279{
280 constexpr char del = '"';
281
282 const std::string value = data.get_value<std::string>();
283
284 if( data.empty() ) { // no children, so just a key->value pair
285 uint n(4*level); while(n--) os << " ";
286 os << del << key << del << ": " << del << value << del;
287 return;
288 }
289
290
291 bool isArray ( data.begin()->first.empty() ); // dictionaries have keys, arrays don't
292 { uint n(4*level); while(n--) os << " "; }
293 if ( ! key.empty() )
294 os << del << key << del << ": ";
295 os << (isArray ? "[" : "{") << std::endl;
296
297 size_t childCounter = data.size();
298 for( const boost::property_tree::ptree::value_type & x : data ) {
299 printElement(x.first, x.second, level + 1, os);
300 if( --childCounter ) os << ",";
301 os << std::endl;
302 }
303 { uint n(4*level); while(n--) os << " "; }
304 os << (isArray ? "]" : "}");
305
306}
unsigned int uint

◆ printRaw()

void TrigConf::DataStructure::printRaw ( std::ostream & os = std::cout) const
inherited

Definition at line 264 of file DataStructure.cxx.

265{
266 boost::property_tree::json_parser::write_json( os, data() );
267}

◆ setData() [1/2]

void TrigConf::DataStructure::setData ( const ptree & data)
inherited

Setting the configuration data.

Definition at line 39 of file DataStructure.cxx.

40{
41 clear();
42 m_initialized = true;
43 m_dataSPtr.reset();
44 m_dataPtr = &data;
45 update();
46}
virtual void clear()
Clearing the configuration data.
virtual void update()
Update the internal data after modification of the data object.

◆ setData() [2/2]

void TrigConf::DataStructure::setData ( ptree && data)
inherited

Definition at line 50 of file DataStructure.cxx.

51{
52 clear();
53 m_initialized = true;
54 m_dataSPtr = std::make_shared<ptree>(std::move(data));
55 m_dataPtr = nullptr;
56 update();
57}

◆ setName()

void TrigConf::DataStructure::setName ( const std::string & n)
inherited

Setting the configuration element name.

Definition at line 59 of file DataStructure.cxx.

59 {
60 m_name = n;
61}

◆ thrValue()

float TrigConf::L1Threshold_Calo::thrValue ( int eta = 0) const
overridevirtual

Accessor to the threshold value for eta-dependent threholds.

Parameters
etathe eta value should be given for potentially eta-dependent thresholds must be overwritten by L1Threshold_Calo and L1Threnshold_MU

Reimplemented from TrigConf::L1Threshold.

Definition at line 272 of file L1ThresholdBase.cxx.

273{
274 return thrValueMeV(eta) / 1000.0f;
275}
Scalar eta() const
pseudorapidity method
virtual unsigned int thrValueMeV(int eta=0) const

◆ thrValue100MeV()

unsigned int TrigConf::L1Threshold_Calo::thrValue100MeV ( int eta = 0) const
virtual

as above above but in 100 MeV

Definition at line 284 of file L1ThresholdBase.cxx.

284 {
285 return energyInCounts( thrValueMeV(eta), 100 );
286}
unsigned int energyInCounts(unsigned int energyMeV, unsigned int energyResolutionMeV)
helper funtion to translate energies into counts

◆ thrValueCounts()

unsigned int TrigConf::L1Threshold_Calo::thrValueCounts ( int eta = 0) const
virtual

Definition at line 278 of file L1ThresholdBase.cxx.

278 {
279 auto extraInfo = m_extraInfo.lock();
280 return energyInCounts( thrValueMeV(eta), extraInfo->resolutionMeV() );
281}
std::weak_ptr< L1ThrExtraInfoBase > m_extraInfo

◆ thrValueMeV()

unsigned int TrigConf::L1Threshold_Calo::thrValueMeV ( int eta = 0) const
virtual

Definition at line 289 of file L1ThresholdBase.cxx.

289 {
290 return m_etaDepThrValue.empty() ? m_thrValue : m_etaDepThrValue.at(eta);
291}

◆ thrValues()

TrigConf::ValueWithEtaDependence< float > TrigConf::L1Threshold_Calo::thrValues ( ) const
virtual

access to the list of ThresholdValues in GeV

Definition at line 294 of file L1ThresholdBase.cxx.

294 {
295 auto thresholdValuesGeV = ValueWithEtaDependence<float>{ m_etaDepThrValue.name()+"GeV" };
296 for( auto & r : m_etaDepThrValue ) {
297 thresholdValuesGeV.addRangeValue(r.value() / 1000.0f, r.etaMin(), r.etaMax(), r.priority(), r.symmetric());
298 }
299 return thresholdValuesGeV;
300}
int r
Definition globals.cxx:22

◆ thrValues100MeV()

TrigConf::ValueWithEtaDependence< unsigned int > TrigConf::L1Threshold_Calo::thrValues100MeV ( ) const
virtual

access to the list of ThresholdValues in 100 MeV (for L1Topo multiplicity)

Definition at line 308 of file L1ThresholdBase.cxx.

308 {
309 auto thrValues100MeV = ValueWithEtaDependence<unsigned int>{ m_etaDepThrValue.name()+"100MeV" };
310 for( auto & r : m_etaDepThrValue ) {
311 thrValues100MeV.addRangeValue( energyInCounts( r.value(), 100 ), r.etaMin(), r.etaMax(), r.priority(), r.symmetric());
312 }
313 return thrValues100MeV;
314}
virtual ValueWithEtaDependence< unsigned int > thrValues100MeV() const
access to the list of ThresholdValues in 100 MeV (for L1Topo multiplicity)

◆ thrValuesCounts()

TrigConf::ValueWithEtaDependence< unsigned int > TrigConf::L1Threshold_Calo::thrValuesCounts ( ) const
virtual

access to the list of ThresholdValues in energy units

Definition at line 317 of file L1ThresholdBase.cxx.

317 {
318 auto extraInfo = m_extraInfo.lock();
319 auto thrValuesCounts = ValueWithEtaDependence<unsigned int>{ m_etaDepThrValue.name()+"Counts" };
320 for( auto & r : m_etaDepThrValue ) {
321 thrValuesCounts.addRangeValue( energyInCounts( r.value(), extraInfo->resolutionMeV() ), r.etaMin(), r.etaMax(), r.priority(), r.symmetric());
322 }
323 return thrValuesCounts;
324}
virtual ValueWithEtaDependence< unsigned int > thrValuesCounts() const
access to the list of ThresholdValues in energy units

◆ thrValuesMeV()

const TrigConf::ValueWithEtaDependence< unsigned int > & TrigConf::L1Threshold_Calo::thrValuesMeV ( ) const
virtual

access to the list of ThresholdValues in MeV

Definition at line 303 of file L1ThresholdBase.cxx.

303 {
304 return m_etaDepThrValue;
305}

◆ type()

const std::string & TrigConf::L1Threshold::type ( ) const
inlineinherited

Accessor to the threshold type.

Definition at line 157 of file L1ThresholdBase.h.

158 { return m_type; }
std::string m_type
threshold type

◆ update()

void TrigConf::L1Threshold_Calo::update ( )
overrideprotectedvirtual

Member Data Documentation

◆ m_dataPtr

const ptree* TrigConf::DataStructure::m_dataPtr { nullptr }
protectedinherited

Definition at line 257 of file DataStructure.h.

257{ nullptr }; // used when not owning the tree

◆ m_dataSPtr

std::shared_ptr<ptree> TrigConf::DataStructure::m_dataSPtr { nullptr }
protectedinherited

Definition at line 256 of file DataStructure.h.

256{ nullptr }; // used when owning the tree

◆ m_etaDepThrValue

ValueWithEtaDependence<unsigned int> TrigConf::L1Threshold_Calo::m_etaDepThrValue {""}
protected

eta-dependent threshold value in MeV

Definition at line 255 of file L1ThresholdBase.h.

255{""};

◆ m_extraInfo

std::weak_ptr<L1ThrExtraInfoBase> TrigConf::L1Threshold::m_extraInfo
protectedinherited

Definition at line 177 of file L1ThresholdBase.h.

◆ m_initialized

bool TrigConf::DataStructure::m_initialized { false }
protectedinherited

if initialized, the underlying ptree is has been assigned to (can be empty)

Definition at line 254 of file DataStructure.h.

254{ false };

◆ m_input

std::string TrigConf::L1Threshold_Calo::m_input {""}
protected

Definition at line 246 of file L1ThresholdBase.h.

246{""};

◆ m_mapping

unsigned int TrigConf::L1Threshold::m_mapping {0}
privateinherited

unique identifier amongst thresholds of the same type

Definition at line 184 of file L1ThresholdBase.h.

184{0};

◆ m_name

std::string TrigConf::DataStructure::m_name {""}
protectedinherited

Definition at line 259 of file DataStructure.h.

259{""}; // most objects are named

◆ m_thrValue

unsigned int TrigConf::L1Threshold_Calo::m_thrValue {0}
protected

threshold value in MeV

Definition at line 253 of file L1ThresholdBase.h.

253{0};

◆ m_type

std::string TrigConf::L1Threshold::m_type {""}
privateinherited

threshold type

Definition at line 183 of file L1ThresholdBase.h.

183{""};

The documentation for this class was generated from the following files: