Back to home page

EIC code displayed by LXR

 
 

    


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

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