Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:45

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/Model.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <set>
0011 #include <string>  // IWYU pragma: export
0012 #include <vector>
0013 
0014 #include "corecel/Types.hh"
0015 #include "celeritas/Types.hh"
0016 #include "celeritas/global/ActionInterface.hh"  // IWYU pragma: export
0017 #include "celeritas/grid/ValueGridBuilder.hh"
0018 
0019 #include "Applicability.hh"  // IWYU pragma: export
0020 
0021 namespace celeritas
0022 {
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Abstract base class representing a physics model with a discrete action.
0026  *
0027  * A Model is a representation (often an approximation) to a physics process
0028  * such as Compton scattering that is valid for one or more particle types in a
0029  * given range (or ranges) of energy.
0030  *
0031  * Each Model subclass is constructed with a unique ActionId by a Process,
0032  * which is effectively a group of Models. Once constructed, it is essentially
0033  * immutable.
0034  *
0035  * The model assumes a few responsibilities:
0036  * - It provides accessors for the ranges of applicability: the same model
0037  *   (interaction kernel) can apply to multiple particles at different energy
0038  *   ranges.
0039  * - It precalculates macroscopic cross sections for each range of
0040  *   applicability.
0041  * - It precalculates energy loss rates and range limiters for each range.
0042  * - If it has an interaction cross section, it provides an "execute" method
0043  *   for applying the interaction and possibly emitting secondaries.
0044  *
0045  * This class is similar to Geant4's G4VContinuousDiscrete process, but more
0046  * limited.
0047  */
0048 class Model : public CoreStepActionInterface
0049 {
0050   public:
0051     //@{
0052     //! Type aliases
0053     using UPConstGridBuilder = std::unique_ptr<ValueGridBuilder const>;
0054     using MicroXsBuilders = std::vector<UPConstGridBuilder>;
0055     using SetApplicability = std::set<Applicability>;
0056     //@}
0057 
0058   public:
0059     //! Get the applicable particle type and energy ranges of the model
0060     virtual SetApplicability applicability() const = 0;
0061 
0062     //! Get the microscopic cross sections for the given particle and material
0063     virtual MicroXsBuilders micro_xs(Applicability range) const = 0;
0064 
0065     //! Dependency ordering of the action
0066     StepActionOrder order() const final { return StepActionOrder::post; }
0067 };
0068 
0069 //---------------------------------------------------------------------------//
0070 }  // namespace celeritas