LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ChannelData.h
Go to the documentation of this file.
1 // OpticalDetectorData/ChannelData.h
2 // William Seligman <seligman@nevis.columbia.edu>
3 
4 // The ADC counts associated with a particular channel.
5 
6 #ifndef OpticalDetectorData_ChannelData_h
7 #define OpticalDetectorData_ChannelData_h
8 
9 // LArSoft includes
11 
12 // C++ includes
13 #include <vector>
14 #include <functional> // so we can redefine less<> below
15 #include <limits>
16 
17 namespace optdata {
18 
19  class ChannelData : public std::vector< ADC_Count_t >
20  {
21  public:
22 
23  // Simple constructors/destructors.
24  // Just in case the user forgets to supply the default channel, use
25  // a garbage value to indicate that there's a problem.
26  // To save on memory reallocations, offer an option to specify the
27  // the initial memory allocation of the channel vector.
29  size_type len = 0 )
30  : fm_optDetChannel(chan)
31  {
32  this->reserve(len);
33  };
34 
36 
37  // The sections bracketed with GCCXML tests handle a problem ART
38  // with generating its data dictionaries.
39 
40  // No "setter" for the channel number; you have to assign it when
41  // you create a ChannelData object.
43 
44 
45  private:
46  unsigned int fm_optDetChannel;
47  };
48 
49  // In case we want to sort a collection of ChannelDatas (e.g.,
50  // std::set<ChannelData>), here's the definition of the less-than
51  // operator.
52  bool operator<( const ChannelData& lhs, const ChannelData& rhs )
53  {
54  // Sort by channel.
55  if ( lhs.ChannelNumber() < rhs.ChannelNumber() )
56  return true;
57  return false;
58  }
59 
60 } // namespace optdata
61 
62 // For no extra charge, include how to sort ChannelData*, just in
63 // case we want (for example) a std::set<ChannelData*>.
64 namespace std {
65  template <>
67  {
68  public:
69  bool operator()( const optdata::ChannelData* lhs, const optdata::ChannelData* rhs )
70  {
71  return (*lhs) < (*rhs);
72  }
73  };
74 } // std
75 
76 #endif // OpticalDetectorData_ChannelData_h
STL namespace.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Int_t max
Definition: plot.C:27
ChannelData(Channel_t chan=std::numeric_limits< Channel_t >::max(), size_type len=0)
Definition: ChannelData.h:28
bool operator()(const optdata::ChannelData *lhs, const optdata::ChannelData *rhs)
Definition: ChannelData.h:69
unsigned int fm_optDetChannel
Definition: ChannelData.h:46
Channel_t ChannelNumber() const
Definition: ChannelData.h:42
unsigned int Channel_t
Definition: OpticalTypes.h:19
bool operator<(const ChannelData &lhs, const ChannelData &rhs)
Definition: ChannelData.h:52