Mantid
Loading...
Searching...
No Matches
ModeratorTzeroLinear.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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#include "MantidAlgorithms/DllConfig.h"
12
13namespace Mantid {
14namespace API {
15class SpectrumInfo;
16}
17namespace Algorithms {
18/* Corrects the time of flight (TOF) by a time offset that is dependent on the
19 velocity of the neutron after passing through the moderator.
20 * "The TOF measured by the BASIS data acquisition system (DAS) should be
21 reduced by this moderator emission time. The DAS "erroneously"
22 * thinks that it takes longer for neutrons to reach the sample and detectors,
23 because it does not "know" that the neutrons
24 * spend some time in the moderator before being emitted and starting flying" -
25 E. Mamontov
26 *
27 * A heuristic formula for the correction, stored in the instrument definition
28 file, is taken as linear on the initial neutron wavelength lambda_i:
29 * t_0 = gradient * lambda_i + intercept, [gradient]=microsec/Angstrom and
30 [intercept]=microsec
31 *
32 * Required Properties:
33 <UL>
34 <LI> InputWorkspace - EventWorkSpace in TOF units. </LI>
35 <LI> OutputWorkspace - EventWorkSpace in TOF units. </LI>
36 <LI> Moderator.Tzero.gradient - Variation of the time offset with initial
37 neutron wavelength (obtained from the instrument parameter file)
38 <LI> Moderator.Tzero.intercept - time offset common to all neutrons
39 (obtained from the instrument parameter file)
40 </UL>
41
42 The recorded TOF = t_0 + t_i + t_f with
43 t_0: moderator emission time
44 t_i: time from moderator to sample
45 t_f: time from sample to detector
46 This algorithm will replace TOF with TOF' = TOF-t_0 = t_i+t_f
47
48 For a direct geometry instrument, lambda_i is the same for all
49 neutrons. Hence the moderator emission time is the same for all neutrons
50 For an indirect geometry instrument, lambda_i is not known but the
51 final energy, E_f, selected by the analyzers is known. For this geometry:
52 t_f = L_f/v_f L_f: distance from sample to detector, v_f:
53 final velocity derived from E_f
54 t_i = L_i/v_i L_i: distance from moderator to sample, v_i:
55 initial velocity unknown
56 t_0 = a/v_i+b a and b are constants derived from the
57 aforementioned heuristic formula.
58 a=gradient*3.956E-03, [a]=meter,
59 b=intercept, [b]=microsec
60 Putting all together: TOF' = (L_i/(L_i+a))*(TOF-t_f-b) + t_i,
61 [TOF']=microsec
62
63 @author Jose Borreguero and Andrei Savici
64 @date 12/12/2011
65*/
66class MANTID_ALGORITHMS_DLL ModeratorTzeroLinear final : public API::Algorithm {
67public:
71 const std::string name() const override;
73 const std::string summary() const override;
75 int version() const override;
76 const std::vector<std::string> seeAlso() const override { return {"ModeratorTzero"}; }
78 const std::string category() const override;
79
80private:
81 // conversion constants applicable to histogram and event workspaces
82 double m_gradient;
85
86 // Initialisation code
87 void init() override;
88 // Execution code for histogram workspace
89 void exec() override;
90 // Execution code for event workspace
91 void execEvent();
92 // Calculate time from sample to detector and initial flight path
93 void calculateTfLi(const API::SpectrumInfo &spectrumInfo, size_t i, double &t_f, double &L_i);
94};
95
96} // namespace Algorithms
97} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
Definition: SpectrumInfo.h:53
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Geometry::Instrument_const_sptr m_instrument
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
Helper class which provides the Collimation Length for SANS instruments.