LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
HLTPathStatus.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Common_HLTPathStatus_h
2 #define canvas_Persistency_Common_HLTPathStatus_h
3 
27 
28 #include <cassert>
29 #include <cstdint>
30 
31 namespace art {
32  class HLTPathStatus {
33 
34  private:
35  // packed status of trigger path [unsigned char is too small]
36  std::uint16_t status_;
37  // bits 0- 1 (0- 3): HLT state
38  // bits 2-16 (0-16383): index of module on path making path decision
39 
40  public:
41  // constructor
43  const unsigned int index = 0)
44  : status_(index * 4 + state)
45  {
46  assert(state < hlt::UNKNOWN);
47  assert(index < 16384);
48  }
49 
50  // get state of path
52  state() const
53  {
54  return (static_cast<hlt::HLTState>(status_ % 4));
55  }
56  // get index of module giving the status of this path
57  unsigned int
58  index() const
59  {
60  return (static_cast<unsigned int>(status_ / 4));
61  }
62  // reset this path
63  void
65  {
66  status_ = 0;
67  }
68 
69  // was this path run?
70  bool
71  wasrun() const
72  {
73  return (state() != hlt::Ready);
74  }
75  // has this path accepted the event? If the path was not run, the
76  // answer is, "yes."
77  bool
78  accept() const
79  {
80  return ((state() == hlt::Pass) || !wasrun());
81  }
82  // has this path encountered an error (exception)?
83  bool
84  error() const
85  {
86  return (state() == hlt::Exception);
87  }
88 
89  }; // HLTPathStatus
90 
91 } // art
92 
93  // ======================================================================
94 
95 #endif /* canvas_Persistency_Common_HLTPathStatus_h */
96 
97 // Local Variables:
98 // mode: c++
99 // End:
bool error() const
Definition: HLTPathStatus.h:84
bool wasrun() const
Definition: HLTPathStatus.h:71
HLTPathStatus(const hlt::HLTState state=hlt::Ready, const unsigned int index=0)
Definition: HLTPathStatus.h:42
HLTState
status of a trigger path
Definition: HLTenums.h:14
not [yet] run
Definition: HLTenums.h:15
unsigned int index() const
Definition: HLTPathStatus.h:58
bool accept() const
Definition: HLTPathStatus.h:78
HLT enums.
std::uint16_t status_
Definition: HLTPathStatus.h:36
accept
Definition: HLTenums.h:16
hlt::HLTState state() const
Definition: HLTPathStatus.h:52