LDMX Software
StripPulseFitter.h
1#pragma once
2
3#include <vector>
4
5#include "Tracking/Digitization/PulseShape.h"
6
7namespace tracking::digitization {
8
41 public:
42 // I like not having underscores for struct members,
43 // but that's not settable until a later version of clang-tidy
44 // NOLINTBEGIN(readability-identifier-naming)
45 struct FitResult {
46 double amplitude{
47 0};
48 double t0{0};
49 double chi2{0};
50 int ndf{0};
51 bool converged{false};
52 };
53 // NOLINTEND(readability-identifier-naming)
54
65 StripPulseFitter(const PulseShape& shape, double t0_offset_ns,
66 double sampling_interval_ns, double pedestal_adc,
67 double noise_sigma_adc, double t_scan_min_ns = -50.0,
68 double t_scan_max_ns = 150.0, double t_scan_step_ns = 1.0);
69
76 FitResult fit(const std::vector<short>& samples) const;
77
78 private:
80 std::pair<double, double> evalAtT(const std::vector<short>& samples,
81 double T) const;
82
83 const PulseShape* shape_;
84 double t0_offset_ns_;
85 double sampling_interval_ns_;
86 double pedestal_adc_;
87 double inv_sigma2_;
88 double t_scan_min_ns_;
89 double t_scan_max_ns_;
90 double t_scan_step_ns_;
91};
92
93} // namespace tracking::digitization
Abstract base class for silicon-strip readout pulse shapes.
Definition PulseShape.h:30
Fits a pulse shape to the ADC samples of a single silicon-strip readout channel to extract hit amplit...
std::pair< double, double > evalAtT(const std::vector< short > &samples, double T) const
Evaluate χ²(T) and the corresponding best-fit amplitude.
StripPulseFitter(const PulseShape &shape, double t0_offset_ns, double sampling_interval_ns, double pedestal_adc, double noise_sigma_adc, double t_scan_min_ns=-50.0, double t_scan_max_ns=150.0, double t_scan_step_ns=1.0)
double inv_sigma2_
1/σ², pre-computed.
FitResult fit(const std::vector< short > &samples) const
Fit the pulse to the given ADC sample vector.
int ndf
Degrees of freedom = n_samples − 2.
double amplitude
Fitted peak amplitude [ADC counts], ped-subtracted.
bool converged
False if no above-pedestal samples found.
double chi2
Chi-squared value at the minimum.
double t0
Fitted hit arrival time T [ns].