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