All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCWireCollection.h
Go to the documentation of this file.
1 
2 #ifndef MCWIRECOLLECTION_H
3 #define MCWIRECOLLECTION_H
4 
5 // C++ includes
7 
8 namespace sim {
9 
10  class MCWireCollection : public std::vector<sim::MCWire> {
11 
12  public:
13 
14  /// Default ctor
15  MCWireCollection(const unsigned int ch=sim::kINVALID_UINT)
16  {
17  Reset();
18  fChannel = ch;
19  }
20 
21  void Reset()
22  {
23  std::vector<sim::MCWire>::clear();
25  }
26 
27  private:
28 
29  unsigned int fChannel;
30 
31 
32  public:
33 
34  /// Getter for channel number
35  unsigned int Channel() const { return fChannel; }
36 
37  /// For sorting
38  inline bool operator< ( const MCWireCollection& rhs ) const { return fChannel < rhs.fChannel; }
39 
40  /// wrapper for push_back
41  inline void push_back(const MCWire& wire)
42  {
43 
44  bool sort = (!empty() && wire < (*rbegin()));
45 
46  std::vector<sim::MCWire>::push_back(wire);
47 
48  if(sort) std::sort(begin(),end());
49 
50  }
51  };
52 }
53 
54 // Define a pointer comparison
55 namespace std {
56  template <>
57  class less<sim::MCWireCollection*>
58  {
59  public:
61  { return (*lhs) < (*rhs); }
62  };
63 }
64 
65 #endif
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
void push_back(const MCWire &wire)
wrapper for push_back
unsigned int Channel() const
Getter for channel number.
MCWireCollection(const unsigned int ch=sim::kINVALID_UINT)
Default ctor.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
bool operator<(const MCWireCollection &rhs) const
For sorting.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
bool empty(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:555
bool operator()(const sim::MCWireCollection *lhs, const sim::MCWireCollection *rhs)