remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGOutputTools Namespace Reference

Functionality for simple output post-processing (i.e., pre-clustering and similar) shared between multiple output schemes. More...

Classes

struct  ClusterPars
 Container for the parameters of step pre-clustering. More...
 

Enumerations

enum class  PositionMode { kPreStep , kPostStep , kAverage , kBoth }
 Enum of which position of the hit to store. More...
 

Functions

G4ThreeVector get_position (RMGDetectorHit *hit, RMGOutputTools::PositionMode mode)
 Get the position to save for a given hit.
 
double get_distance (RMGDetectorHit *hit, RMGOutputTools::PositionMode mode)
 Get the distance to surface to save for a given hit.
 
double distance_to_surface (const G4VPhysicalVolume *pv, const G4ThreeVector &position)
 Compute the distance from the point to the surface of the physical volume.
 
std::shared_ptr< RMGDetectorHitsCollectionpre_cluster_hits (const RMGDetectorHitsCollection *hits, ClusterPars cluster_pars, bool has_distance_to_surface, bool has_velocity)
 Perform a basic reduction of the hits collection removing very short steps.
 
RMGDetectorHitaverage_hits (std::vector< RMGDetectorHit * > hits, bool compute_distance_to_surface, bool compute_velocity)
 Average a cluster of hits to produce one effective hit.
 
bool check_step_point_containment (const G4StepPoint *step_point, RMGDetectorType det_type)
 Check if the step point is contained in a physical volume registered as a detector.
 
std::map< int, std::vector< RMGDetectorHit * > > combine_low_energy_tracks (const std::map< int, std::vector< RMGDetectorHit * > > &hits_map, const ClusterPars &cluster_pars, bool has_distance_to_surface)
 Combine low energy electron tracks into their neighbours.
 
void redistribute_gamma_energy (std::map< int, std::vector< RMGDetectorHit * > > hits_map, ClusterPars cluster_pars, bool has_distance_to_surface)
 Search for hits close to any gamma track and reassign the energy deposit to that track.
 

Detailed Description

Functionality for simple output post-processing (i.e., pre-clustering and similar) shared between multiple output schemes.

Enumeration Type Documentation

◆ PositionMode

enum class RMGOutputTools::PositionMode
strong

Enum of which position of the hit to store.

Enumerator
kPreStep 

Store the prestep point.

kPostStep 

Store the poststep point.

kAverage 

Store the average.

kBoth 

Store both post and prestep

Function Documentation

◆ average_hits()

RMGDetectorHit * RMGOutputTools::average_hits ( std::vector< RMGDetectorHit * > hits,
bool compute_distance_to_surface,
bool compute_velocity )

Average a cluster of hits to produce one effective hit.

The steps in a cluster are average with the energy being the sum over the steps, and the pre/post step position / distance / velcity to surface computed from the first/last step. Other fields must be the same for all steps in the cluster and are taken from the first step.

Parameters
hitsthe vector of hits to average
compute_distance_to_surfaceboolean flag of whether to compute the distance to surface.
compute_velocityboolean flag of whether to compute velocity.
Returns
the averaged hit.

◆ check_step_point_containment()

bool RMGOutputTools::check_step_point_containment ( const G4StepPoint * step_point,
RMGDetectorType det_type )

Check if the step point is contained in a physical volume registered as a detector.

Parameters
step_pointThe step point (either post or pre step) to check.
det_typeType of detector to check for.

◆ combine_low_energy_tracks()

std::map< int, std::vector< RMGDetectorHit * > > RMGOutputTools::combine_low_energy_tracks ( const std::map< int, std::vector< RMGDetectorHit * > > & hits_map,
const ClusterPars & cluster_pars,
bool has_distance_to_surface )

Combine low energy electron tracks into their neighbours.

Some interactions of gammas, eg. Compton scattering or the photoelectric effect can produce very low energy electron tracks. This function reads a map of steps in each track (keyed by trackid), it then computes the total energy in each electron track. If a track is below a certain threshold then the code searches through the other tracks to see if there is one where the first pre-step point is within the cluster distance of this track. If so they are combined for further pre-clustering. In the case multiple nearby tracks are found the highest energy one is used.

Parameters
hits_mapa map of vectors of RMGDetectorHit pointers with the key being the track id.
cluster_parsa RMGOutputTools::ClusterPars struct of the parameters for clustering.
has_distance_to_surfacea flag of whether the hits have the distance to surface field, and clustering should be performed separately for surface and bulk.
Returns
A map of steps after combining low energy tracks.

◆ distance_to_surface()

double RMGOutputTools::distance_to_surface ( const G4VPhysicalVolume * pv,
const G4ThreeVector & position )

Compute the distance from the point to the surface of the physical volume.

Checks distance to surfaces of mother volume.

Parameters
pvThe physical volume to find the distance to.
positionThe position to evaluate the distance for.

◆ get_distance()

double RMGOutputTools::get_distance ( RMGDetectorHit * hit,
RMGOutputTools::PositionMode mode )

Get the distance to surface to save for a given hit.

The logic is the same as for RMGOutputTools::get_position

◆ get_position()

G4ThreeVector RMGOutputTools::get_position ( RMGDetectorHit * hit,
RMGOutputTools::PositionMode mode )

Get the position to save for a given hit.

If the mode is kPostStep or if the particle is a gamma then the post-step point is used. This is since gamma's have only discrete interactions happening at the post-step. Otherwise if mode is kPreStep the prestep point is extracted, if it is either kBoth or kAverage the average of pre and post step is used (in the case of kBoth the pre and post step should also be saved separately).

◆ pre_cluster_hits()

std::shared_ptr< RMGDetectorHitsCollection > RMGOutputTools::pre_cluster_hits ( const RMGDetectorHitsCollection * hits,
RMGOutputTools::ClusterPars cluster_pars,
bool has_distance_to_surface,
bool has_velocity )

Perform a basic reduction of the hits collection removing very short steps.

This is based on a "within" track clustering (but note that some low energy tracks can be merged by CombineLowEnergyTracks . The steps in every track are looped through and combined into effective steps. A step is added to the current cluster if:

  • If the flag has_distance_to_surface is set. The step must not move from the surface region (defined by the distance_to_surface<fSurfaceThickness) to the bulk or visa versa.
  • the time difference between the step and the first of the cluster is not above fClusterTimeThreshold ,
  • the distance between the step and the first of the cluster is not above fClusterDistance (for the bulk) or fClusterSurfaceDistance for the surface (if has_distance_to_surface is true).
  • the hits in each cluster are then combined into one effective step with AverageHits
Returns
a collection of hits after pre-clustering.

◆ redistribute_gamma_energy()

void RMGOutputTools::redistribute_gamma_energy ( std::map< int, std::vector< RMGDetectorHit * > > hits_map,
RMGOutputTools::ClusterPars cluster_pars,
bool has_distance_to_surface )

Search for hits close to any gamma track and reassign the energy deposit to that track.

Gamma particles do not deposit energy, however as part of some interactions a very small "local" energy deposit happen, due to atomic binding energy. This method search through the gamma tracks and for each it looks for a nearby electron hit to instead assign this small local energy deposit too, this can avoid writing out the gamma tracks in the output scheme.