MonitoringObject is a basic object to hold data for the run-dependency monitoring Run summary TCanvases and monitoring variables.
More...
#include <MonitoringObject.h>
|
| MonitoringObject () |
| Constructor.
|
|
| MonitoringObject (const std::string &name) |
| Constructor with name (always use this)
|
|
void | addCanvas (TCanvas *canv) |
| Add Canvas to monitoring object.
|
|
const std::map< std::string, float > & | getVariables () |
| Get map of all float variables.
|
|
const std::map< std::string, float > & | getUpError () |
| Get map of all float variables upper errors.
|
|
const std::map< std::string, float > & | getLowError () |
| Get map of all float variables lower errors.
|
|
const std::vector< std::pair< std::string, std::string > > & | getStringVariables () |
| Get vector of all string variables.
|
|
TCanvas * | getCanvas (const std::string &name) |
| Get pointer to existing canvas with given name (NULL is returned if not existing)
|
|
const std::vector< TCanvas * > & | getListOfCanvases () |
| Get list of all canvases.
|
|
void | print () const |
| Print content of MonitoringObject.
|
|
void | setVariable (const std::string &var, float val, float upErr=-1., float dwErr=-1) |
| set value to float variable (new variable is made if not yet existing)
|
|
void | setVariable (const std::string &var, const std::string &val) |
| set value to string variable (new variable is made if not yet existing)
|
|
|
std::vector< TCanvas * > | m_Canvases |
| vector of all TCanvases
|
|
std::map< std::string, float > | m_vars |
| map of all float variables
|
|
std::map< std::string, float > | m_upErr |
| map of upper errors of variables
|
|
std::map< std::string, float > | m_dwErr |
| map of lower errors of variables
|
|
std::vector< std::pair< std::string, std::string > > | m_strVars |
| map of all string variables
|
|
MonitoringObject is a basic object to hold data for the run-dependency monitoring Run summary TCanvases and monitoring variables.
Definition at line 30 of file MonitoringObject.h.
◆ MonitoringObject() [1/2]
◆ MonitoringObject() [2/2]
Constructor with name (always use this)
Definition at line 38 of file MonitoringObject.h.
39 {
40 fName = name;
41 }
◆ addCanvas()
void addCanvas |
( |
TCanvas * |
canv | ) |
|
|
inline |
Add Canvas to monitoring object.
- Parameters
-
canv | pointer to canvas to add |
Definition at line 47 of file MonitoringObject.h.
48 {
50 if (cc->GetName() == canv->GetName()) {
51 B2ERROR("Canvas with name " << canv->GetName() << " already in the " << fName <<
52 " MonitoringObject! Use different name (or call getCanvas(name) to access pointer to the existing TCanvas).");
53 return;
54 }
55 }
57 };
std::vector< TCanvas * > m_Canvases
vector of all TCanvases
◆ getCanvas()
TCanvas * getCanvas |
( |
const std::string & |
name | ) |
|
|
inline |
Get pointer to existing canvas with given name (NULL is returned if not existing)
Definition at line 94 of file MonitoringObject.h.
95 {
97 if (cc->GetName() == name) return cc;
98 }
99 B2WARNING("TCanvas with name " << name << " not found in MonitoringObject " << fName);
100 return NULL;
101 };
◆ getListOfCanvases()
const std::vector< TCanvas * > & getListOfCanvases |
( |
| ) |
|
|
inline |
◆ getLowError()
const std::map< std::string, float > & getLowError |
( |
| ) |
|
|
inline |
Get map of all float variables lower errors.
Definition at line 78 of file MonitoringObject.h.
79 {
81 }
std::map< std::string, float > m_dwErr
map of lower errors of variables
◆ getStringVariables()
const std::vector< std::pair< std::string, std::string > > & getStringVariables |
( |
| ) |
|
|
inline |
Get vector of all string variables.
Definition at line 86 of file MonitoringObject.h.
87 {
89 }
std::vector< std::pair< std::string, std::string > > m_strVars
map of all string variables
◆ getUpError()
const std::map< std::string, float > & getUpError |
( |
| ) |
|
|
inline |
Get map of all float variables upper errors.
Definition at line 70 of file MonitoringObject.h.
71 {
73 }
std::map< std::string, float > m_upErr
map of upper errors of variables
◆ getVariables()
const std::map< std::string, float > & getVariables |
( |
| ) |
|
|
inline |
Get map of all float variables.
Definition at line 62 of file MonitoringObject.h.
63 {
65 }
std::map< std::string, float > m_vars
map of all float variables
◆ print()
Print content of MonitoringObject.
Definition at line 18 of file MonitoringObject.cc.
19{
20
22 printVar.put("Name", GetName());
23 for (
const auto& var :
m_vars) {
24 printVar.put(var.first, var.second);
25 }
27 printVar.put(var.first, var.second);
28 }
29
32 printCanv.put(canv->GetName(), canv->GetTitle());
33 }
34
35 std::cout << "=== MonitoringObject ===\n";
36 std::cout << printVar.string();
37 std::cout << "\n List of canvases: \n";
38 std::cout << printCanv.string();
39 std::cout << "========================\n";
40}
create human-readable or JSON output for key value pairs.
◆ setVariable() [1/2]
void setVariable |
( |
const std::string & |
var, |
|
|
const std::string & |
val |
|
) |
| |
|
inline |
set value to string variable (new variable is made if not yet existing)
- Parameters
-
var | variable name |
val | variable value |
Definition at line 149 of file MonitoringObject.h.
150 {
151
153 if (pair.first == var) {
154 pair.second = val;
155 return;
156 }
157 }
158 m_strVars.push_back(std::pair<std::string, std::string>(var, val));
159 }
◆ setVariable() [2/2]
void setVariable |
( |
const std::string & |
var, |
|
|
float |
val, |
|
|
float |
upErr = -1. , |
|
|
float |
dwErr = -1 |
|
) |
| |
|
inline |
set value to float variable (new variable is made if not yet existing)
- Parameters
-
var | variable name |
val | variable value |
upErr | variable size of positive error |
dwErr | variable size of negative error (if not set, symmetric error with size upErr is used) |
Definition at line 123 of file MonitoringObject.h.
124 {
125
126 auto vv =
m_vars.find(var);
127 if (vv !=
m_vars.end()) vv->second = val;
128 else m_vars.insert({var, val});
129
130 if (upErr > 0) {
132 if (vvE !=
m_upErr.end()) vvE->second = upErr;
133 else m_upErr.insert({var, upErr});
134 }
135
136 if (dwErr > 0) {
138 if (vvE !=
m_dwErr.end()) vvE->second = dwErr;
139 else m_dwErr.insert({var, dwErr});
140 }
141
142 }
◆ m_Canvases
std::vector<TCanvas*> m_Canvases |
|
private |
◆ m_dwErr
std::map<std::string, float> m_dwErr |
|
private |
◆ m_strVars
std::vector<std::pair<std::string, std::string> > m_strVars |
|
private |
◆ m_upErr
std::map<std::string, float> m_upErr |
|
private |
◆ m_vars
std::map<std::string, float> m_vars |
|
private |
The documentation for this class was generated from the following files: