Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:20

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/ext/GeantPhysicsOptions.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "celeritas/Constants.hh"
0012 #include "celeritas/Quantities.hh"
0013 
0014 #include "GeantOpticalPhysicsOptions.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 //! Brems selection (TODO: make bitset)
0020 enum class BremsModelSelection
0021 {
0022     none,
0023     seltzer_berger,
0024     relativistic,
0025     all,
0026     size_
0027 };
0028 
0029 //---------------------------------------------------------------------------//
0030 //! MSC selection (TODO: make bitset?)
0031 enum class MscModelSelection
0032 {
0033     none,
0034     urban,  //!< Urban for all energies
0035     wentzelvi,  //!< Wentzel VI for all energies
0036     urban_wentzelvi,  //!< Urban below 100 MeV, Wentzel VI above
0037     size_
0038 };
0039 
0040 //---------------------------------------------------------------------------//
0041 //! Atomic relaxation options
0042 enum class RelaxationSelection
0043 {
0044     none,
0045     radiative,
0046     all,
0047     size_
0048 };
0049 
0050 //---------------------------------------------------------------------------//
0051 /*!
0052  * Construction options for Geant muon EM physics.
0053  */
0054 struct GeantMuonPhysicsOptions
0055 {
0056     //! Enable muon pair production
0057     bool pair_production{false};
0058     //! Enable muon ionization
0059     bool ionization{false};
0060     //! Enable muon bremsstrahlung
0061     bool bremsstrahlung{false};
0062     //! Enable muon single Coulomb scattering
0063     bool coulomb{false};
0064     //! Enable muon multiple Coulomb scattering
0065     bool msc{false};
0066 
0067     //! True if any process is activated
0068     explicit operator bool() const
0069     {
0070         return pair_production || ionization || bremsstrahlung || coulomb
0071                || msc;
0072     }
0073 };
0074 
0075 //! Equality operator
0076 constexpr bool
0077 operator==(GeantMuonPhysicsOptions const& a, GeantMuonPhysicsOptions const& b)
0078 {
0079     // clang-format off
0080     return a.pair_production == b.pair_production
0081            && a.ionization == b.ionization
0082            && a.bremsstrahlung == b.bremsstrahlung
0083            && a.coulomb == b.coulomb
0084            && a.msc == b.msc;
0085     // clang-format on
0086 }
0087 
0088 //---------------------------------------------------------------------------//
0089 /*!
0090  * Construction options for Geant physics.
0091  *
0092  * These options attempt to default to our closest match to \c
0093  * G4StandardEmPhysics. They are passed to the \c detail::CelerEmPhysicsList
0094  * and \c detail::CelerFTFPBert physics lists to provide an easy way to set up
0095  * physics options.
0096  */
0097 struct GeantPhysicsOptions
0098 {
0099     using MevEnergy = Quantity<units::Mev, double>;
0100 
0101     //!@{
0102     //! \name Gamma physics
0103     //! Enable Compton scattering
0104     bool compton_scattering{true};
0105     //! Enable the photoelectric effect
0106     bool photoelectric{true};
0107     //! Enable Rayleigh scattering
0108     bool rayleigh_scattering{true};
0109     //! Enable electron pair production
0110     bool gamma_conversion{true};
0111     //! Use G4GammaGeneral instead of individual gamma processes
0112     bool gamma_general{false};
0113     //!@}
0114 
0115     //!@{
0116     //! \name Electron and positron physics
0117     //! Enable discrete Coulomb
0118     bool coulomb_scattering{false};
0119     //! Enable e- and e+ ionization
0120     bool ionization{true};
0121     //! Enable positron annihilation
0122     bool annihilation{true};
0123     //! Enable bremsstrahlung and select a model
0124     BremsModelSelection brems{BremsModelSelection::all};
0125     //! Enable multiple coulomb scattering and select a model
0126     MscModelSelection msc{MscModelSelection::urban};
0127     //! Enable atomic relaxation and select a model
0128     RelaxationSelection relaxation{RelaxationSelection::none};
0129     //!@}
0130 
0131     //! Muon EM physics
0132     GeantMuonPhysicsOptions muon;
0133 
0134     //!@{
0135     //! \name Physics options
0136     //! Number of log-spaced bins per factor of 10 in energy
0137     int em_bins_per_decade{7};
0138     //! Enable universal energy fluctuations
0139     bool eloss_fluctuation{true};
0140     //! Apply relativistic corrections for select models
0141     bool lpm{true};
0142     //! See \c PhysicsParamsOptions::disable_integral_xs
0143     bool integral_approach{true};
0144     //!@}
0145 
0146     //!@{
0147     //! \name Cutoff options
0148     //! Lowest energy of any EM physics process
0149     MevEnergy min_energy{0.1 * 1e-3};  // 0.1 keV
0150     //! Highest energy of any EM physics process
0151     MevEnergy max_energy{100 * 1e6};  // 100 TeV
0152     //! See \c PhysicsParamsOptions::linear_loss_limit
0153     double linear_loss_limit{0.01};
0154     //! Tracking cutoff kinetic energy for e-/e+
0155     MevEnergy lowest_electron_energy{0.001};  // 1 keV
0156     //! Kill secondaries below the production cut
0157     bool apply_cuts{false};
0158     //! Set the default production cut for all particle types [len]
0159     double default_cutoff{0.1 * units::centimeter};
0160     //!@}
0161 
0162     //!@{
0163     //! \name Multiple scattering configuration
0164     //! E-/e+ range factor for MSC models
0165     double msc_range_factor{0.04};
0166     //! Safety factor for MSC models
0167     double msc_safety_factor{0.6};
0168     //! Lambda limit for MSC models [len]
0169     double msc_lambda_limit{0.1 * units::centimeter};
0170     //! Polar angle limii between single and multiple Coulomb scattering
0171     double msc_theta_limit{constants::pi};
0172     //! Factor for dynamic computation of angular limit between SS and MSC
0173     double angle_limit_factor{1};
0174     //! Step limit algorithm for MSC models
0175     MscStepLimitAlgorithm msc_step_algorithm{MscStepLimitAlgorithm::safety};
0176     //! Nuclear form factor model for Coulomm scattering
0177     NuclearFormFactorType form_factor{NuclearFormFactorType::exponential};
0178     //!@}
0179 
0180     //! Print detailed Geant4 output
0181     bool verbose{false};
0182 
0183     //! Optical physics options
0184     GeantOpticalPhysicsOptions optical{
0185         GeantOpticalPhysicsOptions::deactivated()};
0186 };
0187 
0188 //! Equality operator, mainly for test harness
0189 // TODO: when we require C++20, use `friend bool operator==(...) = default;`
0190 constexpr bool
0191 operator==(GeantPhysicsOptions const& a, GeantPhysicsOptions const& b)
0192 {
0193     // clang-format off
0194     return a.coulomb_scattering == b.coulomb_scattering
0195            && a.photoelectric == b.photoelectric
0196            && a.rayleigh_scattering == b.rayleigh_scattering
0197            && a.gamma_conversion == b.gamma_conversion
0198            && a.gamma_general == b.gamma_general
0199            && a.compton_scattering == b.compton_scattering
0200            && a.ionization == b.ionization
0201            && a.annihilation == b.annihilation
0202            && a.brems == b.brems
0203            && a.msc == b.msc
0204            && a.relaxation == b.relaxation
0205            && a.em_bins_per_decade == b.em_bins_per_decade
0206            && a.eloss_fluctuation == b.eloss_fluctuation
0207            && a.lpm == b.lpm
0208            && a.integral_approach == b.integral_approach
0209            && a.min_energy == b.min_energy
0210            && a.max_energy == b.max_energy
0211            && a.linear_loss_limit == b.linear_loss_limit
0212            && a.lowest_electron_energy == b.lowest_electron_energy
0213            && a.apply_cuts == b.apply_cuts
0214            && a.msc_range_factor == b.msc_range_factor
0215            && a.msc_safety_factor == b.msc_safety_factor
0216            && a.msc_lambda_limit == b.msc_lambda_limit
0217            && a.msc_theta_limit == b.msc_theta_limit
0218            && a.angle_limit_factor == b.angle_limit_factor
0219            && a.msc_step_algorithm == b.msc_step_algorithm
0220            && a.form_factor == b.form_factor
0221            && a.verbose == b.verbose
0222            && a.optical == b.optical;
0223     // clang-format on
0224 }
0225 
0226 //---------------------------------------------------------------------------//
0227 // FREE FUNCTIONS
0228 //---------------------------------------------------------------------------//
0229 
0230 char const* to_cstring(BremsModelSelection value);
0231 char const* to_cstring(MscModelSelection value);
0232 char const* to_cstring(RelaxationSelection value);
0233 
0234 //---------------------------------------------------------------------------//
0235 }  // namespace celeritas