remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGScintillatorOutputScheme.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_SCINTILLATOR_OUTPUT_SCHEME_HH_
17#define _RMG_SCINTILLATOR_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 "RMGOutputTools.hh"
28#include "RMGScintillatorDetector.hh"
29#include "RMGVOutputScheme.hh"
30
31class G4Event;
47class RMGScintillatorOutputScheme : public RMGVOutputScheme {
48
49 public:
50
51 RMGScintillatorOutputScheme();
52
54 void AssignOutputNames(G4AnalysisManager* ana_man) override;
55
59 void StoreEvent(const G4Event*) override;
60
66 bool ShouldDiscardEvent(const G4Event*) override;
67
69 void SetEdepCutLow(double threshold) { fEdepCutLow = threshold; }
70
72 void SetEdepCutHigh(double threshold) { fEdepCutHigh = threshold; }
73
75 void AddEdepCutDetector(int det_uid) { fEdepCutDetectors.insert(det_uid); }
76
78 void SetPositionMode(RMGOutputTools::PositionMode mode) { fPositionMode = mode; }
79
81 void SetClusterDistance(double threshold) { fPreClusterPars.cluster_distance = threshold; }
82
84 void SetClusterTimeThreshold(double threshold) {
85 fPreClusterPars.cluster_time_threshold = threshold;
86 }
87
89 void SetElectronTrackEnergyThreshold(double threshold) {
90 fPreClusterPars.track_energy_threshold = threshold;
91 }
92
93 protected:
94
95 [[nodiscard]] std::string GetNtupleNameFlat() const override { return "scintillator"; }
96
97 private:
98
99 RMGDetectorHitsCollection* GetHitColl(const G4Event*);
100 void SetPositionModeString(std::string mode);
101
102 std::vector<std::unique_ptr<G4GenericMessenger>> fMessengers;
103 void DefineCommands();
104
105 double fEdepCutLow = -1;
106 double fEdepCutHigh = -1;
107 std::set<int> fEdepCutDetectors;
108
109 bool fStoreSinglePrecisionEnergy = false;
110 bool fStoreSinglePrecisionPosition = false;
111 bool fStoreTrackID = false;
112
113 bool fPreClusterHits = true;
114 bool fDiscardZeroEnergyHits = true;
115
117 RMGOutputTools::ClusterPars fPreClusterPars{};
118
121
122 bool fStoreVelocity = false;
123};
124
125#endif
126
127// vim: tabstop=2 shiftwidth=2 expandtab
void SetPositionMode(RMGOutputTools::PositionMode mode)
Set which position is used for the steps.
Definition RMGScintillatorOutputScheme.hh:78
void StoreEvent(const G4Event *) override
Store the information from the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGScintillatorOutputScheme.cc:170
void AssignOutputNames(G4AnalysisManager *ana_man) override
Sets the names of the output columns, invoked in RMGRunAction::SetupAnalysisManager.
Definition RMGScintillatorOutputScheme.cc:51
void SetEdepCutLow(double threshold)
Set a lower cut on the energy deposited in the event to store it.
Definition RMGScintillatorOutputScheme.hh:69
void AddEdepCutDetector(int det_uid)
Add a detector uid to the list of detectors to apply the energy cut for.
Definition RMGScintillatorOutputScheme.hh:75
void SetEdepCutHigh(double threshold)
Set a upper cut on the energy deposited in the event to store it.
Definition RMGScintillatorOutputScheme.hh:72
void SetClusterDistance(double threshold)
Set a distance to compute together steps in the bulk.
Definition RMGScintillatorOutputScheme.hh:81
void SetClusterTimeThreshold(double threshold)
Set the time threshold for pre-clustering.
Definition RMGScintillatorOutputScheme.hh:84
void SetElectronTrackEnergyThreshold(double threshold)
Set the energy threshold to merge electron tracks.
Definition RMGScintillatorOutputScheme.hh:89
bool ShouldDiscardEvent(const G4Event *) override
Decide whether to store the event, invoked in RMGEventAction::EndOfEventAction.
Definition RMGScintillatorOutputScheme.cc:138
PositionMode
Enum of which position of the hit to store.
Definition RMGOutputTools.hh:33
@ kAverage
Definition RMGOutputTools.hh:39