L1 extra information for certain threshold types.
More...
#include <L1ThresholdBase.h>
Inherits TrigConf::DataStructure.
Inherited by TrigConf::L1ThrExtraInfo_cTAU, TrigConf::L1ThrExtraInfo_eEM, TrigConf::L1ThrExtraInfo_EMTAULegacy, TrigConf::L1ThrExtraInfo_eTAU, TrigConf::L1ThrExtraInfo_gJ, TrigConf::L1ThrExtraInfo_gLJ, TrigConf::L1ThrExtraInfo_gTE, TrigConf::L1ThrExtraInfo_gXE, TrigConf::L1ThrExtraInfo_jEM, TrigConf::L1ThrExtraInfo_JETLegacy, TrigConf::L1ThrExtraInfo_jJ, TrigConf::L1ThrExtraInfo_jLJ, TrigConf::L1ThrExtraInfo_jTAU, TrigConf::L1ThrExtraInfo_jTE, TrigConf::L1ThrExtraInfo_jXE, TrigConf::L1ThrExtraInfo_MU, and TrigConf::L1ThrExtraInfo_XSLegacy.
|
| using | ptree = boost::property_tree::ptree |
| |
|
| virtual void | update () override |
| | Update the internal data after modification of the data object. More...
|
| |
L1 extra information for certain threshold types.
Definition at line 72 of file L1ThresholdBase.h.
◆ ptree
◆ L1ThrExtraInfoBase() [1/4]
| TrigConf::L1ThrExtraInfoBase::L1ThrExtraInfoBase |
( |
| ) |
|
|
delete |
◆ L1ThrExtraInfoBase() [2/4]
◆ L1ThrExtraInfoBase() [3/4]
◆ ~L1ThrExtraInfoBase()
| virtual TrigConf::L1ThrExtraInfoBase::~L1ThrExtraInfoBase |
( |
| ) |
|
|
overridevirtualdefault |
◆ L1ThrExtraInfoBase() [4/4]
| TrigConf::L1ThrExtraInfoBase::L1ThrExtraInfoBase |
( |
const std::string & |
thrTypeName, |
|
|
const ptree & |
data |
|
) |
| |
◆ className()
| virtual std::string TrigConf::L1ThrExtraInfoBase::className |
( |
| ) |
const |
|
inlineoverridevirtual |
A string that is the name of the class.
Reimplemented from TrigConf::DataStructure.
Reimplemented in TrigConf::L1ThrExtraInfo_MU, TrigConf::L1ThrExtraInfo_gTE, TrigConf::L1ThrExtraInfo_gXE, TrigConf::L1ThrExtraInfo_jTE, TrigConf::L1ThrExtraInfo_jXE, TrigConf::L1ThrExtraInfo_gLJ, TrigConf::L1ThrExtraInfo_gJ, TrigConf::L1ThrExtraInfo_jLJ, TrigConf::L1ThrExtraInfo_jJ, TrigConf::L1ThrExtraInfo_cTAU, TrigConf::L1ThrExtraInfo_jTAU, TrigConf::L1ThrExtraInfo_eTAU, TrigConf::L1ThrExtraInfo_jEM, TrigConf::L1ThrExtraInfo_eEM, TrigConf::L1ThrExtraInfo_XSLegacy, TrigConf::L1ThrExtraInfo_JETLegacy, and TrigConf::L1ThrExtraInfo_EMTAULegacy.
Definition at line 90 of file L1ThresholdBase.h.
91 return "L1ThrExtraInfoBase";
◆ clear()
| void TrigConf::DataStructure::clear |
( |
| ) |
|
|
virtualinherited |
◆ createExtraInfo()
◆ data()
| const ptree& TrigConf::DataStructure::data |
( |
| ) |
const |
|
inlineinherited |
Access to the underlying data, if needed.
Definition at line 83 of file DataStructure.h.
85 throw std::runtime_error(
"Trying to access data of uninitialized object of type " +
className());
◆ empty()
| bool TrigConf::DataStructure::empty |
( |
| ) |
const |
|
inlineinherited |
◆ 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.
137 const auto &
obj =
data().get_child_optional(
key);
139 if( ignoreIfMissing ) {
142 throw std::runtime_error(
className() +
"#" +
name() +
": structure '" +
key +
"' does not exist" );
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>");
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");
153 return obj.get().data();
◆ 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
-
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
| ignoreIfMissing | Controls the behavior in case of missing configuration child |
Definition at line 152 of file DataStructure.h.
153 const auto &
obj =
data().get_child_optional(
key);
155 if( ignoreIfMissing ) {
158 throw std::runtime_error(
className() +
"#" +
name() +
": structure '" +
key +
"' does not exist" );
161 return obj.get().get_value<
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.
166 const auto &
obj =
data().get_child_optional(
key);
170 auto v =
obj.get().get_value_optional<
T>();
171 return v ? std::optional(std::move(*
v)) : std::nullopt;
◆ getExtraInfo()
◆ getKeys()
| std::vector< std::string > TrigConf::DataStructure::getKeys |
( |
| ) |
const |
|
inherited |
◆ getList()
| std::vector< TrigConf::DataStructure > TrigConf::DataStructure::getList |
( |
const std::string & |
pathToChild, |
|
|
bool |
ignoreIfMissing = false |
|
) |
| const |
|
inherited |
Access to array structure.
- Parameters
-
| pathToChild | The path to the configuration child, relative to the current one in form "path.to.child" |
| ignoreIfMissing | Controls 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.
159 std::vector<TrigConf::DataStructure> childList;
160 const auto &
list =
data().get_child_optional(pathToChild);
162 if ( ignoreIfMissing ) {
165 throw std::runtime_error(
className() +
"#" +
name() +
": structure '" + pathToChild +
"' does not exist.");
175 if (
list.get().empty() ) {
176 if (
list.get().get_value<std::string>() !=
"" ) {
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");
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");
186 childList.reserve(
list.get().size());
188 for(
auto & childData :
list.get() )
189 childList.emplace_back( childData.second );
◆ getList_optional()
Definition at line 196 of file DataStructure.cxx.
201 return std::optional<std::vector<TrigConf::DataStructure> >(
getList(pathToChild));
◆ getObject()
Access to configuration object.
- Parameters
-
| pathToChild | The path to the configuration child, relative to the current one |
| ignoreIfMissing | Controls 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;
}
Definition at line 206 of file DataStructure.cxx.
208 const auto &
obj =
data().get_child_optional(pathToChild);
210 if ( ignoreIfMissing ) {
213 throw std::runtime_error(
className() +
"#" +
name() +
": structure '" + pathToChild +
"' does not exist.");
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");
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>");
224 return {
obj.get() };
◆ getObject_optional()
Definition at line 229 of file DataStructure.cxx.
232 if(
const auto &
obj =
data().get_child_optional(pathToChild)) {
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");
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>");
241 return std::optional<TrigConf::DataStructure>(
obj.get());
◆ 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.
81 return data().get_value<std::string>();
◆ getValue() [2/2]
template<class T >
| T TrigConf::DataStructure::getValue |
( |
| ) |
const |
|
inlineinherited |
◆ 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.
117 auto v =
data().get_value_optional<
T>();
118 return v ? std::optional<T>(std::move(*
v)) : std::nullopt;
◆ hasAttribute()
| bool TrigConf::DataStructure::hasAttribute |
( |
const std::string & |
key | ) |
const |
|
inherited |
Check for attribute.
- Parameters
-
| key | The 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.
86 const auto & child =
data().get_child_optional(
key );
89 return child.get().empty();
◆ hasChild()
| bool TrigConf::DataStructure::hasChild |
( |
const std::string & |
path | ) |
const |
|
inherited |
Check if child exists.
- Parameters
-
| path | The 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.
114 const auto & child =
data().get_child_optional(
path );
◆ hasExtraInfo()
| bool TrigConf::L1ThrExtraInfoBase::hasExtraInfo |
( |
const std::string & |
key = "" | ) |
const |
◆ isInitialized()
| bool TrigConf::DataStructure::isInitialized |
( |
| ) |
const |
|
inlineinherited |
◆ isNull()
| bool TrigConf::DataStructure::isNull |
( |
const std::string & |
key | ) |
const |
|
inherited |
Check if an attribute is null.
- Parameters
-
| key | The 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.
94 auto child =
data().get_child_optional(
key );
98 return child->get_value<std::string>() ==
"null";
◆ isValid()
| bool TrigConf::DataStructure::isValid |
( |
| ) |
const |
|
inlineinherited |
◆ 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.
75 return data().empty();
◆ load()
| void TrigConf::L1ThrExtraInfoBase::load |
( |
| ) |
|
|
private |
◆ name()
| const std::string & TrigConf::DataStructure::name |
( |
| ) |
const |
|
finalvirtualinherited |
◆ operator bool()
| TrigConf::DataStructure::operator bool |
( |
| ) |
const |
|
inlineexplicitinherited |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator[]()
| std::string TrigConf::DataStructure::operator[] |
( |
const std::string & |
key | ) |
const |
|
inherited |
Access to simple attribute.
- Parameters
-
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
Definition at line 120 of file DataStructure.cxx.
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>");
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");
◆ ownsData()
| bool TrigConf::DataStructure::ownsData |
( |
| ) |
const |
|
inlineinherited |
◆ print()
| void TrigConf::DataStructure::print |
( |
std::ostream & |
os = std::cout | ) |
const |
|
virtualinherited |
◆ 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
-
| key | The key of this data as found in the parent structure |
| data | The ptree to print |
| level | The substruture level used to indent the output |
| os | The output stream |
Definition at line 278 of file DataStructure.cxx.
280 constexpr
char del =
'"';
282 const std::string
value =
data.get_value<std::string>();
286 os << del <<
key << del <<
": " << del <<
value << del;
291 bool isArray (
data.begin()->first.empty() );
294 os << del <<
key << del <<
": ";
295 os << (isArray ?
"[" :
"{") << std::endl;
297 size_t childCounter =
data.size();
298 for(
const boost::property_tree::ptree::value_type &
x :
data ) {
300 if( --childCounter )
os <<
",";
304 os << (isArray ?
"]" :
"}");
◆ printRaw()
| void TrigConf::DataStructure::printRaw |
( |
std::ostream & |
os = std::cout | ) |
const |
|
inherited |
◆ resolutionMeV()
| unsigned int TrigConf::L1ThrExtraInfoBase::resolutionMeV |
( |
| ) |
const |
|
inline |
◆ setData() [1/2]
| void TrigConf::DataStructure::setData |
( |
const ptree & |
data | ) |
|
|
inherited |
◆ setData() [2/2]
| void TrigConf::DataStructure::setData |
( |
ptree && |
data | ) |
|
|
inherited |
◆ setName()
| void TrigConf::DataStructure::setName |
( |
const std::string & |
n | ) |
|
|
inherited |
◆ thresholdTypeName()
| const std::string & TrigConf::L1ThrExtraInfoBase::thresholdTypeName |
( |
| ) |
const |
◆ update()
| virtual void TrigConf::L1ThrExtraInfoBase::update |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
◆ m_dataPtr
| const ptree* TrigConf::DataStructure::m_dataPtr { nullptr } |
|
protectedinherited |
◆ m_dataSPtr
| std::shared_ptr<ptree> TrigConf::DataStructure::m_dataSPtr { nullptr } |
|
protectedinherited |
◆ m_extraInfo
| std::map<std::string, DataStructure> TrigConf::L1ThrExtraInfoBase::m_extraInfo {} |
|
protected |
◆ 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.
◆ m_name
| std::string TrigConf::DataStructure::m_name {""} |
|
protectedinherited |
◆ m_resolutionMeV
| unsigned int TrigConf::L1ThrExtraInfoBase::m_resolutionMeV { 1000 } |
|
private |
The documentation for this class was generated from the following files: