BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SimulationElement.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Base/Pixel/SimulationElement.h
6 //! @brief Defines class SimulationElement.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_BASE_PIXEL_SIMULATIONELEMENT_H
21 #define BORNAGAIN_BASE_PIXEL_SIMULATIONELEMENT_H
22 
24 #include "Base/Vector/Vectors3D.h"
25 #include <memory>
26 
27 class IPixel;
28 
29 //! Data stucture containing both input and output of a single detector cell.
30 //! @ingroup simulation
31 
33 public:
34  SimulationElement() = delete;
35  SimulationElement(double wavelength, double alpha_i, double phi_i,
36  std::unique_ptr<IPixel> pixel, const Eigen::Matrix2cd& beam_polarization,
37  const Eigen::Matrix2cd& analyzer, bool isSpecular_);
42 
43  //! Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y.
44  SimulationElement pointElement(double x, double y) const;
45 
46  //! Returns assigned PolarizationHandler
48 
49  double wavelength() const { return m_wavelength; }
50  double getAlphaI() const { return m_alpha_i; }
51  double getPhiI() const { return m_phi_i; }
52  double getAlphaMean() const { return getAlpha(0.5, 0.5); }
53  double getPhiMean() const { return getPhi(0.5, 0.5); }
56  double intensity() const { return m_intensity; }
57  kvector_t getKi() const;
58  kvector_t getMeanKf() const;
59  kvector_t meanQ() const;
60  kvector_t getQ(double x, double y) const;
61 
62  double integrationFactor(double x, double y) const;
63 
64  double solidAngle() const;
65 
66  double getAlpha(double x, double y) const;
67  double getPhi(double x, double y) const;
68 
69  //! Tells if simulation element corresponds to a specular peak
70  bool isSpecular() const { return m_is_specular; }
71 
72 private:
73  kvector_t getKf(double x, double y) const;
74 
76  const double m_wavelength; //!< wavelength of beam
77  const double m_alpha_i; //!< incident grazing angle
78  const double m_phi_i; //!< incident angle in xy plane
79  const kvector_t m_k_i; //!< cached value of k_i
80  const kvector_t m_mean_kf; //!< cached value of mean_kf
81  mutable std::unique_ptr<IPixel> m_pixel;
82  const bool m_is_specular;
83  double m_intensity; //!< simulated intensity for detector cell
84 };
85 
86 #endif // BORNAGAIN_BASE_PIXEL_SIMULATIONELEMENT_H
87 #endif // USER_API
Defines class PolarizationHandler.
Defines basic vectors in Z^3, R^3, C^3.
Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel.
Definition: IPixel.h:25
Convenience class for handling polarization density matrix and polarization analyzer operator.
Data stucture containing both input and output of a single detector cell.
const PolarizationHandler m_polarization
const bool m_is_specular
double solidAngle() const
double wavelength() const
SimulationElement pointElement(double x, double y) const
Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y.
SimulationElement & operator=(const SimulationElement &)=delete
double intensity() const
double getAlphaI() const
double m_intensity
simulated intensity for detector cell
SimulationElement()=delete
void addIntensity(double intensity)
kvector_t getMeanKf() const
kvector_t meanQ() const
double getPhiMean() const
const double m_wavelength
wavelength of beam
SimulationElement(SimulationElement &&other)
void setIntensity(double intensity)
const double m_phi_i
incident angle in xy plane
kvector_t getKf(double x, double y) const
Returns outgoing wavevector Kf for in-pixel coordinates x,y.
double getPhiI() const
kvector_t getKi() const
const kvector_t m_mean_kf
cached value of mean_kf
const double m_alpha_i
incident grazing angle
double integrationFactor(double x, double y) const
kvector_t getQ(double x, double y) const
Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y.
const PolarizationHandler & polarizationHandler() const
Returns assigned PolarizationHandler.
const kvector_t m_k_i
cached value of k_i
std::unique_ptr< IPixel > m_pixel
double getAlphaMean() const
double getAlpha(double x, double y) const
bool isSpecular() const
Tells if simulation element corresponds to a specular peak.
double getPhi(double x, double y) const