Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/celeritas/phys/Process.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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