24 FormFactorTruncatedSphere::FormFactorTruncatedSphere(
const std::vector<double> P)
27 {{
"Radius",
"nm",
"radius", 0, +INF, 0},
28 {
"Height",
"nm",
"height before removal of cap", 0, +INF, 0},
29 {
"DeltaHeight",
"nm",
"height of removed cap", 0, +INF, 0}}},
31 m_radius(m_P[0]), m_height(m_P[1]), m_dh(m_P[2])
33 check_initialization();
37 FormFactorTruncatedSphere::FormFactorTruncatedSphere(
double radius,
double height,
double dh)
42 bool FormFactorTruncatedSphere::check_initialization()
const
45 if (m_height > 2. * m_radius || m_dh > m_height) {
46 std::ostringstream ostr;
47 ostr <<
"::FormFactorTruncatedSphere() -> Error in class initialization ";
48 ostr <<
"with parameters 'radius':" << m_radius <<
" 'height':" << m_height
49 <<
" 'delta_height':" << m_dh <<
"\n\n";
50 ostr <<
"Check for height <= 2.*radius AND delta_height < height failed.";
57 complex_t FormFactorTruncatedSphere::Integrand(
double Z)
const
59 double Rz = std::sqrt(m_radius * m_radius - Z * Z);
60 complex_t qx = m_q.
x();
61 complex_t qy = m_q.
y();
62 complex_t q_p = std::sqrt(qx * qx + qy * qy);
70 if (std::abs(q.
mag()) < std::numeric_limits<double>::epsilon()) {
72 * (m_height * m_height * (3. * m_radius - m_height)
73 - m_dh * m_dh * (3. * m_radius - m_dh));
76 complex_t integral =
ComplexIntegrator().integrate([&](
double Z) {
return Integrand(Z); },
77 m_radius - m_height, m_radius - m_dh);
78 return M_TWOPI * integral *
exp_I(q.
z() * (m_height - m_radius));
84 double height = m_height - m_dh;
87 effects.dz_top + m_dh);
88 return createTransformedFormFactor(slicedff, rot, effects.position);
93 mP_shape = std::make_unique<TruncatedEllipsoid>(m_radius, m_radius, m_radius, m_height, m_dh);
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Defines many exception classes in namespace Exceptionss.
Defines classes RealIntegrator, ComplexIntegrator.
Defines M_PI and some more mathematical constants.
Defines namespace MathFunctions.
Defines class RealLimits.
Defines class TruncatedEllipsoid.
double mag() const
Returns magnitude of the vector.
T z() const
Returns z-component in cartesian coordinate system.
T y() const
Returns y-component in cartesian coordinate system.
T x() const
Returns x-component in cartesian coordinate system.
To integrate a complex function of a real variable.
Pure virtual interface for rotations.
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
double Bessel_J1c(double x)
Bessel function Bessel_J1(x)/x.