Mantid
Loading...
Searching...
No Matches
WorkspaceBoundingBox.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 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 "MantidHistogramData/Histogram.h"
12#include "MantidKernel/Logger.h"
13#include "MantidKernel/V3D.h"
14
15namespace Mantid {
16namespace Algorithms {
17namespace {
18// static logger
19Kernel::Logger g_log("WorkspaceBoundingBox");
20} // namespace
21
22/* This is a simple class originally intended for use solely with FindCenterOfMassPosition2.cpp
23 *
24 */
26public:
27 WorkspaceBoundingBox(const API::MatrixWorkspace_const_sptr &workspace, const double integrationRadius,
28 const double beamRadius, const bool ignoreDirectBeam, const double cenX, const double cenY);
30
31 double getCenterX() const { return m_centerXPosPrev; }
32 double getCenterY() const { return m_centerYPosPrev; }
33
36
37 double distanceFromPrevious() const;
38
40
41private:
43 Kernel::V3D position(const std::size_t index) const;
45 double countsValue(const std::size_t index) const;
46 bool isValidIndex(const std::size_t index) const;
47 void updateMinMax(const std::size_t index);
48 bool includeInIntegration(const std::size_t index);
50 bool symmetricRegionContainsPoint(double x, double y);
51 void setCenterPrev(const double x, const double y);
52 void setBounds(const double xMin, const double xMax, const double yMin, const double yMax);
53 void normalizePosition(const double totalCounts);
54 double updatePositionAndReturnCount(const std::size_t index);
55 double calculateRadiusX() const;
56 double calculateRadiusY() const;
59 std::size_t m_numSpectra;
67 // overall range to consider
68 double m_xPosMin{0};
69 double m_xPosMax{0};
70 double m_yPosMin{0};
71 double m_yPosMax{0};
72 // range for current search
73 double m_xBoxMin{0};
74 double m_xBoxMax{0};
75 double m_yBoxMin{0};
76 double m_yBoxMax{0};
77};
78
79} // namespace Algorithms
80} // namespace Mantid
double position
Definition GetAllEi.cpp:154
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
bool centerOfMassWithinBeamCenter()
This only has effect if the integral is ignoring the beam center as a whole.
API::MatrixWorkspace_const_sptr m_workspace
bool symmetricRegionContainsPoint(double x, double y)
Checks if a given x/y coord is within the bounding box.
void updateMinMax(const std::size_t index)
Compare current mins and maxs to the coordinates of the spectrum at index expnd mins and maxs to incl...
void prepareCenterCalculation()
Copy the current center to the previous and update the x/y range for overall integration.
void normalizePosition(const double totalCounts)
Perform normalization on x/y coords over given values.
void setBounds(const double xMin, const double xMax, const double yMin, const double yMax)
Update the symmetric (in x and y separately) range of space that is symmetric around the beam center.
bool includeInIntegration(const std::size_t index)
Checks to see if spectrum at index should be included in the integration.
double updatePositionAndReturnCount(const std::size_t index)
Sets member variables x/y to new x/y based on spectrum info and historgram data at the given index.
bool isValidIndex(const std::size_t index) const
Performs checks on the spectrum located at index to determine if it is acceptable to be operated on.
void setCenterPrev(const double x, const double y)
double countsValue(const std::size_t index) const
Class for 3D vectors.
Definition V3D.h:34
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Kernel::Logger g_log("DetermineSpinStateOrder")
Helper class which provides the Collimation Length for SANS instruments.