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

Implements the algorithm for calculating the correction factor for self-attenuation and single wavelength using a Monte Carlo. More...

#include <MCAbsorptionStrategy.h>

Inheritance diagram for Mantid::Algorithms::MCAbsorptionStrategy:
Mantid::Algorithms::IMCAbsorptionStrategy

Public Member Functions

virtual void calculate (Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &finalPos, const std::vector< double > &lambdas, const double lambdaFixed, std::vector< double > &attenuationFactors, std::vector< double > &attFactorErrors, MCInteractionStatistics &stats) override
 Compute the correction for a final position of the neutron and wavelengths before and after scattering. More...
 
 MCAbsorptionStrategy (IMCInteractionVolume &interactionVolume, const IBeamProfile &beamProfile, Kernel::DeltaEMode::Type EMode, const size_t nevents, const size_t maxScatterPtAttempts, const bool regenerateTracksForEachLambda)
 Constructor. More...
 
- Public Member Functions inherited from Mantid::Algorithms::IMCAbsorptionStrategy
virtual void calculate (Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &finalPos, const std::vector< double > &lambdas, const double lambdaFixed, std::vector< double > &attenuationFactors, std::vector< double > &attFactorErrors, MCInteractionStatistics &stats)=0
 
virtual ~IMCAbsorptionStrategy ()=default
 

Private Member Functions

IMCInteractionVolumesetActiveRegion (IMCInteractionVolume &interactionVolume, const IBeamProfile &beamProfile)
 Set the active region on the interaction volume as smaller of the sample bounding box and the beam cross section. More...
 

Private Attributes

const IBeamProfilem_beamProfile
 
const Kernel::DeltaEMode::Type m_EMode
 
const size_t m_maxScatterAttempts
 
const size_t m_nevents
 
const bool m_regenerateTracksForEachLambda
 
const IMCInteractionVolumem_scatterVol
 

Detailed Description

Implements the algorithm for calculating the correction factor for self-attenuation and single wavelength using a Monte Carlo.

A single instance has a fixed nominal source position, nominal sample position & sample + containers shapes.

The error on all points is defined to be \(\frac{SD}{\sqrt{N}}\), where SD is the standard deviation of the attenuation factors across the simulated tracks and N is the number of events generated.

Definition at line 41 of file MCAbsorptionStrategy.h.

Constructor & Destructor Documentation

◆ MCAbsorptionStrategy()

Mantid::Algorithms::MCAbsorptionStrategy::MCAbsorptionStrategy ( IMCInteractionVolume interactionVolume,
const IBeamProfile beamProfile,
Kernel::DeltaEMode::Type  EMode,
const size_t  nevents,
const size_t  maxScatterPtAttempts,
const bool  regenerateTracksForEachLambda 
)

Constructor.

Parameters
interactionVolumeA reference to the MCInteractionVolume dependency
beamProfileA reference to the object the beam profile
EModeThe energy mode of the instrument
neventsThe number of Monte Carlo events used in the simulation
maxScatterPtAttemptsThe maximum number of tries to generate a random point within the object
regenerateTracksForEachLambdaWhether to resimulate tracks for each wavelength point or not

Definition at line 31 of file MCAbsorptionStrategy.cpp.

Member Function Documentation

◆ calculate()

void Mantid::Algorithms::MCAbsorptionStrategy::calculate ( Kernel::PseudoRandomNumberGenerator rng,
const Kernel::V3D finalPos,
const std::vector< double > &  lambdas,
const double  lambdaFixed,
std::vector< double > &  attenuationFactors,
std::vector< double > &  attFactorErrors,
MCInteractionStatistics stats 
)
overridevirtual

Compute the correction for a final position of the neutron and wavelengths before and after scattering.

Parameters
rngA reference to a PseudoRandomNumberGenerator
finalPosDefines the final position of the neutron, assumed to be where it is detected
lambdasSet of wavelength values from the input workspace
lambdaFixedEfixed value for a detector ID converted to wavelength, in \(\\A^-1\)
attenuationFactorsA vector containing the calculated correction factors
attFactorErrorsA vector containing the calculated correction factor errors
statsA 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::IMCAbsorptionStrategy.

Definition at line 69 of file MCAbsorptionStrategy.cpp.

References Mantid::Algorithms::IMCInteractionVolume::calculateBeforeAfterTrack(), Mantid::Kernel::delta, Mantid::Kernel::DeltaEMode::Direct, Mantid::Algorithms::IBeamProfile::generatePoint(), Mantid::Algorithms::IMCInteractionVolume::getFullBoundingBox(), Mantid::Kernel::DeltaEMode::Indirect, m_beamProfile, m_EMode, m_maxScatterAttempts, m_nevents, m_regenerateTracksForEachLambda, m_scatterVol, and std::to_string().

Referenced by Mantid::Algorithms::AddAbsorptionWeightedPathLengths::exec().

◆ setActiveRegion()

IMCInteractionVolume & Mantid::Algorithms::MCAbsorptionStrategy::setActiveRegion ( IMCInteractionVolume interactionVolume,
const IBeamProfile beamProfile 
)
private

Set the active region on the interaction volume as smaller of the sample bounding box and the beam cross section.

Trying to keep the beam details outside the interaction volume class

Parameters
interactionVolumeThe interaction volume object
beamProfileThe beam profile
Returns
The interaction volume object with active region set

Definition at line 46 of file MCAbsorptionStrategy.cpp.

References Mantid::Algorithms::IBeamProfile::defineActiveRegion(), Mantid::Algorithms::IMCInteractionVolume::getFullBoundingBox(), and Mantid::Algorithms::IMCInteractionVolume::setActiveRegion().

Member Data Documentation

◆ m_beamProfile

const IBeamProfile& Mantid::Algorithms::MCAbsorptionStrategy::m_beamProfile
private

Definition at line 52 of file MCAbsorptionStrategy.h.

Referenced by calculate().

◆ m_EMode

const Kernel::DeltaEMode::Type Mantid::Algorithms::MCAbsorptionStrategy::m_EMode
private

Definition at line 56 of file MCAbsorptionStrategy.h.

Referenced by calculate().

◆ m_maxScatterAttempts

const size_t Mantid::Algorithms::MCAbsorptionStrategy::m_maxScatterAttempts
private

Definition at line 55 of file MCAbsorptionStrategy.h.

Referenced by calculate().

◆ m_nevents

const size_t Mantid::Algorithms::MCAbsorptionStrategy::m_nevents
private

Definition at line 54 of file MCAbsorptionStrategy.h.

Referenced by calculate().

◆ m_regenerateTracksForEachLambda

const bool Mantid::Algorithms::MCAbsorptionStrategy::m_regenerateTracksForEachLambda
private

Definition at line 57 of file MCAbsorptionStrategy.h.

Referenced by calculate().

◆ m_scatterVol

const IMCInteractionVolume& Mantid::Algorithms::MCAbsorptionStrategy::m_scatterVol
private

Definition at line 53 of file MCAbsorptionStrategy.h.

Referenced by calculate().


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