-
Notifications
You must be signed in to change notification settings - Fork 122
/
SignalOverError.cpp
54 lines (44 loc) · 1.92 KB
/
SignalOverError.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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 +
#include "MantidAlgorithms/SignalOverError.h"
#include "MantidKernel/System.h"
using namespace Mantid::Kernel;
using namespace Mantid::API;
namespace Mantid {
namespace Algorithms {
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(SignalOverError)
//----------------------------------------------------------------------------------------------
/** Constructor
*/
SignalOverError::SignalOverError() : UnaryOperation() {
// Flag that EventWorkspaces will become histograms
this->useHistogram = true;
}
//----------------------------------------------------------------------------------------------
/// Algorithm's name for identification. @see Algorithm::name
const std::string SignalOverError::name() const { return "SignalOverError"; }
/// Algorithm's version for identification. @see Algorithm::version
int SignalOverError::version() const { return 1; }
/// Algorithm's category for identification. @see Algorithm::category
const std::string SignalOverError::category() const {
return "Arithmetic\\Errors";
}
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
/** Perform the Y/E */
void SignalOverError::performUnaryOperation(const double XIn, const double YIn,
const double EIn, double &YOut,
double &EOut) {
(void)XIn; // Avoid compiler warning
// Signal / Error
YOut = YIn / EIn;
// Clear the error
EOut = 0.0;
}
} // namespace Algorithms
} // namespace Mantid