Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MoleculeCounter.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#ifndef G4MoleculeCounter_h
27#define G4MoleculeCounter_h
28
29#include "G4Molecule.hh"
30#include <map>
32#include <memory>
33
34using namespace std;
35
37{
38 bool operator() (const double& a, const double& b) const
39 {
40 if(fabs(a - b) < fPrecision)
41 {
42 return false;
43 }
44 else
45 {
46 return a < b;
47 }
48 }
49
50 static double fPrecision ;
51};
52
53typedef map<G4double, G4int, compDoubleWithPrecision> NbMoleculeAgainstTime;
54
56{
57protected:
59 virtual ~G4MoleculeCounter(){;}
61 typedef std::map<G4Molecule, NbMoleculeAgainstTime> CounterMapType;
62
64
65 std::map<const G4MoleculeDefinition*, G4bool> fDontRegister ;
67
69
70public:
71 static void DeleteInstance();
72
74 inline const NbMoleculeAgainstTime& GetNbMoleculeAgainstTime(const G4Molecule &molecule);
75 std::auto_ptr<vector<G4Molecule> > GetRecordedMolecules();
76 virtual void AddAMoleculeAtTime(const G4Molecule&, G4double);
77 virtual void RemoveAMoleculeAtTime(const G4Molecule&, G4double);
78
79 // inline void DontRegister(G4MoleculeID);
80 inline virtual void DontRegister(const G4MoleculeDefinition*);
81 inline virtual void ResetDontRegister();
82
83 void Use(G4bool flag = true)
84 {
85 fUse=flag;
86 }
88 {
89 return fUse;
90 }
91
92 inline void SetVerbose(G4int);
93 inline G4int GetVerbose();
94
95 virtual void ResetCounter();
96};
97
99{
100 fCounterMap.clear();
101}
102
104{
105 return fCounterMap[molecule];
106}
107
109{
110 fVerbose = level;
111}
112
114{
115 return fVerbose ;
116}
117
119{
120 fDontRegister[molDef] = true ;
121}
122
124{
125 fDontRegister.clear();
126}
127
128#endif
map< G4double, G4int, compDoubleWithPrecision > NbMoleculeAgainstTime
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
virtual void AddAMoleculeAtTime(const G4Molecule &, G4double)
const NbMoleculeAgainstTime & GetNbMoleculeAgainstTime(const G4Molecule &molecule)
static G4MoleculeCounter * GetMoleculeCounter()
std::map< const G4MoleculeDefinition *, G4bool > fDontRegister
std::map< G4Molecule, NbMoleculeAgainstTime > CounterMapType
static G4MoleculeCounter * fpInstance
virtual void DontRegister(const G4MoleculeDefinition *)
virtual ~G4MoleculeCounter()
CounterMapType fCounterMap
virtual void RemoveAMoleculeAtTime(const G4Molecule &, G4double)
static void DeleteInstance()
std::auto_ptr< vector< G4Molecule > > GetRecordedMolecules()
virtual void ResetCounter()
virtual void ResetDontRegister()
void Use(G4bool flag=true)
bool operator()(const double &a, const double &b) const