Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VMoleculeCounter.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4VMoleculeCounter.hh
27// Geant4
28//
29// Created by Mathieu Karamitros on 02/11/2016.
30// Modified by Christian Velten on 10/27/2024.
31//
32//
33#ifndef G4VMOLECULECOUNTER_HH
34#define G4VMOLECULECOUNTER_HH 1
35
38
39#include <map>
40#include <memory>
41
44class G4Track;
45class G4StepPoint;
46
47//------------------------------------------------------------------------------
48
49class G4VMoleculeCounter : public G4VMoleculeCounterInternalBase
50{
51 template<typename>
53
54 public:
62 {
63 virtual ~G4VMoleculeCounterIndex() = default;
64 virtual G4bool operator<(G4VMoleculeCounterIndex const&) const = 0;
65 virtual G4bool operator==(G4VMoleculeCounterIndex const&) const = 0;
66 virtual G4String GetInfo() const = 0;
67 virtual const G4MolecularConfiguration* GetMolecule() const = 0;
68 };
69
70 private:
73 G4VMoleculeCounter(G4VMoleculeCounter const&) = delete;
74 void operator=(G4VMoleculeCounter const& x) = delete;
75
76 public:
77 ~G4VMoleculeCounter() override = default;
78
79 public:
80 virtual std::unique_ptr<G4VMoleculeCounterIndex> BuildIndex(const G4Track*) const = 0;
81 virtual std::unique_ptr<G4VMoleculeCounterIndex> BuildIndex(const G4Track*,
82 const G4StepPoint*) const = 0;
83 virtual std::unique_ptr<G4VMoleculeCounterIndex> BuildSimpleIndex(const G4MolecularConfiguration*) const = 0;
84
85 virtual void AddMolecule(std::unique_ptr<G4VMoleculeCounterIndex>, G4double, G4int = 1) = 0;
86 virtual void RemoveMolecule(std::unique_ptr<G4VMoleculeCounterIndex>, G4double, G4int = 1) = 0;
87
88 virtual std::set<const G4MolecularConfiguration*> GetRecordedMolecules() const = 0;
89 std::set<G4double> GetRecordedTimes() const override = 0;
90
91 virtual void SchedulerFinalizedTracking() = 0;
92
93 protected:
95
98
99 std::set<const G4MoleculeDefinition*> fIgnoredMolecules{};
100 std::set<const G4MolecularConfiguration*> fIgnoredReactants{};
101
102 public:
104
106 void SetSensitiveToStepping(G4bool = true);
107
109
110 // Ignore certain molecules from counting
113 void RegisterAll();
114
117
118 protected:
120};
121
122//------------------------------------------------------------------------------
123
128
133
142
144{
145 fIgnoredMolecules.insert(molecule);
146}
147
149{
150 fIgnoredReactants.insert(reactant);
151}
152
154{
155 fIgnoredMolecules.clear();
156 fIgnoredReactants.clear();
157}
158
159#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
virtual void SchedulerFinalizedTracking()=0
MoleculeCounterType GetType() const
void IgnoreMolecule(const G4MoleculeDefinition *)
virtual void RemoveMolecule(std::unique_ptr< G4VMoleculeCounterIndex >, G4double, G4int=1)=0
virtual std::unique_ptr< G4VMoleculeCounterIndex > BuildIndex(const G4Track *, const G4StepPoint *) const =0
std::set< const G4MoleculeDefinition * > fIgnoredMolecules
~G4VMoleculeCounter() override=default
G4bool IsReactantIgnored(const G4MoleculeDefinition *) const
std::set< const G4MolecularConfiguration * > fIgnoredReactants
virtual std::unique_ptr< G4VMoleculeCounterIndex > BuildSimpleIndex(const G4MolecularConfiguration *) const =0
G4bool GetNegativeCountsAreFatal() const
void SetSensitiveToStepping(G4bool=true)
MoleculeCounterType fType
virtual std::unique_ptr< G4VMoleculeCounterIndex > BuildIndex(const G4Track *) const =0
virtual void AddMolecule(std::unique_ptr< G4VMoleculeCounterIndex >, G4double, G4int=1)=0
friend class G4VUserMoleculeCounter
std::set< G4double > GetRecordedTimes() const override=0
G4bool GetSensitiveToStepping() const
void IgnoreReactant(const G4MolecularConfiguration *)
virtual std::set< const G4MolecularConfiguration * > GetRecordedMolecules() const =0
void SetNegativeCountsAreFatal(G4bool)
virtual const G4MolecularConfiguration * GetMolecule() const =0
virtual G4bool operator==(G4VMoleculeCounterIndex const &) const =0
virtual G4bool operator<(G4VMoleculeCounterIndex const &) const =0
virtual G4String GetInfo() const =0