Pottu
Gate1D.hpp
Go to the documentation of this file.
1 
8 #ifndef H_GATE1D
9 #define H_GATE1D
10 
11 #include "DetectorEvent.hpp"
12 
13 
14 namespace pottu {
15 
19  template <class T = double>
20  struct Gate1D {
21  T low;
22  T high;
23 
26  bool operator()( const DetectorEvent &det ) const noexcept {
27  return det.e >= low && det.e < high;
28  }
29 
30  bool operator()( T e ) const noexcept {
31  return e >= low && e < high;
32  }
33 
38  int cmp( T e ) const noexcept {
39  if( e < low )
40  return -1;
41  if( e < high )
42  return 0;
43  return 1;
44  }
45 
46  bool isInside( T value ) const noexcept {
47  return value >= low && value < high;
48  }
49 
54  T width() const noexcept {
55  return high-low;
56  }
57  };
58 
59 }
60 
61 #endif
Event containing event information of one daq channel.
Definition: DetectorEvent.hpp:47
Definition: mainpage.dox:6
Simple 1D gate object for the continous range [low,high[.
Definition: Gate1D.hpp:20
bool operator()(const DetectorEvent &det) const noexcept
Tests gate with detector energy. DEPRECATED!
Definition: Gate1D.hpp:26
int cmp(T e) const noexcept
Compares with three results, smaller, ingate, bigger.
Definition: Gate1D.hpp:38
T width() const noexcept
Returns the width of the gate.
Definition: Gate1D.hpp:54