Back to home page

EIC code displayed by LXR

 
 

    


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

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/em/data/FluctuationData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/cont/Array.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "celeritas/Quantities.hh"
0015 #include "celeritas/Types.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Material-dependent parameters used in the energy loss fluctuation model.
0022  */
0023 struct UrbanFluctuationParameters
0024 {
0025     using Energy = units::MevEnergy;
0026     using Real2 = Array<real_type, 2>;
0027 
0028     Real2 binding_energy;  //!< Binding energies E_1 and E_2 [MeV]
0029     Real2 log_binding_energy;  //!< Log of binding energies [LogMevEnergy]
0030     Real2 oscillator_strength;  //!< Oscillator strengths f_1 and f_2
0031 };
0032 
0033 //---------------------------------------------------------------------------//
0034 /*!
0035  * Data needed to sample from the energy loss distribution.
0036  */
0037 template<Ownership W, MemSpace M>
0038 struct FluctuationData
0039 {
0040     template<class T>
0041     using MaterialItems = Collection<T, W, M, MaterialId>;
0042     using Mass = units::MevMass;
0043 
0044     //// MEMBER DATA ////
0045 
0046     ParticleId electron_id;  //!< ID of an electron
0047     Mass electron_mass;  //!< Electron mass
0048     MaterialItems<UrbanFluctuationParameters> urban;  //!< Model parameters
0049 
0050     //// MEMBER FUNCTIONS ////
0051 
0052     //! Check whether the data is assigned
0053     explicit CELER_FUNCTION operator bool() const
0054     {
0055         return electron_id && electron_mass > zero_quantity();
0056     }
0057 
0058     //! Assign from another set of data
0059     template<Ownership W2, MemSpace M2>
0060     FluctuationData& operator=(FluctuationData<W2, M2> const& other)
0061     {
0062         electron_id = other.electron_id;
0063         electron_mass = other.electron_mass;
0064         urban = other.urban;
0065         return *this;
0066     }
0067 };
0068 
0069 //---------------------------------------------------------------------------//
0070 }  // namespace celeritas