Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05:50

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/phys/PhysicsOptions.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 #include "celeritas/Quantities.hh"
0011 #include "celeritas/Types.hh"
0012 #include "celeritas/Units.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Particle-dependent physics configuration options.
0019  *
0020  * These parameters have different values for light particles
0021  * (electrons/positrons) and heavy particles (muons/hadrons).
0022  *
0023  * Input options are:
0024  * - \c min_range: below this value, there is no extra transformation from
0025  *   particle range to step length.
0026  * - \c max_step_over_range: at higher energy (longer range), gradually
0027  *   decrease the maximum step length until it's this fraction of the tabulated
0028  *   range.
0029  * - \c lowest_energy: tracking cutoff kinetic energy.
0030  * - \c displaced: whether MSC lateral displacement is enabled for e-/e+
0031  * - \c range_factor: used in the MSC step limitation algorithm to restrict the
0032  *   step size to \f$ f_r \cdot max(r, \lambda) \f$ at the start of a track or
0033  *   after entering a volume, where \f$ f_r \f$ is the range factor, \f$ r \f$
0034  *   is the range, and \f$ \lambda \f$ is the mean free path.
0035  * - \c step_limit_algorithm: algorithm used to determine the MSC step limit.
0036  *
0037  * NOTE: min_range/max_step_over_range are not accessible through Geant4, and
0038  * they can also be set to be different for electrons, mu/hadrons, and ions
0039  * (they are set in Geant4 with \c G4EmParameters::SetStepFunction()).
0040  */
0041 struct ParticleOptions
0042 {
0043     using Energy = units::MevEnergy;
0044 
0045     //!@{
0046     //! \name Range calculation
0047     real_type min_range;
0048     real_type max_step_over_range;
0049     //!@}
0050 
0051     //!@{
0052     //! \name Energy loss
0053     Energy lowest_energy;
0054     //!@}
0055 
0056     //!@{
0057     //! \name Multiple scattering
0058     bool displaced;
0059     real_type range_factor;
0060     MscStepLimitAlgorithm step_limit_algorithm;
0061     //!@}
0062 
0063     //! Default options for light particles (electrons/positrons)
0064     static ParticleOptions default_light()
0065     {
0066         ParticleOptions opts;
0067         opts.min_range = real_type{1} * units::millimeter;
0068         opts.max_step_over_range = 0.2;
0069         opts.lowest_energy = ParticleOptions::Energy{0.001};
0070         opts.displaced = true;
0071         opts.range_factor = 0.04;
0072         opts.step_limit_algorithm = MscStepLimitAlgorithm::safety;
0073         return opts;
0074     };
0075 
0076     //! Default options for heavy particles (muons/hadrons)
0077     static ParticleOptions default_heavy()
0078     {
0079         ParticleOptions opts;
0080         opts.min_range = 0.1 * units::millimeter;
0081         opts.max_step_over_range = 0.2;
0082         opts.lowest_energy = ParticleOptions::Energy{0.001};
0083         opts.displaced = false;
0084         opts.range_factor = 0.2;
0085         opts.step_limit_algorithm = MscStepLimitAlgorithm::minimal;
0086         return opts;
0087     };
0088 };
0089 
0090 //---------------------------------------------------------------------------//
0091 /*!
0092  * Physics configuration options.
0093  *
0094  * Input options are:
0095  * - \c fixed_step_limiter: if nonzero, prevent any tracks from taking a step
0096  *   longer than this length.
0097  * - \c min_eprime_over_e: energy scaling fraction used to estimate the maximum
0098  *   cross section over the step in the integral approach for energy loss
0099  *   processes.
0100  * - \c linear_loss_limit: if the mean energy loss along a step is greater than
0101  *   this fractional value of the pre-step kinetic energy, recalculate the
0102  *   energy loss.
0103  * - \c lambda_limit: limit on the MSC mean free path.
0104  * - \c safety_factor: used in the MSC step limitation algorithm to restrict
0105  *   the step size to \f$ f_s s \f$, where \f$ f_s \f$ is the safety factor and
0106  *   \f$  s \f$ is the safety distance.
0107  * - \c secondary_stack_factor: the number of secondary slots per track slot
0108  *   allocated.
0109  * - \c disable_integral_xs: for particles with energy loss processes, the
0110  *   particle energy changes over the step, so the assumption that the cross
0111  *   section is constant is no longer valid. By default, many charged particle
0112  *   processes use MC integration to sample the discrete interaction length
0113  *   with the correct probability. Disable this integral approach for all
0114  *   processes.
0115  */
0116 struct PhysicsOptions
0117 {
0118     //!@{
0119     //! \name Range calculation
0120     real_type fixed_step_limiter{0};
0121     //!@}
0122 
0123     //!@{
0124     //! \name Energy loss
0125     real_type min_eprime_over_e{0.8};
0126     real_type linear_loss_limit{0.01};
0127     //!@}
0128 
0129     //!@{
0130     //! \name Multiple scattering
0131     real_type lambda_limit{real_type{1} * units::millimeter};
0132     real_type safety_factor{0.6};
0133     //!@}
0134 
0135     //!@{
0136     //! \name Particle-dependent parameters
0137     ParticleOptions light{ParticleOptions::default_light()};
0138     ParticleOptions heavy{ParticleOptions::default_heavy()};
0139     //!@}
0140 
0141     real_type secondary_stack_factor{3};
0142     bool disable_integral_xs{false};
0143 };
0144 
0145 //---------------------------------------------------------------------------//
0146 }  // namespace celeritas