25 : m_intensity(intensity)
26 , m_wavelength(wavelength)
28 , m_alpha(direction.alpha())
29 , m_phi(direction.phi())
41 return Beam(1.0, 1.0, {0, 0});
81 throw std::runtime_error(
82 "Beam::setCentralK() -> Error. Wavelength can't be negative or zero.");
89 throw std::runtime_error(
90 "Beam::setCentralK() -> Error. Inclination angle alpha_i can't be negative.");
114 if (bloch_vector.
mag() > 1.0) {
115 throw std::runtime_error(
116 "Beam::setPolarization: "
117 "The given Bloch vector cannot represent a real physical ensemble");
129 Eigen::Matrix2cd result;
133 result(0, 0) = (1.0 + z) / 2.0;
136 result(1, 1) = (1.0 - z) / 2.0;
Defines the macro ASSERT.
static constexpr double INCLINATION_LIMIT
std::complex< double > complex_t
Defines M_PI and some more mathematical constants.
Defines class RealParameter.
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.
An incident neutron or x-ray beam.
Direction direction() const
static Beam horizontalBeam()
void setDirection(const Direction &direction)
void setPolarization(const kvector_t bloch_vector)
Sets the polarization density matrix according to the given Bloch vector.
kvector_t m_bloch_vector
Bloch vector encoding the beam's polarization.
Eigen::Matrix2cd getPolarization() const
Returns the polarization density matrix (in spin basis along z-axis)
double wavelength() const
Beam & operator=(const Beam &other)
const IFootprintFactor * footprintFactor() const
Returns footprint factor.
void setFootprintFactor(const IFootprintFactor &shape_factor)
Sets footprint factor to the beam.
kvector_t getCentralK() const
Returns the wavevector.
void setInclination(const double alpha)
std::vector< const INode * > getChildren() const override
Returns a vector of children.
std::unique_ptr< IFootprintFactor > m_shape_factor
footprint correction handler
kvector_t getBlochVector() const
void setWavelength(double wavelength)
double m_intensity
beam intensity (neutrons/sec)
A direction in three-dimensional space.
kvector_t vector() const
Returns Cartesian 3D vector.
void registerChild(INode *node)
const std::string & getName() const
void registerVector(const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
void setName(const std::string &name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
RealParameter & setNonnegative()
RealParameter & setLimited(double lower, double upper)
RealParameter & setUnit(const std::string &name)