remage
Simulation framework for HPGe-based experiments
Loading...
Searching...
No Matches
RMGVertexConfinement::SampleableObject Struct Reference

#include <RMGVertexConfinement.hh>

Collaboration diagram for RMGVertexConfinement::SampleableObject:

Public Member Functions

 SampleableObject (const SampleableObject &)=default
 SampleableObject (G4VPhysicalVolume *physvol, G4RotationMatrix rot, G4ThreeVector trans, G4VSolid *solid, bool is_native_sampleable=false, bool on_surface=false)
 SampleableObject constructor.
bool IsInside (const G4ThreeVector &vertex) const
 Check if the vertex is inside the solid.
bool Sample (G4ThreeVector &vertex, size_t max_attempts, bool force_containment_check, size_t &n_trials) const
 Generate a sample from the solid.
bool GenerateSurfacePoint (G4ThreeVector &vertex, size_t max_attempts, size_t max_intersections) const
 Generate a point on the surface of the solid.
std::vector< G4ThreeVector > GetIntersections (G4ThreeVector start, G4ThreeVector dir) const
 Get the number of intersections between the solid and the line starting at start with direction dir.
void GetDirection (G4ThreeVector &dir, G4ThreeVector &pos) const
 Get a position and direction for the generic surface sampling algorithm.
void ApplyDepthProfile (G4ThreeVector &local_vertex, const G4VSolid *solid) const
 Displace a surface point inward according to depth_profile.
void RecalcMass (int z, int n)

Public Attributes

G4VPhysicalVolumephysical_volume = nullptr
G4VSolidsampling_solid = nullptr
G4RotationMatrix rotation
G4ThreeVector translation
double volume = -1
double mass = -1
double surface = -1
bool surface_sample = false
bool native_sample = false
size_t max_num_intersections = 0
DepthProfile depth_profile = {}
 Depth profile applied when displacing vertices inward from the surface.

Detailed Description

An object which we can generate position samples in. Based on either a G4VPhysicalVolume or geometrical volume defined by a G4VSolid . The sampling can be performed either on the surface or in the volume of the solid.

This structure must contain at least a non-null pointer, between the physical_volume and sampling_solid arguments. The idea is that:

  • physical volumes get always a bounding box assigned, but at later time
  • purely geometrical volumes only have the sampling_solid member defined

Constructor & Destructor Documentation

◆ SampleableObject()

RMGVertexConfinement::SampleableObject::SampleableObject ( G4VPhysicalVolume * physvol,
G4RotationMatrix rot,
G4ThreeVector trans,
G4VSolid * solid,
bool is_native_sampleable = false,
bool on_surface = false )

SampleableObject constructor.

Parameters
physvolThe physical volume.
rotA rotation matrix for the sampling solid.
transA translation vector for the sampling solid.
solidA solid for geometrical volume sampling or for generating candidate points or rejection sampling.
is_native_sampleableA flag of whether the solid is natively sampeable.
on_surfaceA flag of whether the solid should be sampled on the surface.

Member Function Documentation

◆ ApplyDepthProfile()

void RMGVertexConfinement::SampleableObject::ApplyDepthProfile ( G4ThreeVector & local_vertex,
const G4VSolid * solid ) const

Displace a surface point inward according to depth_profile.

Samples a depth from depth_profile and moves local_vertex inward along the outward surface normal of solid. The depth is clamped to the distance to the far boundary (G4VSolid::DistanceToOut) so the vertex stays inside the solid. Does nothing when the profile type is DepthProfile::Type::kNone.

Parameters
local_vertexThe surface point, in the local frame of solid. Modified in place.
solidThe solid whose surface local_vertex lies on.

◆ GenerateSurfacePoint()

bool RMGVertexConfinement::SampleableObject::GenerateSurfacePoint ( G4ThreeVector & vertex,
size_t max_attempts,
size_t max_intersections ) const
nodiscard

Generate a point on the surface of the solid.

This follows the algorithm from https://arxiv.org/abs/0802.2960.

  • Produce a direction vector corresponding to a uniform flux in a bounding sphere.
  • Find the intersections of this line with the solid.
  • Pick one intersection, or repeat.
Parameters
vertexThe sampled vertex,
max_attemptsThe maximum number of attempts to find a valid vertex.
max_intersectionsThe maximum number of intersections possible for the solid, can be an overestimate.

◆ GetDirection()

void RMGVertexConfinement::SampleableObject::GetDirection ( G4ThreeVector & dir,
G4ThreeVector & pos ) const

Get a position and direction for the generic surface sampling algorithm.

This generates a point on a bounding sphere, then shifts by some impact parameter, following the algorithm from https://arxiv.org/abs/0802.2960. This produces a uniform and isotropic flux inside the bounding sphere.

Parameters
dirThe direction vector for the point.
posThe initial position for the point.

◆ GetIntersections()

std::vector< G4ThreeVector > RMGVertexConfinement::SampleableObject::GetIntersections ( G4ThreeVector start,
G4ThreeVector dir ) const
nodiscard

Get the number of intersections between the solid and the line starting at start with direction dir.

This is used in the generic surface sampling algorithm. This function makes use of the methods DistanceToIn(p,v) and DistanceToOut(p,v) of G4VSolid . It continually looks for the distance to the next boundary (along the line) until this becomes zero indicating there are no more intersections.

Parameters
startThe starting vector of the line, note this should be outside the solid.
dirThe direction vector.
Returns
A vector of the points of intersection.

◆ IsInside()

bool RMGVertexConfinement::SampleableObject::IsInside ( const G4ThreeVector & vertex) const
nodiscard

Check if the vertex is inside the solid.

Parameters
vertexThe sampled vertex.
Returns
Boolean flag of whether the vertex is inside the solid.

◆ Sample()

bool RMGVertexConfinement::SampleableObject::Sample ( G4ThreeVector & vertex,
size_t max_attempts,
bool force_containment_check,
size_t & n_trials ) const
nodiscard

Generate a sample from the solid.

Depending on if the solid is a basic one either sample natively, or using rejection sampling. Either samples the volume or the surface depending on the surface_sample member.

Parameters
vertexThe sampled vertex.
max_attemptsThe maximum number of candidate vertices for rejection sampling.
force_containment_checkWhether to force a check on where the point is inside the solid.
n_trialsThe total number of trials performed.

Member Data Documentation

◆ depth_profile

DepthProfile RMGVertexConfinement::SampleableObject::depth_profile = {}

Depth profile applied when displacing vertices inward from the surface.

Only used when surface_sample is true. Defaults to no displacement (DepthProfile::Type::kNone).


The documentation for this struct was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/remage/checkouts/latest/include/RMGVertexConfinement.hh
  • /home/docs/checkouts/readthedocs.org/user_builds/remage/checkouts/latest/src/RMGVertexConfinement.cc