Mantid
Loading...
Searching...
No Matches
GetEi.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidAlgorithms/DllConfig.h"
16
17namespace Mantid {
18namespace Algorithms {
37class MANTID_ALGORITHMS_DLL GetEi final : public API::Algorithm {
38public:
39 GetEi();
40
42 const std::string name() const override { return "GetEi"; }
44 const std::string summary() const override {
45 return "Calculates the kinetic energy of neutrons leaving the source based "
46 "on the time it takes for them to travel between two monitors.";
47 }
48
50 int version() const override { return 1; }
52 const std::string category() const override { return "Inelastic\\Ei"; }
53
54private:
62 enum direction {
63 GO_LEFT = -1,
64 GO_RIGHT = 1
65 };
66
67 // Implement abstract Algorithm methods
68 void init() override;
69 void exec() override;
70
71 void getGeometry(const API::MatrixWorkspace_const_sptr &WS, specnum_t mon0Spec, specnum_t mon1Spec,
72 double &monitor0Dist, double &monitor1Dist) const;
73 std::vector<size_t> getMonitorWsIndexs(const API::MatrixWorkspace_const_sptr &WS, specnum_t specNum1,
74 specnum_t specNum2) const;
75 double timeToFly(double s, double E_KE) const;
76 double getPeakCentre(const API::MatrixWorkspace_const_sptr &WS, const size_t monitIn, const double peakTime);
77 void extractSpec(int wsInd, double start, double end);
78 void getPeakEstimates(double &height, int64_t &centreInd, double &background) const;
79 double findHalfLoc(MantidVec::size_type startInd, const double height, const double noise, const direction go) const;
80 double neutron_E_At(double speed) const;
81 void advanceProgress(double toAdd);
82
86 static const double HALF_WINDOW;
88 static const double PEAK_THRESH_H;
91 static const double PEAK_THRESH_A;
94 static const int64_t PEAK_THRESH_W;
95
96 // for estimating algorithm progress
97 static const double CROP;
98 static const double GET_COUNT_RATE;
100 static const double FIT_PEAK;
101};
102
103} // namespace Algorithms
104} // namespace Mantid
double height
Definition: GetAllEi.cpp:155
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Requires an estimate for the initial neutron energy which it uses to search for monitor peaks and fro...
Definition: GetEi.h:37
static const double PEAK_THRESH_H
ignore an peaks that are less than this factor of the background
Definition: GetEi.h:88
static const double HALF_WINDOW
the range of TOF X-values over which the peak will be searched is double this value,...
Definition: GetEi.h:86
direction
used by the function findHalfLoc to indicate whether to search left or right
Definition: GetEi.h:62
double m_fracCompl
An estimate of the percentage of the algorithm runtimes that has been completed.
Definition: GetEi.h:59
static const double PEAK_THRESH_A
ignore peaks where the half width times the ratio of the peak height to the background is less this
Definition: GetEi.h:91
static const double CROP
fraction of algorithm time taken up with running CropWorkspace
Definition: GetEi.h:97
API::MatrixWorkspace_sptr m_tempWS
name of the tempory workspace that we create and use
Definition: GetEi.h:56
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: GetEi.h:50
static const double FIT_PEAK
single call to ConvertToDistribution
Definition: GetEi.h:100
const std::string summary() const override
Summary of algorithms purpose.
Definition: GetEi.h:44
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: GetEi.h:42
static const int64_t PEAK_THRESH_W
for peaks where the distance to the half heigth is less than this number of bins in either direction ...
Definition: GetEi.h:94
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: GetEi.h:52
static const double GET_COUNT_RATE
fraction of algorithm taken by a
Definition: GetEi.h:98
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16