25 : m_u0(0.0), m_v0(0.0), m_direction(
kvector_t(0.0, -1.0, 0.0)), m_distance(0.0),
26 m_dbeam_u0(0.0), m_dbeam_v0(0.0), m_detector_arrangement(GENERIC)
33 :
IDetector2D(other), m_normal_to_detector(other.m_normal_to_detector), m_u0(other.m_u0),
34 m_v0(other.m_v0), m_direction(other.m_direction), m_distance(other.m_distance),
35 m_dbeam_u0(other.m_dbeam_u0), m_dbeam_v0(other.m_dbeam_v0),
36 m_detector_arrangement(other.m_detector_arrangement), m_u_unit(other.m_u_unit),
37 m_v_unit(other.m_v_unit)
157 return Axes::Units::MM;
167 u_min = p_roi->getXlow();
168 v_min = p_roi->getYlow();
169 width = p_roi->getXup() - p_roi->getXlow();
170 height = p_roi->getYup() - p_roi->getYlow();
209 "RectangularDetector::getAxisName(size_t index) -> Error! index > 1");
217 const double alpha = beam.
getAlpha();
218 const double phi = beam.
getPhi();
221 const double kd = k_spec.
dot(normal_unit);
237 if (distance <= 0.0) {
238 std::ostringstream message;
239 message <<
"RectangularDetector::setPerpendicularToSample() -> Error. "
240 <<
"Distance to sample can't be negative or zero";
272 "RectangularDetector::init() -> Unknown detector arrangement");
#define ASSERT(condition)
BasicVector3D< double > vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Creates a vector<double> as a wavevector with given wavelength and angles.
Defines class IDetectorResolution.
Defines M_PI and some more mathematical constants.
Defines class RectangularDetector.
Defines class RectangularPixel.
Defines class RegionOfInterest.
Defines class SimulationElement.
Defines some unit conversion factors and other constants in namespace Units.
BasicVector3D< double > kvector_t
auto dot(const BasicVector3D< U > &v) const
Returns dot product of vectors (antilinear in the first [=self] argument).
BasicVector3D< T > unit() const
Returns unit vector in direction of this. Throws for null vector.
double mag() const
Returns magnitude of the vector.
T z() const
Returns z-component in cartesian coordinate system.
void setZ(const T &a)
Sets z-component in cartesian coordinate system.
auto cross(const BasicVector3D< U > &v) const
Returns cross product of vectors (linear in both arguments).
Beam defined by wavelength, direction and intensity.
double getWavelength() const
kvector_t getCentralK() const
Returns the wavevector.
Interface for one-dimensional axes.
virtual bool contains(double value) const
Returns true if axis contains given point.
virtual size_t findClosestIndex(double value) const =0
find bin index which is best match for given value
virtual Bin1D getBin(size_t index) const =0
retrieve a 1d bin for the given index
virtual double getMin() const =0
Returns value of first point of axis.
virtual size_t size() const =0
retrieve the number of bins
virtual double getMax() const =0
Returns value of last point of axis.
Abstract 2D detector interface.
const RegionOfInterest * regionOfInterest() const override
Returns region of interest if exists.
void setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)
Sets detector parameters using angle ranges.
size_t getGlobalIndex(size_t x, size_t y) const
Calculate global index from two axis indices.
size_t dimension() const
Returns actual dimensionality of the detector (number of defined axes)
size_t axisBinIndex(size_t index, size_t selected_axis) const
Calculate axis index for given global index.
size_t totalSize() const
Returns total number of pixels.
const IAxis & getAxis(size_t index) const
void setName(const std::string &name)
Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel.
A flat rectangular detector with axes and resolution function.
void setDirectBeamPosition(double u0, double v0)
double m_dbeam_v0
position of direct beam in detector coordinates
void initUandV(double alpha_i)
void init(const Beam &beam) override
Inits detector with the beam settings.
double getDistance() const
double m_v0
position of normal vector hitting point in detector coordinates
void setPerpendicularToSampleX(double distance, double u0, double v0)
void setPerpendicularToDirectBeam(double distance, double u0, double v0)
kvector_t m_direction
direction vector of detector coordinate system
@ PERPENDICULAR_TO_DIRECT_BEAM
@ PERPENDICULAR_TO_SAMPLE
@ PERPENDICULAR_TO_REFLECTED_BEAM_DPOS
@ PERPENDICULAR_TO_REFLECTED_BEAM
void initNormalVector(const kvector_t central_k)
void setPerpendicularToReflectedBeam(double distance, double u0=0.0, double v0=0.0)
kvector_t m_normal_to_detector
Axes::Units defaultAxesUnits() const override
return default axes units
EDetectorArrangement getDetectorArrangment() const
RectangularDetector * clone() const override
size_t indexOfSpecular(const Beam &beam) const override
Returns index of pixel that contains the specular wavevector.
void setPosition(const kvector_t normal_to_detector, double u0, double v0, const kvector_t direction=kvector_t(0.0, -1.0, 0.0))
IPixel * createPixel(size_t index) const override
Creates an IPixel for the given OutputData object and index.
double getDirectBeamV0() const
kvector_t getDirectionVector() const
double m_distance
distance from sample origin to the detector plane
std::string axisName(size_t index) const override
Returns the name for the axis with given index.
EDetectorArrangement m_detector_arrangement
double getDirectBeamU0() const
RectangularDetector(size_t nxbins, double width, size_t nybins, double height)
Rectangular detector constructor.
kvector_t getNormalVector() const
void setDistanceAndOffset(double distance, double u0, double v0)
RectangularPixel * regionOfInterestPixel() const
A pixel in a RectangularDetector.
double getBinSize() const
double m_lower
lower bound of the bin