remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGDetectorHit.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
17#ifndef _RMG_DETECTOR_HIT_HH
18#define _RMG_DETECTOR_HIT_HH
19
20#include "G4Colour.hh"
21#include "G4THitsCollection.hh"
22#include "G4VHit.hh"
23#include "G4VPhysicalVolume.hh"
24
25
40class RMGDetectorHit : public G4VHit {
41
42 public:
43
44 RMGDetectorHit() = default;
45 ~RMGDetectorHit() = default;
46
47 RMGDetectorHit(const RMGDetectorHit&) = default;
48
49 RMGDetectorHit& operator=(RMGDetectorHit const&) = delete;
50 RMGDetectorHit(RMGDetectorHit&&) = delete;
51 RMGDetectorHit& operator=(RMGDetectorHit&&) = delete;
52
53 bool operator==(const RMGDetectorHit&) const;
54
55 inline void* operator new(size_t);
56 inline void operator delete(void*);
57
58 void Print() override;
59 void Draw() override;
60
62 int detector_uid = -1;
63
65 int particle_type = -1;
66
68 double energy_deposition = -1;
75
79
80 double global_time = -1;
81 int track_id = -1;
82 int parent_track_id = -1;
83
85
86 double velocity_pre = -1;
87 double velocity_post = -1;
88
89 G4Colour fDrawColour = G4Colour(0, 0, 1);
90};
91
92using RMGDetectorHitsCollection = G4THitsCollection<RMGDetectorHit>;
93
95extern G4ThreadLocal G4Allocator<RMGDetectorHit>* RMGDetectorHitAllocator;
97
98inline void* RMGDetectorHit::operator new(size_t) {
99 if (!RMGDetectorHitAllocator) RMGDetectorHitAllocator = new G4Allocator<RMGDetectorHit>;
100 return (void*)RMGDetectorHitAllocator->MallocSingle();
101}
102
103inline void RMGDetectorHit::operator delete(void* hit) {
104 RMGDetectorHitAllocator->FreeSingle(static_cast<RMGDetectorHit*>(hit));
105}
106
107#endif
108
109// vim: tabstop=2 shiftwidth=2 expandtab
Class to store hits in the Germanium or Scintillator detectors, extends G4VHit.
Definition RMGDetectorHit.hh:40
double velocity_post
Velocity at the post-step point.
Definition RMGDetectorHit.hh:87
double velocity_pre
Velocity at the pre-step point.
Definition RMGDetectorHit.hh:86
int particle_type
PDG particle code for the track.
Definition RMGDetectorHit.hh:65
double energy_deposition
Energy deposited in this step (Geant4 energy units).
Definition RMGDetectorHit.hh:68
double distance_to_surface_poststep
Distance from the post-step point to the closest surface of the sensitive volume.
Definition RMGDetectorHit.hh:74
int track_id
Geant4 track id of the step.
Definition RMGDetectorHit.hh:81
double global_time
Global time at the pre-step point.
Definition RMGDetectorHit.hh:80
G4ThreeVector global_position_average
Step midpoint in world coordinates.
Definition RMGDetectorHit.hh:78
double distance_to_surface_average
Distance from the step-midpoint to the closest surface of the sensitive volume.
Definition RMGDetectorHit.hh:72
G4ThreeVector global_position_poststep
Step post-point in world coordinates.
Definition RMGDetectorHit.hh:76
G4VPhysicalVolume * physical_volume
Physical volume the step took place in.
Definition RMGDetectorHit.hh:84
int parent_track_id
Track id of the parent (0 for primaries).
Definition RMGDetectorHit.hh:82
int detector_uid
Remage detector unique identifier (uid) for the volume the hit took place in.
Definition RMGDetectorHit.hh:62
G4ThreeVector global_position_prestep
Step pre-point in world coordinates.
Definition RMGDetectorHit.hh:77
double distance_to_surface_prestep
Distance from the pre-step point to the closest surface of the sensitive volume.
Definition RMGDetectorHit.hh:70