Mantid
Loading...
Searching...
No Matches
CompareWorkspaces.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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 {
17namespace Algorithms {
18
60class MANTID_ALGORITHMS_DLL CompareWorkspaces final : public API::Algorithm {
61public:
63 const std::string name() const override { return "CompareWorkspaces"; }
64
66 int version() const override { return 1; }
67 const std::vector<std::string> seeAlso() const override {
68 return {"CheckWorkspacesMatch", "CompareSampleLogs", "CloneWorkspace"};
69 }
70
72 const std::string category() const override { return "Utility\\Workspaces"; }
73
75 const std::string summary() const override {
76 return "Compares two workspaces for equality. This algorithm is mainly "
77 "intended for use by the Mantid development team as part of the "
78 "testing process.";
79 }
80
81protected:
82 Parallel::ExecutionMode
83 getParallelExecutionMode(const std::map<std::string, Parallel::StorageMode> &storageModes) const override;
84 void execMasterOnly() override;
85
86private:
88 void init() override;
89
91 void exec() override;
92
95 bool processGroups() override;
96
98 void processGroups(const std::shared_ptr<const API::WorkspaceGroup> &groupOne,
99 const std::shared_ptr<const API::WorkspaceGroup> &groupTwo);
100
101 void doComparison();
102
104 void doLeanElasticPeaksComparison(const DataObjects::LeanElasticPeaksWorkspace_sptr &tws1,
106 void doTableComparison(const API::ITableWorkspace_const_sptr &tws1, const API::ITableWorkspace_const_sptr &tws2);
107 void doMDComparison(const API::Workspace_sptr &w1, const API::Workspace_sptr &w2);
108 bool compareEventWorkspaces(const DataObjects::EventWorkspace &ews1, const DataObjects::EventWorkspace &ews2);
109 bool checkData(const API::MatrixWorkspace_const_sptr &ws1, const API::MatrixWorkspace_const_sptr &ws2);
110 bool checkAxes(const API::MatrixWorkspace_const_sptr &ws1, const API::MatrixWorkspace_const_sptr &ws2);
111 bool checkSpectraMap(const API::MatrixWorkspace_const_sptr &ws1, const API::MatrixWorkspace_const_sptr &ws2);
112 bool checkInstrument(const API::MatrixWorkspace_const_sptr &ws1, const API::MatrixWorkspace_const_sptr &ws2);
113 bool checkMasking(const API::MatrixWorkspace_const_sptr &ws1, const API::MatrixWorkspace_const_sptr &ws2);
114 bool checkSample(const API::Sample &sample1, const API::Sample &sample2);
115 bool checkRunProperties(const API::Run &run1, const API::Run &run2);
116
118 int compareEventsListInDetails(const DataObjects::EventList &el1, const DataObjects::EventList &el2, double tolTof,
119 double tolWeight, int64_t tolPulse, bool printdetails, size_t &numdiffpulse,
120 size_t &numdifftof, size_t &numdiffboth, size_t &numdiffweight) const;
121
123 void recordMismatch(const std::string &msg, std::string ws1 = "", std::string ws2 = "");
124
125 bool relErr(double x1, double x2, double errorVal) const;
126
128 bool m_result{false};
129
132
134 std::unique_ptr<API::Progress> m_progress = nullptr;
135
141 bool m_parallelComparison{false};
142};
143
144} // namespace Algorithms
145} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
This class stores information regarding an experimental run as a series of log entries.
Definition: Run.h:38
This class stores information about the sample used in particular run.
Definition: Sample.h:33
Compares two workspaces for equality.
const std::string category() const override
Algorithm's category for identification.
int version() const override
Algorithm's version for identification.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
API::ITableWorkspace_sptr m_messages
Mismatch messages that resulted from comparison.
const std::string name() const override
Algorithm's name.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
A class for holding :
Definition: EventList.h:56
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
std::shared_ptr< const ITableWorkspace > ITableWorkspace_const_sptr
shared pointer to Mantid::API::ITableWorkspace (const version)
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
Helper class which provides the Collimation Length for SANS instruments.