Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:55:27

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2018-2021 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Material/Interactions.hpp"
0012 
0013 #include <random>
0014 
0015 namespace ActsFatras::detail {
0016 
0017 /// Generate scattering angles using the Highland/PDG parametrization.
0018 ///
0019 /// The angles are drawn from a single normal distribution with a width
0020 /// given by the Highland/PDG formula.
0021 struct Highland {
0022   /// Generate a single 3D scattering angle.
0023   ///
0024   /// @param[in]     generator is the random number generator
0025   /// @param[in]     slab      defines the passed material
0026   /// @param[in,out] particle  is the particle being scattered
0027   /// @return a 3d scattering angle
0028   ///
0029   /// @tparam generator_t is a RandomNumberEngine
0030   template <typename generator_t>
0031   double operator()(generator_t &generator, const Acts::MaterialSlab &slab,
0032                     Particle &particle) const {
0033     // compute the planar scattering angle
0034     const auto theta0 = Acts::computeMultipleScatteringTheta0(
0035         slab, particle.absolutePdg(), particle.mass(), particle.qOverP(),
0036         particle.absoluteCharge());
0037     // draw from the normal distribution representing the 3d angle distribution
0038     return std::normal_distribution<double>(0.0, M_SQRT2 * theta0)(generator);
0039   }
0040 };
0041 
0042 }  // namespace ActsFatras::detail