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

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. More...
 
Links getResults () const
 Get the results of the intersection tests that have been updated since the previous call to trace. More...
 
 InstrumentRayTracer (Instrument_const_sptr instrument)
 Constructor taking an instrument. More...
 
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. More...
 
void traceFromSample (const Kernel::V3D &dir) const
 Trace a given track from the sample position in the given direction. More...
 

Private Member Functions

void fireRay (Track &testRay) const
 Fire the given track at the instrument. More...
 
 InstrumentRayTracer ()
 Default constructor. More...
 

Private Attributes

boost::unordered_map< IComponent *, BoundingBoxm_boxCache
 Map of component id -> bounding box. More...
 
Instrument_const_sptr m_instrument
 Pointer to the instrument. More...
 
std::mutex m_mutex
 Mutex to lock box cache. More...
 
Track m_resultsTrack
 Accumulate results in this Track object, aids performance. More...
 

Detailed Description

This class is responsible for tracking rays and accumulating a list of objects that are intersected along the way.

Author
Martyn Gigg, Tessella plc
Date
22/10/2010

Definition at line 37 of file InstrumentRayTracer.h.

Constructor & Destructor Documentation

◆ InstrumentRayTracer() [1/2]

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.

Parameters
instrument:: The instrument to perform the ray tracings on. It must have a defined source.

Definition at line 35 of file InstrumentRayTracer.cpp.

References m_instrument.

◆ InstrumentRayTracer() [2/2]

Mantid::Geometry::InstrumentRayTracer::InstrumentRayTracer ( )
private

Default constructor.

Member Function Documentation

◆ fireRay()

void Mantid::Geometry::InstrumentRayTracer::fireRay ( Track testRay) const
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.

Parameters
testRay:: An input/output parameter that defines the track and accumulates the intersection results

Definition at line 124 of file InstrumentRayTracer.cpp.

References Mantid::Geometry::BoundingBox::doesLineIntersect(), m_boxCache, m_instrument, and m_mutex.

Referenced by trace(), and traceFromSample().

◆ getDetectorResult()

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.

Returns
sptr to IDetector, or an invalid sptr if not found

Definition at line 97 of file InstrumentRayTracer.cpp.

References getResults(), and m_instrument.

Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().

◆ getResults()

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.

Returns
A collection of links defining intersection information

Definition at line 86 of file InstrumentRayTracer.cpp.

References Mantid::Geometry::Track::cbegin(), Mantid::Geometry::Track::cend(), Mantid::Geometry::Track::clearIntersectionResults(), and m_resultsTrack.

Referenced by getDetectorResult().

◆ trace()

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.

Parameters
dir:: A directional vector. The starting point is defined by the instrument source.

Definition at line 58 of file InstrumentRayTracer.cpp.

References fireRay(), m_instrument, m_resultsTrack, and Mantid::Geometry::Track::reset().

◆ traceFromSample()

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.

Parameters
dir:: A directional vector. The starting point is defined by the instrument source.

Definition at line 75 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().

Member Data Documentation

◆ m_boxCache

boost::unordered_map<IComponent *, BoundingBox> Mantid::Geometry::InstrumentRayTracer::m_boxCache
mutableprivate

Map of component id -> bounding box.

Definition at line 63 of file InstrumentRayTracer.h.

Referenced by fireRay().

◆ m_instrument

Instrument_const_sptr Mantid::Geometry::InstrumentRayTracer::m_instrument
private

Pointer to the instrument.

Definition at line 58 of file InstrumentRayTracer.h.

Referenced by fireRay(), getDetectorResult(), InstrumentRayTracer(), trace(), and traceFromSample().

◆ m_mutex

std::mutex Mantid::Geometry::InstrumentRayTracer::m_mutex
mutableprivate

Mutex to lock box cache.

Definition at line 65 of file InstrumentRayTracer.h.

Referenced by fireRay().

◆ m_resultsTrack

Track Mantid::Geometry::InstrumentRayTracer::m_resultsTrack
mutableprivate

Accumulate results in this Track object, aids performance.

This is cleared when getResults is called.

Definition at line 61 of file InstrumentRayTracer.h.

Referenced by getResults(), trace(), and traceFromSample().


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