Mergeable object holding (unique) set of (exp,run) pairs.
More...
#include <RunRange.h>
|
| RunRange () |
| Constructor.
|
|
| RunRange (std::vector< Calibration::ExpRun > expRuns) |
| Constructor from vector of ExpRun objects.
|
|
virtual | ~RunRange () |
| Destructor.
|
|
virtual void | clear () |
| Implementation of clearing - resets stored run set.
|
|
virtual void | merge (const RunRange *other) |
| Implementation of merging - other is added to the set (union)
|
|
void | add (int exp, int run) |
| Add an experiment and run number to the set.
|
|
const std::set< Calibration::ExpRun > & | getExpRunSet () |
| Get access to the stored set.
|
|
IntervalOfValidity | getIntervalOfValidity () |
| Make IntervalOfValidity from the set, spanning all runs. Works because sets are sorted by default.
|
|
Long64_t | Merge (TCollection *hlist) |
| Allow merging using TFileMerger if saved directly to a file.
|
|
void | setGranularity (const std::string &granularity) |
| Set the m_granularity to an allowed value.
|
|
std::string | getGranularity () const |
| Gets the m_granularity.
|
|
void | Reset () |
| Root-like Reset function for "template compatibility" with ROOT objects.
|
|
void | SetDirectory (TDirectory *) |
| Root-like SetDirectory function for "template compatibility" with ROOT objects. Does nothing.
|
|
bool | operator< (const RunRange &other) const |
| Comparison operator so that we can use RunRange in a map as a key.
|
|
|
std::set< Calibration::ExpRun > | m_expRunSet = {} |
| The set of (exp,run) stored in object.
|
|
std::string | m_granularity = "run" |
| granularity used by the collector storing the information.
|
|
Mergeable object holding (unique) set of (exp,run) pairs.
Definition at line 25 of file RunRange.h.
◆ RunRange() [1/2]
◆ RunRange() [2/2]
RunRange |
( |
std::vector< Calibration::ExpRun > | expRuns | ) |
|
|
inlineexplicit |
Constructor from vector of ExpRun objects.
Definition at line 32 of file RunRange.h.
32 : TNamed()
33 {
34 for (auto expRun : expRuns) {
35 this->add(expRun.first, expRun.second);
36 }
37 };
◆ ~RunRange()
Destructor.
Definition at line 40 of file RunRange.h.
41 {
42 m_expRunSet.clear();
43 }
◆ add()
void add |
( |
int | exp, |
|
|
int | run ) |
|
inline |
Add an experiment and run number to the set.
Definition at line 58 of file RunRange.h.
59 {
60 m_expRunSet.insert(std::make_pair(exp, run));
61 }
◆ clear()
Implementation of clearing - resets stored run set.
Definition at line 46 of file RunRange.h.
47 {
48 m_expRunSet.clear();
49 }
◆ getExpRunSet()
const std::set< Calibration::ExpRun > & getExpRunSet |
( |
| ) |
|
|
inline |
Get access to the stored set.
Definition at line 64 of file RunRange.h.
65 {
66 return m_expRunSet;
67 }
◆ getGranularity()
std::string getGranularity |
( |
| ) |
const |
|
inline |
Gets the m_granularity.
Definition at line 110 of file RunRange.h.
110{return m_granularity;}
◆ getIntervalOfValidity()
Make IntervalOfValidity from the set, spanning all runs. Works because sets are sorted by default.
Definition at line 70 of file RunRange.h.
71 {
72 if (m_expRunSet.empty())
73 return IntervalOfValidity();
74
75 auto low = m_expRunSet.begin();
76 auto high = m_expRunSet.rbegin();
77
78 return IntervalOfValidity(low->first, low->second, high->first, high->second);
79 }
◆ Merge()
Long64_t Merge |
( |
TCollection * | hlist | ) |
|
|
inline |
Allow merging using TFileMerger if saved directly to a file.
Definition at line 82 of file RunRange.h.
83 {
84 B2DEBUG(100, "Running Merge() on " << this->GetName());
85 Long64_t nMerged = 0;
86 if (hlist) {
87 const RunRange* xh = 0;
88 TIter nxh(hlist);
89 while ((xh = dynamic_cast<RunRange*>(nxh()))) {
90
92 ++nMerged;
93 }
94 }
95 B2DEBUG(100, "Merged " << nMerged << " objects");
96 return nMerged;
97 }
std::vector< std::vector< double > > merge(std::vector< std::vector< std::vector< double > > > toMerge)
merge { vector<double> a, vector<double> b} into {a, b}
◆ merge()
virtual void merge |
( |
const RunRange * | other | ) |
|
|
inlinevirtual |
Implementation of merging - other is added to the set (union)
Definition at line 52 of file RunRange.h.
53 {
54 m_expRunSet.insert(other->m_expRunSet.begin(), other->m_expRunSet.end());
55 }
◆ operator<()
bool operator< |
( |
const RunRange & | other | ) |
const |
|
inline |
Comparison operator so that we can use RunRange in a map as a key.
Definition at line 117 of file RunRange.h.
118 {
119 if (m_granularity == other.m_granularity) {
120 return m_expRunSet < other.m_expRunSet;
121 }
122 return m_granularity < other.m_granularity;
123 }
◆ Reset()
Root-like Reset function for "template compatibility" with ROOT objects.
Alias for clear().
Definition at line 112 of file RunRange.h.
◆ SetDirectory()
void SetDirectory |
( |
TDirectory * | | ) |
|
|
inline |
Root-like SetDirectory function for "template compatibility" with ROOT objects. Does nothing.
Definition at line 114 of file RunRange.h.
◆ setGranularity()
void setGranularity |
( |
const std::string & | granularity | ) |
|
|
inline |
Set the m_granularity to an allowed value.
Definition at line 100 of file RunRange.h.
101 {
102 if (granularity == "all" || granularity == "run") {
103 m_granularity = granularity;
104 } else {
105 B2WARNING("Tried to set RunRange granularity to something other than 'run' or 'all' -> " << granularity);
106 }
107 }
◆ m_expRunSet
std::set<Calibration::ExpRun> m_expRunSet = {} |
|
private |
The set of (exp,run) stored in object.
Definition at line 127 of file RunRange.h.
◆ m_granularity
std::string m_granularity = "run" |
|
private |
granularity used by the collector storing the information.
Definition at line 130 of file RunRange.h.
The documentation for this class was generated from the following file: