|
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 | |
| IDetector_const_sptr | getDetectorResult () const |
| Gets the results of the trace, then returns the first detector (that is NOT a monitor) found in the results. | |
| Links | getResults () const |
| Get the results of the intersection tests that have been updated since the previous call to trace. | |
| InstrumentRayTracer (Instrument_const_sptr instrument) | |
| Constructor taking an instrument. | |
| 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. | |
| ~InstrumentRayTracer () | |
Private Member Functions | |
| const ComponentInfo & | componentInfo () const |
| const DetectorInfo & | detectorInfo () const |
| void | ensureOwnedInfoIsBuilt () const |
| ComponentInfo/DetectorInfo for m_instrument, built and owned here only if m_instrument is not parametrized (and so has none cached of its own to reuse). | |
| void | fireRay (Track &testRay) const |
| Fire the given track at the instrument. | |
| InstrumentRayTracer () | |
| Default constructor. | |
Private Attributes | |
| boost::unordered_map< IComponent *, BoundingBox > | m_boxCache |
| Map of component id -> bounding box. | |
| Instrument_const_sptr | m_instrument |
| Pointer to the instrument. | |
| std::mutex | m_mutex |
| Mutex to lock box cache. | |
| std::unique_ptr< ComponentInfo > | m_ownedComponentInfo |
| std::unique_ptr< DetectorInfo > | m_ownedDetectorInfo |
| 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 38 of file InstrumentRayTracer.h.
| Mantid::Geometry::InstrumentRayTracer::InstrumentRayTracer | ( | Instrument_const_sptr | instrument | ) |
Constructor taking an instrument.
Constructor specifying the instrument involved in the tracing.
The instrument must have defined a source component.
| instrument | :: The instrument to perform the ray tracings on. It must have a defined source. |
Definition at line 38 of file InstrumentRayTracer.cpp.
References m_instrument.
|
default |
|
private |
Default constructor.
|
private |
Definition at line 130 of file InstrumentRayTracer.cpp.
References ensureOwnedInfoIsBuilt(), m_instrument, and m_ownedComponentInfo.
Referenced by getDetectorResult().
|
private |
Definition at line 137 of file InstrumentRayTracer.cpp.
References ensureOwnedInfoIsBuilt(), m_instrument, and m_ownedDetectorInfo.
Referenced by getDetectorResult().
|
private |
ComponentInfo/DetectorInfo for m_instrument, built and owned here only if m_instrument is not parametrized (and so has none cached of its own to reuse).
Builds m_ownedComponentInfo/m_ownedDetectorInfo if not already built.
Only needed when m_instrument is not parametrized, in which case it has no ComponentInfo/DetectorInfo of its own to reuse.
Definition at line 125 of file InstrumentRayTracer.cpp.
References m_instrument, m_ownedComponentInfo, m_ownedDetectorInfo, and Mantid::Geometry::InstrumentVisitor::makeWrappers().
Referenced by componentInfo(), and detectorInfo().
|
private |
Fire the given track at the instrument.
Fire the test ray at the instrument and perform a bread-first search of the object tree to find the objects that were intersected.
| testRay | :: An input/output parameter that defines the track and accumulates the intersection results |
Definition at line 151 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::BoundingBox::doesLineIntersect(), m_boxCache, m_instrument, and m_mutex.
Referenced by trace(), and traceFromSample().
| IDetector_const_sptr Mantid::Geometry::InstrumentRayTracer::getDetectorResult | ( | ) | const |
Gets the results of the trace, then returns the first detector (that is NOT a monitor) found in the results.
Definition at line 102 of file InstrumentRayTracer.cpp.
References componentInfo(), detectorInfo(), getResults(), index, and m_instrument.
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 91 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::Track::cbegin(), Mantid::Geometry::Track::cend(), Mantid::Geometry::Track::clearIntersectionResults(), and m_resultsTrack.
Referenced by getDetectorResult().
| 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 63 of file InstrumentRayTracer.cpp.
References fireRay(), m_instrument, m_resultsTrack, and Mantid::Geometry::Track::reset().
| 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 80 of file InstrumentRayTracer.cpp.
References fireRay(), m_instrument, m_resultsTrack, and Mantid::Geometry::Track::reset().
Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().
|
mutableprivate |
Map of component id -> bounding box.
Definition at line 70 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
private |
Pointer to the instrument.
Definition at line 65 of file InstrumentRayTracer.h.
Referenced by componentInfo(), detectorInfo(), ensureOwnedInfoIsBuilt(), fireRay(), getDetectorResult(), InstrumentRayTracer(), trace(), and traceFromSample().
|
mutableprivate |
Mutex to lock box cache.
Definition at line 72 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
mutableprivate |
Definition at line 73 of file InstrumentRayTracer.h.
Referenced by componentInfo(), and ensureOwnedInfoIsBuilt().
|
mutableprivate |
Definition at line 74 of file InstrumentRayTracer.h.
Referenced by detectorInfo(), and ensureOwnedInfoIsBuilt().
|
mutableprivate |
Accumulate results in this Track object, aids performance.
This is cleared when getResults is called.
Definition at line 68 of file InstrumentRayTracer.h.
Referenced by getResults(), trace(), and traceFromSample().