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

bool centerOfMassWithinBeamCenter ()
 This only has effect if the integral is ignoring the beam center as a whole.
 
double distanceFromPrevious () const
 
void findNewCenterPosition ()
 
double getCenterX () const
 
double getCenterY () const
 
void prepareCenterCalculation ()
 Copy the current center to the previous and update the x/y range for overall integration.
 
 WorkspaceBoundingBox (const API::MatrixWorkspace_const_sptr &workspace, const double integrationRadius, const double beamRadius, const bool ignoreDirectBeam, const double cenX, const double cenY)
 
 ~WorkspaceBoundingBox ()
 

Private Member Functions

double calculateRadiusX () const
 
double calculateRadiusY () const
 
double countsValue (const std::size_t index) const
 
bool includeInIntegration (const Kernel::V3D &position)
 
bool includeInIntegration (const std::size_t index)
 Checks to see if spectrum at index should be included in the integration.
 
void initOverallRangeAndFindFirstCenter ()
 
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 normalizePosition (const double totalCounts)
 Perform normalization on x/y coords over given values.
 
Kernel::V3D position (const std::size_t index) const
 
void resetIntermediatePosition ()
 
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.
 
void setCenterPrev (const double x, const double y)
 
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 include this spectrum.
 
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.
 

Private Attributes

double m_beamRadiusSq
 
double m_centerXPosCurr {0}
 
double m_centerXPosPrev {0}
 
double m_centerYPosCurr {0}
 
double m_centerYPosPrev {0}
 
bool m_ignoreDirectBeam
 
double m_integrationRadiusSq
 
std::size_t m_numSpectra
 
const API::SpectrumInfom_spectrumInfo
 
API::MatrixWorkspace_const_sptr m_workspace
 
double m_xBoxMax {0}
 
double m_xBoxMin {0}
 
double m_xPosMax {0}
 
double m_xPosMin {0}
 
double m_yBoxMax {0}
 
double m_yBoxMin {0}
 
double m_yPosMax {0}
 
double m_yPosMin {0}
 

Detailed Description

Definition at line 25 of file WorkspaceBoundingBox.h.

Constructor & Destructor Documentation

◆ WorkspaceBoundingBox()

Mantid::Algorithms::WorkspaceBoundingBox::WorkspaceBoundingBox ( const API::MatrixWorkspace_const_sptr workspace,
const double  integrationRadius,
const double  beamRadius,
const bool  ignoreDirectBeam,
const double  cenX,
const double  cenY 
)

◆ ~WorkspaceBoundingBox()

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

Member Function Documentation

◆ calculateRadiusX()

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

◆ calculateRadiusY()

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

◆ centerOfMassWithinBeamCenter()

bool Mantid::Algorithms::WorkspaceBoundingBox::centerOfMassWithinBeamCenter ( )

This only has effect if the integral is ignoring the beam center as a whole.

Definition at line 184 of file WorkspaceBoundingBox.cpp.

References calculateRadiusX(), calculateRadiusY(), m_beamRadiusSq, and m_ignoreDirectBeam.

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

◆ countsValue()

double Mantid::Algorithms::WorkspaceBoundingBox::countsValue ( const std::size_t  index) const
private

Definition at line 73 of file WorkspaceBoundingBox.cpp.

References index, and m_workspace.

Referenced by isValidIndex(), and updatePositionAndReturnCount().

◆ distanceFromPrevious()

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

◆ findNewCenterPosition()

void Mantid::Algorithms::WorkspaceBoundingBox::findNewCenterPosition ( )

◆ getCenterX()

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

◆ getCenterY()

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

◆ includeInIntegration() [1/2]

bool Mantid::Algorithms::WorkspaceBoundingBox::includeInIntegration ( const Kernel::V3D position)
private

◆ includeInIntegration() [2/2]

bool Mantid::Algorithms::WorkspaceBoundingBox::includeInIntegration ( const std::size_t  index)
private

Checks to see if spectrum at index should be included in the integration.

Parameters
index:: index of spectrum data

Definition at line 158 of file WorkspaceBoundingBox.cpp.

References includeInIntegration(), and position.

Referenced by findNewCenterPosition(), includeInIntegration(), and initOverallRangeAndFindFirstCenter().

◆ initOverallRangeAndFindFirstCenter()

void Mantid::Algorithms::WorkspaceBoundingBox::initOverallRangeAndFindFirstCenter ( )
private

◆ isValidIndex()

bool Mantid::Algorithms::WorkspaceBoundingBox::isValidIndex ( const std::size_t  index) const
private

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 103 of file WorkspaceBoundingBox.cpp.

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

Referenced by findNewCenterPosition(), and initOverallRangeAndFindFirstCenter().

◆ normalizePosition()

void Mantid::Algorithms::WorkspaceBoundingBox::normalizePosition ( const double  totalCounts)
private

Perform normalization on x/y coords over given values.

Definition at line 218 of file WorkspaceBoundingBox.cpp.

References m_centerXPosCurr, and m_centerYPosCurr.

Referenced by findNewCenterPosition(), and initOverallRangeAndFindFirstCenter().

◆ position()

Kernel::V3D Mantid::Algorithms::WorkspaceBoundingBox::position ( const std::size_t  index) const
private

◆ prepareCenterCalculation()

void Mantid::Algorithms::WorkspaceBoundingBox::prepareCenterCalculation ( )

Copy the current center to the previous and update the x/y range for overall integration.

Definition at line 198 of file WorkspaceBoundingBox.cpp.

References calculateRadiusX(), calculateRadiusY(), m_centerXPosCurr, m_centerYPosCurr, setBounds(), and setCenterPrev().

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

◆ resetIntermediatePosition()

void Mantid::Algorithms::WorkspaceBoundingBox::resetIntermediatePosition ( )
private

◆ setBounds()

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

Update the symmetric (in x and y separately) range of space that is symmetric around the beam center.

Definition at line 90 of file WorkspaceBoundingBox.cpp.

References m_xBoxMax, m_xBoxMin, m_yBoxMax, and m_yBoxMin.

Referenced by prepareCenterCalculation().

◆ setCenterPrev()

void Mantid::Algorithms::WorkspaceBoundingBox::setCenterPrev ( const double  x,
const double  y 
)
private

◆ symmetricRegionContainsPoint()

bool Mantid::Algorithms::WorkspaceBoundingBox::symmetricRegionContainsPoint ( double  x,
double  y 
)
private

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 229 of file WorkspaceBoundingBox.cpp.

References m_xBoxMax, m_xBoxMin, m_yBoxMin, and Mantid::Geometry::x.

Referenced by findNewCenterPosition().

◆ updateMinMax()

void Mantid::Algorithms::WorkspaceBoundingBox::updateMinMax ( const std::size_t  index)
private

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 143 of file WorkspaceBoundingBox.cpp.

References m_xPosMax, m_xPosMin, m_yPosMax, m_yPosMin, position, Mantid::Geometry::x, and Mantid::Geometry::y.

Referenced by initOverallRangeAndFindFirstCenter().

◆ updatePositionAndReturnCount()

double Mantid::Algorithms::WorkspaceBoundingBox::updatePositionAndReturnCount ( const std::size_t  index)
private

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 128 of file WorkspaceBoundingBox.cpp.

References countsValue(), m_centerXPosCurr, m_centerYPosCurr, and position.

Referenced by findNewCenterPosition(), and initOverallRangeAndFindFirstCenter().

Member Data Documentation

◆ m_beamRadiusSq

double Mantid::Algorithms::WorkspaceBoundingBox::m_beamRadiusSq
private

Definition at line 61 of file WorkspaceBoundingBox.h.

Referenced by centerOfMassWithinBeamCenter(), and includeInIntegration().

◆ m_centerXPosCurr

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

◆ m_centerXPosPrev

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

◆ m_centerYPosCurr

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

◆ m_centerYPosPrev

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

◆ m_ignoreDirectBeam

bool Mantid::Algorithms::WorkspaceBoundingBox::m_ignoreDirectBeam
private

Definition at line 62 of file WorkspaceBoundingBox.h.

Referenced by centerOfMassWithinBeamCenter(), and includeInIntegration().

◆ m_integrationRadiusSq

double Mantid::Algorithms::WorkspaceBoundingBox::m_integrationRadiusSq
private

Definition at line 60 of file WorkspaceBoundingBox.h.

Referenced by includeInIntegration().

◆ m_numSpectra

std::size_t Mantid::Algorithms::WorkspaceBoundingBox::m_numSpectra
private

◆ m_spectrumInfo

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

Definition at line 58 of file WorkspaceBoundingBox.h.

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

◆ m_workspace

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

Definition at line 57 of file WorkspaceBoundingBox.h.

Referenced by countsValue(), findNewCenterPosition(), and WorkspaceBoundingBox().

◆ m_xBoxMax

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

Definition at line 74 of file WorkspaceBoundingBox.h.

Referenced by setBounds(), and symmetricRegionContainsPoint().

◆ m_xBoxMin

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

Definition at line 73 of file WorkspaceBoundingBox.h.

Referenced by setBounds(), and symmetricRegionContainsPoint().

◆ m_xPosMax

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

Definition at line 69 of file WorkspaceBoundingBox.h.

Referenced by calculateRadiusX(), and updateMinMax().

◆ m_xPosMin

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

Definition at line 68 of file WorkspaceBoundingBox.h.

Referenced by calculateRadiusX(), and updateMinMax().

◆ m_yBoxMax

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

Definition at line 76 of file WorkspaceBoundingBox.h.

Referenced by setBounds().

◆ m_yBoxMin

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

Definition at line 75 of file WorkspaceBoundingBox.h.

Referenced by setBounds(), and symmetricRegionContainsPoint().

◆ m_yPosMax

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

Definition at line 71 of file WorkspaceBoundingBox.h.

Referenced by calculateRadiusY(), and updateMinMax().

◆ m_yPosMin

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

Definition at line 70 of file WorkspaceBoundingBox.h.

Referenced by calculateRadiusY(), and updateMinMax().


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