diff --git a/qudarap/qsim.h b/qudarap/qsim.h index a4b7143d67..5b44b6b22d 100644 --- a/qudarap/qsim.h +++ b/qudarap/qsim.h @@ -783,8 +783,20 @@ inline QSIM_METHOD int qsim::propagate_to_boundary(unsigned& flag, RNG& rng, sct if (wls_wins && wls_absorption_distance <= distance_to_boundary) { // WLS ABSORPTION: photon absorbed by wavelength shifting material - p.time += wls_absorption_distance / group_velocity; - p.pos += wls_absorption_distance * (p.mom); + // + // Subprecision floor + half-thickness ceiling: when wls_absorption_distance + // is below float32 precision at world coords, p.pos += dist*mom rounds to + // no-op and the photon stays on the entry boundary, causing BVH ambiguity + // on the next trace. Force minimum step of 4 ulps along the entering + // direction; cap at half of distance_to_boundary so the floor cannot push + // the photon onto (or past) the exit boundary, which would re-create the + // same ambiguity at the far face. + const float pos_max = fmaxf(fmaxf(fabsf(p.pos.x), fabsf(p.pos.y)), fabsf(p.pos.z)); + const float min_step = pos_max * 4.7683716e-7f; // 4 * 2^-23 + const float max_step = distance_to_boundary * 0.5f; + const float eff_wls_distance = fminf(fmaxf(wls_absorption_distance, min_step), max_step); + p.time += eff_wls_distance / group_velocity; + p.pos += eff_wls_distance * (p.mom); // Sample re-emitted wavelength from WLS emission spectrum ICDF float u_wls_wl = curand_uniform(&rng); diff --git a/tests/geom/nested_dune_module.gdml b/tests/geom/nested_dune_module.gdml new file mode 100644 index 0000000000..a84a488939 --- /dev/null +++ b/tests/geom/nested_dune_module.gdml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/run.mac b/tests/run.mac index e2ed9028b3..5baaa6908b 100644 --- a/tests/run.mac +++ b/tests/run.mac @@ -1,6 +1,8 @@ # Can be run in batch, without graphic # or interactively: Idle> /control/execute run1.mac # +/process/optical/scintillation/setStackPhotons false +/process/optical/cerenkov/setStackPhotons false /run/verbose 1 /run/initialize /run/beamOn 1