Mantid
Loading...
Searching...
No Matches
GetAllEi.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
11#include "MantidAlgorithms/DllConfig.h"
13//#include "MantidAPI/IAlgorithm.h"
14
15namespace Mantid {
16
17namespace Geometry {
18class IComponent;
19}
20
21namespace Kernel {
22class Unit;
23}
24
25namespace Algorithms {
26
29class MANTID_ALGORITHMS_DLL GetAllEi : public API::Algorithm {
30public:
31 GetAllEi();
32 virtual ~GetAllEi() = default;
34 const std::string name() const override { return "GetAllEi"; };
36 const std::string summary() const override {
37 return "Analyze the chopper logs and the signal registered by the monitors "
38 "to identify energies used as incident energies in an inelastic "
39 "experiment.";
40 }
42 int version() const override { return 1; };
43 const std::vector<std::string> seeAlso() const override { return {"GetEi"}; }
45 const std::string category() const override { return "Inelastic\\Ei"; };
47 std::map<std::string, std::string> validateInputs() override;
48
49private:
50 // Implement abstract Algorithm methods
51 void init() override;
52 void exec() override;
53 Kernel::Property *getPLogForProperty(const API::MatrixWorkspace_sptr &inputWS, const std::string &propertyName);
54 void setFilterLog(const API::MatrixWorkspace_sptr &inputWS);
55 // former lambda function exposed as not evry compiler support this yet
56 bool peakGuess(const API::MatrixWorkspace_sptr &inputWS, size_t index, double Ei,
57 const std::vector<size_t> &monsRangeMin, const std::vector<size_t> &monsRangeMax, double &peakPos,
58 double &peakHeight, double &peakTwoSigma);
59
60protected: // for testing, private otherwise.
61 // prepare working workspace with appropriate monitor spectra for fitting
63 // prepare matrix workspace to analyze monitor signal
64 buildWorkspaceToFit(const API::MatrixWorkspace_sptr &inputWS, size_t &wsIndex0);
65
67 double getAvrgLogValue(const API::MatrixWorkspace_sptr &inputWS, const std::string &propertyName,
68 std::vector<Kernel::SplittingInterval> &splitter);
70 void findChopSpeedAndDelay(const API::MatrixWorkspace_sptr &inputWS, double &chop_speed, double &chop_delay);
71 void findGuessOpeningTimes(const std::pair<double, double> &TOF_range, double ChopDelay, double Period,
72 std::vector<double> &guess_opening_times);
74 bool findMonitorPeak(const API::MatrixWorkspace_sptr &inputWS, double Ei, const std::vector<size_t> &monsRangeMin,
75 const std::vector<size_t> &monsRangeMax, double &position, double &height, double &twoSigma);
77 void findBinRanges(const HistogramData::HistogramX &eBins, const HistogramData::HistogramY &signal,
78 const std::vector<double> &guess_energy, double eResolution, std::vector<size_t> &irangeMin,
79 std::vector<size_t> &irangeMax, std::vector<bool> &guessValid);
80
81 size_t calcDerivativeAndCountZeros(const std::vector<double> &bins, const std::vector<double> &signal,
82 std::vector<double> &deriv, std::vector<double> &zeros);
83
85 void printDebugModeInfo(const std::vector<double> &guess_opening, const std::pair<double, double> &TOF_range,
86 std::shared_ptr<Kernel::Unit> &destUnit);
94 // set as half max LET resolution at 20mev at 5e-4
97 // the value of constant phase shift on the chopper used to calculate
98 // tof at chopper from recorded delay.
99 double m_phase;
100 // internal pointer to access to chopper
101 std::shared_ptr<const Geometry::IComponent> m_chopper;
102 // internal pointer to access log, used for filtering
104};
105
106} // namespace Algorithms
107} // namespace Mantid
double height
Definition: GetAllEi.cpp:155
double position
Definition: GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Estimate all incident energies, used by chopper instrument.
Definition: GetAllEi.h:29
virtual ~GetAllEi()=default
Kernel::TimeSeriesProperty< double > * m_pFilterLog
Definition: GetAllEi.h:103
const std::string name() const override
Algorithms name for identification.
Definition: GetAllEi.h:34
std::shared_ptr< const Geometry::IComponent > m_chopper
Definition: GetAllEi.h:101
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: GetAllEi.h:43
bool m_FilterWithDerivative
if true, take derivate of the filter log to identify interval when instrument is running.
Definition: GetAllEi.h:89
int version() const override
Algorithm's version for identification.
Definition: GetAllEi.h:42
double m_min_Eresolution
maximal relative peak width to consider acceptable.
Definition: GetAllEi.h:93
const std::string category() const override
Algorithm's category for identification.
Definition: GetAllEi.h:45
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
Definition: GetAllEi.h:36
Base class for properties.
Definition: Property.h:94
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.