Mantid
Loading...
Searching...
No Matches
MCInteractionVolume.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidAlgorithms/DllConfig.h"
11
12namespace Mantid {
13namespace API {
14class Sample;
15}
16namespace Geometry {
17class SampleEnvironment;
18} // namespace Geometry
19
20namespace Algorithms {
21class IBeamProfile;
22
28class MANTID_ALGORITHMS_DLL MCInteractionVolume : public IMCInteractionVolume {
29public:
30 enum class ScatteringPointVicinity { SAMPLEANDENVIRONMENT, SAMPLEONLY, ENVIRONMENTONLY };
31 [[nodiscard]] static std::shared_ptr<IMCInteractionVolume>
32 create(const API::Sample &sample, const size_t maxScatterAttempts = 5000,
33 const ScatteringPointVicinity pointsIn = ScatteringPointVicinity::SAMPLEANDENVIRONMENT,
34 Geometry::IObject_sptr gaugeVolume = nullptr);
35 const Geometry::BoundingBox getFullBoundingBox() const override;
36 virtual TrackPair calculateBeforeAfterTrack(Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &startPos,
37 const Kernel::V3D &endPos, MCInteractionStatistics &stats) const override;
38 ComponentScatterPoint generatePoint(Kernel::PseudoRandomNumberGenerator &rng) const override;
39 void setActiveRegion(const Geometry::BoundingBox &region) override;
40 Geometry::IObject_sptr getGaugeVolume() const override;
41 void setGaugeVolume(Geometry::IObject_sptr gaugeVolume) override;
42
43private:
44 // init required to be called separately to constructor, so here we prevent public access to direct creation of
45 // instance
46 explicit MCInteractionVolume(const API::Sample &sample, const size_t maxScatterAttempts = 5000,
47 const ScatteringPointVicinity pointsIn = ScatteringPointVicinity::SAMPLEANDENVIRONMENT,
48 Geometry::IObject_sptr gaugeVolume = nullptr);
49 int getComponentIndex(Kernel::PseudoRandomNumberGenerator &rng) const;
50 std::optional<Kernel::V3D> generatePointInObjectByIndex(int componentIndex,
52 const std::shared_ptr<Geometry::IObject> m_sample;
58
59protected:
60 void init() override;
61};
62
63} // namespace Algorithms
64} // namespace Mantid
This class stores information about the sample used in particular run.
Definition Sample.h:33
Defines a base class for objects describing a volume where interactions of Tracks and Objects can tak...
Stores statistics relating to the tracks generated in MCInteractionVolume for a specific detector.
Defines a volume where interactions of Tracks and Objects can take place.
const ScatteringPointVicinity m_pointsIn
const Geometry::SampleEnvironment * m_env
const std::shared_ptr< Geometry::IObject > m_sample
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
Defines a single instance of a SampleEnvironment.
Defines a 1D pseudo-random number generator, i.e.
Class for 3D vectors.
Definition V3D.h:34
std::tuple< bool, std::shared_ptr< Geometry::Track >, std::shared_ptr< Geometry::Track > > TrackPair
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition IObject.h:93
Helper class which provides the Collimation Length for SANS instruments.