Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:54:38

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