24 namespace ActsExamples {
25 namespace Digitization {
39 return std::pair{
value, 0.0};
61 std::normal_distribution<>
dist{0,
sigma};
62 return std::pair{value +
dist(rnd),
dist.stddev()};
72 std::pair<double, double>
range = {std::numeric_limits<double>::lowest(),
73 std::numeric_limits<double>::max()};
76 GaussTrunc(
double sigma_,
const std::pair<double, double>& range_)
87 std::normal_distribution<>
dist{0.,
sigma};
88 double svalue = value +
dist(rnd);
89 if (svalue >=
range.first and svalue <=
range.second) {
90 return std::pair{svalue, dist.stddev()};
92 return ActsFatras::DigitizationError::SmearingOutOfRange;
105 std::pair<double, double>
range = {std::numeric_limits<double>::lowest(),
106 std::numeric_limits<double>::max()};
122 std::normal_distribution<>
dist{0.,
sigma};
123 for (
size_t attempt = 0; attempt <
maxAttemps; ++attempt) {
124 double svalue = value +
dist(rnd);
125 if (svalue >=
range.first and svalue <=
range.second) {
126 return std::pair{svalue, dist.stddev()};
129 return ActsFatras::DigitizationError::SmearingError;
140 Uniform(
double pitch,
const std::pair<double, double>& range_)
142 static_cast<size_t>((range_.second - range_.first) / pitch),
143 range_.first, range_.second) {}
162 std::uniform_real_distribution<>
dist{0., 1.};
164 return std::pair{svalue, (higher -
lower) / std::sqrt(12.)};
166 return ActsFatras::DigitizationError::SmearingError;
177 Digital(
double pitch,
const std::pair<double, double>& range_)
179 static_cast<size_t>((range_.second - range_.first) / pitch),
180 range_.first, range_.second) {}
199 double svalue = 0.5 * (
lower + higher);
200 return std::pair{svalue, (higher -
lower) / std::sqrt(12.)};
202 return ActsFatras::DigitizationError::SmearingError;