Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 08:20:00

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   /// unused with new implementation in LandauDistribution.hpp
0028   double scaleFactorMPV = 1.;
0029   /// Scaling for Sigma
0030   /// unused with new implementation in LandauDistribution.hpp
0031   double scaleFactorSigma = 1.;
0032 
0033   /// Simulate energy loss and update the particle parameters.
0034   ///
0035   /// @param[in]     generator is the random number generator
0036   /// @param[in]     slab      defines the passed material
0037   /// @param[in,out] particle  is the particle being updated
0038   /// @return Empty secondaries containers.
0039   ///
0040   /// @tparam generator_t is a RandomNumberEngine
0041   template <typename generator_t>
0042   std::array<Particle, 0> operator()(generator_t &generator,
0043                                      const Acts::MaterialSlab &slab,
0044                                      Particle &particle) const {
0045     // compute energy loss distribution parameters
0046     const float m = particle.mass();
0047     const float qOverP = particle.qOverP();
0048     const float absQ = particle.absoluteCharge();
0049     // most probable value
0050     const float energyLoss =
0051         Acts::computeEnergyLossLandau(slab, m, qOverP, absQ);
0052 
0053     const float energyLossFwhm =
0054         Acts::computeEnergyLossLandauFwhm(slab, m, qOverP, absQ);
0055 
0056     // Simulate the energy loss
0057 
0058     LandauDistribution lossDistribution =
0059         LandauDistribution::fromFwhm(energyLoss, energyLossFwhm);
0060 
0061     const double loss = lossDistribution(generator);
0062 
0063     // Apply the energy loss
0064     particle.loseEnergy(loss, SimulationOutcome::KilledInteraction);
0065 
0066     // Generates no new particles
0067     return {};
0068   }
0069 };
0070 
0071 }  // namespace ActsFatras