Skip to content
3 changes: 3 additions & 0 deletions Framework/Algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ set(SRC_FILES
src/PolarizationEfficiencyCor.cpp
src/PolarizationCorrections/DepolarizedAnalyserTransmission.cpp
src/PolarizationCorrections/FlipperEfficiency.cpp
src/PolarizationCorrections/PolarizationEfficienciesWildes.cpp
src/PolynomialCorrection.cpp
src/Power.cpp
src/PowerLawCorrection.cpp
Expand Down Expand Up @@ -594,6 +595,7 @@ set(INC_FILES
inc/MantidAlgorithms/PolarizationCorrections/SpinStateValidator.h
inc/MantidAlgorithms/PolarizationCorrections/FlipperEfficiency.h
inc/MantidAlgorithms/PolarizationCorrections/PolarizerEfficiency.h
inc/MantidAlgorithms/PolarizationCorrections/PolarizationEfficienciesWildes.h
inc/MantidAlgorithms/PolarizationCorrectionFredrikze.h
inc/MantidAlgorithms/PolarizationCorrectionWildes.h
inc/MantidAlgorithms/PolarizationEfficiencyCor.h
Expand Down Expand Up @@ -943,6 +945,7 @@ set(TEST_FILES
PolarizationCorrections/SpinStateValidatorTest.h
PolarizationCorrections/FlipperEfficiencyTest.h
PolarizationCorrections/PolarizerEfficiencyTest.h
PolarizationCorrections/PolarizationEfficienciesWildesTest.h
PolarizationCorrectionFredrikzeTest.h
PolarizationCorrectionWildesTest.h
PolarizationEfficiencyCorTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class MANTID_ALGORITHMS_DLL PolarizationCorrectionWildes final : public API::Alg
int version() const override;
const std::string category() const override;
const std::string summary() const override;
const std::vector<std::string> seeAlso() const override;

private:
/// A convenience set of workspaces corresponding flipper configurations.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2024 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once

#include "MantidAPI/Algorithm.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceGroup.h"
#include "MantidAlgorithms/DllConfig.h"

namespace Mantid::Algorithms {

using namespace API;

class MANTID_ALGORITHMS_DLL PolarizationEfficienciesWildes : public API::Algorithm {
public:
/// The string identifier for the algorithm. @see Algorithm::name
std::string const name() const override { return "PolarizationEfficienciesWildes"; }

/// A summary of the algorithm's purpose. @see Algorithm::summary
std::string const summary() const override;

/// The category of the algorithm. @see Algorithm::category
std::string const category() const override { return "Reflectometry\\PolarizationCorrections"; }

/// Returns related algorithms. @see Algorithm::seeAlso
const std::vector<std::string> seeAlso() const override { return {"PolarizationCorrectionWildes"}; }

/// The version number of the algorithm. @see Algorithm::version
int version() const override { return 1; }

private:
/// Setup the algorithm's properties and prepare constants.
void init() override;

/// Execute the algorithm with the provided properties.
void exec() override;

/// Check that the inputs to the algorithm are valid.
std::map<std::string, std::string> validateInputs() override;

/// Calculate Fp, Fa and Phi
void calculateFlipperEfficienciesAndPhi();

/// Calculate (2p-1) from Phi, Fp, Fa and the magnetic workspace intensities
MatrixWorkspace_sptr calculateTPMOFromPhi(const WorkspaceGroup_sptr &magWsGrp);

/// Calculate the polarizer and/or analyser efficiencies, as requested
void calculatePolarizerAndAnalyserEfficiencies(const bool solveForP, const bool solveForA);

/// If either the polarizer or the analyser efficiency is known, use the relationship Phi = (2p-1)(2a-1) to solve for
/// the other efficiency
MatrixWorkspace_sptr solveForUnknownEfficiency(const MatrixWorkspace_sptr &knownEfficiency);

/// Solve for the unknown efficiency from either (2p-1) or (2a-1) using the relationship Phi = (2p-1)(2a-1)
MatrixWorkspace_sptr solveUnknownEfficiencyFromTXMO(const MatrixWorkspace_sptr &wsTXMO);

/// Set the algorithm outputs
void setOutputs();

/// Clear the values for all the algorithm member variables
void resetMemberVariables();

/// Sets the property value to its current value. For output workspace properties this will clear any workspaces being
/// held by the property
void resetPropertyValue(const std::string &propertyName);

MatrixWorkspace_sptr m_wsFp = nullptr;
MatrixWorkspace_sptr m_wsFa = nullptr;
MatrixWorkspace_sptr m_wsPhi = nullptr;
MatrixWorkspace_sptr m_wsP = nullptr;
MatrixWorkspace_sptr m_wsA = nullptr;
};
} // namespace Mantid::Algorithms
4 changes: 4 additions & 0 deletions Framework/Algorithms/src/PolarizationCorrectionWildes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ const std::string PolarizationCorrectionWildes::summary() const {
"and analyzer efficiencies.";
}

const std::vector<std::string> PolarizationCorrectionWildes::seeAlso() const {
return {"PolarizationEfficienciesWildes"};
}

/**
* Count the non-nullptr workspaces
* @return the count on non-nullptr workspaces.
Expand Down
Loading