30 , m_direction(R3(0.0, -1.0, 0.0))
34 , m_detector_arrangement(GENERIC)
157 const double u_min = uAxisBoundsROI.first;
158 const double v_min = vAxisBoundsROI.first;
159 const double width = uAxisBoundsROI.second - uAxisBoundsROI.first;
160 const double height = vAxisBoundsROI.second - vAxisBoundsROI.first;
176 const Bin1D u_bin = u_axis.
bin(u_index);
177 const Bin1D v_bin = v_axis.
bin(v_index);
193 throw std::runtime_error(
194 "RectangularDetector::getAxisName(size_t index) -> Error! index > 1");
206 const double kd = k_spec.dot(normal_unit);
222 if (distance <= 0.0) {
223 std::ostringstream message;
224 message <<
"RectangularDetector::setPerpendicularToSample() -> Error. "
225 <<
"Distance to sample can't be negative or zero";
226 throw std::runtime_error(message.str());
235 R3 central_k_unit = central_k.unit();
256 throw std::runtime_error(
"RectangularDetector::init() -> Unknown detector arrangement");
270 R3 zp = z - z.dot(normal_unit) * normal_unit;
271 double uz = zp.dot(
m_u_unit) / zp.mag();
272 double vz = zp.dot(
m_v_unit) / zp.mag();
283 const IAxis& yAxis = *axes[1];
286 IAxis* alpha_f_axis = det_pixel->createAxis(yAxis.
size());
Defines the macro ASSERT.
#define ASSERT(condition)
Defines structs Bin1D, Bin1DCVector.
Defines M_PI and some more mathematical constants.
Defines interface CoordSystem2D and its subclasses.
Defines class DiffuseElement.
R3 vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Defines interface IDetectorResolution.
Defines class RectangularDetector.
Defines class RectangularPixel.
Defines some unit conversion factors and other constants in namespace Units.
An incident neutron or x-ray beam.
Direction direction() const
double wavelength() const
double m_lower
lower bound of the bin
Interface for objects that provide axis translations to different units for IDetector objects.
A direction in three-dimensional space.
R3 vector() const
Returns Cartesian 3D vector.
Abstract base class for one-dimensional axes.
double span() const
Returns distance from first to last point.
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 bin(size_t index) const =0
retrieve a 1d bin for the given index
virtual size_t size() const =0
Returns the number of bins.
Interface to provide axis translations to different units for simulation output.
std::pair< double, double > regionOfInterestBounds(size_t iAxis) const
The lower and upper bound of the region of interest. If no region of interest is explicitly defined,...
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. Any region of interest is not taken into account.
void setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)
Sets equidistant axes.
const IAxis & axis(size_t index) const
One axis of the complete detector. Any region of interest is not taken into account.
OwningVector< IAxis > axesClippedToRegionOfInterest() const
Returns the axes clipped to the region of interest. If no region of interest is explicitly defined,...
size_t getGlobalIndex(size_t x, size_t y) const
Calculate global index from two axis indices.
size_t rank() const
Returns number of defined axes.
Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. Abstract base class for Sp...
ICoordSystem class that handles the unit translations for rectangular detectors Its default units are...
ICoordSystem class that handles the unit translations for off-specular simulations with a spherical d...
A flat rectangular detector with axes and resolution function.
R3 getDirectionVector() const
void initNormalVector(R3 central_k)
CoordSystem2D * scatteringCoords(const Beam &beam) const override
R3 m_direction
direction vector of detector coordinate system
R3 getNormalVector() const
void setDirectBeamPosition(double u0, double v0)
double m_dbeam_v0
position of direct beam in detector coordinates
void initUandV(double alpha_i)
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)
@ PERPENDICULAR_TO_DIRECT_BEAM
@ PERPENDICULAR_TO_SAMPLE
@ PERPENDICULAR_TO_REFLECTED_BEAM_DPOS
@ PERPENDICULAR_TO_REFLECTED_BEAM
void setPerpendicularToReflectedBeam(double distance, double u0=0.0, double v0=0.0)
~RectangularDetector() override
EDetectorArrangement getDetectorArrangment() const
RectangularDetector * clone() const override
size_t indexOfSpecular(const Beam &beam) const override
Returns index of pixel that contains the specular wavevector. If no pixel contains this specular wave...
void setDetectorPosition(R3 normal_to_detector, double u0, double v0, R3 direction=R3(0.0, -1.0, 0.0))
IPixel * createPixel(size_t index) const override
Creates an IPixel for the given Datafield object and index.
double getDirectBeamV0() 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
void setDetectorNormal(const Direction &direction) override
Inits detector with the beam settings.
RectangularDetector(size_t nxbins, double width, size_t nybins, double height)
Rectangular detector constructor.
ICoordSystem * offspecCoords(IAxis *beamAxis, const Direction &beamDirection) const override
void setDistanceAndOffset(double distance, double u0, double v0)
RectangularPixel * regionOfInterestPixel() const
A pixel in a RectangularDetector.