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