Commit 59b52c3 1 parent 35b08a0 commit 59b52c3 Copy full SHA for 59b52c3
File tree 2 files changed +18
-4
lines changed
tests/include/detray/test/utils/simulation
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,20 @@ struct random_numbers {
75
75
76
76
// / Explicit normal distribution around a @param mean and @param stddev
77
77
DETRAY_HOST auto normal (const scalar_t mean, const scalar_t stddev) {
78
- return stddev == scalar_t {0 }
79
- ? mean
80
- : std::normal_distribution<scalar_t >(mean, stddev)(m_engine);
78
+ const bool is_zero_stddev{stddev == scalar_t {0 }};
79
+ const scalar_t ret{is_zero_stddev ? mean
80
+ : std::normal_distribution<scalar_t >(
81
+ mean, stddev)(m_engine)};
82
+ // Hotfix for the traccc wire chamber Kalman fitter CI tests: Only a
83
+ // specific set of tracks pass the test, so detray needs to make sure
84
+ // that these tracks are generated in the random_track_generator. This
85
+ // means that the correct number of draws from the random number engine
86
+ // needs to be done in order to arrive at the SAME internal state of
87
+ // 'm_engine'. TODO: Remove once the test are stable
88
+ if (is_zero_stddev) {
89
+ std::normal_distribution<scalar_t >(mean, 1 .f )(m_engine);
90
+ }
91
+ return ret;
81
92
}
82
93
83
94
// / 50:50 coin toss
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ struct scattering_helper {
38
38
39
39
// Generate theta and phi for random scattering
40
40
const scalar_type r_theta{
41
- std::normal_distribution<scalar_type>(0 .f , angle)(generator)};
41
+ angle == scalar_type{0 }
42
+ ? 0 .f
43
+ : std::normal_distribution<scalar_type>(0 .f , angle)(generator)};
44
+
42
45
const scalar_type r_phi{std::uniform_real_distribution<scalar_type>(
43
46
-constant<scalar_type>::pi , constant<scalar_type>::pi )(generator)};
44
47
You can’t perform that action at this time.
0 commit comments