LArSoft  v08_35_01
Liquid Argon Software toolkit - http://larsoft.org/
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 
16  {
17  Reset();
18  }
19 
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;
37  float fSignalWidth;
38 
39  float fPeakAmp;
40  float fCharge;
41 
42  //
43  // Particle information that caused this MCHit
44  //
45 
46  float fPartVertex[3];
47  float fPartEnergy;
49 
50 
51  public:
52 
54  void SetCharge(float qsum, float amp) { fCharge=qsum; fPeakAmp=amp; }
55 
57  void SetTime(const float peak, const float width)
58  {
59  fSignalTime = peak;
60  fSignalWidth = width;
61  }
62 
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 
75  float PeakTime() const { return fSignalTime; }
76 
78  float PeakWidth() const { return fSignalWidth; }
79 
81  float Charge(bool max=false) const { return ( max ? fPeakAmp : fCharge ); }
82 
84  const float* PartVertex() const { return fPartVertex; }
85 
87  float PartEnergy() const { return fPartEnergy; }
88 
90  int PartTrackId() const { return fPartTrackId; }
91 
93  inline bool operator< ( const MCHit& rhs ) const { return fSignalTime < rhs.fSignalTime; }
94 
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
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
STL namespace.
static const float kINVALID_FLOAT
Definition: TruncMean.h:31
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
Int_t max
Definition: plot.C:27
double energy
Definition: plottest35.C:25
int PartTrackId() const
Getter for track ID.
Definition: MCHit.h:90
Monte Carlo Simulation.
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 "charge".
Definition: MCHit.h:81