From 764164866ad27d47b9c3a590304c96a575282685 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 3 Oct 2024 11:23:28 +0200 Subject: [PATCH] re-generate --- .../TruthTracking/ParticleSmearing.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp index 3d84e50ec00..a65011134c0 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/ParticleSmearing.cpp @@ -101,13 +101,18 @@ ActsExamples::ProcessCode ActsExamples::ParticleSmearing::execute( params[Acts::eBoundLoc0] = sigmaD0 * stdNormal(rng); params[Acts::eBoundLoc1] = sigmaZ0 * stdNormal(rng); params[Acts::eBoundTime] = time + sigmaT0 * stdNormal(rng); - // smear direction angles phi,theta ensuring correct bounds - const auto [newPhi, newTheta] = Acts::detail::normalizePhiTheta( - phi + sigmaPhi * stdNormal(rng), theta + sigmaTheta * stdNormal(rng)); - params[Acts::eBoundPhi] = newPhi; - params[Acts::eBoundTheta] = newTheta; - if (std::abs(newTheta) < 1e-6) { - throw std::runtime_error("Theta is too close to zero."); + // smear direction angles phi, theta ensuring correct bounds + while (true) { + const auto [newPhi, newTheta] = Acts::detail::normalizePhiTheta( + phi + sigmaPhi * stdNormal(rng), + theta + sigmaTheta * stdNormal(rng)); + + // We don't want to have theta-values parallel to the beam axis. + if (std::abs(newTheta) > 1e-6) { + params[Acts::eBoundPhi] = newPhi; + params[Acts::eBoundTheta] = newTheta; + break; + } } // compute smeared q/p params[Acts::eBoundQOverP] = qOverP + sigmaQOverP * stdNormal(rng);