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 #include "Acts/Material/MaterialSlab.hpp"
0013 #include "ActsFatras/EventData/Particle.hpp"
0014 #include "ActsFatras/Utilities/LandauDistribution.hpp"
0015 
0016 #include <array>
0017 
0018 namespace ActsFatras {
0019 
0020 /// Simulate energy loss using the Bethe-Bloch/Landau description.
0021 ///
0022 /// Energy loss is computed using the most probable value and appropriate
0023 /// fluctuations from a Landau distribution. No secondaries are generated
0024 /// for the removed energy.
0025 struct BetheBloch {
0026   /// Scaling for most probable value
0027   double scaleFactorMPV = 1.;
0028   /// Scaling for Sigma
0029   double scaleFactorSigma = 1.;
0030 
0031   /// Simulate energy loss and update the particle parameters.
0032   ///
0033   /// @param[in]     generator is the random number generator
0034   /// @param[in]     slab      defines the passed material
0035   /// @param[in,out] particle  is the particle being updated
0036   /// @return Empty secondaries containers.
0037   ///
0038   /// @tparam generator_t is a RandomNumberEngine
0039   template <typename generator_t>
0040   std::array<Particle, 0> operator()(generator_t &generator,
0041                                      const Acts::MaterialSlab &slab,
0042                                      Particle &particle) const {
0043     // compute energy loss distribution parameters
0044     const float m = particle.mass();
0045     const float qOverP = particle.qOverP();
0046     const float absQ = particle.absoluteCharge();
0047     // most probable value
0048     const float energyLoss =
0049         Acts::computeEnergyLossLandau(slab, m, qOverP, absQ);
0050     // Gaussian-equivalent sigma
0051     const float energyLossSigma =
0052         Acts::computeEnergyLossLandauSigma(slab, m, qOverP, absQ);
0053 
0054     // Simulate the energy loss
0055     // TODO landau location and scale parameters are not identical to the most
0056     //      probable value and the Gaussian-equivalent sigma
0057     LandauDistribution lossDistribution(scaleFactorMPV * energyLoss,
0058                                         scaleFactorSigma * energyLossSigma);
0059     const auto loss = lossDistribution(generator);
0060 
0061     // Apply the energy loss
0062     particle.correctEnergy(-loss);
0063 
0064     // Generates no new particles
0065     return {};
0066   }
0067 };
0068 
0069 }  // namespace ActsFatras