OMSim
Geant4 for IceCube optical module studies
Loading...
Searching...
No Matches
OMSimG4VRadioactiveDecay.hh
Go to the documentation of this file.
1
10#pragma once
11
12#include <vector>
13#include <map>
14#include <CLHEP/Units/SystemOfUnits.h>
15
16#include "G4ios.hh"
17#include "globals.hh"
18#include "G4VRestDiscreteProcess.hh"
19#include "OMSimG4ParticleChangeForRadDecay.hh"
20
21#include "G4NucleusLimits.hh"
22#include "G4ThreeVector.hh"
23#include "G4RadioactiveDecayMode.hh"
24
25class G4Fragment;
26class G4RadioactiveDecayMessenger;
27class G4PhotonEvaporation;
28class G4Ions;
29class G4DecayTable;
30class G4ITDecay;
31
32typedef std::map<G4String, G4DecayTable*> DecayTableMap;
33
34class G4VRadioactiveDecay : public G4VRestDiscreteProcess
35{
36 // class description
37
38 // Implementation of the radioactive decay process which simulates the
39 // decays of radioactive nuclei. These nuclei are submitted to RDM as
40 // G4Ions. The required half-lives and decay schemes are retrieved from
41 // the Radioactivity database which was derived from ENSDF.
42 // All decay products are submitted back to the particle tracking process
43 // through the G4ParticleChangeForRadDecay object.
44 // class description - end
45
46 public: // with description
47
48 G4VRadioactiveDecay(const G4String& processName="RadioactiveDecay",
49 const G4double timeThreshold=-1.0);
50 ~G4VRadioactiveDecay() override;
51
52 G4bool IsApplicable(const G4ParticleDefinition&) override;
53 // Return true if the specified isotope is
54 // 1) defined as "nucleus" and
55 // 2) it is within theNucleusLimit
56
57 G4VParticleChange* AtRestDoIt(const G4Track& theTrack,
58 const G4Step& theStep) override;
59
60 G4VParticleChange* PostStepDoIt(const G4Track& theTrack,
61 const G4Step& theStep) override;
62
63 void BuildPhysicsTable(const G4ParticleDefinition &) override;
64
65 void ProcessDescription(std::ostream& outFile) const override;
66
67 virtual G4VParticleChange* DecayIt(const G4Track& theTrack,
68 const G4Step& theStep);
69
70 // Return decay table if it exists, if not, load it from file
71 G4DecayTable* GetDecayTable(const G4ParticleDefinition*);
72
73 // Select a logical volume in which RDM applies
74 void SelectAVolume(const G4String& aVolume);
75
76 // Remove a logical volume from the RDM applied list
77 void DeselectAVolume(const G4String& aVolume);
78
79 // Select all logical volumes for the application of RDM
80 void SelectAllVolumes();
81
82 // Remove all logical volumes from RDM applications
83 void DeselectAllVolumes();
84
85 // Enable/disable ARM
86 inline void SetARM(G4bool arm) { applyARM = arm; }
87
88 G4DecayTable* LoadDecayTable(const G4Ions*);
89 // Load the decay data of isotope theParentNucleus
90
91 void AddUserDecayDataFile(G4int Z, G4int A, const G4String& filename);
92 // Allow the user to replace the radio-active decay data provided in Geant4
93 // by its own data file for a given isotope
94
95 inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
96 { theNucleusLimits = theNucleusLimits1; }
97 // Sets theNucleusLimits which specifies the range of isotopes
98 // the G4VRadioactiveDecay applies.
99
100 // Returns theNucleusLimits which specifies the range of isotopes used
101 // by G4VRadioactiveDecay
102 inline G4NucleusLimits GetNucleusLimits() const { return theNucleusLimits; }
103
104 inline void SetDecayDirection(const G4ThreeVector& theDir) {
105 forceDecayDirection = theDir.unit();
106 }
107
108 inline const G4ThreeVector& GetDecayDirection() const {
109 return forceDecayDirection;
110 }
111
112 inline void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg) {
113 forceDecayHalfAngle = std::min(std::max(0.*CLHEP::deg,halfAngle),180.*CLHEP::deg);
114 }
115
116 inline G4double GetDecayHalfAngle() const { return forceDecayHalfAngle; }
117
118 // Force direction (random within half-angle) for "visible" daughters
119 // (applies to electrons, positrons, gammas, neutrons, protons or alphas)
120 inline void SetDecayCollimation(const G4ThreeVector& theDir,
121 G4double halfAngle = 0.*CLHEP::deg) {
122 SetDecayDirection(theDir);
123 SetDecayHalfAngle(halfAngle);
124 }
125
126 // Ignore radioactive decays at rest of nuclides happening
127 // after this (very long) time threshold
128 inline void SetThresholdForVeryLongDecayTime(const G4double inputThreshold) {
129 fThresholdForVeryLongDecayTime = std::max( 0.0, inputThreshold );
130 }
131 inline G4double GetThresholdForVeryLongDecayTime() const {
132 return fThresholdForVeryLongDecayTime;
133 }
134
135 void StreamInfo(std::ostream& os, const G4String& endline);
136
137 G4VRadioactiveDecay(const G4VRadioactiveDecay& right) = delete;
138 G4VRadioactiveDecay& operator=(const G4VRadioactiveDecay& right) = delete;
139
140 protected:
141
142 G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
143 G4ForceCondition* condition) override;
144
145 G4double GetMeanLifeTime(const G4Track& theTrack,
146 G4ForceCondition* condition) override;
147
148 // sampling of products
149 void DecayAnalog(const G4Track& theTrack, G4DecayTable*);
150
151 // sampling products at rest
152 G4DecayProducts* DoDecay(const G4ParticleDefinition&, G4DecayTable*);
153
154 // Apply directional bias for "visible" daughters (e+-, gamma, n, p, alpha)
155 void CollimateDecay(G4DecayProducts* products);
156 void CollimateDecayProduct(G4DynamicParticle* product);
157 G4ThreeVector ChooseCollimationDirection() const;
158
159 // ParticleChange for decay process
160 G4ParticleChangeForRadDecay fParticleChangeForRadDecay;
161
162 G4RadioactiveDecayMessenger* theRadioactiveDecayMessenger;
163 G4PhotonEvaporation* photonEvaporation;
164 G4ITDecay* decayIT;
165
166 std::vector<G4String> ValidVolumes;
167 G4bool isAllVolumesMode{true};
168
169 static const G4double levelTolerance;
170
171 // Library of decay tables
172 static DecayTableMap* master_dkmap;
173
174 private:
175
176 G4NucleusLimits theNucleusLimits;
177
178 G4bool isInitialised{false};
179 G4bool applyARM{true};
180
181 // Parameters for pre-collimated (biased) decay products
182 G4ThreeVector forceDecayDirection{G4ThreeVector(0., 0., 0.)};
183 G4double forceDecayHalfAngle{0.0};
184 static const G4ThreeVector origin; // (0,0,0) for convenience
185
186 // Radioactive decay database directory path
187 static G4String dirPath;
188
189 // User define radioactive decay data files replacing some files in the G4RADECAY database
190 static std::map<G4int, G4String>* theUserRDataFiles;
191
192 // The last RadDecayMode
193 G4RadioactiveDecayMode theRadDecayMode{G4RadioactiveDecayMode::IT};
194
195 // Ignore radioactive decays at rest of nuclides happening after this (very long) time threshold
196 G4double fThresholdForVeryLongDecayTime;
197};
198
199
Definition OMSimG4ParticleChangeForRadDecay.hh:12
Definition OMSimG4VRadioactiveDecay.hh:35