Loader of trigger configurations from Json files.
More...
#include <JsonFileLoader.h>
|
| std::string | findFile (const std::string &filename) const |
Loader of trigger configurations from Json files.
Definition at line 25 of file JsonFileLoader.h.
◆ JsonFileLoader()
| TrigConf::JsonFileLoader::JsonFileLoader |
( |
| ) |
|
◆ ~JsonFileLoader()
| virtual TrigConf::JsonFileLoader::~JsonFileLoader |
( |
| ) |
|
|
overridevirtualdefault |
◆ checkTriggerLevel()
| bool TrigConf::JsonFileLoader::checkTriggerLevel |
( |
const std::string & | filename, |
|
|
std::string & | level ) const |
Checks the trigger level of a given json file.
- Parameters
-
| filename | [in] Name of the json file |
| level | [out] either "L1", "HLT" or "UNKNOWN" |
Definition at line 128 of file JsonFileLoader.cxx.
130{
132
134
136
137 if ( succeeded ) {
138 if (
data.hasChild(
"chains")) {
140 }
else if (
data.hasChild(
"items")) {
142 }
143 }
144
145 return succeeded;
146}
char data[hepevt_bytes_allocation_ATLAS]
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
◆ findFile()
| std::string TrigConf::JsonFileLoader::findFile |
( |
const std::string & | filename | ) |
const |
|
private |
Definition at line 28 of file JsonFileLoader.cxx.
28 {
29
30
31 if( std::filesystem::exists( filename ) ) {
33 }
34
35
36 if (!
filename.empty() && filename[0] ==
'/') {
37 TRG_MSG_WARNING(
"Can not find file with absolute location " << filename);
38 return {};
39 }
40
41 return {};
42}
#define TRG_MSG_WARNING(x)
◆ getFileType()
| std::string TrigConf::JsonFileLoader::getFileType |
( |
const std::string & | filename | ) |
const |
Checks the trigger level of a given json file.
- Parameters
-
| filename | [in] Name of the json file |
Definition at line 114 of file JsonFileLoader.cxx.
115{
116 std::string
ft =
"UNKNOWN";
117
120 ft =
data.getAttribute(
"filetype",
true, ft);
121 }
122
124}
◆ getName()
| const std::string & TrigConf::TrigConfMessaging::getName |
( |
| ) |
const |
|
inlineinherited |
◆ loadFile() [1/2]
| bool TrigConf::JsonFileLoader::loadFile |
( |
const std::string & | filename, |
|
|
boost::property_tree::ptree & | data, |
|
|
const std::string & | pathToChild = "" ) const |
Load content of json file into a ptree.
- Parameters
-
| filename | [in] Name of the json file |
| data | [out] |
| pathToChild | [in] Path to a sub structure for partial loading of data |
If the optional parameter pathToChild is specified, one can load parts if the configuration from the file.
const std::string l1_filename = "TriggerMenuXML/LVL1config_Physics_pp_v7.json";
fileLoader.
loadFile( l1_filename, metSignificance,
"CaloInfo.METSignificance");
Base class for Trigger configuration data and wrapper around underlying representation.
Loader of trigger configurations from Json files.
Definition at line 45 of file JsonFileLoader.cxx.
48{
49
52 return false;
53 }
55
56
57 try {
58 boost::property_tree::read_json(
file,
data);
59 }
60 catch (const boost::property_tree::json_parser_error& e) {
62 return false;
63 }
64
65 if( ! pathToChild.empty() ) {
66
67
68 boost::optional<ptree&> subtree =
data.get_child_optional(pathToChild);
69 if(subtree) {
71 } else {
74 }
75 }
76
77 return true;
78}
std::string findFile(const std::string &filename) const
◆ loadFile() [2/2]
| bool TrigConf::JsonFileLoader::loadFile |
( |
const std::string & | filename, |
|
|
DataStructure & | data, |
|
|
const std::string & | pathToChild = "" ) const |
Load content of json file into a ptree.
- Parameters
-
| filename | [in] Name of the json file |
| data | [out] |
| pathToChild | [in] Path to a sub structure for partial loading of data |
Definition at line 82 of file JsonFileLoader.cxx.
85{
86 boost::property_tree::ptree
pt;
87
88 if( !
loadFile( filename, pt, pathToChild) )
89 return false;
90
91 data.setData(std::move(pt));
92
93 return true;
94}
◆ msg() [1/2]
| MsgStreamTC & TrigConf::TrigConfMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 86 of file TrigConfMessaging.h.
87 {
89 if (!ms) {
92 }
94 }
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
◆ msg() [2/2]
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 96 of file TrigConfMessaging.h.
97 {
99 }
MsgStreamTC & msg() const
The standard message stream.
◆ msgLvl()
| bool TrigConf::TrigConfMessaging::msgLvl |
( |
const MSGTC::Level | lvl | ) |
const |
|
inlineinherited |
Test the output level.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
- Return values
-
| true | Messages at level "lvl" will be printed |
Definition at line 75 of file TrigConfMessaging.h.
76 {
79 return true;
80 }
81 else {
82 return false;
83 }
84 }
◆ outputLevel()
| MSGTC::Level TrigConf::JsonFileLoader::outputLevel |
( |
| ) |
const |
|
inline |
Definition at line 88 of file JsonFileLoader.h.
MSGTC::Level level()
Return message level of stream.
◆ saveFile()
| bool TrigConf::JsonFileLoader::saveFile |
( |
const std::string & | filename, |
|
|
const DataStructure & | data ) const |
Save content of DataStructure (underlying ptree) to a file.
- Parameters
-
| filename | [in] Name of the json file |
| data | [in] |
Definition at line 99 of file JsonFileLoader.cxx.
101{
102 if ( filename == "" ) {
103 TRG_MSG_ERROR(
"Could not save to file, as specified filename is empty");
104 return false;
105 }
106 boost::property_tree::write_json(filename,
data.data());
108
109 return true;
110}
◆ setLevel()
Definition at line 86 of file JsonFileLoader.h.
void setLevel(MSGTC::Level lvl)
Set message level of stream.
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls |
|
mutableprivateinherited |
◆ m_name
| std::string TrigConf::TrigConfMessaging::m_name |
|
privateinherited |
The documentation for this class was generated from the following files: