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 31 of file MonitoringObject.h.
◆ MonitoringObject() [1/2]
◆ MonitoringObject() [2/2]
Constructor with name (always use this)
Definition at line 39 of file MonitoringObject.h.
40 {
41 fName = name;
42 }
◆ addCanvas()
void addCanvas |
( |
TCanvas * |
canv | ) |
|
|
inline |
Add Canvas to monitoring object.
- Parameters
-
canv | pointer to canvas to add |
Definition at line 48 of file MonitoringObject.h.
49 {
51 if (cc->GetName() == canv->GetName()) {
52 B2ERROR("Canvas with name " << canv->GetName() << " already in the " << fName <<
53 " MonitoringObject! Use different name (or call getCanvas(name) to access pointer to the existing TCanvas).");
54 return;
55 }
56 }
58 };
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 95 of file MonitoringObject.h.
96 {
98 if (cc->GetName() == name) return cc;
99 }
100 B2WARNING("TCanvas with name " << name << " not found in MonitoringObject " << fName);
101 return NULL;
102 };
◆ 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 79 of file MonitoringObject.h.
80 {
82 }
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 87 of file MonitoringObject.h.
88 {
90 }
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 71 of file MonitoringObject.h.
72 {
74 }
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 63 of file MonitoringObject.h.
64 {
66 }
std::map< std::string, float > m_vars
map of all float variables
◆ print()
Print content of MonitoringObject.
Definition at line 19 of file MonitoringObject.cc.
20{
21
23 printVar.put("Name", GetName());
24 for (
const auto& var :
m_vars) {
25 printVar.put(var.first, var.second);
26 }
28 printVar.put(var.first, var.second);
29 }
30
33 printCanv.put(canv->GetName(), canv->GetTitle());
34 }
35
36 std::cout << "=== MonitoringObject ===\n";
37 std::cout << printVar.string();
38 std::cout << "\n List of canvases: \n";
39 std::cout << printCanv.string();
40 std::cout << "========================\n";
41}
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 150 of file MonitoringObject.h.
151 {
152
154 if (pair.first == var) {
155 pair.second = val;
156 return;
157 }
158 }
159 m_strVars.push_back(std::pair<std::string, std::string>(var, val));
160 }
◆ 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 124 of file MonitoringObject.h.
125 {
126
127 auto vv =
m_vars.find(var);
128 if (vv !=
m_vars.end()) vv->second = val;
129 else m_vars.insert({var, val});
130
131 if (upErr > 0) {
133 if (vvE !=
m_upErr.end()) vvE->second = upErr;
134 else m_upErr.insert({var, upErr});
135 }
136
137 if (dwErr > 0) {
139 if (vvE !=
m_dwErr.end()) vvE->second = dwErr;
140 else m_dwErr.insert({var, dwErr});
141 }
142
143 }
◆ 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: