Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:06:43

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/Process.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <string>  // IWYU pragma: export
0011 #include <vector>
0012 
0013 #include "corecel/cont/Range.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/inp/Grid.hh"
0016 
0017 namespace celeritas
0018 {
0019 struct Applicability;
0020 class Model;
0021 
0022 //---------------------------------------------------------------------------//
0023 /*!
0024  * An interface/factory method for creating models.
0025  *
0026  * Currently processes pull their data from Geant4 which combines multiple
0027  * model cross sections into an individual range for each particle type.
0028  * Therefore we make the process responsible for providing the combined cross
0029  * section values -- currently this will use preprocessed Geant4 data but later
0030  * we could provide helper functions so that each Process can individually
0031  * combine its models.
0032  *
0033  * Each process has an interaction ("post step doit") and may have both energy
0034  * loss and range limiters.
0035  */
0036 class Process
0037 {
0038   public:
0039     //!@{
0040     //! \name Type aliases
0041     using SPConstModel = std::shared_ptr<Model const>;
0042     using VecModel = std::vector<SPConstModel>;
0043     using ActionIdIter = RangeIter<ActionId>;
0044     using XsGrid = inp::XsGrid;
0045     using EnergyLossGrid = inp::UniformGrid;
0046     //!@}
0047 
0048   public:
0049     // Virtual destructor for polymorphic deletion
0050     virtual ~Process();
0051 
0052     //! Construct the models associated with this process
0053     virtual VecModel build_models(ActionIdIter start_id) const = 0;
0054 
0055     //! Get the interaction cross sections [l/len] for the given energy range
0056     virtual XsGrid macro_xs(Applicability range) const = 0;
0057 
0058     //! Get the energy loss [MeV/len] for the given energy range
0059     virtual EnergyLossGrid energy_loss(Applicability range) const = 0;
0060 
0061     //! Whether the integral method can be used to sample interaction length
0062     virtual bool supports_integral_xs() const = 0;
0063 
0064     //! Whether the process applies when the particle is stopped
0065     virtual bool applies_at_rest() const = 0;
0066 
0067     //! Name of the process
0068     virtual std::string_view label() const = 0;
0069 
0070   protected:
0071     //!@{
0072     //! Allow construction and assignment only through daughter classes
0073     Process() = default;
0074     CELER_DEFAULT_COPY_MOVE(Process);
0075     //!@}
0076 };
0077 
0078 //---------------------------------------------------------------------------//
0079 }  // namespace celeritas