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
77 void SetEdepCutLow(double threshold) { fEdepCutLow = threshold; }
78
80 void SetEdepCutHigh(double threshold) { fEdepCutHigh = threshold; }
81
83 void AddEdepCutDetector(int det_uid) { fEdepCutDetectors.insert(det_uid); }
84
86 void SetPositionMode(RMGOutputTools::PositionMode mode) { fPositionMode = mode; }
87
89 void SetClusterDistance(double threshold) { fPreClusterPars.cluster_distance = threshold; }
90
92 void SetClusterDistanceSurface(double threshold) {
93 fPreClusterPars.cluster_distance_surface = threshold;
94 }
95
97 void SetSurfaceThickness(double thickness) { fPreClusterPars.surface_thickness = thickness; }
98
100 void SetClusterTimeThreshold(double threshold) {
101 fPreClusterPars.cluster_time_threshold = threshold;
102 }
103
105 void SetElectronTrackEnergyThreshold(double threshold) {
106 fPreClusterPars.track_energy_threshold = threshold;
107 }
108
109 void EndOfRunAction(const G4Run*) override;
110
111 protected:
112
113 [[nodiscard]] std::string GetNtupleNameFlat() const override { return "germanium"; }
114
115 private:
116
117 RMGDetectorHitsCollection* GetHitColl(const G4Event*);
118 void SetPositionModeString(std::string mode);
119
120 std::vector<std::unique_ptr<G4GenericMessenger>> fMessengers;
121 void DefineCommands();
122
123 double fEdepCutLow = -1;
124 double fEdepCutHigh = -1;
125 std::set<int> fEdepCutDetectors;
126
127 bool fDiscardWaitingTracksUnlessGermaniumEdep = false;
128 bool fDiscardZeroEnergyHits = true;
129
130 bool fStoreSinglePrecisionEnergy = false;
131 bool fStoreSinglePrecisionPosition = false;
132
133 bool fStoreTrackID = false;
134 bool fPreClusterHits = true;
135 bool fStoreVelocity = false;
136
138 RMGOutputTools::ClusterPars fPreClusterPars{};
139
140 // mode of position to store
142
143 std::map<std::string, G4ThreeVector> fDetectorOrigins;
144};
145
146#endif
147
148// vim: tabstop=2 shiftwidth=2 expandtab
void EndOfRunAction(const G4Run *) override
Perform final actions at the end of a run.
Definition RMGGermaniumOutputScheme.cc:386
void SetPositionMode(RMGOutputTools::PositionMode mode)
Set which position is used for the steps.
Definition RMGGermaniumOutputScheme.hh:86
void SetEdepCutLow(double threshold)
Set a lower cut on the energy deposited in the event to store it.
Definition RMGGermaniumOutputScheme.hh:77
void SetElectronTrackEnergyThreshold(double threshold)
Set the energy threshold to merge electron tracks.
Definition RMGGermaniumOutputScheme.hh:105
void SetClusterDistanceSurface(double threshold)
Set a distance to compute together steps in the surface.
Definition RMGGermaniumOutputScheme.hh:92
void SetSurfaceThickness(double thickness)
Set the thickness of the surface region.
Definition RMGGermaniumOutputScheme.hh:97
void SetClusterTimeThreshold(double threshold)
Set the time threshold for pre-clustering.
Definition RMGGermaniumOutputScheme.hh:100
std::optional< bool > StackingActionNewStage(int) override
Wraps G4UserStackingAction::StackingActionNewStage.
Definition RMGGermaniumOutputScheme.cc:375
void StoreEvent(const G4Event *event) override
Store the information from the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGGermaniumOutputScheme.cc:214
void AssignOutputNames(G4AnalysisManager *ana_man) override
Sets the names of the output columns, invoked in RMGRunAction::SetupAnalysisManager.
Definition RMGGermaniumOutputScheme.cc:54
void SetClusterDistance(double threshold)
Set a distance to compute together steps in the bulk.
Definition RMGGermaniumOutputScheme.hh:89
void AddEdepCutDetector(int det_uid)
Add a detector uid to the list of detectors to apply the energy cut for.
Definition RMGGermaniumOutputScheme.hh:83
void SetEdepCutHigh(double threshold)
Set a lower cut on the energy deposited in the event to store it.
Definition RMGGermaniumOutputScheme.hh:80
bool ShouldDiscardEvent(const G4Event *event) override
Decide whether to store the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGGermaniumOutputScheme.cc:179
PositionMode
Enum of which position of the hit to store.
Definition RMGOutputTools.hh:37
@ kAverage
Definition RMGOutputTools.hh:43