remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGOutputTools.hh
1// Copyright (C) 2025 Toby Dixon <https://orcid.org/0000-0001-8787-6336>
2//
3// This program is free software: you can redistribute it and/or modify it under
4// the terms of the GNU Lesser General Public License as published by the Free
5// Software Foundation, either version 3 of the License, or (at your option) any
6// later version.
7//
8// This program is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11// details.
12//
13// You should have received a copy of the GNU Lesser General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16#ifndef _RMG_OUTPUT_TOOLS_HH_
17#define _RMG_OUTPUT_TOOLS_HH_
18
19#include <map>
20#include <unordered_map>
21#include <vector>
22
23#include "G4AffineTransform.hh"
24#include "G4Step.hh"
25#include "G4ThreeVector.hh"
26#include "G4VSolid.hh"
27
28#include "RMGDetectorHit.hh"
29#include "RMGDetectorMetadata.hh"
30
34namespace RMGOutputTools {
35
47
48
50 struct ClusterPars {
51 bool combine_low_energy_tracks;
52 bool reassign_gamma_energy;
53 double track_energy_threshold;
54 double surface_thickness;
55 double cluster_distance;
56 double cluster_distance_surface;
57 double cluster_time_threshold;
58 };
59
70
76
82 double distance_to_surface(const G4VPhysicalVolume* pv, const G4ThreeVector& position);
83
92 const G4VPhysicalVolume* pv,
93 const G4ThreeVector& position,
94 bool is_distance_check_germanium_only
95 );
96
108 const G4VPhysicalVolume* pv,
109 const G4ThreeVector& position,
110 double safety,
111 bool is_distance_check_germanium_only = false
112 );
113
132 std::shared_ptr<RMGDetectorHitsCollection> pre_cluster_hits(
133 const RMGDetectorHitsCollection* hits,
134 ClusterPars cluster_pars,
135 bool has_distance_to_surface,
136 bool has_velocity
137 );
138
152 std::vector<RMGDetectorHit*> hits,
153 bool compute_distance_to_surface,
154 bool compute_velocity
155 );
156
162 bool check_step_point_containment(const G4StepPoint* step_point, RMGDetectorType det_type);
163
184 std::map<int, std::vector<RMGDetectorHit*>> combine_low_energy_tracks(
185 const std::map<int, std::vector<RMGDetectorHit*>>& hits_map,
186 const ClusterPars& cluster_pars,
187 bool has_distance_to_surface
188 );
189
198 std::map<int, std::vector<RMGDetectorHit*>> hits_map,
199 ClusterPars cluster_pars,
200 bool has_distance_to_surface
201 );
202} // namespace RMGOutputTools
203
204#endif
205
206// vim: tabstop=2 shiftwidth=2 expandtab
Class to store hits in the Germanium or Scintillator detectors, extends G4VHit.
Definition RMGDetectorHit.hh:40
Functionality for simple output post-processing (i.e., pre-clustering and similar) shared between mul...
Definition RMGOutputTools.hh:34
bool is_within_surface_safety(const G4VPhysicalVolume *pv, const G4ThreeVector &position, double safety, bool is_distance_check_germanium_only=false)
Check if any surface is closer than a given safety distance.
Definition RMGOutputTools.cc:499
double distance_to_surface(const G4VPhysicalVolume *pv, const G4ThreeVector &position)
Compute the distance from the point to the surface of the physical volume.
Definition RMGOutputTools.cc:468
double get_distance(RMGDetectorHit *hit, RMGOutputTools::PositionMode mode)
Get the distance to surface to save for a given hit.
Definition RMGOutputTools.cc:104
RMGDetectorHit * average_hits(std::vector< RMGDetectorHit * > hits, bool compute_distance_to_surface, bool compute_velocity)
Average a cluster of hits to produce one effective hit.
Definition RMGOutputTools.cc:128
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.
Definition RMGOutputTools.cc:271
G4ThreeVector get_position(RMGDetectorHit *hit, RMGOutputTools::PositionMode mode)
Get the position to save for a given hit.
Definition RMGOutputTools.cc:80
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.
Definition RMGOutputTools.cc:225
PositionMode
Enum of which position of the hit to store.
Definition RMGOutputTools.hh:37
@ kPostStep
Definition RMGOutputTools.hh:41
@ kBoth
Definition RMGOutputTools.hh:45
@ kPreStep
Definition RMGOutputTools.hh:39
@ kAverage
Definition RMGOutputTools.hh:43
std::shared_ptr< RMGDetectorHitsCollection > pre_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.
Definition RMGOutputTools.cc:368
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.
Definition RMGOutputTools.cc:190
Container for the parameters of step pre-clustering.
Definition RMGOutputTools.hh:50