remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGIsotopeFilterScheme.hh
1// Copyright (C) 2024 Manuel Huber <https://orcid.org/0009-0000-5212-2999>
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_ISOTOPE_FILTER_SCHEME_HH_
17#define _RMG_ISOTOPE_FILTER_SCHEME_HH_
18
19#include <optional>
20#include <set>
21
22#include "G4AnalysisManager.hh"
23#include "G4GenericMessenger.hh"
24#include "G4VUserEventInformation.hh"
25
26#include "RMGVOutputScheme.hh"
27
34class RMGIsotopeFilterEventInformation : public G4VUserEventInformation {
35
36 public:
37
38 RMGIsotopeFilterEventInformation() = default;
39 void Print() const override {}
40};
41
42class G4Event;
52class RMGIsotopeFilterScheme : public RMGVOutputScheme {
53
54 public:
55
56 RMGIsotopeFilterScheme();
57
59 bool ShouldDiscardEvent(const G4Event*) override;
61 std::optional<bool> StackingActionNewStage(int stage) override;
63 std::optional<G4ClassificationOfNewTrack> StackingActionClassify(const G4Track*, int stage) override;
65 void TrackingActionPre(const G4Track*) override;
66
68 void AddIsotope(int a, int z) { fIsotopes.insert({a, z}); }
69
70 private:
71
72 std::unique_ptr<G4GenericMessenger> fMessenger;
73 void DefineCommands();
74
75 std::set<std::pair<int, int>> fIsotopes;
76
77 bool fDiscardPhotonsIfIsotopeNotProduced = false;
78};
79
80#endif
81
82// vim: tabstop=2 shiftwidth=2 expandtab
void AddIsotope(int a, int z)
Add an (A, Z) isotope to the keep list.
Definition RMGIsotopeFilterScheme.hh:68
std::optional< bool > StackingActionNewStage(int stage) override
Drive the two-stage stacking when photon deferral is enabled.
Definition RMGIsotopeFilterScheme.cc:80
bool ShouldDiscardEvent(const G4Event *) override
Discard the event if none of the registered isotopes was produced.
Definition RMGIsotopeFilterScheme.cc:50
std::optional< G4ClassificationOfNewTrack > StackingActionClassify(const G4Track *, int stage) override
Defer photons to stage 1; otherwise leave the classification unchanged.
Definition RMGIsotopeFilterScheme.cc:66
void TrackingActionPre(const G4Track *) override
Tag the current event if the track's particle matches a registered isotope.
Definition RMGIsotopeFilterScheme.cc:28