Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:19:46

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Material/Interactions.hpp"
0012 #include "ActsFatras/EventData/Particle.hpp"
0013 
0014 #include <numbers>
0015 #include <random>
0016 
0017 namespace ActsFatras::detail {
0018 
0019 /// Generate scattering angles using the Highland/PDG parametrization.
0020 ///
0021 /// The angles are drawn from a single normal distribution with a width
0022 /// given by the Highland/PDG formula.
0023 struct Highland {
0024   /// Generate a single 3D scattering angle.
0025   ///
0026   /// @param[in]     generator is the random number generator
0027   /// @param[in]     slab      defines the passed material
0028   /// @param[in,out] particle  is the particle being scattered
0029   /// @return a 3d scattering angle
0030   ///
0031   /// @tparam generator_t is a RandomNumberEngine
0032   template <typename generator_t>
0033   double operator()(generator_t &generator, const Acts::MaterialSlab &slab,
0034                     Particle &particle) const {
0035     // compute the planar scattering angle
0036     const double theta0 = Acts::computeMultipleScatteringTheta0(
0037         slab, particle.absolutePdg(), particle.mass(), particle.qOverP(),
0038         particle.absoluteCharge());
0039     // draw from the normal distribution representing the 3d angle distribution
0040     return std::normal_distribution<double>(
0041         0., std::numbers::sqrt2 * theta0)(generator);
0042   }
0043 };
0044 
0045 }  // namespace ActsFatras::detail