All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCHit.h
Go to the documentation of this file.
1 #ifndef MCHIT_H
2 #define MCHIT_H
3 
4 // C++ includes
5 #include <functional>
7 
8 namespace sim {
9 
10  class MCHit {
11 
12  public:
13 
14  /// Default ctor
16  {
17  Reset();
18  }
19 
20  /// Method to reset
21  void Reset()
22  {
25  for(int i=0; i<3; ++i)
29  }
30 
31  private:
32 
33  //
34  // MCHit core information
35  //
36  float fSignalTime; ///< where peak resides in waveform ticks
37  float fSignalWidth; ///< width (1sigma) in waveform ticks
38 
39  float fPeakAmp; ///< Peak amplitude (ADC)
40  float fCharge; ///< Charge sum (ADC integral over MCWire)
41 
42  //
43  // Particle information that caused this MCHit
44  //
45 
46  float fPartVertex[3]; ///< particle vertex (x,y,z) information
47  float fPartEnergy; ///< particle energy deposition (dE) in MeV
48  int fPartTrackId; ///< particle G4 Track ID
49 
50 
51  public:
52 
53  /// Setter function for charge/amplitude
54  void SetCharge(float qsum, float amp) { fCharge=qsum; fPeakAmp=amp; }
55 
56  /// Setter function for time
57  void SetTime(const float peak, const float width)
58  {
59  fSignalTime = peak;
60  fSignalWidth = width;
61  }
62 
63  /// Setter function for partile info
64  void SetParticleInfo(const float vtx[],
65  const float energy,
66  const int trackId)
67  {
68  for(size_t i=0; i<3; ++i)
69  fPartVertex[i] = vtx[i];
70  fPartEnergy = energy;
71  fPartTrackId = trackId;
72  }
73 
74  /// Getter for start time
75  float PeakTime() const { return fSignalTime; }
76 
77  /// Getter for start time
78  float PeakWidth() const { return fSignalWidth; }
79 
80  /// Getter for "charge"
81  float Charge(bool max=false) const { return ( max ? fPeakAmp : fCharge ); }
82 
83  /// Getter for particle vertex
84  const float* PartVertex() const { return fPartVertex; }
85 
86  /// Getter for particle energy
87  float PartEnergy() const { return fPartEnergy; }
88 
89  /// Getter for track ID
90  int PartTrackId() const { return fPartTrackId; }
91 
92  /// For sorting with MCHit itself
93  inline bool operator< ( const MCHit& rhs ) const { return fSignalTime < rhs.fSignalTime; }
94 
95  /// For sorting with generic time
96  inline bool operator< ( const float& rhs) const { return fSignalTime < rhs; }
97 
98  };
99 
100 }
101 
102 // Define a pointer comparison
103 namespace std {
104  template <>
105  class less<sim::MCHit*>
106  {
107  public:
108  bool operator()( const sim::MCHit* lhs, const sim::MCHit* rhs )
109  { return (*lhs) < (*rhs); }
110  };
111 }
112 
113 #endif
const float * PartVertex() const
Getter for particle vertex.
Definition: MCHit.h:84
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
float PeakTime() const
Getter for start time.
Definition: MCHit.h:75
const int kINVALID_INT
Definition: MCLimits.h:16
void SetCharge(float qsum, float amp)
Setter function for charge/amplitude.
Definition: MCHit.h:54
void SetParticleInfo(const float vtx[], const float energy, const int trackId)
Setter function for partile info.
Definition: MCHit.h:64
float PartEnergy() const
Getter for particle energy.
Definition: MCHit.h:87
void Reset()
Method to reset.
Definition: MCHit.h:21
void SetTime(const float peak, const float width)
Setter function for time.
Definition: MCHit.h:57
bool operator()(const sim::MCHit *lhs, const sim::MCHit *rhs)
Definition: MCHit.h:108
float fCharge
Charge sum (ADC integral over MCWire)
Definition: MCHit.h:40
int fPartTrackId
particle G4 Track ID
Definition: MCHit.h:48
float fPartEnergy
particle energy deposition (dE) in MeV
Definition: MCHit.h:47
float PeakWidth() const
Getter for start time.
Definition: MCHit.h:78
float fPeakAmp
Peak amplitude (ADC)
Definition: MCHit.h:39
bool operator<(const MCHit &rhs) const
For sorting with MCHit itself.
Definition: MCHit.h:93
MCHit()
Default ctor.
Definition: MCHit.h:15
static const float kINVALID_FLOAT
int PartTrackId() const
Getter for track ID.
Definition: MCHit.h:90
float fPartVertex[3]
particle vertex (x,y,z) information
Definition: MCHit.h:46
float fSignalWidth
width (1sigma) in waveform ticks
Definition: MCHit.h:37
float fSignalTime
where peak resides in waveform ticks
Definition: MCHit.h:36
const float kINVALID_FLOAT
Definition: MCLimits.h:12
float Charge(bool max=false) const
Getter for &quot;charge&quot;.
Definition: MCHit.h:81