Mantid
Loading...
Searching...
No Matches
TOFSANSResolutionByPixelCalculator.cpp
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 +
8#include <cmath>
9namespace Mantid::Algorithms {
10
21 double lCollim, double l2) const {
22 return (4.0 * M_PI * M_PI / 12.0) * (3.0 * r1 * r1 / (lCollim * lCollim) +
23 3.0 * r2 * r2 * (lCollim + l2) * (lCollim + l2) / (lCollim * lCollim * l2 * l2) +
24 (deltaR * deltaR) / (l2 * l2));
25}
26
27/*
28 * Calculates the sigmaQ value
29 * @param moderatorValue: The value of the moderator for a certain wavelength
30 * @param wavlengthIndependentFactor: the geometry-dependent prefactor
31 * @param q: the momentum transfer
32 * @param wavelength: the neutron's wavelength
33 * @param deltaWavelength: the wavelength spread for that wavelength
34 * @param l1: the l1 length
35 * @param l2: the L2 length
36 * @returns the sigma q value
37 */
38
39double TOFSANSResolutionByPixelCalculator::getSigmaQValue(double moderatorValue, double wavlengthIndependentFactor,
40 double q, double wavelength, double deltaWavelength,
41 double l1, double l2) const {
42 // Calculate the moderator uncertainty
43 const double sigModerator = moderatorValue * 3.9560 / (1000.0 * (l1 + l2));
44
45 // Calculate the wavelength uncertainty
46 const double sigWavelengthSquared = deltaWavelength * deltaWavelength / 12.0 + sigModerator * sigModerator;
47
48 // Calculate the q uncertainty
49 const double qbyWavelengthSquared = q * q / (wavelength * wavelength);
50
51 return sqrt(wavlengthIndependentFactor / (wavelength * wavelength) + (sigWavelengthSquared * qbyWavelengthSquared));
52}
53} // namespace Mantid::Algorithms
double getSigmaQValue(double moderatorValue, double wavlengthIndependentFactor, double q, double wavelength, double deltaWavelength, double l1, double l2) const
double getWavelengthIndependentFactor(double r1, double r2, double deltaR, double lCollim, double l2) const
Calculates the wavelength-independent prefactor for the resolutin calculation.