Hit.cxx
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file lardataobj/RecoBase/Hit.cxx
3  * @brief Definition of signal hit object.
4  * @author mitchell.soderberg@yale.edu
5  * @see lardataobj/RecoBase/Hit.h
6  *
7  * ****************************************************************************/
8 
9 // Hit header
11 
12 // C/C++ standard library
13 #include <iomanip>
14 #include <ostream>
15 
16 namespace recob {
17 
18  //----------------------------------------------------------------------
20  : fChannel(raw::InvalidChannelID)
21  , fStartTick(0)
22  , fEndTick(0)
23  , fPeakTime(0.)
24  , fSigmaPeakTime(-1.)
25  , fRMS(0.)
26  , fPeakAmplitude(0.)
27  , fSigmaPeakAmplitude(-1.)
28  , fSummedADC(0.)
29  , fIntegral(0.)
30  , fSigmaIntegral(-1.)
31  , fMultiplicity(0)
32  , fLocalIndex(-1)
33  , fGoodnessOfFit(0.)
34  , fNDF(-1)
35  , fView(geo::kUnknown)
36  , fSignalType(geo::kMysteryType)
37  , fWireID() // invalid
38  {}
39 
40  //----------------------------------------------------------------------
43  raw::TDCtick_t start_tick,
44  raw::TDCtick_t end_tick,
45  float peak_time,
46  float sigma_peak_time,
47  float rms,
48  float peak_amplitude,
49  float sigma_peak_amplitude,
50  float summedADC,
51  float hit_integral,
52  float hit_sigma_integral,
53  short int multiplicity,
54  short int local_index,
55  float goodness_of_fit,
56  int dof,
57  geo::View_t view,
58  geo::SigType_t signal_type,
59  geo::WireID wireID
60  )
61  : fChannel(channel)
62  , fStartTick(start_tick)
63  , fEndTick(end_tick)
64  , fPeakTime(peak_time)
65  , fSigmaPeakTime(sigma_peak_time)
66  , fRMS(rms)
67  , fPeakAmplitude(peak_amplitude)
68  , fSigmaPeakAmplitude(sigma_peak_amplitude)
69  , fSummedADC(summedADC)
70  , fIntegral(hit_integral)
71  , fSigmaIntegral(hit_sigma_integral)
72  , fMultiplicity(multiplicity)
73  , fLocalIndex(local_index)
74  , fGoodnessOfFit(goodness_of_fit)
75  , fNDF(dof)
76  , fView(view)
77  , fSignalType(signal_type)
78  , fWireID(wireID)
79  {}
80 
81 
82  //----------------------------------------------------------------------
83  // ostream operator.
84  //
85  std::ostream& operator<< (std::ostream& o, Hit const& hit) {
86  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
87  o << " Channel " << std::setw(5) << std::right << hit.Channel()
88  << " View = " << std::setw(3) << std::right << hit.View()
89  << " Signal type = " << std::setw(3) << std::right << hit.SignalType()
90  << " Wire = " << std::setw(3) << std::right << hit.WireID()
91  << "\n\tStartTick = " << std::setw(7) << std::right << hit.StartTick()
92  << "\tEndTick = " << std::setw(7) << std::right << hit.EndTick()
93  << "\tPeakTime = " << std::setw(7) << std::right << hit.PeakTime()
94  << " +/- " << std::setw(7) << std::right << hit.SigmaPeakTime()
95  << "\tRMS = " << std::setw(7) << std::right << hit.RMS()
96  << "\n\tAmplitude = " << std::setw(7) << std::right << hit.PeakAmplitude()
97  << " +/- " << std::setw(7) << std::right << hit.SigmaPeakAmplitude()
98  << "\tIntegral = " << std::setw(7) << std::right << hit.Integral()
99  << " +/- " << std::setw(7) << std::right << hit.SigmaIntegral()
100  << "\tADCsum = " << std::setw(7) << std::right << hit.SummedADC()
101  << "\tMultiplicity = " << std::setw(5) << std::right << hit.LocalIndex() << " of " << hit.Multiplicity()
102  << "\tGoodnessOfFit = " << std::setw(7) << std::right << hit.GoodnessOfFit()
103  << " DoF = " << std::setw(7) << std::right << hit.DegreesOfFreedom()
104  << std::endl;
105  return o;
106  } // operator<< (std::ostream, Hit)
107 
108 
109  //----------------------------------------------------------------------
110  // < operator.
111  //
112  bool operator < (const Hit & a, const Hit & b)
113  {
114  if (a.Channel() != b.Channel())
115  return a.Channel() < b.Channel();
116  if (a.View() != b.View())
117  return a.View() < b.View();
118  if (a.StartTick() != b.StartTick())
119  return a.StartTick() < b.StartTick();
120 
121  return false; //They are equal
122  } // operator< (Hit, Hit)
123 
124 
125  //----------------------------------------------------------------------
126 } // namespace recob
short int LocalIndex() const
How well do we believe we know this hit?
Definition: Hit.h:227
friend bool operator<(const Hit &a, const Hit &b)
Definition: Hit.cxx:112
geo::SigType_t SignalType() const
Signal type for the plane of the hit.
Definition: Hit.h:231
float fPeakAmplitude
the estimated amplitude of the hit at its peak, in ADC units
Definition: Hit.h:61
raw::TDCtick_t fStartTick
initial tdc tick for hit
Definition: Hit.h:56
Reconstruction base classes.
Who knows?
Definition: geo_types.h:147
float fSummedADC
the sum of calibrated ADC counts of the hit
Definition: Hit.h:63
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:40
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
geo::WireID WireID() const
Definition: Hit.h:233
float RMS() const
RMS of the hit shape, in tick units.
Definition: Hit.h:220
float fSigmaPeakAmplitude
uncertainty on estimated amplitude of the hit at its peak, in ADC units
Definition: Hit.h:62
geo::View_t fView
view for the plane of the hit
Definition: Hit.h:70
geo::SigType_t fSignalType
signal type for the plane of the hit
Definition: Hit.h:71
float SigmaPeakAmplitude() const
Uncertainty on estimated amplitude of the hit at its peak, in ADC units.
Definition: Hit.h:222
float SigmaIntegral() const
Definition: Hit.h:225
int DegreesOfFreedom() const
Definition: Hit.h:229
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:224
geo::View_t View() const
View for the plane of the hit.
Definition: Hit.h:232
Raw data description.
Hit()
Default constructor: a hit with no signal.
Definition: Hit.cxx:19
uint8_t channel
Definition: CRTFragment.hh:201
float GoodnessOfFit() const
Degrees of freedom in the determination of the hit signal shape (-1 by default)
Definition: Hit.h:228
short int Multiplicity() const
How many hits could this one be shared with.
Definition: Hit.h:226
raw::TDCtick_t fEndTick
final tdc tick for hit
Definition: Hit.h:57
float fSigmaPeakTime
uncertainty for the signal peak, in tick units
Definition: Hit.h:59
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
Definition: Hit.h:221
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
friend std::ostream & operator<<(std::ostream &o, const Hit &a)
short int fMultiplicity
how many hits could this one be shared with
Definition: Hit.h:66
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:32
enum geo::_plane_sigtype SigType_t
const double a
float fPeakTime
time of the signal peak, in tick units
Definition: Hit.h:58
raw::ChannelID_t fChannel
ID of the readout channel the hit was extracted from.
Definition: Hit.h:55
int fNDF
degrees of freedom in the determination of the hit shape
Definition: Hit.h:69
float fRMS
RMS of the hit shape, in tick units.
Definition: Hit.h:60
raw::TDCtick_t StartTick() const
Initial tdc tick for hit.
Definition: Hit.h:216
Detector simulation of raw signals on wires.
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
raw::TDCtick_t EndTick() const
Final tdc tick for hit.
Definition: Hit.h:217
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:218
Declaration of signal hit object.
geo::WireID fWireID
WireID for the hit (Cryostat, TPC, Plane, Wire)
Definition: Hit.h:72
float fSigmaIntegral
the uncertainty of integral under the calibrated signal waveform of the hit, in ADC units ...
Definition: Hit.h:65
float fGoodnessOfFit
how well do we believe we know this hit?
Definition: Hit.h:68
static bool * b
Definition: config.cpp:1043
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
Definition: Hit.h:223
short int fLocalIndex
index of this hit among the Multiplicity() hits in the signal window
Definition: Hit.h:67
float SigmaPeakTime() const
Uncertainty for the signal peak, in tick units.
Definition: Hit.h:219
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
float fIntegral
the integral under the calibrated signal waveform of the hit, in tick x ADC units ...
Definition: Hit.h:64
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
LArSoft geometry interface.
Definition: ChannelGeo.h:16
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:230
QTextStream & endl(QTextStream &s)