All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCWire.h
Go to the documentation of this file.
1 #ifndef MCWIRE_H
2 #define MCWIRE_H
3 
4 // C++ includes
5 #include <vector>
6 #include <functional> // std::less
8 
9 namespace sim {
10 
11  class MCWire : public std::vector<double> {
12 
13  public:
14 
15  /// Default ctor
17  {
18  Reset();
19  }
20 
21  void Reset()
22  {
23  std::vector<double>::clear();
25  }
26 
27  private:
28 
29  unsigned int fStartTDC;
30 
31 
32  public:
33 
34  MCWire(const unsigned int start,
35  const std::vector<double> &wf)
36  {
37  SetStartTDC(start);
38  SetWaveform(wf);
39  }
40 
41  /// Setter function for time
42  void SetStartTDC(const unsigned int start)
43  {
44  fStartTDC = start;
45  }
46 
47  /// Setter function for waveform
48  void SetWaveform(const std::vector<double>& wf)
49  {
50  this->resize(wf.size(),0);
51  for(std::size_t i=0; i<wf.size(); ++i)
52  this->at(i) = wf.at(i);
53  }
54 
55  /// Getter for start time
56  unsigned int StartTDC() const { return fStartTDC; }
57 
58  /// For sorting
59  inline bool operator< ( const MCWire& rhs ) const { return fStartTDC < rhs.fStartTDC; }
60 
61  };
62 }
63 
64 // Define a pointer comparison
65 namespace std {
66  template <>
67  class less<sim::MCWire*>
68  {
69  public:
70  bool operator()( const sim::MCWire* lhs, const sim::MCWire* rhs )
71  { return (*lhs) < (*rhs); }
72  };
73 }
74 
75 #endif
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
unsigned int fStartTDC
Definition: MCWire.h:29
void SetStartTDC(const unsigned int start)
Setter function for time.
Definition: MCWire.h:42
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:56
bool operator()(const sim::MCWire *lhs, const sim::MCWire *rhs)
Definition: MCWire.h:70
void SetWaveform(const std::vector< double > &wf)
Setter function for waveform.
Definition: MCWire.h:48
void Reset()
Definition: MCWire.h:21
MCWire()
Default ctor.
Definition: MCWire.h:16
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
MCWire(const unsigned int start, const std::vector< double > &wf)
Definition: MCWire.h:34
bool operator<(const MCWire &rhs) const
For sorting.
Definition: MCWire.h:59