Mantid
Loading...
Searching...
No Matches
CalculateReflectometryP.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 {
17private:
20
21public:
26
32 void updateThetaIncident(double thetaIncident) override { m_sin_theta_i = sin(to_radians_factor * thetaIncident); }
33
39 void setThetaFinal(double thetaFinal) override { m_sin_theta_f = sin(to_radians_factor * thetaFinal); }
40
45 void setTwoTheta(double twoTheta) override {
46 if (m_version == 1)
48 else
50 }
51
56 double calculateDim0(double wavelength) const override {
57 double wavenumber = 2.0 * M_PI / wavelength;
58 double ki = wavenumber * m_sin_theta_i;
59 double kf = wavenumber * m_sin_theta_f;
60 return ki + kf;
61 }
62
67 double calculateDim1(double wavelength) const override {
68 double wavenumber = 2.0 * M_PI / wavelength;
69 double ki = wavenumber * m_sin_theta_i;
70 double kf = wavenumber * m_sin_theta_f;
71 return ki - kf;
72 }
73 Mantid::Geometry::Quadrilateral createQuad(double lamUpper, double lamLower, double thetaUpper,
74 double thetaLower) override {
75 setTwoTheta(thetaLower);
76 auto dim1UpperRightVertex = calculateDim1(lamLower);
77 auto dim0LowerLeftVertex = calculateDim0(lamUpper);
78 // UPPER LEFT VERTEX
79 const Mantid::Kernel::V2D secondVertex(calculateDim0(lamUpper), // highest qx
80 calculateDim1(lamLower));
81
82 setTwoTheta(thetaUpper);
83 const Mantid::Kernel::V2D firstVertex(dim0LowerLeftVertex,
84 calculateDim1(lamUpper)); // lowest qz
85
86 const Mantid::Kernel::V2D thirdVertex(calculateDim0(lamLower),
87 dim1UpperRightVertex); // highest qz
88 // LOWER RIGHT VERTEX
89 const Mantid::Kernel::V2D fourthVertex(calculateDim0(lamLower), // lowest qx
90 calculateDim1(lamUpper));
91
92 Mantid::Geometry::Quadrilateral quad(firstVertex, fourthVertex, thirdVertex, secondVertex);
93 // Our lower-left vertex may not be in the right position
94 // we keep shifting the vertices around in a clock-wise fashion
95 // until the lower-left vertex is in the correct place.
96 while ((quad.at(0).X() > quad.at(3).X()) || (quad.at(0).Y() > quad.at(1).Y())) {
98 }
99 return quad;
100 }
101};
102} // namespace DataObjects
103} // namespace Mantid
class CalculateReflectometryP: p-type transformation calculator
void setTwoTheta(double twoTheta) override
Set the final theta value from the detector twoTheta angle.
double calculateDim0(double wavelength) const override
Executes the calculation to determine PSum.
void updateThetaIncident(double thetaIncident) override
Setter for the incident theta value require for the calculation.
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 PDiff.
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.