Mantid
Loading...
Searching...
No Matches
Functions
Mantid::Geometry::ComponentInfoBankHelpers Namespace Reference

Functions

MANTID_GEOMETRY_DLL bool isAncestorOf (const ComponentInfo &compInfo, const size_t possibleAncestor, const size_t current)
 Finds all ancestors up to the root of a component index and returns true if the possible ancestor is encountered in the search. More...
 
MANTID_GEOMETRY_DLL bool isDetectorFixedInBank (const ComponentInfo &compInfo, const size_t detIndex)
 Tests whether or not the detector is within a fixed bank. More...
 
MANTID_GEOMETRY_DLL bool isSaveableBank (const ComponentInfo &compInfo, const DetectorInfo &detInfo, const size_t idx)
 Function: isSaveableBank. More...
 
MANTID_GEOMETRY_DLL Eigen::Vector3d offsetFromAncestor (const Mantid::Geometry::ComponentInfo &compInfo, const size_t ancestorIdx, const size_t currentIdx)
 Returns the position of the component at the current index relative to the ancestor component at the ancestor index. More...
 

Function Documentation

◆ isAncestorOf()

bool Mantid::Geometry::ComponentInfoBankHelpers::isAncestorOf ( const ComponentInfo compInfo,
const size_t  possibleAncestor,
const size_t  current 
)

Finds all ancestors up to the root of a component index and returns true if the possible ancestor is encountered in the search.

The root index is not counted, as the function exits upon reaching the root before further searching.

Parameters
compInfo: Geometry::ComponentInfo Instrument cache containing the component info.
possibleAncestor: the queried ancestor.
current: the queried descendant.

Definition at line 83 of file ComponentInfoBankHelpers.cpp.

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

◆ isDetectorFixedInBank()

bool Mantid::Geometry::ComponentInfoBankHelpers::isDetectorFixedInBank ( const ComponentInfo compInfo,
const size_t  detIndex 
)

Tests whether or not the detector is within a fixed bank.

If detIndex does not point to a detector, this will return false. This method only returns true if the bank which houses the detector is rectangular, a grid or structured.

Parameters
compInfoComponentInfo which defines instrument tree for testing
detIndexIndex of the detector to be tested
Returns
True if the detector is fixed in a bank, False otherwise.

Definition at line 25 of file ComponentInfoBankHelpers.cpp.

References Mantid::Geometry::ComponentInfo::componentType(), Mantid::Geometry::ComponentInfo::isDetector(), and Mantid::Geometry::ComponentInfo::parent().

Referenced by Mantid::DataHandling::MoveInstrumentComponent::exec(), and Mantid::Geometry::Instrument::makeLegacyParameterMap().

◆ isSaveableBank()

bool Mantid::Geometry::ComponentInfoBankHelpers::isSaveableBank ( const ComponentInfo compInfo,
const DetectorInfo detInfo,
const size_t  idx 
)

Function: isSaveableBank.

Returns true if the index of the component in the Instrument cache can be represented as an NXdetector, ignoring tubes. otherwise returns false. current implementation can treat root as saveable NXdetector.

Parameters
compInfo: Geometry::ComponentInfo flat tree representation of all components
detInfo: Geometry::DetectorInfo flat tree representation of detectors
idx: size_t index of component
Returns
true if component at index is bank, false otherwise.

Definition at line 52 of file ComponentInfoBankHelpers.cpp.

References Mantid::Geometry::ComponentInfo::detectorsInSubtree(), Mantid::Geometry::ComponentInfo::hasDetectors(), Mantid::Geometry::ComponentInfo::isDetector(), Mantid::Geometry::ComponentInfo::sample(), and Mantid::Geometry::ComponentInfo::source().

◆ offsetFromAncestor()

Eigen::Vector3d Mantid::Geometry::ComponentInfoBankHelpers::offsetFromAncestor ( const Mantid::Geometry::ComponentInfo compInfo,
const size_t  ancestorIdx,
const size_t  currentIdx 
)

Returns the position of the component at the current index relative to the ancestor component at the ancestor index.

Used by saveInstrument to get the pixel offsets relative directly to the bank, ignoring any intermediate assembly types.

Parameters
compInfo: Geometry::ComponentInfo Instrument cache containing the component info.
ancestorIdx: size_t index of ancestor component which the offset is relative to
currentIdx: size_t index of current component
Returns
Eigen::vector3d offset of the component at the current index relative to the ancestor component

Definition at line 106 of file ComponentInfoBankHelpers.cpp.

References Mantid::Geometry::ComponentInfo::position(), Mantid::Geometry::ComponentInfo::rotation(), Mantid::Kernel::toQuaterniond(), and Mantid::Kernel::toVector3d().