LDMX Software
SiStripDigitizer.h
1#pragma once
2
3#include <map>
4#include <random>
5#include <utility>
6
7#include "Acts/Definitions/Algebra.hpp"
9#include "Tracking/Digitization/SiStripConstants.h"
10
11namespace tracking::digitization {
12
61 public:
62 // I like not having underscores for struct members,
63 // but that's not settable until a later version of clang-tidy
64 // NOLINTBEGIN(readability-identifier-naming)
66 struct SensorParams {
68 double thickness{0.0};
70 double sense_pitch{SENSE_PITCH_MM};
72 double readout_pitch{READOUT_PITCH_MM};
74 double bias_voltage{BIAS_VOLTAGE_V};
76 double depletion_voltage{DEPLETION_VOLTAGE_V};
78 double temperature{TEMPERATURE_K};
80 double noise_electrons{NOISE_ELECTRONS};
82 double threshold_electrons{THRESHOLD_ELECTRONS};
84 bool is_n_type{true};
89 /***** lorentz angles should be calculated from sensor geometry and
90 * bfield *********/
98 double trapping{0.0};
108 int n_readout_strips{N_READOUT_STRIPS};
112 double readout_transfer_efficiency{READOUT_TRANSFER_EFFICIENCY};
116 double sense_transfer_efficiency{SENSE_TRANSFER_EFFICIENCY};
117 };
118 // NOLINTEND(readability-identifier-naming)
119
120 SiStripDigitizer() = default;
121
122 explicit SiStripDigitizer(const SensorParams& params) : params_(params) {}
123
126 void seed(uint64_t s) { generator_.seed(s); }
127
144 std::map<int, double> computeStripCharges(double edep,
145 const Acts::Vector3& local_pos,
146 const Acts::Vector3& local_dir,
147 double path_length) const;
148
155 void applyNoiseAndThreshold(std::map<int, double>& strip_charges);
156
157 const SensorParams& params() const { return params_; }
158 SensorParams& mutableParams() { return params_; }
159
161 void setThickness(double thickness) { params_.thickness = thickness; }
162
163 private:
169 int adaptiveNSegments(const Acts::Vector3& local_dir,
170 double path_length) const;
171
179 double diffusionSigma(double d, bool is_minority) const;
180
186 double stripFraction(double u0, double sigma, double strip_center,
187 double pitch) const;
188
201 std::map<int, double> computeCarrierCharges(
202 double q_per_seg, int n_seg, const Acts::Vector3& local_pos,
203 const Acts::Vector3& local_dir, double path_length, double w_collect,
204 double lorentz_tan, bool is_minority) const;
205
211 std::map<int, double> senseToReadout(
212 const std::map<int, double>& sense_charges) const;
213
214 SensorParams params_;
215 std::default_random_engine generator_;
216 std::normal_distribution<double> normal_{0.0, 1.0};
217};
218
219} // namespace tracking::digitization
Class which encapsulates information from a hit in a simulated tracking detector.
Realistic digitization of silicon strip sensor hits.
std::map< int, double > computeStripCharges(double edep, const Acts::Vector3 &local_pos, const Acts::Vector3 &local_dir, double path_length) const
Simulate charge collection for a single hit.
int adaptiveNSegments(const Acts::Vector3 &local_dir, double path_length) const
Number of track sub-segments, chosen adaptively so that the U displacement per segment does not excee...
double diffusionSigma(double d, bool is_minority) const
Diffusion sigma [mm] for carriers drifting distance d [mm].
void setThickness(double thickness)
Set the sensor thickness [mm] from the geometry before processing hits.
void seed(uint64_t s)
Seed the internal random-number engine.
double stripFraction(double u0, double sigma, double strip_center, double pitch) const
Fraction of a Gaussian charge cloud (centred at u0 with sigma sigma) collected by a strip of width pi...
void applyNoiseAndThreshold(std::map< int, double > &strip_charges)
Add Gaussian electronic noise to signal strips and their immediate neighbours, then remove strips bel...
std::map< int, double > senseToReadout(const std::map< int, double > &sense_charges) const
Sum sense-strip charges into readout-strip charges according to the AC-coupling ratio ratio = round(r...
std::map< int, double > computeCarrierCharges(double q_per_seg, int n_seg, const Acts::Vector3 &local_pos, const Acts::Vector3 &local_dir, double path_length, double w_collect, double lorentz_tan, bool is_minority) const
Simulate one carrier type and return the sense-strip charge map.
All parameters describing one silicon strip sensor layer.
double electron_lorentz_tangent
tan(θ_Lorentz) for electrons. Sign encodes U-shift direction.
double threshold_electrons
Readout threshold [electrons]. Strips below this are suppressed.
double readout_pitch
Readout strip pitch [mm]. Must be an integer multiple of sense_pitch.
double sense_pitch
Sense (inner) electrode pitch [mm].
double noise_electrons
Electronic noise sigma [electrons ENC].
double thickness
Sensor thickness [mm]. Must be set from the geometry before use.
double bias_voltage
Applied reverse-bias voltage [V].
double deposition_granularity
Adaptive segmentation granularity: max U-step as fraction of sense_pitch.
double trapping
Charge-trapping fraction lost per 100 µm of drift.
bool hole_side_readout
Simulate and read out the hole-collection side (p-strips / backplane).
double readout_transfer_efficiency
AC-coupling transfer efficiency from a paired sense strip (physically under a readout strip,...
int n_segments_min
Minimum number of track sub-segments (used when the track is close to normal incidence so the adaptiv...
double sense_transfer_efficiency
AC-coupling transfer efficiency from an unpaired sense strip (between two readout strips,...
bool electron_side_readout
Simulate and read out the electron-collection side (n-strips).
bool is_n_type
true = n-type bulk; false = p-type bulk. LDMX (and HPS) use n-type bulk.