27 : m_wavelength(
wavelength), m_alpha(alpha), m_phi(phi), m_intensity(intensity)
39 return Beam(1.0, 0.0, 0.0, 1.0);
43 :
Beam(other.m_wavelength, other.m_alpha, other.m_phi, other.m_intensity)
80 "Beam::setCentralK() -> Error. Wavelength can't be negative or zero.");
83 "Beam::setCentralK() -> Error. Inclination angle alpha_i can't be negative.");
103 throw std::runtime_error(
"Error in Beam::setWidthRatio: footprint factor is nullptr. "
104 "Probably, you have forgotten to initialize it.");
110 if (bloch_vector.
mag() > 1.0) {
112 "Beam::setPolarization: "
113 "The given Bloch vector cannot represent a real physical ensemble");
125 Eigen::Matrix2cd result;
129 result(0, 0) = (1.0 + z) / 2.0;
132 result(1, 1) = (1.0 - z) / 2.0;
Defines the macro ASSERT.
BasicVector3D< double > vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Creates a vector<double> as a wavevector with given wavelength and angles.
static constexpr double INCLINATION_LIMIT
Defines complex_t, and a few elementary functions.
std::complex< double > complex_t
Defines many exception classes in namespace Exceptionss.
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.
Beam defined by wavelength, direction and intensity.
Beam(double wavelength, double alpha, double phi, double intensity)
static Beam horizontalBeam()
void setWidthRatio(double width_ratio)
Sets beam to sample width ratio in footprint factor.
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)
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.
std::vector< const INode * > getChildren() const override
Returns a vector of children (const).
std::unique_ptr< IFootprintFactor > m_shape_factor
footprint correction handler
kvector_t getBlochVector() const
void setCentralK(double wavelength, double alpha_i, double phi_i)
Sets the wavevector in terms of wavelength and incoming angles.
double m_intensity
beam intensity (neutrons/sec)
void registerChild(INode *node)
RealParameter & registerParameter(const std::string &name, double *parpointer)
const std::string & getName() const
void setName(const std::string &name)
void registerVector(const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
RealParameter & setNonnegative()
RealParameter & setLimited(double lower, double upper)
RealParameter & setUnit(const std::string &name)
const double wavelength(0.154)