Mantid
Loading...
Searching...
No Matches
CalculateCountRate.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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"
13
14namespace Mantid {
15namespace Algorithms {
16
29class MANTID_ALGORITHMS_DLL CalculateCountRate : public API::Algorithm {
30public:
31 virtual ~CalculateCountRate() = default;
32 const std::string name() const override;
33 int version() const override;
34 const std::vector<std::string> seeAlso() const override { return {"ChangePulsetime"}; }
35 const std::string category() const override;
36 const std::string summary() const override;
39 bool normalizeCountRate() const;
41 bool useLogDerivative() const;
43 bool buildVisWS() const;
44
45private:
46 void init() override;
47 void exec() override;
48 // holder of the temporary log, used for normalization, binning source etc...
49 std::unique_ptr<Kernel::TimeSeriesProperty<double>> m_tmpLogHolder;
50 // diable log normalization
51 void disableNormalization(const std::string &NormLogError);
52
53protected: // for testing, actually private
56 bool m_normalizeResult{false};
57 Kernel::TimeSeriesProperty<double> const *m_pNormalizationLog{nullptr};
59 int m_numLogSteps{200};
62 bool m_rangeExplicit{false};
63 bool m_useLogDerivative{false};
65 double m_XRangeMin{0}, m_XRangeMax{0};
67 Types::Core::DateAndTime m_TRangeMin{0}, m_TRangeMax{0};
70
71 void setSourceWSandXRanges(DataObjects::EventWorkspace_sptr &InputWorkspace);
72
73 void setOutLogParameters(const DataObjects::EventWorkspace_sptr &InputWorkspace);
74
75 void calcRateLog(DataObjects::EventWorkspace_sptr &InputWorkspace, Kernel::TimeSeriesProperty<double> *const targLog);
76
77 void checkAndInitVisWorkspace();
78
79 void histogramEvents(const DataObjects::EventList &el, std::mutex *spectraLocks);
80
81 void buildVisWSNormalization(std::vector<double> &normalization);
82
84 bool m_doVis{false};
87 // variables used in 2D histogramming of the visualization workspace
88 double m_visX0, m_visDX, m_visT0, m_visDT, m_visTmax;
89 // vector used in normalization of the visualization workspace
90 std::vector<double> m_visNorm;
91};
92
93} // namespace Algorithms
94} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
In normal circumstances an instrument in event mode counts neutrons with constant steady rate which d...
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
DataObjects::EventWorkspace_sptr m_workingWS
temporary workspace used to keep intermediate results
DataObjects::Workspace2D_sptr m_visWs
shared pointer to the optional visualization workspace
std::unique_ptr< Kernel::TimeSeriesProperty< double > > m_tmpLogHolder
A class for holding :
Definition: EventList.h:56
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
Helper class which provides the Collimation Length for SANS instruments.