LDMX Software
FittedSiStripHit.h
1#pragma once
2
3#include <iostream>
4
5#include "TObject.h"
6
7namespace ldmx {
8
24 public:
25 FittedSiStripHit() = default;
26
27 FittedSiStripHit(int layer_id, int strip_id, float amplitude, float t0,
28 float chi2, int ndf, int track_id = -1, int pdg_id = 0,
29 int sim_hit_id = -1, float edep = 0.f)
30 : layer_id_(layer_id),
31 strip_id_(strip_id),
32 amplitude_(amplitude),
33 t0_(t0),
34 chi2_(chi2),
35 ndf_(ndf),
36 track_id_(track_id),
37 pdg_id_(pdg_id),
38 sim_hit_id_(sim_hit_id),
39 edep_(edep) {}
40
41 virtual ~FittedSiStripHit() = default;
42
43 void clear() {
44 layer_id_ = -1;
45 strip_id_ = -1;
46 amplitude_ = 0;
47 t0_ = 0;
48 chi2_ = 0;
49 ndf_ = 0;
50 track_id_ = -1;
51 pdg_id_ = 0;
52 sim_hit_id_ = -1;
53 edep_ = 0.f;
54 }
55
56 // --- Getters ---
57 int getLayerID() const { return layer_id_; }
58 int getStripID() const { return strip_id_; }
60 float getAmplitude() const { return amplitude_; }
62 float getT0() const { return t0_; }
63 float getChi2() const { return chi2_; }
64 int getNDF() const { return ndf_; }
65 float getReducedChi2() const { return (ndf_ > 0) ? chi2_ / ndf_ : 0.f; }
67 int getTrackID() const { return track_id_; }
69 int getPdgID() const { return pdg_id_; }
71 int getSimHitID() const { return sim_hit_id_; }
73 float getEdep() const { return edep_; }
74
75 // --- Setters ---
76 void setLayerID(int v) { layer_id_ = v; }
77 void setStripID(int v) { strip_id_ = v; }
78 void setAmplitude(float v) { amplitude_ = v; }
79 void setT0(float v) { t0_ = v; }
80 void setChi2(float v) { chi2_ = v; }
81 void setNDF(int v) { ndf_ = v; }
82 void setTrackID(int v) { track_id_ = v; }
83 void setPdgID(int v) { pdg_id_ = v; }
84 void setSimHitID(int v) { sim_hit_id_ = v; }
85 void setEdep(float v) { edep_ = v; }
86
87 friend std::ostream& operator<<(std::ostream& o, const FittedSiStripHit& h) {
88 o << "[ FittedSiStripHit ]: layer=" << h.layer_id_
89 << " strip=" << h.strip_id_ << " amp=" << h.amplitude_ << " ADC"
90 << " t0=" << h.t0_ << " ns" << " chi2/ndf=" << h.chi2_ << "/" << h.ndf_
91 << " track_id=" << h.track_id_ << " pdg_id=" << h.pdg_id_
92 << " sim_hit_id=" << h.sim_hit_id_ << " edep=" << h.edep_ << " MeV";
93 return o;
94 }
95
96 protected:
97 int layer_id_{-1};
98 int strip_id_{-1};
100 0};
101 float t0_{0};
102 float chi2_{0};
103 int ndf_{0};
104
105 // Truth information (for MC truth matching; -1/0 means not set)
107 int track_id_{-1};
109 int pdg_id_{0};
111 int sim_hit_id_{-1};
113 float edep_{0.f};
114
115 ClassDef(FittedSiStripHit, 1);
116};
117
118} // namespace ldmx
Result of fitting a pulse shape to the ADC samples of a single readout strip.
int getPdgID() const
PDG particle ID of the particle that created this hit (0 if unknown).
int getSimHitID() const
Detector ID of the originating SimTrackerHit (-1 if unknown).
int track_id_
Geant4 track ID of the particle that created this hit.
float edep_
Energy deposited by the parent SimTrackerHit [MeV].
float t0_
Fitted hit time [ns] in sample-window frame.
int pdg_id_
PDG particle ID of the particle that created this hit.
int getTrackID() const
Geant4 track ID of the particle that created this hit (-1 if unknown).
int sim_hit_id_
Detector ID of the originating SimTrackerHit.
float getEdep() const
Energy deposited by the parent SimTrackerHit [MeV] (0 if unknown).
float getAmplitude() const
Fitted pedestal-subtracted peak amplitude [ADC counts].
float amplitude_
Fitted peak amplitude [ADC counts], pedestal-subtracted.
float getT0() const
Fitted hit arrival time [ns] in the sample-window reference frame.