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