Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:13

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 
0013 #include <numbers>
0014 #include <random>
0015 
0016 namespace ActsFatras::detail {
0017 
0018 /// Generate scattering angles using the Highland/PDG parametrization.
0019 ///
0020 /// The angles are drawn from a single normal distribution with a width
0021 /// given by the Highland/PDG formula.
0022 struct Highland {
0023   /// Generate a single 3D scattering angle.
0024   ///
0025   /// @param[in]     generator is the random number generator
0026   /// @param[in]     slab      defines the passed material
0027   /// @param[in,out] particle  is the particle being scattered
0028   /// @return a 3d scattering angle
0029   ///
0030   /// @tparam generator_t is a RandomNumberEngine
0031   template <typename generator_t>
0032   double operator()(generator_t &generator, const Acts::MaterialSlab &slab,
0033                     Particle &particle) const {
0034     // compute the planar scattering angle
0035     const auto theta0 = Acts::computeMultipleScatteringTheta0(
0036         slab, particle.absolutePdg(), particle.mass(), particle.qOverP(),
0037         particle.absoluteCharge());
0038     // draw from the normal distribution representing the 3d angle distribution
0039     return std::normal_distribution<double>(
0040         0., std::numbers::sqrt2 * theta0)(generator);
0041   }
0042 };
0043 
0044 }  // namespace ActsFatras::detail