-
Notifications
You must be signed in to change notification settings - Fork 122
/
ConvertFromDistribution.cpp
37 lines (30 loc) · 1.39 KB
/
ConvertFromDistribution.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 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 +
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/ConvertFromDistribution.h"
#include "MantidAPI/HistogramValidator.h"
#include "MantidAPI/RawCountValidator.h"
#include "MantidAPI/WorkspaceOpOverloads.h"
#include "MantidKernel/CompositeValidator.h"
namespace Mantid::Algorithms {
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(ConvertFromDistribution)
using namespace API;
void ConvertFromDistribution::init() {
auto wsValidator = std::make_shared<Kernel::CompositeValidator>();
wsValidator->add<HistogramValidator>();
wsValidator->add<RawCountValidator>(false);
declareProperty(std::make_unique<WorkspaceProperty<>>("Workspace", "", Kernel::Direction::InOut, wsValidator),
"The name of the workspace to convert.");
}
void ConvertFromDistribution::exec() {
MatrixWorkspace_sptr workspace = getProperty("Workspace");
WorkspaceHelpers::makeDistribution(workspace, false);
}
} // namespace Mantid::Algorithms