LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
MCHitCollection.h
Go to the documentation of this file.
1 
2 #ifndef MCHITCOLLECTION_H
3 #define MCHITCOLLECTION_H
4 
5 // C++ includes
6 #include <vector>
8 
9 namespace sim {
10 
11  class MCHitCollection : public std::vector<sim::MCHit> {
12 
13  public:
14 
16  MCHitCollection(const unsigned int ch= ::sim::kINVALID_UINT)
17  {
18  Reset();
19  fChannel = ch;
20  }
21 
23  void Reset()
24  {
27  }
28 
29  private:
30 
31  unsigned int fChannel;
32 
33 
34  public:
35 
37  unsigned int Channel() const { return fChannel; }
38 
40  inline bool operator< ( const MCHitCollection& rhs ) const { return fChannel < rhs.fChannel; }
41 
43  inline void push_back(const MCHit& hit)
44  {
45 
46  bool sort = (!empty() && hit < (*rbegin()));
47 
48  std::vector<sim::MCHit>::push_back(hit);
49 
50  if(sort) std::sort(begin(),end());
51 
52  }
53  };
54 }
55 
56 // Define a pointer comparison
57 namespace std {
58  template <>
60  {
61  public:
62  bool operator()( const sim::MCHitCollection* lhs, const sim::MCHitCollection* rhs )
63  { return (*lhs) < (*rhs); }
64  };
65 }
66 
67 #endif
void push_back(const MCHit &hit)
wrapper for push_back
STL namespace.
void Reset()
Method to reset.
bool operator()(const sim::MCHitCollection *lhs, const sim::MCHitCollection *rhs)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
unsigned int fChannel
Channel number.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
Monte Carlo Simulation.
Detector simulation of raw signals on wires.
unsigned int Channel() const
Getter for channel number.
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
bool operator<(const MCHitCollection &rhs) const
For sorting.
MCHitCollection(const unsigned int ch=::sim::kINVALID_UINT)
Default ctor.
vec_iX clear()