-
Notifications
You must be signed in to change notification settings - Fork 122
/
ConvertFromDistribution.cpp
34 lines (27 loc) · 1.13 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
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/ConvertFromDistribution.h"
#include "MantidAPI/HistogramValidator.h"
#include "MantidAPI/RawCountValidator.h"
#include "MantidAPI/WorkspaceOpOverloads.h"
#include "MantidKernel/CompositeValidator.h"
namespace Mantid {
namespace Algorithms {
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(ConvertFromDistribution)
using namespace API;
void ConvertFromDistribution::init() {
auto wsValidator = boost::make_shared<Kernel::CompositeValidator>();
wsValidator->add<HistogramValidator>();
wsValidator->add<RawCountValidator>(false);
declareProperty(Kernel::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 Algorithms
} // namespace Mantid