Mantid
Loading...
Searching...
No Matches
CalculateReflectometryKiKf.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
9
10namespace Mantid {
11namespace DataObjects {
18private:
21
22public:
27
33 void updateThetaIncident(double thetaIncident) override { m_sin_theta_i = sin(to_radians_factor * thetaIncident); }
34
40 void setThetaFinal(double thetaFinal) override { m_sin_theta_f = sin(to_radians_factor * thetaFinal); }
41
46 void setTwoTheta(double twoTheta) override {
47 if (m_version == 1)
49 else
51 }
52
57 double calculateDim0(double wavelength) const override {
58 double wavenumber = 2 * M_PI / wavelength;
59 return wavenumber * m_sin_theta_i;
60 }
61
66 double calculateDim1(double wavelength) const override {
67 double wavenumber = 2 * M_PI / wavelength;
68 return wavenumber * m_sin_theta_f;
69 }
70 Mantid::Geometry::Quadrilateral createQuad(double lamUpper, double lamLower, double thetaUpper,
71 double thetaLower) override {
72 setTwoTheta(thetaLower);
73 const Mantid::Kernel::V2D firstVertex(calculateDim0(lamLower), // highest qx
74 calculateDim1(lamLower));
75 const Mantid::Kernel::V2D secondVertex(calculateDim0(lamUpper),
76 calculateDim1(lamUpper)); // lowest qz
77 setTwoTheta(thetaUpper);
78 const Mantid::Kernel::V2D thirdVertex(calculateDim0(lamLower),
79 calculateDim1(lamLower)); // highest qz
80 const Mantid::Kernel::V2D fourthVertex(calculateDim0(lamUpper), // lowest qx
81 calculateDim1(lamUpper));
82
83 Mantid::Geometry::Quadrilateral quad(fourthVertex, secondVertex, firstVertex, thirdVertex);
84 // Our lower-left vertex may not be in the right position
85 // we keep shifting the vertices around in a clock-wise fashion
86 // until the lower-left vertex is in the correct place.
87 while ((quad.at(0).X() > quad.at(3).X()) || (quad.at(0).Y() > quad.at(1).Y())) {
89 }
90
91 return quad;
92 }
93};
94} // namespace DataObjects
95} // namespace Mantid
class CalculateReflectometryKiKf: Calculation type for converting to ki or kf given a theta value (in...
void setTwoTheta(double twoTheta) override
Set the final theta value from the detector twoTheta angle.
double calculateDim1(double wavelength) const override
Executes the calculation to determine Kf.
double calculateDim0(double wavelength) const override
Executes the calculation to determine Ki.
void updateThetaIncident(double thetaIncident) override
Setter for the incident theta value require for the calculation.
Mantid::Geometry::Quadrilateral createQuad(double lamUpper, double lamLower, double thetaUpper, double thetaLower) override
void setThetaFinal(double thetaFinal) override
Setter for the final 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.