OpticalRawDigit.h
Go to the documentation of this file.
1 /// OpticalRawDigit.h
2 /// Kazuhiro Terao <kazuhiro@nevis.columbia.edu>
3 ///
4 /// Equivalent of raw::RawDigit (waveform for TPC) for Optical system
5 /// except the code is a complete copy from FIFOChannel written by William Seligman.
6 /// William Seligman <seligman@nevis.columbia.edu>
7 ///
8 
9 #ifndef optdata_OpticalRawDigit_h
10 #define optdata_OpticalRawDigit_h
11 
12 // LArSoft includes
14 
15 // C++ includes
16 #include <vector>
17 #include <functional> // so we can redefine less<> below
18 #include <limits>
19 
20 namespace optdata {
21 
23  {
24  public:
25 
26  // Simple constructor/destructor.
28  TimeSlice_t time = 0,
29  Frame_t frame = 0,
31  size_type len = 0 )
32  : FIFOChannel(category,time,frame,channel,len)
33  {};
34 
36  };
37 
38  // In case we want to sort a collection of OpticalRawDigits (e.g.,
39  // std::set<OpticalRawDigit>), here's the definition of the less-than
40  // operator.
41  bool operator<( const OpticalRawDigit& lhs, const OpticalRawDigit& rhs )
42  {
43  // Sort by channel, frame number, and time associated with the first bin.
44  if ( lhs.ChannelNumber() < rhs.ChannelNumber() &&
45  lhs.Frame() < rhs.Frame() &&
46  lhs.TimeSlice() < rhs.TimeSlice() )
47  return true;
48  return false;
49  }
50 
51 } // namespace optdata
52 
53 // For no extra charge, include how to sort OpticalRawDigit*, just in
54 // case we want (for example) a std::set<OpticalRawDigit*>.
55 namespace std {
56  template <>
58  {
59  public:
61  {
62  return (*lhs) < (*rhs);
63  }
64  };
65 } // std
66 
67 #endif // optdata_OpticalRawDigit_h
Frame_t Frame() const
Definition: FIFOChannel.h:50
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.
uint8_t channel
Definition: CRTFragment.hh:201
TimeSlice_t TimeSlice() const
Definition: FIFOChannel.h:46
static int max(int a, int b)
Channel_t ChannelNumber() const
Definition: ChannelData.h:39
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:49