28 EXCEPTION_RAISE(
"RandomSeedException",
29 "Noise generator was not seeded before use");
31 ldmx_log(trace) <<
"Empty channels: " << emptyChannels;
40 ldmx_log(trace) <<
"Integral: " << integral;
42 double noise_hit_count =
random_->Binomial(emptyChannels, integral);
43 ldmx_log(trace) <<
"# Noise hits_: " << noise_hit_count;
45 std::vector<double> noise_hits;
46 for (
int hit_index = 0; hit_index < noise_hit_count; ++hit_index) {
47 double rand =
random_->Uniform();
48 ldmx_log(trace) <<
"Rand: " << rand;
49 double draw = integral * rand;
50 ldmx_log(trace) <<
"Draw: " << draw;
52 double cumulative_prob = 1.0 - integral + draw;
53 ldmx_log(trace) <<
"Cumulative probability: " << cumulative_prob;
55 double value_above_threshold;
57 value_above_threshold =
58 ROOT::Math::gaussian_quantile(cumulative_prob,
noise_);
60 value_above_threshold =
63 ldmx_log(trace) <<
"Noise value: " << value_above_threshold;
65 noise_hits.push_back(value_above_threshold);