LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MCHit.h
Go to the documentation of this file.
1 #ifndef MCHIT_H
2 #define MCHIT_H
3 
4 // C++ includes
6 #include <functional>
7 
8 namespace sim {
9 
10  class MCHit {
11 
12  public:
14  MCHit() { Reset(); }
15 
17  void Reset()
18  {
21  for (int i = 0; i < 3; ++i)
25  }
26 
27  private:
28  //
29  // MCHit core information
30  //
31  float fSignalTime;
32  float fSignalWidth;
33 
34  float fPeakAmp;
35  float fCharge;
36 
37  //
38  // Particle information that caused this MCHit
39  //
40 
41  float fPartVertex[3];
42  float fPartEnergy;
44 
45  public:
47  void SetCharge(float qsum, float amp)
48  {
49  fCharge = qsum;
50  fPeakAmp = amp;
51  }
52 
54  void SetTime(const float peak, const float width)
55  {
56  fSignalTime = peak;
57  fSignalWidth = width;
58  }
59 
61  void SetParticleInfo(const float vtx[], const float energy, const int trackId)
62  {
63  for (size_t i = 0; i < 3; ++i)
64  fPartVertex[i] = vtx[i];
65  fPartEnergy = energy;
66  fPartTrackId = trackId;
67  }
68 
70  float PeakTime() const { return fSignalTime; }
71 
73  float PeakWidth() const { return fSignalWidth; }
74 
76  float Charge(bool max = false) const { return (max ? fPeakAmp : fCharge); }
77 
79  const float* PartVertex() const { return fPartVertex; }
80 
82  float PartEnergy() const { return fPartEnergy; }
83 
85  int PartTrackId() const { return fPartTrackId; }
86 
88  inline bool operator<(const MCHit& rhs) const { return fSignalTime < rhs.fSignalTime; }
89 
91  inline bool operator<(const float& rhs) const { return fSignalTime < rhs; }
92  };
93 
94 }
95 
96 // Define a pointer comparison
97 namespace std {
98  template <>
99  class less<sim::MCHit*> {
100  public:
101  bool operator()(const sim::MCHit* lhs, const sim::MCHit* rhs) { return (*lhs) < (*rhs); }
102  };
103 }
104 
105 #endif
static constexpr float kINVALID_FLOAT
Definition: TruncMean.h:32
const float * PartVertex() const
Getter for particle vertex.
Definition: MCHit.h:79
float PeakTime() const
Getter for start time.
Definition: MCHit.h:70
bool operator<(const float &rhs) const
For sorting with generic time.
Definition: MCHit.h:91
const int kINVALID_INT
Definition: MCLimits.h:16
void SetCharge(float qsum, float amp)
Setter function for charge/amplitude.
Definition: MCHit.h:47
void SetParticleInfo(const float vtx[], const float energy, const int trackId)
Setter function for partile info.
Definition: MCHit.h:61
float PartEnergy() const
Getter for particle energy.
Definition: MCHit.h:82
void Reset()
Method to reset.
Definition: MCHit.h:17
void SetTime(const float peak, const float width)
Setter function for time.
Definition: MCHit.h:54
bool operator()(const sim::MCHit *lhs, const sim::MCHit *rhs)
Definition: MCHit.h:101
float fCharge
Charge sum (ADC integral over MCWire)
Definition: MCHit.h:35
STL namespace.
int fPartTrackId
particle G4 Track ID
Definition: MCHit.h:43
float fPartEnergy
particle energy deposition (dE) in MeV
Definition: MCHit.h:42
float PeakWidth() const
Getter for start time.
Definition: MCHit.h:73
float fPeakAmp
Peak amplitude (ADC)
Definition: MCHit.h:34
bool operator<(const MCHit &rhs) const
For sorting with MCHit itself.
Definition: MCHit.h:88
MCHit()
Default ctor.
Definition: MCHit.h:14
double energy
Definition: plottest35.C:25
int PartTrackId() const
Getter for track ID.
Definition: MCHit.h:85
Monte Carlo Simulation.
float fPartVertex[3]
particle vertex (x,y,z) information
Definition: MCHit.h:41
float fSignalWidth
width (1sigma) in waveform ticks
Definition: MCHit.h:32
float fSignalTime
where peak resides in waveform ticks
Definition: MCHit.h:31
const float kINVALID_FLOAT
Definition: MCLimits.h:12
float Charge(bool max=false) const
Getter for "charge".
Definition: MCHit.h:76