LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
OpticalRawDigit.h
Go to the documentation of this file.
1 
9 #ifndef optdata_OpticalRawDigit_h
10 #define optdata_OpticalRawDigit_h
11 
12 // LArSoft includes
14 
15 // C++ includes
16 #include <functional> // so we can redefine less<> below
17 #include <limits>
18 #include <vector>
19 
20 namespace optdata {
21 
22  class OpticalRawDigit : public FIFOChannel {
23  public:
24  // Simple constructor/destructor.
26  TimeSlice_t time = 0,
27  Frame_t frame = 0,
28  Channel_t channel = std::numeric_limits<Channel_t>::max(),
29  size_type len = 0)
30  : FIFOChannel(category, time, frame, channel, len){};
31 
33  };
34 
35  // In case we want to sort a collection of OpticalRawDigits (e.g.,
36  // std::set<OpticalRawDigit>), here's the definition of the less-than
37  // operator.
38  bool operator<(const OpticalRawDigit& lhs, const OpticalRawDigit& rhs)
39  {
40  // Sort by channel, frame number, and time associated with the first bin.
41  if (lhs.ChannelNumber() < rhs.ChannelNumber() && lhs.Frame() < rhs.Frame() &&
42  lhs.TimeSlice() < rhs.TimeSlice())
43  return true;
44  return false;
45  }
46 
47 } // namespace optdata
48 
49 // For no extra charge, include how to sort OpticalRawDigit*, just in
50 // case we want (for example) a std::set<OpticalRawDigit*>.
51 namespace std {
52  template <>
54  public:
56  {
57  return (*lhs) < (*rhs);
58  }
59  };
60 } // std
61 
62 #endif // optdata_OpticalRawDigit_h
Frame_t Frame() const
Definition: FIFOChannel.h:43
OpticalRawDigit(Optical_Category_t category=kUndefined, TimeSlice_t time=0, Frame_t frame=0, Channel_t channel=std::numeric_limits< Channel_t >::max(), size_type len=0)
enum optdata::_optical_category_t Optical_Category_t
STL namespace.
TimeSlice_t TimeSlice() const
Definition: FIFOChannel.h:39
Channel_t ChannelNumber() const
Definition: ChannelData.h:36
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
unsigned int Frame_t
Definition: OpticalTypes.h:21
bool operator()(const optdata::OpticalRawDigit *lhs, const optdata::OpticalRawDigit *rhs)
unsigned int Channel_t
Definition: OpticalTypes.h:19
bool operator<(const ChannelData &lhs, const ChannelData &rhs)
Definition: ChannelData.h:45