LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MCWire.h
Go to the documentation of this file.
1 
2 #ifndef MCWIRE_H
3 #define MCWIRE_H
4 
5 // C++ includes
6 #include <vector>
7 #include <algorithm>
8 #include <functional> // std::less
9 #include "MCLimits.h"
10 
11 namespace sim {
12 
13  class MCWire : public std::vector<double> {
14 
15  public:
16 
19  {
20  Reset();
21  }
22 
23  void Reset()
24  {
27  }
28 
29  private:
30 
31  unsigned int fStartTDC;
32 
33 
34  public:
35 
36  MCWire(const unsigned int start,
37  const std::vector<double> &wf)
38  {
39  SetStartTDC(start);
40  SetWaveform(wf);
41  }
42 
44  void SetStartTDC(const unsigned int start)
45  {
46  fStartTDC = start;
47  }
48 
50  void SetWaveform(const std::vector<double>& wf)
51  {
52  this->resize(wf.size(),0);
53  for(std::size_t i=0; i<wf.size(); ++i)
54  this->at(i) = wf.at(i);
55  }
56 
58  unsigned int StartTDC() const { return fStartTDC; }
59 
61  inline bool operator< ( const MCWire& rhs ) const { return fStartTDC < rhs.fStartTDC; }
62 
63  };
64 }
65 
66 // Define a pointer comparison
67 namespace std {
68  template <>
69  class less<sim::MCWire*>
70  {
71  public:
72  bool operator()( const sim::MCWire* lhs, const sim::MCWire* rhs )
73  { return (*lhs) < (*rhs); }
74  };
75 }
76 
77 #endif
unsigned int fStartTDC
Definition: MCWire.h:31
void SetStartTDC(const unsigned int start)
Setter function for time.
Definition: MCWire.h:44
STL namespace.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
unsigned int StartTDC() const
Getter for start time.
Definition: MCWire.h:58
bool operator()(const sim::MCWire *lhs, const sim::MCWire *rhs)
Definition: MCWire.h:72
Monte Carlo Simulation.
void SetWaveform(const std::vector< double > &wf)
Setter function for waveform.
Definition: MCWire.h:50
void Reset()
Definition: MCWire.h:23
MCWire()
Default ctor.
Definition: MCWire.h:18
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
MCWire(const unsigned int start, const std::vector< double > &wf)
Definition: MCWire.h:36
vec_iX clear()
bool operator<(const MCWire &rhs) const
For sorting.
Definition: MCWire.h:61