|
Mantid
|
This class is responsible for tracking rays and accumulating a list of objects that are intersected along the way. More...
#include <InstrumentRayTracer.h>
Public Member Functions | |
| const ComponentInfo & | componentInfo () const |
| ComponentInfo/DetectorInfo for the traced instrument, against which the index returned by getDetectorResult is defined. | |
| const DetectorInfo & | detectorInfo () const |
| size_t | getDetectorResult () const |
| Get the index of the first non-monitor detector intersected since the previous call to trace, or ComponentInfo::invalidIndex if none. | |
| Links | getResults () const |
| Get the results of the intersection tests that have been updated since the previous call to trace. | |
| InstrumentRayTracer (ComponentInfo const &componentInfo, DetectorInfo const &detectorInfo) | |
| Constructor taking the ComponentInfo/DetectorInfo of the instrument to trace, which must outlive this object. | |
| void | trace (const Kernel::V3D &dir) const |
| Trace a given track from the instrument source in the given direction and compile a list of results that this track intersects. | |
| void | traceFromSample (const Kernel::V3D &dir) const |
| Trace a given track from the sample position in the given direction. | |
Private Member Functions | |
| void | fireRay (Track &testRay) const |
| Fire the given track at the instrument. | |
| void | testIntersectionWithGrid (size_t const index, Track &testRay) const |
| Intersect the track with the first layer of a Rectangular or Grid bank. | |
| void | testIntersectionWithShape (size_t const index, Track &testRay) const |
| Intersect the track with the shape of a leaf component. | |
Private Attributes | |
| boost::unordered_map< size_t, BoundingBox > | m_boxCache |
| Map of component index -> bounding box. | |
| ComponentInfo const & | m_componentInfo |
| ComponentInfo of the instrument being traced. | |
| DetectorInfo const & | m_detectorInfo |
| DetectorInfo of the instrument being traced. | |
| std::mutex | m_mutex |
| Mutex to lock box cache. | |
| Track | m_resultsTrack |
| Accumulate results in this Track object, aids performance. | |
This class is responsible for tracking rays and accumulating a list of objects that are intersected along the way.
Definition at line 37 of file InstrumentRayTracer.h.
| Mantid::Geometry::InstrumentRayTracer::InstrumentRayTracer | ( | ComponentInfo const & | componentInfo, |
| DetectorInfo const & | detectorInfo | ||
| ) |
Constructor taking the ComponentInfo/DetectorInfo of the instrument to trace, which must outlive this object.
Constructor specifying the instrument involved in the tracing, which must have a defined source.
| componentInfo | :: The ComponentInfo of the instrument to perform the ray tracings on. It must outlive this object. |
| detectorInfo | :: The DetectorInfo of the same instrument. It must outlive this object. |
Definition at line 37 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::ComponentInfo::hasSource(), and m_componentInfo.
| const ComponentInfo & Mantid::Geometry::InstrumentRayTracer::componentInfo | ( | ) | const |
ComponentInfo/DetectorInfo for the traced instrument, against which the index returned by getDetectorResult is defined.
Definition at line 106 of file InstrumentRayTracer.cpp.
References m_componentInfo.
| const DetectorInfo & Mantid::Geometry::InstrumentRayTracer::detectorInfo | ( | ) | const |
Definition at line 109 of file InstrumentRayTracer.cpp.
References m_detectorInfo.
Referenced by Mantid::DataObjects::Peak::findDetector().
|
private |
Fire the given track at the instrument.
Fire the test ray at the instrument and perform a breadth-first search of the ComponentInfo tree to find the components that were intersected.
| testRay | :: An input/output parameter that defines the track and accumulates the intersection results |
Definition at line 122 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::BoundingBox::doesLineIntersect(), m_boxCache, m_componentInfo, m_mutex, testIntersectionWithGrid(), and testIntersectionWithShape().
Referenced by trace(), and traceFromSample().
| size_t Mantid::Geometry::InstrumentRayTracer::getDetectorResult | ( | ) | const |
Get the index of the first non-monitor detector intersected since the previous call to trace, or ComponentInfo::invalidIndex if none.
Gets the results of the trace, then returns the index of the first detector (that is NOT a monitor) found in the results.
Definition at line 92 of file InstrumentRayTracer.cpp.
References getResults(), index, Mantid::Geometry::DetectorInfo::indexOf(), Mantid::Geometry::ComponentInfo::invalidIndex, m_componentInfo, and m_detectorInfo.
Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().
| Links Mantid::Geometry::InstrumentRayTracer::getResults | ( | ) | const |
Get the results of the intersection tests that have been updated since the previous call to trace.
Return the results of any trace() calls since the last call the getResults.
Definition at line 80 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::Track::cbegin(), Mantid::Geometry::Track::cend(), Mantid::Geometry::Track::clearIntersectionResults(), and m_resultsTrack.
Referenced by getDetectorResult().
|
private |
Intersect the track with the first layer of a Rectangular or Grid bank.
Intersect the track with the first layer of a Rectangular or Grid bank by treating it as a plane, adding a link to the track for the pixel hit.
| index | :: The component index of the bank |
| testRay | :: The track to test, which accumulates the results |
Base point (x,y,z) = position of pixel 0,0
Vertical (y-axis) basis vector of the detector
Horizontal (x-axis) basis vector of the detector
Definition at line 207 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::Track::addLink(), Mantid::Geometry::Track::direction(), index, Mantid::Kernel::Matrix< T >::Invert(), m_componentInfo, Mantid::Geometry::ComponentInfo::pixelGridComponent(), Mantid::Kernel::Matrix< T >::setColumn(), and Mantid::Geometry::Track::startPoint().
Referenced by fireRay().
|
private |
Intersect the track with the shape of a leaf component.
Intersect the track with the shape of a leaf component, adding a link to the track for each intersection.
| index | :: The component index of the leaf component |
| testRay | :: The track to test, which accumulates the results |
Definition at line 167 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::Track::addLink(), Mantid::Geometry::Track::direction(), Mantid::Kernel::V3D::distance(), index, Mantid::Kernel::Quat::inverse(), m_componentInfo, Mantid::Kernel::Quat::rotate(), Mantid::Geometry::ComponentInfo::shape(), and Mantid::Geometry::Track::startPoint().
Referenced by fireRay().
| void Mantid::Geometry::InstrumentRayTracer::trace | ( | const Kernel::V3D & | dir | ) | const |
Trace a given track from the instrument source in the given direction and compile a list of results that this track intersects.
Trace a given track from the instrument source in the given direction.
For performance reasons the results are accumulated within the object and can be returned using getResults.
| dir | :: A directional vector. The starting point is defined by the instrument source. |
Definition at line 54 of file InstrumentRayTracer.cpp.
References fireRay(), m_componentInfo, m_resultsTrack, Mantid::Geometry::Track::reset(), and Mantid::Geometry::ComponentInfo::sourcePosition().
| void Mantid::Geometry::InstrumentRayTracer::traceFromSample | ( | const Kernel::V3D & | dir | ) | const |
Trace a given track from the sample position in the given direction.
For performance reasons the results are accumulated within the object and can be returned using getResults.
| dir | :: A directional vector. The starting point is defined by the instrument source. |
Definition at line 69 of file InstrumentRayTracer.cpp.
References fireRay(), m_componentInfo, m_resultsTrack, Mantid::Geometry::Track::reset(), and Mantid::Geometry::ComponentInfo::samplePosition().
Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().
|
mutableprivate |
Map of component index -> bounding box.
Definition at line 74 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
private |
ComponentInfo of the instrument being traced.
Definition at line 67 of file InstrumentRayTracer.h.
Referenced by componentInfo(), fireRay(), getDetectorResult(), InstrumentRayTracer(), testIntersectionWithGrid(), testIntersectionWithShape(), trace(), and traceFromSample().
|
private |
DetectorInfo of the instrument being traced.
Definition at line 69 of file InstrumentRayTracer.h.
Referenced by detectorInfo(), and getDetectorResult().
|
mutableprivate |
Mutex to lock box cache.
Definition at line 76 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
mutableprivate |
Accumulate results in this Track object, aids performance.
This is cleared when getResults is called.
Definition at line 72 of file InstrumentRayTracer.h.
Referenced by getResults(), trace(), and traceFromSample().