forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RayleighData.hh
84 lines (75 loc) · 2.48 KB
/
RayleighData.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//----------------------------------*-C++-*----------------------------------//
// Copyright 2021-2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/em/data/RayleighData.hh
//---------------------------------------------------------------------------//
#pragma once
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "corecel/cont/Array.hh"
#include "corecel/data/Collection.hh"
#include "celeritas/Types.hh"
namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Rayleigh angular parameters to fit tabulated form factors.
*
* The form factors \em FF (constructed by the RayleighModel) are:
* \f[
* FF(E,cos)^2 = \Sigma_{j} \frac{a_j}{[1 + b_j x]^{n}}
* \f]
* where \f$ x = E^{2}(1 - \cos\theta) \f$ and \em n is the high energy slope
* of the form factor and \em a and \em b are free parameters to obtain the
* best fit to the form factor. The unit for the energy (\em E) is in MeV.
*/
struct RayleighParameters
{
Real3 a;
Real3 b;
Real3 n;
};
//---------------------------------------------------------------------------//
/*!
* Model and particles IDs.
*/
struct RayleighIds
{
ActionId action;
ParticleId gamma;
//! Check whether the data is assigned
explicit CELER_FUNCTION operator bool() const { return action && gamma; }
};
//---------------------------------------------------------------------------//
/*!
* Device data for creating an interactor.
*/
template<Ownership W, MemSpace M>
struct RayleighData
{
//! Model and particle IDs
RayleighIds ids;
template<class T>
using ElementItems = celeritas::Collection<T, W, M, ElementId>;
ElementItems<RayleighParameters> params;
//! Check whether the data is assigned
explicit CELER_FUNCTION operator bool() const
{
return ids && !params.empty();
}
//! Assign from another set of data
template<Ownership W2, MemSpace M2>
RayleighData& operator=(RayleighData<W2, M2> const& other)
{
CELER_EXPECT(other);
ids.action = other.ids.action;
ids.gamma = other.ids.gamma;
params = other.params;
return *this;
}
};
using RayleighRef = NativeCRef<RayleighData>;
//---------------------------------------------------------------------------//
} // namespace celeritas