|
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 Types inherited from Mantid::Algorithms::IMCInteractionVolume | |
| 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. | |
| ComponentScatterPoint | generatePoint (Kernel::PseudoRandomNumberGenerator &rng) const override |
| Generate point randomly across one of the components of the environment including the sample itself in the selection. | |
| const Geometry::BoundingBox | getFullBoundingBox () const override |
| Returns the defined gauge volume if one is present, otherwise returns axis-aligned bounding box for the volume including env if m_pointsIn != SampleOnly. | |
| Geometry::IObject_sptr | getGaugeVolume () const override |
| Returns the defined gauge volume if one is present, otherwise returns nullptr. | |
| void | setActiveRegion (const Geometry::BoundingBox ®ion) override |
| Sets the active region volume on the InteractionVolume. | |
| void | setGaugeVolume (Geometry::IObject_sptr gaugeVolume) override |
| Sets the gauge volume on the InteractionVolume. | |
Public Member Functions inherited from Mantid::Algorithms::IMCInteractionVolume | |
| virtual | ~IMCInteractionVolume ()=default |
Static Public Member Functions | |
| static std::shared_ptr< IMCInteractionVolume > | create (const API::Sample &sample, const size_t maxScatterAttempts=5000, const ScatteringPointVicinity pointsIn=ScatteringPointVicinity::SAMPLEANDENVIRONMENT, Geometry::IObject_sptr gaugeVolume=nullptr) |
| Factory Method for constructing the volume encompassing the sample + any environment kit. | |
Protected Member Functions | |
| void | init () override |
| Construct the volume encompassing the sample + any environment kit. | |
Private Member Functions | |
| std::optional< Kernel::V3D > | generatePointInObjectByIndex (int componentIndex, Kernel::PseudoRandomNumberGenerator &rng) const |
| Generate a point in an object identified by an index. | |
| int | getComponentIndex (Kernel::PseudoRandomNumberGenerator &rng) const |
| Randomly select a component across the sample/environment. | |
| MCInteractionVolume (const API::Sample &sample, const size_t maxScatterAttempts=5000, const ScatteringPointVicinity pointsIn=ScatteringPointVicinity::SAMPLEANDENVIRONMENT, Geometry::IObject_sptr gaugeVolume=nullptr) | |
| Construct the volume encompassing the sample + any environment kit. | |
Private Attributes | |
| Geometry::BoundingBox | m_activeRegion |
| const Geometry::SampleEnvironment * | m_env |
| Geometry::IObject_sptr | m_gaugeVolume |
| 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.
|
explicitprivate |
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 |
| gaugeVolume | Pointer to any gauge volume object defined for the interaction |
Definition at line 88 of file MCInteractionVolume.cpp.
|
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 218 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().
|
static |
Factory Method for constructing 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 |
| gaugeVolume | Pointer to any gauge volume object defined for the interaction |
Definition at line 67 of file MCInteractionVolume.cpp.
Referenced by Mantid::Algorithms::MonteCarloAbsorption::doSimulation(), and Mantid::Algorithms::AddAbsorptionWeightedPathLengths::exec().
|
overridevirtual |
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 |
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 191 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 161 of file MCInteractionVolume.cpp.
References Mantid::Geometry::IObject::generatePointInObject(), Mantid::Geometry::SampleEnvironment::getComponent(), m_activeRegion, m_env, m_gaugeVolume, 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 134 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 defined gauge volume if one is present, otherwise returns axis-aligned bounding box for the volume including env if m_pointsIn != SampleOnly.
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 111 of file MCInteractionVolume.cpp.
References Mantid::Geometry::SampleEnvironment::boundingBox(), Mantid::Geometry::BoundingBox::grow(), m_env, m_gaugeVolume, m_pointsIn, m_sample, and SAMPLEONLY.
Referenced by init().
|
overridevirtual |
Returns the defined gauge volume if one is present, otherwise returns nullptr.
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 98 of file MCInteractionVolume.cpp.
References m_gaugeVolume.
|
overrideprotectedvirtual |
Construct the volume encompassing the sample + any environment kit.
The active region defines a bounding region for the sampling of the scattering position.
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 27 of file MCInteractionVolume.cpp.
References Mantid::Geometry::SampleEnvironment::getComponent(), getFullBoundingBox(), Mantid::Geometry::IObject::hasValidShape(), m_activeRegion, m_env, m_sample, and Mantid::Geometry::SampleEnvironment::nelements().
|
overridevirtual |
Sets the active region volume on the InteractionVolume.
| region | A reference to a Bounding Box for the active region |
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 126 of file MCInteractionVolume.cpp.
References m_activeRegion.
|
overridevirtual |
Sets the gauge volume on the InteractionVolume.
| gaugeVolume | A shared pointer to the gauge volume shape object |
Implements Mantid::Algorithms::IMCInteractionVolume.
Definition at line 104 of file MCInteractionVolume.cpp.
References m_gaugeVolume.
|
private |
Definition at line 54 of file MCInteractionVolume.h.
Referenced by generatePointInObjectByIndex(), init(), and setActiveRegion().
|
private |
Definition at line 53 of file MCInteractionVolume.h.
Referenced by calculateBeforeAfterTrack(), generatePointInObjectByIndex(), getComponentIndex(), getFullBoundingBox(), and init().
|
private |
Definition at line 57 of file MCInteractionVolume.h.
Referenced by generatePointInObjectByIndex(), getFullBoundingBox(), getGaugeVolume(), and setGaugeVolume().
|
private |
Definition at line 55 of file MCInteractionVolume.h.
Referenced by generatePoint().
|
private |
Definition at line 56 of file MCInteractionVolume.h.
Referenced by getComponentIndex(), and getFullBoundingBox().
|
private |
Definition at line 52 of file MCInteractionVolume.h.
Referenced by calculateBeforeAfterTrack(), generatePointInObjectByIndex(), getComponentIndex(), getFullBoundingBox(), and init().