BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SimulationElement Class Reference

Data stucture containing both input and output of a single detector cell. More...

Collaboration diagram for SimulationElement:
[legend]

Public Member Functions

 SimulationElement ()=delete
 
 SimulationElement (const SimulationElement &other)
 
 SimulationElement (double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel, const Eigen::Matrix2cd &beam_polarization, const Eigen::Matrix2cd &analyzer, bool isSpecular_)
 
 SimulationElement (SimulationElement &&other)
 
 ~SimulationElement ()
 
void addIntensity (double intensity)
 
double getAlpha (double x, double y) const
 
double getAlphaI () const
 
double getAlphaMean () const
 
kvector_t getKi () const
 
kvector_t getMeanKf () const
 
double getPhi (double x, double y) const
 
double getPhiI () const
 
double getPhiMean () const
 
kvector_t getQ (double x, double y) const
 Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y. More...
 
double integrationFactor (double x, double y) const
 
double intensity () const
 
bool isSpecular () const
 Tells if simulation element corresponds to a specular peak. More...
 
kvector_t meanQ () const
 
SimulationElementoperator= (const SimulationElement &)=delete
 
SimulationElement pointElement (double x, double y) const
 Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y. More...
 
const PolarizationHandlerpolarizationHandler () const
 Returns assigned PolarizationHandler. More...
 
void setIntensity (double intensity)
 
double solidAngle () const
 
double wavelength () const
 

Private Member Functions

kvector_t getKf (double x, double y) const
 Returns outgoing wavevector Kf for in-pixel coordinates x,y. More...
 

Private Attributes

const double m_alpha_i
 incident grazing angle More...
 
double m_intensity
 simulated intensity for detector cell More...
 
const bool m_is_specular
 
const kvector_t m_k_i
 cached value of k_i More...
 
const kvector_t m_mean_kf
 cached value of mean_kf More...
 
const double m_phi_i
 incident angle in xy plane More...
 
std::unique_ptr< IPixelm_pixel
 
const PolarizationHandler m_polarization
 
const double m_wavelength
 wavelength of beam More...
 

Detailed Description

Data stucture containing both input and output of a single detector cell.

Definition at line 32 of file SimulationElement.h.

Constructor & Destructor Documentation

◆ SimulationElement() [1/4]

SimulationElement::SimulationElement ( )
delete

◆ SimulationElement() [2/4]

SimulationElement::SimulationElement ( double  wavelength,
double  alpha_i,
double  phi_i,
std::unique_ptr< IPixel pixel,
const Eigen::Matrix2cd &  beam_polarization,
const Eigen::Matrix2cd &  analyzer,
bool  isSpecular_ 
)

Definition at line 19 of file SimulationElement.cpp.

23  : m_polarization(beam_polarization, analyzer)
25  , m_alpha_i(alpha_i)
26  , m_phi_i(phi_i)
28  , m_mean_kf(pixel->getK(0.5, 0.5, m_wavelength))
29  , m_pixel(std::move(pixel))
30  , m_is_specular(isSpecular_)
31  , m_intensity(0.0)
32 {
33 }
kvector_t vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition: Direction.cpp:19
const PolarizationHandler m_polarization
const bool m_is_specular
double wavelength() const
double m_intensity
simulated intensity for detector cell
const double m_wavelength
wavelength of beam
const double m_phi_i
incident angle in xy plane
const kvector_t m_mean_kf
cached value of mean_kf
const double m_alpha_i
incident grazing angle
const kvector_t m_k_i
cached value of k_i
std::unique_ptr< IPixel > m_pixel

◆ SimulationElement() [3/4]

SimulationElement::SimulationElement ( const SimulationElement other)

Definition at line 35 of file SimulationElement.cpp.

37  , m_wavelength(other.m_wavelength)
38  , m_alpha_i(other.m_alpha_i)
39  , m_phi_i(other.m_phi_i)
40  , m_k_i(other.m_k_i)
41  , m_mean_kf(other.m_mean_kf)
42  , m_pixel(std::move(other.m_pixel->clone()))
44  , m_intensity(other.m_intensity)
45 {
46 }

◆ SimulationElement() [4/4]

SimulationElement::SimulationElement ( SimulationElement &&  other)
default

◆ ~SimulationElement()

SimulationElement::~SimulationElement ( )
default

Member Function Documentation

◆ addIntensity()

void SimulationElement::addIntensity ( double  intensity)
inline

Definition at line 55 of file SimulationElement.h.

55 { m_intensity += intensity; }
double intensity() const

References intensity(), and m_intensity.

Referenced by ParticleLayoutComputation::compute(), and RoughMultiLayerComputation::compute().

Here is the call graph for this function:

◆ getAlpha()

double SimulationElement::getAlpha ( double  x,
double  y 
) const

Definition at line 92 of file SimulationElement.cpp.

93 {
94  return M_PI_2 - getKf(x, y).theta();
95 }
#define M_PI_2
Definition: Constants.h:45
double theta() const
Returns polar angle.
kvector_t getKf(double x, double y) const
Returns outgoing wavevector Kf for in-pixel coordinates x,y.

References getKf(), M_PI_2, and BasicVector3D< T >::theta().

Referenced by getAlphaMean().

Here is the call graph for this function:

◆ getAlphaI()

double SimulationElement::getAlphaI ( ) const
inline

Definition at line 50 of file SimulationElement.h.

50 { return m_alpha_i; }

References m_alpha_i.

Referenced by GISASSpecularComputation::compute(), and ISimulation2D::normalize().

◆ getAlphaMean()

double SimulationElement::getAlphaMean ( ) const
inline

Definition at line 52 of file SimulationElement.h.

52 { return getAlpha(0.5, 0.5); }
double getAlpha(double x, double y) const

References getAlpha().

Referenced by RoughMultiLayerComputation::compute().

Here is the call graph for this function:

◆ getKf()

kvector_t SimulationElement::getKf ( double  x,
double  y 
) const
private

Returns outgoing wavevector Kf for in-pixel coordinates x,y.

In-pixel coordinates take values from 0 to 1.

Definition at line 75 of file SimulationElement.cpp.

76 {
77  return m_pixel->getK(x, y, m_wavelength);
78 }

References m_pixel, and m_wavelength.

Referenced by getAlpha(), and getPhi().

◆ getKi()

kvector_t SimulationElement::getKi ( ) const

Definition at line 63 of file SimulationElement.cpp.

64 {
65  return m_k_i;
66 }

References m_k_i.

Referenced by FormFactorCoherentPart::evaluate(), FormFactorCoherentPart::evaluatePol(), getQ(), and meanQ().

◆ getMeanKf()

kvector_t SimulationElement::getMeanKf ( ) const

◆ getPhi()

double SimulationElement::getPhi ( double  x,
double  y 
) const

Definition at line 97 of file SimulationElement.cpp.

98 {
99  return getKf(x, y).phi();
100 }
double phi() const
Returns azimuth angle.

References getKf(), and BasicVector3D< T >::phi().

Referenced by getPhiMean().

Here is the call graph for this function:

◆ getPhiI()

double SimulationElement::getPhiI ( ) const
inline

Definition at line 51 of file SimulationElement.h.

51 { return m_phi_i; }

References m_phi_i.

◆ getPhiMean()

double SimulationElement::getPhiMean ( ) const
inline

Definition at line 53 of file SimulationElement.h.

53 { return getPhi(0.5, 0.5); }
double getPhi(double x, double y) const

References getPhi().

Here is the call graph for this function:

◆ getQ()

kvector_t SimulationElement::getQ ( double  x,
double  y 
) const

Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y.

In-pixel coordinates take values from 0 to 1.

Definition at line 87 of file SimulationElement.cpp.

88 {
89  return getKi() - m_pixel->getK(x, y, m_wavelength);
90 }
kvector_t getKi() const

References getKi(), m_pixel, and m_wavelength.

Here is the call graph for this function:

◆ integrationFactor()

double SimulationElement::integrationFactor ( double  x,
double  y 
) const

Definition at line 102 of file SimulationElement.cpp.

103 {
104  return m_pixel->integrationFactor(x, y);
105 }

References m_pixel.

Referenced by IInterferenceFunctionStrategy::evaluate_for_fixed_angles().

◆ intensity()

double SimulationElement::intensity ( ) const
inline

◆ isSpecular()

bool SimulationElement::isSpecular ( ) const
inline

Tells if simulation element corresponds to a specular peak.

Definition at line 70 of file SimulationElement.h.

70 { return m_is_specular; }

References m_is_specular.

Referenced by GISASSpecularComputation::compute().

◆ meanQ()

kvector_t SimulationElement::meanQ ( ) const

Definition at line 80 of file SimulationElement.cpp.

81 {
82  return getKi() - getMeanKf();
83 }
kvector_t getMeanKf() const

References getKi(), and getMeanKf().

Referenced by RoughMultiLayerComputation::compute(), DecouplingApproximationStrategy::polarizedCalculation(), SSCApproximationStrategy::polarizedCalculation(), DecouplingApproximationStrategy::scalarCalculation(), and SSCApproximationStrategy::scalarCalculation().

Here is the call graph for this function:

◆ operator=()

SimulationElement& SimulationElement::operator= ( const SimulationElement )
delete

◆ pointElement()

SimulationElement SimulationElement::pointElement ( double  x,
double  y 
) const

Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y.

Definition at line 52 of file SimulationElement.cpp.

53 {
54  return {m_wavelength,
55  m_alpha_i,
56  m_phi_i,
57  std::unique_ptr<IPixel>(m_pixel->createZeroSizePixel(x, y)), // TODO simplify
61 }
Eigen::Matrix2cd getAnalyzerOperator() const
Gets the polarization analyzer operator (in spin basis along z-axis)
Eigen::Matrix2cd getPolarization() const
Gets the polarization density matrix (in spin basis along z-axis)

References PolarizationHandler::getAnalyzerOperator(), PolarizationHandler::getPolarization(), m_alpha_i, m_is_specular, m_phi_i, m_pixel, m_polarization, and m_wavelength.

Referenced by IInterferenceFunctionStrategy::evaluate_for_fixed_angles().

Here is the call graph for this function:

◆ polarizationHandler()

const PolarizationHandler& SimulationElement::polarizationHandler ( ) const
inline

◆ setIntensity()

void SimulationElement::setIntensity ( double  intensity)
inline

Definition at line 54 of file SimulationElement.h.

References intensity(), and m_intensity.

Referenced by ISimulation2D::addBackgroundIntensity(), GISASSpecularComputation::compute(), and ISimulation2D::normalize().

Here is the call graph for this function:

◆ solidAngle()

double SimulationElement::solidAngle ( ) const

Definition at line 107 of file SimulationElement.cpp.

108 {
109  return m_pixel->solidAngle();
110 }

References m_pixel.

Referenced by GISASSpecularComputation::compute(), IInterferenceFunctionStrategy::evaluate(), and ISimulation2D::normalize().

◆ wavelength()

double SimulationElement::wavelength ( ) const
inline

Member Data Documentation

◆ m_alpha_i

const double SimulationElement::m_alpha_i
private

incident grazing angle

Definition at line 77 of file SimulationElement.h.

Referenced by getAlphaI(), and pointElement().

◆ m_intensity

double SimulationElement::m_intensity
private

simulated intensity for detector cell

Definition at line 83 of file SimulationElement.h.

Referenced by addIntensity(), intensity(), and setIntensity().

◆ m_is_specular

const bool SimulationElement::m_is_specular
private

Definition at line 82 of file SimulationElement.h.

Referenced by isSpecular(), and pointElement().

◆ m_k_i

const kvector_t SimulationElement::m_k_i
private

cached value of k_i

Definition at line 79 of file SimulationElement.h.

Referenced by getKi().

◆ m_mean_kf

const kvector_t SimulationElement::m_mean_kf
private

cached value of mean_kf

Definition at line 80 of file SimulationElement.h.

Referenced by getMeanKf().

◆ m_phi_i

const double SimulationElement::m_phi_i
private

incident angle in xy plane

Definition at line 78 of file SimulationElement.h.

Referenced by getPhiI(), and pointElement().

◆ m_pixel

std::unique_ptr<IPixel> SimulationElement::m_pixel
mutableprivate

Definition at line 81 of file SimulationElement.h.

Referenced by getKf(), getQ(), integrationFactor(), pointElement(), and solidAngle().

◆ m_polarization

const PolarizationHandler SimulationElement::m_polarization
private

Definition at line 75 of file SimulationElement.h.

Referenced by pointElement(), and polarizationHandler().

◆ m_wavelength

const double SimulationElement::m_wavelength
private

wavelength of beam

Definition at line 76 of file SimulationElement.h.

Referenced by getKf(), getQ(), pointElement(), and wavelength().


The documentation for this class was generated from the following files: