remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGGermaniumOutputScheme.hh
1// Copyright (C) 2022 Luigi Pertoldi <https://orcid.org/0000-0002-0467-2571>
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_GERMANIUM_OUTPUT_SCHEME_HH_
17#define _RMG_GERMANIUM_OUTPUT_SCHEME_HH_
18
19#include <memory>
20#include <optional>
21#include <set>
22
23#include "G4AnalysisManager.hh"
24#include "G4GenericMessenger.hh"
25
26#include "RMGDetectorHit.hh"
27#include "RMGGermaniumDetector.hh"
28#include "RMGOutputTools.hh"
29#include "RMGVOutputScheme.hh"
30
31class G4Event;
50class RMGGermaniumOutputScheme : public RMGVOutputScheme {
51
52 public:
53
54 RMGGermaniumOutputScheme();
55
57 void AssignOutputNames(G4AnalysisManager* ana_man) override;
58
62 void StoreEvent(const G4Event* event) override;
63
69 bool ShouldDiscardEvent(const G4Event* event) override;
70
74 std::optional<bool> StackingActionNewStage(int) override;
75
80 std::optional<G4ClassificationOfNewTrack> StackingActionClassify(const G4Track*, int) override;
81
83 void SetEdepCutLow(double threshold) { fEdepCutLow = threshold; }
84
86 void SetEdepCutHigh(double threshold) { fEdepCutHigh = threshold; }
87
89 void AddEdepCutDetector(int det_uid) { fEdepCutDetectors.insert(det_uid); }
90
92 void SetPositionMode(RMGOutputTools::PositionMode mode) { fPositionMode = mode; }
93
95 void SetClusterDistance(double threshold) { fPreClusterPars.cluster_distance = threshold; }
96
98 void SetClusterDistanceSurface(double threshold) {
99 fPreClusterPars.cluster_distance_surface = threshold;
100 }
101
103 void SetSurfaceThickness(double thickness) { fPreClusterPars.surface_thickness = thickness; }
104
106 void SetClusterTimeThreshold(double threshold) {
107 fPreClusterPars.cluster_time_threshold = threshold;
108 }
109
111 void SetElectronTrackEnergyThreshold(double threshold) {
112 fPreClusterPars.track_energy_threshold = threshold;
113 }
114
115 void EndOfRunAction(const G4Run*) override;
116
117 protected:
118
119 [[nodiscard]] std::string GetNtupleNameFlat() const override { return "germanium"; }
120
121 private:
122
123 RMGDetectorHitsCollection* GetHitColl(const G4Event*);
124 void SetPositionModeString(std::string mode);
125
126 std::vector<std::unique_ptr<G4GenericMessenger>> fMessengers;
127 void DefineCommands();
128
129 double fEdepCutLow = -1;
130 double fEdepCutHigh = -1;
131 std::set<int> fEdepCutDetectors;
132
133 bool fDiscardPhotonsIfNoGermaniumEdep = false;
134 bool fDiscardZeroEnergyHits = true;
135
136 bool fStoreSinglePrecisionEnergy = false;
137 bool fStoreSinglePrecisionPosition = false;
138
139 bool fStoreTrackID = false;
140 bool fPreClusterHits = true;
141 bool fStoreVelocity = false;
142
144 RMGOutputTools::ClusterPars fPreClusterPars{};
145
146 // mode of position to store
148
149 std::map<std::string, G4ThreeVector> fDetectorOrigins;
150};
151
152#endif
153
154// vim: tabstop=2 shiftwidth=2 expandtab
void EndOfRunAction(const G4Run *) override
Perform final actions at the end of a run.
Definition RMGGermaniumOutputScheme.cc:401
void SetPositionMode(RMGOutputTools::PositionMode mode)
Set which position is used for the steps.
Definition RMGGermaniumOutputScheme.hh:92
void SetEdepCutLow(double threshold)
Set a lower cut on the energy deposited in the event to store it.
Definition RMGGermaniumOutputScheme.hh:83
void SetElectronTrackEnergyThreshold(double threshold)
Set the energy threshold to merge electron tracks.
Definition RMGGermaniumOutputScheme.hh:111
std::optional< G4ClassificationOfNewTrack > StackingActionClassify(const G4Track *, int) override
Wraps G4UserStackingAction::StackingActionClassify.
Definition RMGGermaniumOutputScheme.cc:375
void SetClusterDistanceSurface(double threshold)
Set a distance to compute together steps in the surface.
Definition RMGGermaniumOutputScheme.hh:98
void SetSurfaceThickness(double thickness)
Set the thickness of the surface region.
Definition RMGGermaniumOutputScheme.hh:103
void SetClusterTimeThreshold(double threshold)
Set the time threshold for pre-clustering.
Definition RMGGermaniumOutputScheme.hh:106
std::optional< bool > StackingActionNewStage(int) override
Wraps G4UserStackingAction::StackingActionNewStage.
Definition RMGGermaniumOutputScheme.cc:389
void StoreEvent(const G4Event *event) override
Store the information from the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGGermaniumOutputScheme.cc:215
void AssignOutputNames(G4AnalysisManager *ana_man) override
Sets the names of the output columns, invoked in RMGRunAction::SetupAnalysisManager.
Definition RMGGermaniumOutputScheme.cc:55
void SetClusterDistance(double threshold)
Set a distance to compute together steps in the bulk.
Definition RMGGermaniumOutputScheme.hh:95
void AddEdepCutDetector(int det_uid)
Add a detector uid to the list of detectors to apply the energy cut for.
Definition RMGGermaniumOutputScheme.hh:89
void SetEdepCutHigh(double threshold)
Set a lower cut on the energy deposited in the event to store it.
Definition RMGGermaniumOutputScheme.hh:86
bool ShouldDiscardEvent(const G4Event *event) override
Decide whether to store the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGGermaniumOutputScheme.cc:180
PositionMode
Enum of which position of the hit to store.
Definition RMGOutputTools.hh:33
@ kAverage
Definition RMGOutputTools.hh:39