Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Algorithms::WorkspaceBoundingBox Class Reference

#include <WorkspaceBoundingBox.h>

Public Member Functions

double calculateDistance () const
 
double calculateRadiusX () const
 
double calculateRadiusY () const
 
bool containsPoint (double x, double y)
 Checks if a given x/y coord is within the bounding box. More...
 
int findFirstValidWs (const int numSpec) const
 Searches for the first valid spectrum info in member variable workspace More...
 
double getCenterX () const
 
double getCenterY () const
 
API::MatrixWorkspace_const_sptr getWorkspace ()
 
double getX () const
 
double getXMax () const
 
double getXMin () const
 
double getY () const
 
double getYMax () const
 
double getYMin () const
 
bool isOutOfBoundsOfNonDirectBeam (const double beamRadius, int index, const bool directBeam)
 Checks to see if spectrum at index is within the diameter of the given beamRadius. More...
 
bool isValidWs (int index) const
 Performs checks on the spectrum located at index to determine if it is acceptable to be operated on. More...
 
void normalizePosition (double x, double y)
 Perform normalization on x/y coords over given values. More...
 
void setBounds (double xMin, double xMax, double yMin, double yMax)
 
void setCenter (double x, double y)
 
void setPosition (double x, double y)
 
void updateMinMax (int index)
 Compare current mins and maxs to the coordinates of the spectrum at index expnd mins and maxs to include this spectrum. More...
 
double updatePositionAndReturnCount (int index)
 Sets member variables x/y to new x/y based on spectrum info and historgram data at the given index. More...
 
 WorkspaceBoundingBox ()
 
 WorkspaceBoundingBox (const API::MatrixWorkspace_const_sptr &workspace)
 
 ~WorkspaceBoundingBox ()
 

Private Member Functions

Kernel::V3Dposition (int index) const
 
double yValue (const int index) const
 

Private Attributes

double centerX {0}
 
double centerY {0}
 
int m_cachedHistogramYIndex {-1}
 
Kernel::V3D m_cachedPosition
 
int m_cachedPositionIndex {-1}
 
double m_cachedYValue
 
const API::SpectrumInfom_spectrumInfo
 
API::MatrixWorkspace_const_sptr m_workspace
 
double x {0}
 
double xMax {0}
 
double xMin {0}
 
double y {0}
 
double yMax {0}
 
double yMin {0}
 

Detailed Description

Definition at line 25 of file WorkspaceBoundingBox.h.

Constructor & Destructor Documentation

◆ WorkspaceBoundingBox() [1/2]

Mantid::Algorithms::WorkspaceBoundingBox::WorkspaceBoundingBox ( const API::MatrixWorkspace_const_sptr workspace)

Definition at line 10 of file WorkspaceBoundingBox.cpp.

References m_spectrumInfo, m_workspace, and workspace.

◆ WorkspaceBoundingBox() [2/2]

Mantid::Algorithms::WorkspaceBoundingBox::WorkspaceBoundingBox ( )

Definition at line 17 of file WorkspaceBoundingBox.cpp.

References m_spectrumInfo.

◆ ~WorkspaceBoundingBox()

Mantid::Algorithms::WorkspaceBoundingBox::~WorkspaceBoundingBox ( )
default

Member Function Documentation

◆ calculateDistance()

double Mantid::Algorithms::WorkspaceBoundingBox::calculateDistance ( ) const

◆ calculateRadiusX()

double Mantid::Algorithms::WorkspaceBoundingBox::calculateRadiusX ( ) const

Definition at line 154 of file WorkspaceBoundingBox.cpp.

References x, xMax, and xMin.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ calculateRadiusY()

double Mantid::Algorithms::WorkspaceBoundingBox::calculateRadiusY ( ) const

Definition at line 156 of file WorkspaceBoundingBox.cpp.

References y, yMax, and yMin.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ containsPoint()

bool Mantid::Algorithms::WorkspaceBoundingBox::containsPoint ( double  x,
double  y 
)

Checks if a given x/y coord is within the bounding box.

Parameters
x:: x coordinate
y:: y coordinate
Returns
true/false if it is within the mins/maxs of the box

Definition at line 174 of file WorkspaceBoundingBox.cpp.

References x, xMax, xMin, and yMin.

Referenced by Mantid::Algorithms::updateBoundingBox().

◆ findFirstValidWs()

int Mantid::Algorithms::WorkspaceBoundingBox::findFirstValidWs ( const int  numSpec) const

Searches for the first valid spectrum info in member variable workspace

Parameters
numSpec:: the number of spectrum in the workspace to search through
Returns
index of first valid spectrum

Definition at line 89 of file WorkspaceBoundingBox.cpp.

References isValidWs().

◆ getCenterX()

double Mantid::Algorithms::WorkspaceBoundingBox::getCenterX ( ) const
inline

◆ getCenterY()

double Mantid::Algorithms::WorkspaceBoundingBox::getCenterY ( ) const
inline

◆ getWorkspace()

API::MatrixWorkspace_const_sptr Mantid::Algorithms::WorkspaceBoundingBox::getWorkspace ( )
inline

Definition at line 31 of file WorkspaceBoundingBox.h.

References m_workspace.

Referenced by Mantid::Algorithms::updateBoundingBox().

◆ getX()

double Mantid::Algorithms::WorkspaceBoundingBox::getX ( ) const
inline

Definition at line 32 of file WorkspaceBoundingBox.h.

References x.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ getXMax()

double Mantid::Algorithms::WorkspaceBoundingBox::getXMax ( ) const
inline

Definition at line 37 of file WorkspaceBoundingBox.h.

References xMax.

◆ getXMin()

double Mantid::Algorithms::WorkspaceBoundingBox::getXMin ( ) const
inline

Definition at line 36 of file WorkspaceBoundingBox.h.

References xMin.

◆ getY()

double Mantid::Algorithms::WorkspaceBoundingBox::getY ( ) const
inline

Definition at line 33 of file WorkspaceBoundingBox.h.

References y.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ getYMax()

double Mantid::Algorithms::WorkspaceBoundingBox::getYMax ( ) const
inline

Definition at line 39 of file WorkspaceBoundingBox.h.

References yMax.

◆ getYMin()

double Mantid::Algorithms::WorkspaceBoundingBox::getYMin ( ) const
inline

Definition at line 38 of file WorkspaceBoundingBox.h.

References yMin.

◆ isOutOfBoundsOfNonDirectBeam()

bool Mantid::Algorithms::WorkspaceBoundingBox::isOutOfBoundsOfNonDirectBeam ( const double  beamRadius,
int  index,
const bool  directBeam 
)

Checks to see if spectrum at index is within the diameter of the given beamRadius.

Parameters
beamRadius:: radius of beam in meters
index:: index of spectrum data
directBeam:: whether or not the spectrum is subject to the beam
Returns
number of points of histogram data at index

Definition at line 137 of file WorkspaceBoundingBox.cpp.

References centerX, centerY, and position.

Referenced by Mantid::Algorithms::initBoundingBox(), and Mantid::Algorithms::updateBoundingBox().

◆ isValidWs()

bool Mantid::Algorithms::WorkspaceBoundingBox::isValidWs ( int  index) const

Performs checks on the spectrum located at index to determine if it is acceptable to be operated on.

Parameters
index:: index of spectrum data
Returns
true/false if its valid

Definition at line 65 of file WorkspaceBoundingBox.cpp.

References Mantid::API::g_log, Mantid::API::SpectrumInfo::hasDetectors(), index, Mantid::API::SpectrumInfo::isMonitor(), m_spectrumInfo, Mantid::Kernel::Logger::warning(), and yValue().

Referenced by findFirstValidWs(), Mantid::Algorithms::initBoundingBox(), and Mantid::Algorithms::updateBoundingBox().

◆ normalizePosition()

void Mantid::Algorithms::WorkspaceBoundingBox::normalizePosition ( double  x,
double  y 
)

Perform normalization on x/y coords over given values.

Parameters
x:: value to normalize member x over
y:: value to normalize member y over

Definition at line 163 of file WorkspaceBoundingBox.cpp.

References x, and y.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ position()

Kernel::V3D & Mantid::Algorithms::WorkspaceBoundingBox::position ( int  index) const
private

◆ setBounds()

void Mantid::Algorithms::WorkspaceBoundingBox::setBounds ( double  xMin,
double  xMax,
double  yMin,
double  yMax 
)

◆ setCenter()

void Mantid::Algorithms::WorkspaceBoundingBox::setCenter ( double  x,
double  y 
)

◆ setPosition()

void Mantid::Algorithms::WorkspaceBoundingBox::setPosition ( double  x,
double  y 
)

Definition at line 42 of file WorkspaceBoundingBox.cpp.

References x, and y.

Referenced by Mantid::Algorithms::FindCenterOfMassPosition2::findCenterOfMass().

◆ updateMinMax()

void Mantid::Algorithms::WorkspaceBoundingBox::updateMinMax ( int  index)

Compare current mins and maxs to the coordinates of the spectrum at index expnd mins and maxs to include this spectrum.

Parameters
index:: index of spectrum data

Definition at line 119 of file WorkspaceBoundingBox.cpp.

References position, x, xMax, xMin, y, yMax, and yMin.

Referenced by Mantid::Algorithms::initBoundingBox().

◆ updatePositionAndReturnCount()

double Mantid::Algorithms::WorkspaceBoundingBox::updatePositionAndReturnCount ( int  index)

Sets member variables x/y to new x/y based on spectrum info and historgram data at the given index.

Parameters
index:: index of spectrum data
Returns
number of points of histogram data at index

Definition at line 104 of file WorkspaceBoundingBox.cpp.

References position, x, y, and yValue().

Referenced by Mantid::Algorithms::initBoundingBox(), and Mantid::Algorithms::updateBoundingBox().

◆ yValue()

double Mantid::Algorithms::WorkspaceBoundingBox::yValue ( const int  index) const
private

Member Data Documentation

◆ centerX

double Mantid::Algorithms::WorkspaceBoundingBox::centerX {0}
private

◆ centerY

double Mantid::Algorithms::WorkspaceBoundingBox::centerY {0}
private

◆ m_cachedHistogramYIndex

int Mantid::Algorithms::WorkspaceBoundingBox::m_cachedHistogramYIndex {-1}
mutableprivate

Definition at line 73 of file WorkspaceBoundingBox.h.

Referenced by yValue().

◆ m_cachedPosition

Kernel::V3D Mantid::Algorithms::WorkspaceBoundingBox::m_cachedPosition
mutableprivate

Definition at line 72 of file WorkspaceBoundingBox.h.

Referenced by position().

◆ m_cachedPositionIndex

int Mantid::Algorithms::WorkspaceBoundingBox::m_cachedPositionIndex {-1}
mutableprivate

Definition at line 71 of file WorkspaceBoundingBox.h.

Referenced by position().

◆ m_cachedYValue

double Mantid::Algorithms::WorkspaceBoundingBox::m_cachedYValue
mutableprivate

Definition at line 74 of file WorkspaceBoundingBox.h.

Referenced by yValue().

◆ m_spectrumInfo

const API::SpectrumInfo* Mantid::Algorithms::WorkspaceBoundingBox::m_spectrumInfo
private

Definition at line 61 of file WorkspaceBoundingBox.h.

Referenced by isValidWs(), position(), and WorkspaceBoundingBox().

◆ m_workspace

API::MatrixWorkspace_const_sptr Mantid::Algorithms::WorkspaceBoundingBox::m_workspace
private

Definition at line 60 of file WorkspaceBoundingBox.h.

Referenced by getWorkspace(), WorkspaceBoundingBox(), and yValue().

◆ x

double Mantid::Algorithms::WorkspaceBoundingBox::x {0}
private

◆ xMax

double Mantid::Algorithms::WorkspaceBoundingBox::xMax {0}
private

◆ xMin

double Mantid::Algorithms::WorkspaceBoundingBox::xMin {0}
private

◆ y

double Mantid::Algorithms::WorkspaceBoundingBox::y {0}
private

◆ yMax

double Mantid::Algorithms::WorkspaceBoundingBox::yMax {0}
private

Definition at line 69 of file WorkspaceBoundingBox.h.

Referenced by calculateRadiusY(), getYMax(), setBounds(), and updateMinMax().

◆ yMin

double Mantid::Algorithms::WorkspaceBoundingBox::yMin {0}
private

The documentation for this class was generated from the following files: