7constexpr int HISTOGRAM_INDEX{0};
11 const double integrationRadius,
const double beamRadius,
12 const bool ignoreDirectBeam,
const double cenX,
const double cenY)
13 : m_workspace(
workspace), m_integrationRadiusSq(integrationRadius * integrationRadius),
14 m_beamRadiusSq(beamRadius * beamRadius), m_ignoreDirectBeam(ignoreDirectBeam) {
16 throw std::runtime_error(
"This object only works with integrated workspaces");
29 throw std::runtime_error(
"SpectrumInfo object is not initialized");
38 double totalCount = 0;
57 double totalCount = 0;
59 const auto &spectrumInfo =
m_workspace->spectrumInfo();
64 const V3D pos = spectrumInfo.position(i);
105 throw std::runtime_error(
"SpectrumInfo object is not initialized");
107 g_log.
warning() <<
"Workspace index " <<
index <<
" has no detector assigned to it - discarding\n";
117 if (std::isnan(YIn) || std::isinf(YIn))
130 const auto &pos = this->
position(index);
144 const auto &pos = this->
position(index);
145 const double x = pos.X();
146 const double y = pos.Y();
165 const double distanceFromCenterSq = dx * dx + dy * dy;
178 return sqrt(xExtent * xExtent + yExtent * yExtent);
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
bool isMonitor(const size_t index) const
Returns true if the detector(s) associated with the spectrum are monitors.
bool hasDetectors(const size_t index) const
Returns true if the spectrum is associated with detectors in the instrument.
Kernel::V3D position(const size_t index) const
Returns the position of the spectrum with given index.
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 initOverallRangeAndFindFirstCenter()
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 m_integrationRadiusSq
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.
double calculateRadiusY() const
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.
double distanceFromPrevious() const
Kernel::V3D position(const std::size_t index) const
void setCenterPrev(const double x, const double y)
void findNewCenterPosition()
void resetIntermediatePosition()
double calculateRadiusX() const
WorkspaceBoundingBox(const API::MatrixWorkspace_const_sptr &workspace, const double integrationRadius, const double beamRadius, const bool ignoreDirectBeam, const double cenX, const double cenY)
double countsValue(const std::size_t index) const
const API::SpectrumInfo * m_spectrumInfo
void warning(const std::string &msg)
Logs at warning level.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Kernel::Logger g_log("DetermineSpinStateOrder")