Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:54:44

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/io/ImportParameters.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <map>
0010 
0011 #include "celeritas/Constants.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/Units.hh"
0014 
0015 #include "ImportUnits.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Common electromagnetic physics parameters (see G4EmParameters.hh).
0022  *
0023  * \note Geant4 v11 removed the Spline() option from G4EmParameters.hh.
0024  * \note The Geant4 MSC models use the values in \c G4EmParameters as the
0025  * defaults; however, the MSC parameters can also be set directly using the
0026  * model setter methods (there is no way to retrieve the values from the model
0027  * in that case).
0028  */
0029 struct ImportEmParameters
0030 {
0031     static constexpr auto energy_units{ImportUnits::mev};
0032 
0033     //! Energy loss fluctuation
0034     bool energy_loss_fluct{false};
0035     //! LPM effect for bremsstrahlung and pair production
0036     bool lpm{true};
0037     //! Integral cross section rejection
0038     bool integral_approach{true};
0039     //! Slowing down threshold for linearity assumption
0040     double linear_loss_limit{0.01};
0041     //! Lowest e-/e+ kinetic energy [MeV]
0042     double lowest_electron_energy{0.001};
0043     //! Lowest muon/hadron kinetic energy [MeV]
0044     double lowest_muhad_energy{0.001};
0045     //! Whether auger emission should be enabled (valid only for relaxation)
0046     bool auger{false};
0047     //! MSC step limit algorithm for e-/e+
0048     MscStepLimitAlgorithm msc_step_algorithm{MscStepLimitAlgorithm::safety};
0049     //! MSC step limit algorithm for muon/hadron
0050     MscStepLimitAlgorithm msc_muhad_step_algorithm{
0051         MscStepLimitAlgorithm::minimal};
0052     //! MSC lateral displacement for e-/e+
0053     double msc_displaced{true};
0054     //! MSC lateral displacement for muon/hadron
0055     double msc_muhad_displaced{false};
0056     //! MSC range factor for e-/e+
0057     double msc_range_factor{0.04};
0058     //! MSC range factor for muon/hadron
0059     double msc_muhad_range_factor{0.2};
0060     //! MSC safety factor
0061     double msc_safety_factor{0.6};
0062     //! MSC lambda limit [length]
0063     double msc_lambda_limit{1 * units::millimeter};
0064     //! Polar angle limit between single and multiple Coulomb scattering
0065     double msc_theta_limit{constants::pi};
0066     //! Kill secondaries below production cut
0067     bool apply_cuts{false};
0068     //! Nuclear screening factor for single/multiple Coulomb scattering
0069     double screening_factor{1};
0070     //! Factor for dynamic computation of angular limit between SS and MSC
0071     double angle_limit_factor{1};
0072     //! Nuclear form factor model for Coulomb scattering
0073     NuclearFormFactorType form_factor{NuclearFormFactorType::exponential};
0074 
0075     //! Whether parameters are assigned and valid
0076     explicit operator bool() const
0077     {
0078         return linear_loss_limit > 0 && lowest_electron_energy > 0
0079                && msc_step_algorithm != MscStepLimitAlgorithm::size_
0080                && msc_muhad_step_algorithm != MscStepLimitAlgorithm::size_
0081                && msc_range_factor > 0 && msc_range_factor < 1
0082                && msc_muhad_range_factor > 0 && msc_muhad_range_factor < 1
0083                && msc_safety_factor >= 0.1 && msc_lambda_limit > 0
0084                && msc_theta_limit >= 0 && msc_theta_limit <= constants::pi
0085                && screening_factor > 0 && angle_limit_factor > 0
0086                && form_factor != NuclearFormFactorType::size_;
0087     }
0088 };
0089 
0090 //---------------------------------------------------------------------------//
0091 /*!
0092  * Particle-dependent parameters for killing looping tracks.
0093  */
0094 struct ImportLoopingThreshold
0095 {
0096     static constexpr auto energy_units{ImportUnits::mev};
0097 
0098     //! Number of steps a higher-energy looping track takes before it's killed
0099     int threshold_trials{10};
0100     //! Energy below which looping tracks are immediately killed [MeV]
0101     double important_energy{250};
0102 
0103     //! Whether parameters are assigned and valid
0104     explicit operator bool() const
0105     {
0106         return threshold_trials > 0 && important_energy >= 0;
0107     }
0108 };
0109 
0110 //---------------------------------------------------------------------------//
0111 /*!
0112  * Parameters related to transportation.
0113  *
0114  * The looping thresholds are particle-dependent and stored in a map where the
0115  * keys are the PDG number.
0116  */
0117 struct ImportTransParameters
0118 {
0119     //!@{
0120     //! \name Type aliases
0121     using PDGInt = int;
0122     using ImportLoopingMap = std::map<PDGInt, ImportLoopingThreshold>;
0123     //!@}
0124 
0125     //! Thresholds for killing looping tracks
0126     ImportLoopingMap looping;
0127     //! Maximum number of substeps in the field propagator
0128     int max_substeps{1000};
0129 
0130     //! Whether parameters are assigned and valid
0131     explicit operator bool() const
0132     {
0133         return max_substeps >= 0 && !looping.empty();
0134     }
0135 };
0136 
0137 //---------------------------------------------------------------------------//
0138 /*!
0139  * TODO: Placeholder for optical parameter data.
0140  * See \c G4OpticalParameters .
0141  */
0142 struct ImportOpticalParameters
0143 {
0144     bool scintillation_by_particle{false};
0145 };
0146 
0147 //---------------------------------------------------------------------------//
0148 }  // namespace celeritas