Public Member Functions | Private Attributes | Friends | List of all members
gar::rec::Hit Class Reference

#include <Hit.h>

Public Member Functions

 Hit ()
 
 Hit (unsigned int chan, float sig, float *pos, float startT, float endT, float Time, float RMS)
 
const float * Position () const
 
float const & Signal () const
 
unsigned int Channel () const
 
float StartTime () const
 
float EndTime () const
 
float Time () const
 
float RMS () const
 
void operator+= (gar::rec::Hit const &h)
 
bool operator< (gar::rec::Hit const &h) const
 
bool operator== (gar::rec::Hit const &h) const
 

Private Attributes

unsigned int fChannel
 channel recording this hit More...
 
float fSignal
 size of the signal for this hit (integral of ADC values) More...
 
float fPosition [3]
 position of the hit More...
 
float fTime
 time of hit charge arrival at the readout plane (ticks) More...
 
float fStartTime
 start time of the hit (ticks) More...
 
float fEndTime
 end time of the hit (ticks) More...
 
float fRMS
 Hit width calculated with RMS (in ticks) More...
 

Friends

std::ostream & operator<< (std::ostream &o, gar::rec::Hit const &h)
 

Detailed Description

Definition at line 15 of file Hit.h.

Constructor & Destructor Documentation

gar::rec::Hit::Hit ( )

Definition at line 15 of file Hit.cxx.

16  {
17  return;
18  }
gar::rec::Hit::Hit ( unsigned int  chan,
float  sig,
float *  pos,
float  startT,
float  endT,
float  Time,
float  RMS 
)

Definition at line 21 of file Hit.cxx.

28  : fChannel (chan )
29  , fSignal (sig )
30  , fTime (Time )
31  , fStartTime(startT)
32  , fEndTime (endT )
33  , fRMS (RMS )
34  {
35 
36  fPosition[0] = pos[0];
37  fPosition[1] = pos[1];
38  fPosition[2] = pos[2];
39 
40  return;
41  }
float fPosition[3]
position of the hit
Definition: Hit.h:26
float fStartTime
start time of the hit (ticks)
Definition: Hit.h:28
float fRMS
Hit width calculated with RMS (in ticks)
Definition: Hit.h:30
float Time() const
Definition: Hit.h:70
float fSignal
size of the signal for this hit (integral of ADC values)
Definition: Hit.h:25
unsigned int fChannel
channel recording this hit
Definition: Hit.h:24
float fEndTime
end time of the hit (ticks)
Definition: Hit.h:29
float fTime
time of hit charge arrival at the readout plane (ticks)
Definition: Hit.h:27
float RMS() const
Definition: Hit.h:69

Member Function Documentation

unsigned int gar::rec::Hit::Channel ( ) const
inline

Definition at line 64 of file Hit.h.

64 { return fChannel; }
unsigned int fChannel
channel recording this hit
Definition: Hit.h:24
float gar::rec::Hit::EndTime ( ) const
inline

Definition at line 68 of file Hit.h.

68 { return fEndTime; }
float fEndTime
end time of the hit (ticks)
Definition: Hit.h:29
void gar::rec::Hit::operator+= ( gar::rec::Hit const &  h)

Definition at line 47 of file Hit.cxx.

48  {
49  // only add hits on the same channel
50  if(fChannel != h.Channel()){
51  MF_LOG_WARNING("Hit")
52  << "attempting to add hits from different channels, that will not work";
53  return;
54  }
55 
56  // add h to this hit. Set the new position, etc to be the weighted
57  // average of the individual hits
58  float totSig = fSignal + h.Signal();
59 
60  if(totSig == 0.){
61  MF_LOG_WARNING("Hit")
62  << "attempting to add two hits and neithr has any signal, bail.";
63  return;
64  }
65 
66  for(size_t i = 0; i < 3; ++i)
67  fPosition[i] = (fPosition[i] * fSignal + h.Position()[i] * h.Signal()) / totSig;
68 
69  // don't do a weighted average but just make a wider hit
70 
71  //fStartTime = (fStartTime * fSignal + h.StartTime() * h.Signal()) / totSig;
72  //fEndTime = (fEndTime * fSignal + h.EndTime() * h.Signal()) / totSig;
73 
74  fStartTime = TMath::Min(fStartTime,h.StartTime());
75  fEndTime = TMath::Max(fEndTime,h.EndTime());
76 
77  float avgtime = (fTime * fSignal + h.Time() * h.Signal()) / totSig;
78 
79  fRMS = TMath::Sqrt( (fSignal*(TMath::Sq(fTime-avgtime)+TMath::Sq(fRMS))
80  + h.Signal()*(TMath::Sq(h.Time()-avgtime)+TMath::Sq(h.RMS())))/totSig );
81 
82  fTime = avgtime;
83 
84  fSignal += h.Signal();
85 
86  return;
87  }
float fPosition[3]
position of the hit
Definition: Hit.h:26
float fStartTime
start time of the hit (ticks)
Definition: Hit.h:28
float fRMS
Hit width calculated with RMS (in ticks)
Definition: Hit.h:30
float fSignal
size of the signal for this hit (integral of ADC values)
Definition: Hit.h:25
unsigned int fChannel
channel recording this hit
Definition: Hit.h:24
#define MF_LOG_WARNING(category)
float fEndTime
end time of the hit (ticks)
Definition: Hit.h:29
float fTime
time of hit charge arrival at the readout plane (ticks)
Definition: Hit.h:27
bool gar::rec::Hit::operator< ( gar::rec::Hit const &  h) const

Definition at line 91 of file Hit.cxx.

92  {
93  if (Channel() < h.Channel() ) return true;
94  if (Channel() > h.Channel() ) return false;
95  if (StartTime() < h.StartTime()) return true;
96  if (StartTime() > h.StartTime()) return false;
97  if (EndTime() < h.EndTime() ) return true;
98  if (EndTime() > h.EndTime() ) return false;
99  // I dunno wot den
100  //return true; //original
101  return false;
102 
103  }
float StartTime() const
Definition: Hit.h:67
float EndTime() const
Definition: Hit.h:68
unsigned int Channel() const
Definition: Hit.h:64
bool gar::rec::Hit::operator== ( gar::rec::Hit const &  h) const

Definition at line 106 of file Hit.cxx.

107  {
108  //if(Position()!=h.Position())
109  // return false;
110  if(Channel()!=h.Channel())
111  return false;
112  //if(Signal()!=h.Signal())
113  // return false;
114  if(StartTime()!=h.StartTime())
115  return false;
116  if(EndTime()!=h.EndTime())
117  return false;
118  //if(RMS()!=h.RMS())
119  // return false;
120  //if(Time()!=h.Time())
121  // return false;
122 
123  return true;
124 
125  }
float StartTime() const
Definition: Hit.h:67
float EndTime() const
Definition: Hit.h:68
unsigned int Channel() const
Definition: Hit.h:64
const float * gar::rec::Hit::Position ( ) const
inline

Definition at line 65 of file Hit.h.

65 { return &fPosition[0]; }
float fPosition[3]
position of the hit
Definition: Hit.h:26
float gar::rec::Hit::RMS ( ) const
inline

Definition at line 69 of file Hit.h.

69 { return fRMS; }
float fRMS
Hit width calculated with RMS (in ticks)
Definition: Hit.h:30
float const & gar::rec::Hit::Signal ( ) const
inline

Definition at line 66 of file Hit.h.

66 { return fSignal; }
float fSignal
size of the signal for this hit (integral of ADC values)
Definition: Hit.h:25
float gar::rec::Hit::StartTime ( ) const
inline

Definition at line 67 of file Hit.h.

67 { return fStartTime; }
float fStartTime
start time of the hit (ticks)
Definition: Hit.h:28
float gar::rec::Hit::Time ( ) const
inline

Definition at line 70 of file Hit.h.

70 { return fTime; }
float fTime
time of hit charge arrival at the readout plane (ticks)
Definition: Hit.h:27

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
gar::rec::Hit const &  h 
)
friend

Definition at line 128 of file Hit.cxx.

129  {
130 
131  o << "Hit on channel "
132  << h.Channel()
133  << "\n\tposition = ("
134  << h.Position()[0]
135  << ", "
136  << h.Position()[1]
137  << ", "
138  << h.Position()[2]
139  << ")"
140  << "\n\tsignal = "
141  << h.Signal()
142  << "\n\tstart time: "
143  << h.StartTime()
144  << " end time: "
145  << h.EndTime();
146 
147  return o;
148  }

Member Data Documentation

unsigned int gar::rec::Hit::fChannel
private

channel recording this hit

Definition at line 24 of file Hit.h.

float gar::rec::Hit::fEndTime
private

end time of the hit (ticks)

Definition at line 29 of file Hit.h.

float gar::rec::Hit::fPosition[3]
private

position of the hit

Definition at line 26 of file Hit.h.

float gar::rec::Hit::fRMS
private

Hit width calculated with RMS (in ticks)

Definition at line 30 of file Hit.h.

float gar::rec::Hit::fSignal
private

size of the signal for this hit (integral of ADC values)

Definition at line 25 of file Hit.h.

float gar::rec::Hit::fStartTime
private

start time of the hit (ticks)

Definition at line 28 of file Hit.h.

float gar::rec::Hit::fTime
private

time of hit charge arrival at the readout plane (ticks)

Definition at line 27 of file Hit.h.


The documentation for this class was generated from the following files: