Mantid
Loading...
Searching...
No Matches
CalculateReflectometryQxQz.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10
11namespace Mantid {
12namespace DataObjects {
13
19private:
22 double m_dirQx;
23 double m_dirQz;
24
25public:
30 : CalculateReflectometry(version), m_cos_theta_i(0.0), m_sin_theta_i(0.0), m_dirQx(0.0), m_dirQz(0.0) {}
31
37 void updateThetaIncident(double thetaIncident) override {
38 m_cos_theta_i = cos(thetaIncident * to_radians_factor);
39 m_sin_theta_i = sin(thetaIncident * to_radians_factor);
40 }
41
47 void setThetaFinal(double thetaFinal) override {
48 const double c_cos_theta_f = cos(thetaFinal * to_radians_factor);
49 m_dirQx = (c_cos_theta_f - m_cos_theta_i);
50 const double c_sin_theta_f = sin(thetaFinal * to_radians_factor);
51 m_dirQz = (c_sin_theta_f + m_sin_theta_i);
52 }
53
58 void setTwoTheta(double twoTheta) override {
59 if (m_version == 1)
61 else
63 }
64
69 double calculateDim0(double wavelength) const override {
70 double wavenumber = 2 * M_PI / wavelength;
71 return wavenumber * m_dirQx;
72 }
73
78 double calculateDim1(double wavelength) const override {
79 double wavenumber = 2 * M_PI / wavelength;
80 return wavenumber * m_dirQz;
81 }
82
83 Mantid::Geometry::Quadrilateral createQuad(double lamUpper, double lamLower, double thetaUpper,
84 double thetaLower) override {
85 setTwoTheta(thetaLower);
86 const Mantid::Kernel::V2D firstVertex(calculateDim0(lamLower), // highest qx
87 calculateDim1(lamLower));
88 const Mantid::Kernel::V2D secondVertex(calculateDim0(lamUpper),
89 calculateDim1(lamUpper)); // lowest qz
90 setTwoTheta(thetaUpper);
91 const Mantid::Kernel::V2D thirdVertex(calculateDim0(lamLower),
92 calculateDim1(lamLower)); // highest qz
93 const Mantid::Kernel::V2D fourthVertex(calculateDim0(lamUpper), // lowest qx
94 calculateDim1(lamUpper));
95 Mantid::Geometry::Quadrilateral quad(fourthVertex, secondVertex, firstVertex, thirdVertex);
96 // Our lower-left vertex may not be in the right position
97 // we keep shifting the vertices around in a clock-wise fashion
98 // until the lower-left vertex is in the correct place.
99 while ((quad.at(0).X() > quad.at(3).X()) || (quad.at(0).Y() > quad.at(1).Y())) {
101 }
102
103 return quad;
104 }
105};
106} // namespace DataObjects
107} // namespace Mantid
Converts from inputs of wavelength, incident theta and final theta to Qx and Qz for reflectometry exp...
void setTwoTheta(double twoTheta) override
Set the final theta value from the detector twoTheta value.
double calculateDim0(double wavelength) const override
Executes the calculation to determine Qx.
void setThetaFinal(double thetaFinal) override
Setter for the final theta value require for the calculation.
Mantid::Geometry::Quadrilateral createQuad(double lamUpper, double lamLower, double thetaUpper, double thetaLower) override
double calculateDim1(double wavelength) const override
Executes the calculation to determine Qz.
void updateThetaIncident(double thetaIncident) override
Setter for the incident theta value require for the calculation.
Provides a common interface to Reflectometry Transform calculators.
A ConvexPolygon with only 4 vertices.
Definition: Quadrilateral.h:24
virtual void shiftVertexesClockwise()
Shifts the vertexes in a clockwise manner.
const Kernel::V2D & at(const size_t index) const override
Bounds-checked index access.
Implements a 2-dimensional vector embedded in a 3D space, i.e.
Definition: V2D.h:29
double Y() const
Y position.
Definition: V2D.h:49
double X() const
X position.
Definition: V2D.h:44
Helper class which provides the Collimation Length for SANS instruments.