LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PMTTrigger.h
Go to the documentation of this file.
1 
6 #ifndef optdata_PMTTrigger_h
7 #define optdata_PMTTrigger_h
8 
9 // LArSoft includes
11 
12 // C++ includes
13 #include <functional> // so we can redefine less<> below
14 #include <limits>
15 
16 namespace optdata {
17 
18  class PMTTrigger
19  {
20  public:
21 
22  // Simple constructor/destructor.
24  TimeSlice_t time = 0,
25  Frame_t frame = 0 )
26  : fm_category(category)
27  , fm_timeSlice(time)
28  , fm_frame(frame)
29  {};
30 
32 
33  // Here we have getters and setters for the time information.
34 
35 
37 
38  // A time slice associated with the first bin in the channel
39  // data. For example, the first bin of the ADC channel may refer
40  // to clock value 8595824 (in some arbitrary units).
41  TimeSlice_t TimeSlice() const { return fm_timeSlice; }
43 
44  // The frame number associated with the first frame in the channel.
45  Frame_t Frame() const { return fm_frame; }
46  void SetFrame( Frame_t f ) { fm_frame = f; }
47 
48 
49  private:
50  Optical_Category_t fm_category; // A channel category from Types.h
51  TimeSlice_t fm_timeSlice; // The time of the first slice in the channel data
52  Frame_t fm_frame; // The frame number corresponding to the above time
53  };
54 
55  // In case we want to sort a collection of PMTTriggers (e.g.,
56  // std::set<PMTTrigger>), here's the definition of the less-than
57  // operator.
58  bool operator<( const PMTTrigger& lhs, const PMTTrigger& rhs )
59  {
60  // Sort by channel, frame number, and time associated with the first bin.
61  if (
62  lhs.Frame() < rhs.Frame() &&
63  lhs.TimeSlice() < rhs.TimeSlice() &&
64  lhs.Category() < rhs.Category() )
65  return true;
66  return false;
67  }
68 
69 } // namespace optdata
70 
71 // For no extra charge, include how to sort PMTTrigger*, just in
72 // case we want (for example) a std::set<PMTTrigger*>.
73 namespace std {
74  template <>
76  {
77  public:
78  bool operator()( const optdata::PMTTrigger* lhs, const optdata::PMTTrigger* rhs )
79  {
80  return (*lhs) < (*rhs);
81  }
82  };
83 } // std
84 
85 #endif // optdata_PMTTrigger_h
bool operator()(const optdata::PMTTrigger *lhs, const optdata::PMTTrigger *rhs)
Definition: PMTTrigger.h:78
Optical_Category_t Category() const
Definition: PMTTrigger.h:36
PMTTrigger(Optical_Category_t category=kUndefined, TimeSlice_t time=0, Frame_t frame=0)
Definition: PMTTrigger.h:23
void SetTimeSlice(TimeSlice_t t)
Definition: PMTTrigger.h:42
enum optdata::_optical_category_t Optical_Category_t
STL namespace.
TFile f
Definition: plotHisto.C:6
void SetFrame(Frame_t f)
Definition: PMTTrigger.h:46
TimeSlice_t fm_timeSlice
Definition: PMTTrigger.h:51
Optical_Category_t fm_category
Definition: PMTTrigger.h:50
Frame_t Frame() const
Definition: PMTTrigger.h:45
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
unsigned int Frame_t
Definition: OpticalTypes.h:21
bool operator<(const ChannelData &lhs, const ChannelData &rhs)
Definition: ChannelData.h:52
TimeSlice_t TimeSlice() const
Definition: PMTTrigger.h:41