Mantid
Loading...
Searching...
No Matches
EqualBinsChecker.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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
9#include "MantidKernel/DllConfig.h"
11#include <span>
12#include <string>
13
14namespace Mantid {
15namespace Kernel {
16
23class MANTID_KERNEL_DLL EqualBinsChecker {
24public:
26 enum class ReferenceBin { Average, First };
28 enum class ErrorType { Cumulative, Individual };
29 // Note: xData is a non-owning view and must outlive this object. It is a span so that the
30 // size-checked histogram data types can be checked directly, without a std::vector<double>.
31 EqualBinsChecker(std::span<double const> xData, const double errorLevel, const double warningLevel = -1);
32 virtual ~EqualBinsChecker() = default;
33 virtual std::string validate() const;
34 virtual void setReferenceBin(const ReferenceBin &refBinType);
35 virtual void setErrorType(const ErrorType &errorType);
36
37protected:
38 virtual double getReferenceDx() const;
39 virtual double getDifference(const size_t bin, const double dx) const;
40
41private:
42 std::span<double const> const m_xData;
43 const double m_errorLevel;
44 const bool m_warn;
45 const double m_warningLevel;
48};
49
50} // namespace Kernel
51} // namespace Mantid
EqualBinsChecker : Checks for evenly spaced bins.
ErrorType
Type of errors to check.
virtual ~EqualBinsChecker()=default
ReferenceBin
Type of bin to compare others to.
std::span< double const > const m_xData
Helper class which provides the Collimation Length for SANS instruments.