Mantid
Loading...
Searching...
No Matches
HeliumAnalyserEfficiency.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2025 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
8#pragma once
9
10//----------------------------------------------------------------------
11// Includes
12//----------------------------------------------------------------------
13#include "MantidAPI/Algorithm.h"
15#include "MantidAlgorithms/DllConfig.h"
16
17namespace Mantid {
18namespace Algorithms {
19using namespace API;
20using VectorPair = std::pair<std::vector<double>, std::vector<double>>;
21/*
22Docs
23*/
24class MANTID_ALGORITHMS_DLL HeliumAnalyserEfficiency final : public API::Algorithm {
25public:
28 const std::string name() const override { return "HeliumAnalyserEfficiency"; }
30 const std::string summary() const override { return "Calculates the efficiency of a He3 analyser."; }
32 int version() const override { return 1; }
34 const std::string category() const override { return "SANS\\PolarizationCorrections"; }
35 std::map<std::string, std::string> validateInputs() override;
36
37private:
38 // Implement abstract Algorithm methods
39 void init() override;
40 void exec() override;
41
42 void declareInputProperties();
43 void declareFitProperties();
44 void declareOutputProperties();
45
46 void fitDecayTime(const MatrixWorkspace_sptr &workspace);
47 void makeFit(const Algorithm_sptr &fitAlgorithm, const std::string &fitOutputName);
48 void prepareOutputs(const std::vector<MatrixWorkspace_sptr> &efficiencies);
49 ITableWorkspace_sptr prepareOutputTable(const std::vector<ITableWorkspace_sptr> &tables);
50
51 std::vector<MatrixWorkspace_sptr> calculateEfficiencies(const std::vector<std::string> &workspaceNames,
52 const std::string &spinConfiguration);
53
54 VectorPair fitHe3Polarization(const double mu, const std::vector<MatrixWorkspace_sptr> &efficiencies);
55 VectorPair getTimeDifferences(const std::vector<std::string> &wsNames);
56
57 void convertToTheoreticalEfficiencies(const std::vector<MatrixWorkspace_sptr> &efficiencies,
58 const std::vector<double> &pHeVec, const std::vector<double> &pHeErrorVec,
59 const double mu);
60 double calculateTCrit(const size_t numberOfBins) const;
61
62 std::vector<MatrixWorkspace_sptr> m_outputCurves;
63 std::vector<ITableWorkspace_sptr> m_outputParameters;
64};
65} // namespace Algorithms
66} // namespace Mantid
IPeaksWorkspace_sptr workspace
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
std::vector< ITableWorkspace_sptr > m_outputParameters
const std::string summary() const override
Summary of algorithms purpose.
std::vector< MatrixWorkspace_sptr > m_outputCurves
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
Definition Algorithm.h:52
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::pair< std::vector< double >, std::vector< double > > VectorPair
Helper class which provides the Collimation Length for SANS instruments.