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

#include <PanelsSurfaceCalculator.h>

Public Member Functions

Mantid::Kernel::Quat calcBankRotation (const V3D &detPos, V3D normal, const V3D &zAxis, const V3D &yAxis, const V3D &samplePosition) const
 Calculate the rotation needed around the bank's local x and y axes to place a bank on the projection plane Perform the rotation in two stages to avoid any twist about the normal.
 
V3D calculateBankNormal (const ComponentInfo &componentInfo, const std::vector< size_t > &tubes)
 Calculate the normal vector of a bank of detectors.
 
V3D calculatePanelNormal (const std::vector< V3D > &panelCorners) const
 Calculate the normal vector to a panel.
 
std::vector< std::vector< size_t > > examineAllComponents (const ComponentInfo &componentInfo, std::function< std::vector< size_t >(const ComponentInfo &, size_t, std::vector< bool > &)> operation)
 Perform a specified operation on all the components.
 
size_t findNumDetectors (const ComponentInfo &componentInfo, const std::vector< size_t > &components) const
 How many detectors are there in the given list of component indices?
 
std::optional< Kernel::V2DgetSideBySideViewPos (const ComponentInfo &componentInfo, const Instrument_const_sptr &instrument, const size_t componentIndex) const
 Gives the specified side-by-side view position from the IDF.
 
bool isBankFlat (const ComponentInfo &componentInfo, size_t bankIndex, const std::vector< size_t > &tubes, const V3D &normal)
 Do all the detectors lie in a plane?
 
std::vector< V3DretrievePanelCorners (const ComponentInfo &componentInfo, const size_t rootIndex) const
 Returns the four corners of the specified panel.
 
void setBankVisited (const ComponentInfo &componentInfo, size_t bankIndex, std::vector< bool > &visitedComponents) const
 Recursively set all detectors and subcomponents of a bank as visited.
 
void setupBasisAxes (const V3D &zaxis, V3D &xaxis, V3D &yaxis) const
 Given the z axis, define the x and y ones.
 
std::vector< Mantid::Kernel::V2DtransformedBoundingBoxPoints (const ComponentInfo &componentInfo, size_t detectorIndex, const V3D &refPos, const Mantid::Kernel::Quat &rotation, const V3D &xaxis, const V3D &yaxis) const
 Transforms bounding box of a detector.
 
std::vector< size_t > tubeDetectorParentIDs (const ComponentInfo &componentInfo, size_t rootIndex, std::vector< bool > &visited)
 Parent indices of tubes.
 

Private Attributes

Mantid::Kernel::Logger g_log = Mantid::Kernel::Logger("PanelsSurfaceCalculator")
 

Detailed Description

Definition at line 28 of file PanelsSurfaceCalculator.h.

Member Function Documentation

◆ calcBankRotation()

Mantid::Kernel::Quat Mantid::API::PanelsSurfaceCalculator::calcBankRotation ( const V3D detPos,
V3D  normal,
const V3D zAxis,
const V3D yAxis,
const V3D samplePosition 
) const

Calculate the rotation needed around the bank's local x and y axes to place a bank on the projection plane Perform the rotation in two stages to avoid any twist about the normal.

Parameters
detPos:: Position of a detector of the bank.
normal:: Normal to the bank's plane.
zAxis:: Direction to the viewer
yAxis:: Perpendicular axis
samplePosition:: Sample position
Returns
:: Rotation

Definition at line 226 of file PanelsSurfaceCalculator.cpp.

References Mantid::Kernel::V3D::cross_prod(), Mantid::Kernel::V3D::normalize(), Mantid::Kernel::V3D::nullVector(), Mantid::Kernel::V3D::scalar_prod(), Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().

◆ calculateBankNormal()

Mantid::Kernel::V3D Mantid::API::PanelsSurfaceCalculator::calculateBankNormal ( const ComponentInfo componentInfo,
const std::vector< size_t > &  tubes 
)

Calculate the normal vector of a bank of detectors.

Parameters
componentInfo:: ComponentInfo object from the workspace
tubes:: Component indices of the tubes in the bank
Returns
Bank normal vector

Definition at line 154 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::children(), g_log, Mantid::Kernel::V3D::normalize(), Mantid::Geometry::ComponentInfo::position(), Mantid::Kernel::Logger::warning(), Mantid::Geometry::x, and Mantid::Geometry::y.

Referenced by tubeDetectorParentIDs().

◆ calculatePanelNormal()

Mantid::Kernel::V3D Mantid::API::PanelsSurfaceCalculator::calculatePanelNormal ( const std::vector< V3D > &  panelCorners) const

Calculate the normal vector to a panel.

Parameters
panelCorners:: The four panel corner locations
Returns
:: Normal vector

Definition at line 117 of file PanelsSurfaceCalculator.cpp.

References Mantid::Kernel::normalize().

◆ examineAllComponents()

std::vector< std::vector< size_t > > Mantid::API::PanelsSurfaceCalculator::examineAllComponents ( const ComponentInfo componentInfo,
std::function< std::vector< size_t >(const ComponentInfo &, size_t, std::vector< bool > &)>  operation 
)

Perform a specified operation on all the components.

Parameters
componentInfo:: ComponentInfo object from the workspace
operation:: Operation to perform on each component
Returns
Detector IDs for each component

Definition at line 299 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::children(), Mantid::Geometry::ComponentInfo::parent(), Mantid::Geometry::ComponentInfo::root(), and Mantid::Geometry::ComponentInfo::size().

◆ findNumDetectors()

size_t Mantid::API::PanelsSurfaceCalculator::findNumDetectors ( const ComponentInfo componentInfo,
const std::vector< size_t > &  components 
) const

How many detectors are there in the given list of component indices?

Parameters
componentInfo:: ComponentInfo object from the workspace
components:: Component indices to check
Returns
:: Number of detectors

Definition at line 208 of file PanelsSurfaceCalculator.cpp.

◆ getSideBySideViewPos()

std::optional< Kernel::V2D > Mantid::API::PanelsSurfaceCalculator::getSideBySideViewPos ( const ComponentInfo componentInfo,
const Instrument_const_sptr instrument,
const size_t  componentIndex 
) const

Gives the specified side-by-side view position from the IDF.

Parameters
componentInfo:: ComponentInfo object from the workspace
instrument:: Instrument object from the workspace
componentIndex:: Component index to check
Returns
:: Side-by-side position from the IDF

Definition at line 393 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::componentID().

◆ isBankFlat()

bool Mantid::API::PanelsSurfaceCalculator::isBankFlat ( const ComponentInfo componentInfo,
size_t  bankIndex,
const std::vector< size_t > &  tubes,
const V3D normal 
)

Do all the detectors lie in a plane?

Parameters
componentInfo:: ComponentInfo object from the workspace
bankIndex:: Component index of bank
tubes:: Tube component indices
normal:: Panel normal vector
Returns
Do the detectors lie flat in a plane?

Definition at line 134 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::children(), g_log, Mantid::Geometry::ComponentInfo::name(), Mantid::Kernel::normalize(), Mantid::Geometry::ComponentInfo::position(), Mantid::Kernel::Tolerance, and Mantid::Kernel::Logger::warning().

◆ retrievePanelCorners()

std::vector< Mantid::Kernel::V3D > Mantid::API::PanelsSurfaceCalculator::retrievePanelCorners ( const ComponentInfo componentInfo,
const size_t  rootIndex 
) const

◆ setBankVisited()

void Mantid::API::PanelsSurfaceCalculator::setBankVisited ( const ComponentInfo componentInfo,
size_t  bankIndex,
std::vector< bool > &  visitedComponents 
) const

Recursively set all detectors and subcomponents of a bank as visited.

Parameters
componentInfo:: ComponentInfo object from the workspace
bankIndex:: Component index of the bank
visitedComponents:: Vector keeping track of which components have been visited

Definition at line 188 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::children(), and setBankVisited().

Referenced by setBankVisited(), and tubeDetectorParentIDs().

◆ setupBasisAxes()

void Mantid::API::PanelsSurfaceCalculator::setupBasisAxes ( const V3D zaxis,
V3D xaxis,
V3D yaxis 
) const

Given the z axis, define the x and y ones.

Parameters
zaxis:: A given vector in 3d space to become the z axis of a coordinate system.
xaxis:: An output arbitrary vector perpendicular to zaxis.
yaxis:: An output arbitrary vector perpendicular to both zaxis and xaxis.

Definition at line 31 of file PanelsSurfaceCalculator.cpp.

References Mantid::Kernel::V3D::cross_prod(), Mantid::Kernel::V3D::getSpherical(), and Mantid::Kernel::V3D::normalize().

◆ transformedBoundingBoxPoints()

std::vector< Mantid::Kernel::V2D > Mantid::API::PanelsSurfaceCalculator::transformedBoundingBoxPoints ( const ComponentInfo componentInfo,
size_t  detectorIndex,
const V3D refPos,
const Mantid::Kernel::Quat rotation,
const V3D xaxis,
const V3D yaxis 
) const

Transforms bounding box of a detector.

Parameters
componentInfo:: ComponentInfo object from the workspace
detectorIndex:: Component index of the detector
refPos:: Reference position
rotation:: Rotation to apply
xaxis:: X axis
yaxis:: Y axis
Returns
Transformed bounding box points

Definition at line 277 of file PanelsSurfaceCalculator.cpp.

References Mantid::Geometry::ComponentInfo::boundingBox(), detectorIndex, Mantid::Geometry::BoundingBox::minPoint(), Mantid::Kernel::Quat::rotate(), rotation, and Mantid::Kernel::V3D::scalar_prod().

◆ tubeDetectorParentIDs()

std::vector< size_t > Mantid::API::PanelsSurfaceCalculator::tubeDetectorParentIDs ( const ComponentInfo componentInfo,
size_t  rootIndex,
std::vector< bool > &  visited 
)

Parent indices of tubes.

Parameters
componentInfo:: ComponentInfo object from the workspace
rootIndex:: Component index to check
visited:: Vector tracking which components have been checked
Returns
Parent IDs

Definition at line 326 of file PanelsSurfaceCalculator.cpp.

References calculateBankNormal(), Mantid::Geometry::ComponentInfo::children(), Mantid::Geometry::ComponentInfo::componentType(), Mantid::Geometry::ComponentInfo::hasParent(), index, Mantid::Kernel::V3D::nullVector(), Mantid::Geometry::ComponentInfo::parent(), setBankVisited(), and Mantid::Kernel::V3D::size().

Member Data Documentation

◆ g_log

Mantid::Kernel::Logger Mantid::API::PanelsSurfaceCalculator::g_log = Mantid::Kernel::Logger("PanelsSurfaceCalculator")
private

Definition at line 54 of file PanelsSurfaceCalculator.h.

Referenced by calculateBankNormal(), and isBankFlat().


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