LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
MCWireCollection.h
Go to the documentation of this file.
1 
2 #ifndef MCWIRECOLLECTION_H
3 #define MCWIRECOLLECTION_H
4 
5 // C++ includes
6 #include "MCWire.h"
7 
8 namespace sim {
9 
10  class MCWireCollection : public std::vector<sim::MCWire> {
11 
12  public:
13 
15  MCWireCollection(const unsigned int ch=sim::kINVALID_UINT)
16  {
17  Reset();
18  fChannel = ch;
19  }
20 
21  void Reset()
22  {
25  }
26 
27  private:
28 
29  unsigned int fChannel;
30 
31 
32  public:
33 
35  unsigned int Channel() const { return fChannel; }
36 
38  inline bool operator< ( const MCWireCollection& rhs ) const { return fChannel < rhs.fChannel; }
39 
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 <>
58  {
59  public:
61  { return (*lhs) < (*rhs); }
62  };
63 }
64 
65 #endif
STL namespace.
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.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
Monte Carlo Simulation.
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
bool operator()(const sim::MCWireCollection *lhs, const sim::MCWireCollection *rhs)
vec_iX clear()