Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:11:32

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/g4/EmExtraPhysicsHelper.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "corecel/Config.hh"
0012 
0013 #include "corecel/math/Quantity.hh"
0014 #include "corecel/math/UnitUtils.hh"
0015 #include "celeritas/Quantities.hh"
0016 #include "celeritas/UnitTypes.hh"
0017 #include "celeritas/phys/AtomicNumber.hh"
0018 
0019 class G4DynamicParticle;
0020 class G4ElectroNuclearCrossSection;
0021 class G4GammaNuclearXS;
0022 
0023 namespace celeritas
0024 {
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Calculate Geant4 gamma-nuclear and electro-nuclear cross sections.
0028  *
0029  * This class primarily severs as a wrapper around Geant4 cross section
0030  * calculation methods, which are not directly accessible from Celeritas EM
0031  * physics models. Use of this class requires Geant4 11.0 or higher.
0032  */
0033 class EmExtraPhysicsHelper
0034 {
0035   public:
0036     //!@{
0037     using MevEnergy = units::MevEnergy;
0038     using MmSqXs
0039         = Quantity<UnitProduct<units::Millimeter, units::Millimeter>, double>;
0040     //!@}
0041 
0042   public:
0043     // Construct EM extra physics helper
0044     EmExtraPhysicsHelper();
0045 
0046     // Calculate electro-nuclear element cross section
0047     MmSqXs calc_electro_nuclear_xs(AtomicNumber z, MevEnergy energy) const;
0048 
0049     // Calculate gamma-nuclear element cross section
0050     MmSqXs calc_gamma_nuclear_xs(AtomicNumber z, MevEnergy energy) const;
0051 
0052   private:
0053     //// DATA ////
0054     std::shared_ptr<G4DynamicParticle> particle_;
0055     std::shared_ptr<G4ElectroNuclearCrossSection> en_xs_;
0056     std::shared_ptr<G4GammaNuclearXS> gn_xs_;
0057 };
0058 
0059 //---------------------------------------------------------------------------//
0060 // INLINE DEFINITIONS
0061 //---------------------------------------------------------------------------//
0062 
0063 #if CELERITAS_GEANT4_VERSION < 0x0b0000
0064 inline EmExtraPhysicsHelper::EmExtraPhysicsHelper()
0065 {
0066     CELER_NOT_CONFIGURED("Geant4 11 or higher");
0067 }
0068 
0069 inline EmExtraPhysicsHelper::MmSqXs
0070 EmExtraPhysicsHelper::calc_electro_nuclear_xs(AtomicNumber, MevEnergy) const
0071 {
0072     CELER_ASSERT_UNREACHABLE();
0073 }
0074 
0075 inline EmExtraPhysicsHelper::MmSqXs
0076 EmExtraPhysicsHelper::calc_gamma_nuclear_xs(AtomicNumber, MevEnergy) const
0077 {
0078     CELER_ASSERT_UNREACHABLE();
0079 }
0080 
0081 #endif
0082 
0083 //---------------------------------------------------------------------------//
0084 }  // namespace celeritas