CMS 3D CMS Logo

HLTGlobalStatus.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_HLTGlobalStatus_h
2 #define DataFormats_Common_HLTGlobalStatus_h
3 
20 
21 #include <vector>
22 #include <ostream>
23 
24 namespace edm {
26  private:
28  std::vector<HLTPathStatus> paths_;
29 
30  public:
32  HLTGlobalStatus(const unsigned int n = 0) : paths_(n) {}
33 
35  unsigned int size() const { return paths_.size(); }
36 
38  void reset() {
39  const unsigned int n(size());
40  for (unsigned int i = 0; i != n; ++i)
41  paths_[i].reset();
42  }
43 
44  // global "state" variables calculated on the fly!
45 
47  bool wasrun() const { return State(0); }
49  bool accept() const { return State(1); }
51  bool error() const { return State(2); }
52 
53  // get hold of individual elements, using safe indexing with "at" which throws!
54 
55  const HLTPathStatus& at(const unsigned int i) const { return paths_.at(i); }
56  HLTPathStatus& at(const unsigned int i) { return paths_.at(i); }
57  const HLTPathStatus& operator[](const unsigned int i) const { return paths_.at(i); }
58  HLTPathStatus& operator[](const unsigned int i) { return paths_.at(i); }
59 
61  bool wasrun(const unsigned int i) const { return at(i).wasrun(); }
63  bool accept(const unsigned int i) const { return at(i).accept(); }
65  bool error(const unsigned int i) const { return at(i).error(); }
66 
68  hlt::HLTState state(const unsigned int i) const { return at(i).state(); }
70  unsigned int index(const unsigned int i) const { return at(i).index(); }
72  void reset(const unsigned int i) { at(i).reset(); }
74  void swap(HLTGlobalStatus& other) { paths_.swap(other.paths_); }
77  HLTGlobalStatus temp(rhs);
78  this->swap(temp);
79  return *this;
80  }
81 
82  private:
84  bool State(unsigned int icase) const {
85  bool flags[3] = {false, false, false};
86  const unsigned int n(size());
87  for (unsigned int i = 0; i != n; ++i) {
88  const hlt::HLTState s(state(i));
89  if (s != hlt::Ready) {
90  flags[0] = true; // at least one trigger was run
91  if (s == hlt::Pass) {
92  flags[1] = true; // at least one trigger accepted
93  } else if (s == hlt::Exception) {
94  flags[2] = true; // at least one trigger with error
95  }
96  }
97  }
98  return flags[icase];
99  }
100  };
101 
103  inline void swap(HLTGlobalStatus& lhs, HLTGlobalStatus& rhs) { lhs.swap(rhs); }
104 
106  inline std::ostream& operator<<(std::ostream& ost, const HLTGlobalStatus& hlt) {
107  std::vector<std::string> text(4);
108  text[0] = "n";
109  text[1] = "1";
110  text[2] = "0";
111  text[3] = "e";
112  const unsigned int n(hlt.size());
113  for (unsigned int i = 0; i != n; ++i)
114  ost << text.at(hlt.state(i));
115  return ost;
116  }
117 
118 } // namespace edm
119 
120 // The standard allows us to specialize std::swap for non-templates.
121 // This ensures that HLTGlobalStatus::swap() will be used in algorithms.
122 
123 namespace std {
124  template <>
126  lhs.swap(rhs);
127  }
128 } // namespace std
129 
130 #endif // DataFormats_Common_HLTGlobalStatus_h
edm::HLTPathStatus::error
bool error() const
has this path encountered an error (exception)?
Definition: HLTPathStatus.h:61
edm::hlt::HLTState
HLTState
status of a trigger path
Definition: HLTenums.h:16
edm::HLTGlobalStatus::HLTGlobalStatus
HLTGlobalStatus(const unsigned int n=0)
Constructor - for n paths.
Definition: HLTGlobalStatus.h:32
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::HLTGlobalStatus::accept
bool accept(const unsigned int i) const
Has ith path accepted the event?
Definition: HLTGlobalStatus.h:63
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
edm::HLTGlobalStatus::wasrun
bool wasrun() const
Was at least one path run?
Definition: HLTGlobalStatus.h:47
edm::HLTGlobalStatus
Definition: HLTGlobalStatus.h:25
edm::HLTGlobalStatus::error
bool error() const
Has any path encountered an error (exception)
Definition: HLTGlobalStatus.h:51
edm::HLTGlobalStatus::operator=
HLTGlobalStatus & operator=(HLTGlobalStatus const &rhs)
copy assignment implemented with swap()
Definition: HLTGlobalStatus.h:76
edm::HLTGlobalStatus::swap
void swap(HLTGlobalStatus &other)
swap function
Definition: HLTGlobalStatus.h:74
edm::HLTGlobalStatus::state
hlt::HLTState state(const unsigned int i) const
Get status of ith path.
Definition: HLTGlobalStatus.h:68
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
HLTPathStatus.h
edm::HLTGlobalStatus::index
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
Definition: HLTGlobalStatus.h:70
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::HLTGlobalStatus::paths_
std::vector< HLTPathStatus > paths_
Status of each HLT path.
Definition: HLTGlobalStatus.h:28
edm::HLTGlobalStatus::wasrun
bool wasrun(const unsigned int i) const
Was ith path run?
Definition: HLTGlobalStatus.h:61
alignCSCRings.s
s
Definition: alignCSCRings.py:92
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition: HLTGlobalStatus.h:35
trackingPlots.other
other
Definition: trackingPlots.py:1465
edm::HLTGlobalStatus::State
bool State(unsigned int icase) const
Global state variable calculated on the fly.
Definition: HLTGlobalStatus.h:84
edm::HLTGlobalStatus::at
HLTPathStatus & at(const unsigned int i)
Definition: HLTGlobalStatus.h:56
edm::HLTPathStatus::accept
bool accept() const
has this path accepted the event?
Definition: HLTPathStatus.h:59
edm::HLTGlobalStatus::reset
void reset(const unsigned int i)
Reset the ith path.
Definition: HLTGlobalStatus.h:72
edm::HLTPathStatus
Definition: HLTPathStatus.h:33
edm::hlt::Ready
not [yet] run
Definition: HLTenums.h:17
edm::HLTGlobalStatus::at
const HLTPathStatus & at(const unsigned int i) const
Definition: HLTGlobalStatus.h:55
edm::HLTPathStatus::reset
void reset()
reset this path
Definition: HLTPathStatus.h:54
edm::HLTPathStatus::index
unsigned int index() const
Definition: HLTPathStatus.h:52
std
Definition: JetResolutionObject.h:76
edm::HLTGlobalStatus::operator[]
const HLTPathStatus & operator[](const unsigned int i) const
Definition: HLTGlobalStatus.h:57
edm::HLTGlobalStatus::operator[]
HLTPathStatus & operator[](const unsigned int i)
Definition: HLTGlobalStatus.h:58
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
HLTenums.h
edm::HLTGlobalStatus::reset
void reset()
Reset status for all paths.
Definition: HLTGlobalStatus.h:38
edm::hlt::Exception
error
Definition: HLTenums.h:20
runonSM.text
text
Definition: runonSM.py:43
edm::hlt::Pass
accept
Definition: HLTenums.h:18
edm::HLTPathStatus::wasrun
bool wasrun() const
was this path run?
Definition: HLTPathStatus.h:57
HLT_2018_cff.flags
flags
Definition: HLT_2018_cff.py:11758
edm::HLTPathStatus::state
hlt::HLTState state() const
get state of path
Definition: HLTPathStatus.h:48
ValidationMatrix.hlt
hlt
Definition: ValidationMatrix.py:459
edm::HLTGlobalStatus::error
bool error(const unsigned int i) const
Has ith path encountered an error (exception)?
Definition: HLTGlobalStatus.h:65