Mantid
|
Defines a volume where interactions of Tracks and Objects can take place. More...
#include <MCInteractionVolume.h>
Public Types | |
enum class | ScatteringPointVicinity { SAMPLEANDENVIRONMENT , SAMPLEONLY , ENVIRONMENTONLY } |
Public Member Functions | |
virtual TrackPair | calculateBeforeAfterTrack (Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &startPos, const Kernel::V3D &endPos, MCInteractionStatistics &stats) const override |
Calculate a before scatter and after scatter track based on a scatter point in the volume given a start and end point. More... | |
ComponentScatterPoint | generatePoint (Kernel::PseudoRandomNumberGenerator &rng) const |
Generate point randomly across one of the components of the environment including the sample itself in the selection. More... | |
const Geometry::BoundingBox | getFullBoundingBox () const override |
Returns the axis-aligned bounding box for the volume including env if m_pointsIn != SampleOnly. More... | |
MCInteractionVolume (const API::Sample &sample, const size_t maxScatterAttempts=5000, const ScatteringPointVicinity pointsIn=ScatteringPointVicinity::SAMPLEANDENVIRONMENT) | |
Construct the volume encompassing the sample + any environment kit. More... | |
void | setActiveRegion (const Geometry::BoundingBox ®ion) override |
Public Member Functions inherited from Mantid::Algorithms::IMCInteractionVolume | |
virtual TrackPair | calculateBeforeAfterTrack (Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &startPos, const Kernel::V3D &endPos, MCInteractionStatistics &stats) const =0 |
virtual const Geometry::BoundingBox | getFullBoundingBox () const =0 |
virtual void | setActiveRegion (const Geometry::BoundingBox ®ion)=0 |
virtual | ~IMCInteractionVolume ()=default |
Private Member Functions | |
boost::optional< Kernel::V3D > | generatePointInObjectByIndex (int componentIndex, Kernel::PseudoRandomNumberGenerator &rng) const |
Generate a point in an object identified by an index. More... | |
int | getComponentIndex (Kernel::PseudoRandomNumberGenerator &rng) const |
Randomly select a component across the sample/environment. More... | |
Private Attributes | |
Geometry::BoundingBox | m_activeRegion |
const Geometry::SampleEnvironment * | m_env |
const size_t | m_maxScatterAttempts |
const ScatteringPointVicinity | m_pointsIn |
const std::shared_ptr< Geometry::IObject > | m_sample |
Defines a volume where interactions of Tracks and Objects can take place.
Given an initial Track, end point & wavelengths it calculates the absorption correction factor.
Definition at line 28 of file MCInteractionVolume.h.
|
strong |
Enumerator | |
---|---|
SAMPLEANDENVIRONMENT | |
SAMPLEONLY | |
ENVIRONMENTONLY |
Definition at line 30 of file MCInteractionVolume.h.
Mantid::Algorithms::MCInteractionVolume::MCInteractionVolume | ( | const API::Sample & | sample, |
const size_t | maxScatterAttempts = 5000 , |
||
const ScatteringPointVicinity | pointsIn = ScatteringPointVicinity::SAMPLEANDENVIRONMENT |
||
) |
Construct the volume encompassing the sample + any environment kit.
The active region defines a bounding region for the sampling of the scattering position.
sample | A reference to a sample object that defines a valid shape & material |
maxScatterAttempts | The maximum number of tries to generate a random point within the object. [Default=5000] |
pointsIn | Where to generate the scattering point in |
Definition at line 31 of file MCInteractionVolume.cpp.
References Mantid::Geometry::SampleEnvironment::getComponent(), Mantid::API::Sample::getEnvironment(), Mantid::Geometry::IObject::hasValidShape(), m_env, m_sample, and Mantid::Geometry::SampleEnvironment::nelements().
|
overridevirtual |
Calculate a before scatter and after scatter track based on a scatter point in the volume given a start and end point.
rng | A reference to a PseudoRandomNumberGenerator producing random number between [0,1] |
startPos | Origin of the initial track |
endPos | Final position of neutron after scattering (assumed to be outside of the "volume") |
stats | A statistics class to hold the statistics on the generated tracks such as the scattering angle and count of scatter points generated in each sample or environment part |
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 156 of file MCInteractionVolume.cpp.
References Mantid::Algorithms::ComponentScatterPoint::componentIndex, generatePoint(), Mantid::Geometry::SampleEnvironment::interceptSurfaces(), m_env, m_sample, Mantid::Kernel::normalize(), Mantid::Algorithms::ComponentScatterPoint::scatterPoint, Mantid::Algorithms::MCInteractionStatistics::UpdateScatterAngleStats(), and Mantid::Algorithms::MCInteractionStatistics::UpdateScatterPointCounts().
ComponentScatterPoint Mantid::Algorithms::MCInteractionVolume::generatePoint | ( | Kernel::PseudoRandomNumberGenerator & | rng | ) | const |
Generate point randomly across one of the components of the environment including the sample itself in the selection.
The method first selects a random component and then selects a random point within that component using Object::generatePointObject
rng | A reference to a PseudoRandomNumberGenerator where nextValue should return a flat random number between 0.0 & 1.0 |
Definition at line 129 of file MCInteractionVolume.cpp.
References generatePointInObjectByIndex(), getComponentIndex(), m_maxScatterAttempts, and std::to_string().
Referenced by calculateBeforeAfterTrack().
|
private |
Generate a point in an object identified by an index.
componentIndex | Index of the sample/environment component where the sample is -1 |
rng | A reference to a PseudoRandomNumberGenerator where nextValue should return a flat random number between 0.0 & 1.0 |
Definition at line 109 of file MCInteractionVolume.cpp.
References Mantid::Geometry::IObject::generatePointInObject(), Mantid::Geometry::SampleEnvironment::getComponent(), m_activeRegion, m_env, and m_sample.
Referenced by generatePoint().
|
private |
Randomly select a component across the sample/environment.
rng | A reference to a PseudoRandomNumberGenerator where nextValue should return a flat random number between 0.0 & 1.0 |
Definition at line 82 of file MCInteractionVolume.cpp.
References ENVIRONMENTONLY, m_env, m_pointsIn, m_sample, Mantid::Geometry::SampleEnvironment::nelements(), Mantid::Kernel::PseudoRandomNumberGenerator::nextInt(), and SAMPLEONLY.
Referenced by generatePoint().
|
overridevirtual |
Returns the axis-aligned bounding box for the volume including env if m_pointsIn != SampleOnly.
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 65 of file MCInteractionVolume.cpp.
References Mantid::Geometry::SampleEnvironment::boundingBox(), Mantid::Geometry::BoundingBox::grow(), m_env, m_pointsIn, m_sample, and SAMPLEONLY.
|
overridevirtual |
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 74 of file MCInteractionVolume.cpp.
References m_activeRegion.
|
private |
Definition at line 46 of file MCInteractionVolume.h.
Referenced by generatePointInObjectByIndex(), and setActiveRegion().
|
private |
Definition at line 45 of file MCInteractionVolume.h.
Referenced by calculateBeforeAfterTrack(), generatePointInObjectByIndex(), getComponentIndex(), getFullBoundingBox(), and MCInteractionVolume().
|
private |
Definition at line 47 of file MCInteractionVolume.h.
Referenced by generatePoint().
|
private |
Definition at line 48 of file MCInteractionVolume.h.
Referenced by getComponentIndex(), and getFullBoundingBox().
|
private |
Definition at line 44 of file MCInteractionVolume.h.
Referenced by calculateBeforeAfterTrack(), generatePointInObjectByIndex(), getComponentIndex(), getFullBoundingBox(), and MCInteractionVolume().