Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RadioactiveDecay.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 G4RadioactiveDecay_h
27#define G4RadioactiveDecay_h 1
28// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29//
30// MODULE: G4RadioactiveDecay.hh
31//
32// Version: 0.b.4
33// Date: 14/04/00
34// Author: F Lei & P R Truscott
35// Organisation: DERA UK
36// Customer: ESA/ESTEC, NOORDWIJK
37// Contract: 12115/96/JG/NL Work Order No. 3
38//
39// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40//
41// CHANGE HISTORY
42// --------------
43// 17 October 2011, L Desorgher - Add the method AddUserDecayDataFile
44//
45// 01 June 2011, M. Kelsey -- Add directional biasing interface to allow for
46// "collimation" of decay daughters.
47//
48// 29 February 2000, P R Truscott, DERA UK
49// 0.b.3 release.
50//
51// 13 April 2000, F Lei, DERA UK
52// 0.b.4 release. No change to this file
53//
54// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55////////////////////////////////////////////////////////////////////////////////
56
57#include <vector>
58#include <map>
60
61#include "G4ios.hh"
62#include "globals.hh"
65
66#include "G4NucleusLimits.hh"
70#include "G4ThreeVector.hh"
71#include "G4Threading.hh"
73
74class G4Fragment;
77
78typedef std::vector<G4RadioactiveDecayChainsFromParent> G4RadioactiveDecayParentChainTable;
79typedef std::vector<G4RadioactiveDecayRatesToDaughter> G4RadioactiveDecayRates;
80typedef std::map<G4String, G4DecayTable*> DecayTableMap;
81
82
84{
85 // class description
86
87 // Implementation of the radioactive decay process which simulates the
88 // decays of radioactive nuclei. These nuclei are submitted to RDM as
89 // G4Ions. The required half-lives and decay schemes are retrieved from
90 // the Radioactivity database which was derived from ENSDF.
91 // All decay products are submitted back to the particle tracking process
92 // through the G4ParticleChangeForRadDecay object.
93 // class description - end
94
95 public: // with description
96
97 G4RadioactiveDecay(const G4String& processName="RadioactiveDecay");
99
100 virtual void ProcessDescription(std::ostream& outFile) const;
101
102 // Return true if the specified isotope is
103 // 1) defined as "nucleus" and
104 // 2) it is within theNucleusLimit
106
107 // Return decay table if it exists, if not, load it from file
109
110 // Select a logical volume in which RDM applies
111 void SelectAVolume(const G4String aVolume);
112
113 // Remove a logical volume from the RDM applied list
114 void DeselectAVolume(const G4String aVolume);
115
116 // Select all logical volumes for the application of RDM
117 void SelectAllVolumes();
118
119 // Remove all logical volumes from RDM applications
120 void DeselectAllVolumes();
121
122 // Set the decay biasing scheme using the data in "filename"
123 void SetDecayBias(G4String filename);
124
125 // Set the half-life threshold for isomer production
126 void SetHLThreshold(G4double hl) {halflifethreshold = hl;}
127
128 // Enable/disable ICM
129 void SetICM(G4bool icm) {applyICM = icm;}
130
131 // Enable/disable ARM
132 void SetARM(G4bool arm) {applyARM = arm;}
133
134 // Set source exposure function using histograms in "filename"
135 void SetSourceTimeProfile(G4String filename);
136
138 // Returns true if the coefficient and decay time table for all the
139 // descendants of the specified isotope are ready.
140 // used in VR decay mode only
141
143 // Calculates the coefficient and decay time table for all the descendents
144 // of the specified isotope. Adds the calculated table to the private data
145 // member "theParentChainTable".
146 // used in VR decay mode only
147
149 // Used to retrieve the coefficient and decay time table for all the
150 // descendants of the specified isotope from "theParentChainTable"
151 // and place it in "chainsFromParent".
152 // used in VR decay mode only
153
154 void SetDecayRate(G4int,G4int,G4double, G4int, std::vector<G4double>,
155 std::vector<G4double>);
156 // Sets "theDecayRate" with data supplied in the arguements.
157 // used in VR decay mode only
158
159 std::vector<G4RadioactivityTable*> GetTheRadioactivityTables()
160 {return theRadioactivityTables;}
161 // Return vector of G4Radioactivity map - should be used in VR mode only
162
163 G4DecayTable* LoadDecayTable(const G4ParticleDefinition& theParentNucleus);
164 // Load the decay data of isotope theParentNucleus
165
166 void AddUserDecayDataFile(G4int Z, G4int A,G4String filename);
167 // Allow the user to replace the radio-active decay data provided in Geant4
168 // by its own data file for a given isotope
169
170 inline void SetVerboseLevel(G4int value) {verboseLevel = value;}
171 // Sets the VerboseLevel which controls duggering display
172
173 inline G4int GetVerboseLevel() const {return verboseLevel;}
174 // Returns the VerboseLevel which controls level of debugging output
175
176 inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
177 {theNucleusLimits = theNucleusLimits1 ;}
178 // Sets theNucleusLimits which specifies the range of isotopes
179 // the G4RadioactiveDecay applies.
180
182 {return theNucleusLimits;}
183 // Returns theNucleusLimits which specifies the range of isotopes
184 // the G4RadioactiveDecay applies
185
186 // Controls whether G4RadioactiveDecay runs in analogue mode or
187 // variance reduction mode. SetBRBias, SetSplitNuclei and
188 // SetSourceTimeProfile all turn off analogue mode and use VR mode
189 inline void SetAnalogueMonteCarlo (G4bool r ) {
190 AnalogueMC = r;
191 if (!AnalogueMC) halflifethreshold = 1e-6*CLHEP::s;
192 }
193
194 // Controls whether G4RadioactiveDecay uses fast beta simulation mode
195 // Currently does nothing - kept for backward compatibility
196 inline void SetFBeta (G4bool r ) { FBeta = r; }
197
198 // Returns true if the simulation is an analogue Monte Carlo, and false if
199 // any of the biassing schemes have been selected.
200 inline G4bool IsAnalogueMonteCarlo () {return AnalogueMC;}
201
202 // Sets whether branching ration bias scheme applies.
203 inline void SetBRBias(G4bool r) {
204 BRBias = r;
206 }
207
208 // Sets the number of times a nucleus will decay when biased
209 inline void SetSplitNuclei(G4int r) {
210 NSplit = r;
212 }
213
214 // Returns the nuclear splitting number
215 inline G4int GetSplitNuclei () {return NSplit;}
216
217 inline void SetDecayDirection(const G4ThreeVector& theDir) {
218 forceDecayDirection = theDir.unit();
219 }
220
221 inline const G4ThreeVector& GetDecayDirection() const {
222 return forceDecayDirection;
223 }
224
225 inline void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg) {
226 forceDecayHalfAngle = std::min(std::max(0.*CLHEP::deg,halfAngle),180.*CLHEP::deg);
227 }
228
229 inline G4double GetDecayHalfAngle() const {return forceDecayHalfAngle;}
230
231 // Force direction (random within half-angle) for "visible" daughters
232 // (applies to electrons, positrons, gammas, neutrons, protons or alphas)
233 inline void SetDecayCollimation(const G4ThreeVector& theDir,
234 G4double halfAngle = 0.*CLHEP::deg) {
235 SetDecayDirection(theDir);
236 SetDecayHalfAngle(halfAngle);
237 }
238
240
241 G4VParticleChange* DecayIt(const G4Track& theTrack,
242 const G4Step& theStep);
243
244 protected:
245
246 G4DecayProducts* DoDecay(const G4ParticleDefinition& theParticleDef);
247
248 // Apply directional bias for "visible" daughters (e+-, gamma, n, p, alpha)
249 void CollimateDecay(G4DecayProducts* products);
252
253 G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
255
256 G4double GetMeanLifeTime(const G4Track& theTrack,
258
260
262
263 G4int GetDecayTimeBin(const G4double aDecayTime);
264
265 //Add gamma,Xray,conversion,and auger electrons for bias mode
267 G4double weight,
268 G4double currenTime,
269 std::vector<double>& weights_v,
270 std::vector<double>& times_v,
271 std::vector<G4DynamicParticle*>& secondaries_v);
272
273 private:
274
275 void StreamInfo(std::ostream& os, const G4String& endline);
276
278 G4RadioactiveDecay & operator=(const G4RadioactiveDecay &right);
279
280 G4RadioactiveDecaymessenger* theRadioactiveDecaymessenger;
281 G4PhotonEvaporation* photonEvaporation;
282
283 G4NucleusLimits theNucleusLimits;
284
285 G4bool isInitialised;
286 G4bool AnalogueMC;
287 G4bool BRBias;
288 G4bool FBeta;
289 G4int NSplit;
290
291 G4double halflifethreshold;
292 G4bool applyICM;
293 G4bool applyARM;
294
295 // Parameters for pre-collimated (biased) decay products
296 G4ThreeVector forceDecayDirection;
297 G4double forceDecayHalfAngle;
298 static const G4ThreeVector origin; // (0,0,0) for convenience
299
300 G4int NSourceBin;
301 G4double SBin[100];
302 G4double SProfile[100];
303 G4int NDecayBin;
304 G4double DBin[100];
305 G4double DProfile[100];
306
307 std::vector<G4String> ValidVolumes;
308 bool isAllVolumesMode;
309
310 G4RadioactiveDecayRatesToDaughter ratesToDaughter;
311 G4RadioactiveDecayRates theDecayRateVector;
312 G4RadioactiveDecayChainsFromParent chainsFromParent;
313 G4RadioactiveDecayParentChainTable theParentChainTable;
314
315 // for the radioactivity tables
316 std::vector<G4RadioactivityTable*> theRadioactivityTables;
317 G4int decayWindows[100];
318 static const G4double levelTolerance;
319
320 // Radioactive decay database directory path
321 G4String dirPath;
322
323 // User-defined radioactive decay data files
324 std::map<G4int, G4String> theUserRadioactiveDataFiles;
325
326 //The last RadDecayMode
327 G4RadioactiveDecayMode theRadDecayMode;
328
329 // Library of decay tables
330 DecayTableMap* dkmap;
331#ifdef G4MULTITHREADED
332 static DecayTableMap* master_dkmap;
333#endif
334
335 // Remainder of life time at rest
336 G4double fRemainderLifeTime;
337 G4int verboseLevel;
338
339
340 // ParticleChange for decay process
341 G4ParticleChangeForRadDecay fParticleChangeForRadDecay;
342
343 // inline implementations
344 inline
345 G4double AtRestGetPhysicalInteractionLength(const G4Track& track,
347 {
348 fRemainderLifeTime =
350 return fRemainderLifeTime;
351 }
352
353 inline
354 G4VParticleChange* AtRestDoIt(const G4Track& theTrack,
355 const G4Step& theStep)
356 {return DecayIt(theTrack, theStep);}
357
358 inline
359 G4VParticleChange* PostStepDoIt(const G4Track& theTrack,
360 const G4Step& theStep)
361 {return DecayIt(theTrack, theStep);}
362
363#ifdef G4MULTITHREADED
364 public:
365 static G4Mutex radioactiveDecayMutex;
366 protected:
367 G4int& NumberOfInstances();
368#endif
369};
370
371#endif
372
G4double condition(const G4ErrorSymMatrix &m)
G4ForceCondition
std::vector< G4RadioactiveDecayRatesToDaughter > G4RadioactiveDecayRates
std::map< G4String, G4DecayTable * > DecayTableMap
std::vector< G4RadioactiveDecayChainsFromParent > G4RadioactiveDecayParentChainTable
G4RadioactiveDecayMode
std::vector< G4RadioactiveDecayRatesToDaughter > G4RadioactiveDecayRates
std::map< G4String, G4DecayTable * > DecayTableMap
std::vector< G4RadioactiveDecayChainsFromParent > G4RadioactiveDecayParentChainTable
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Hep3Vector unit() const
void DeselectAVolume(const G4String aVolume)
void SetSplitNuclei(G4int r)
void SetVerboseLevel(G4int value)
void SetSourceTimeProfile(G4String filename)
void BuildPhysicsTable(const G4ParticleDefinition &)
std::vector< G4RadioactivityTable * > GetTheRadioactivityTables()
void SetDecayBias(G4String filename)
void SetICM(G4bool icm)
G4double GetDecayHalfAngle() const
G4DecayTable * LoadDecayTable(const G4ParticleDefinition &theParentNucleus)
void SetBRBias(G4bool r)
G4double GetMeanLifeTime(const G4Track &theTrack, G4ForceCondition *condition)
G4DecayProducts * DoDecay(const G4ParticleDefinition &theParticleDef)
G4NucleusLimits GetNucleusLimits() const
void CollimateDecayProduct(G4DynamicParticle *product)
G4DecayTable * GetDecayTable(const G4ParticleDefinition *)
const G4ThreeVector & GetDecayDirection() const
void SelectAVolume(const G4String aVolume)
G4int GetVerboseLevel() const
G4double GetMeanFreePath(const G4Track &theTrack, G4double previousStepSize, G4ForceCondition *condition)
G4ThreeVector ChooseCollimationDirection() const
G4int GetDecayTimeBin(const G4double aDecayTime)
G4VParticleChange * DecayIt(const G4Track &theTrack, const G4Step &theStep)
void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg)
void SetAnalogueMonteCarlo(G4bool r)
void SetDecayRate(G4int, G4int, G4double, G4int, std::vector< G4double >, std::vector< G4double >)
void SetDecayDirection(const G4ThreeVector &theDir)
G4bool IsApplicable(const G4ParticleDefinition &)
void CalculateChainsFromParent(const G4ParticleDefinition &)
void SetARM(G4bool arm)
void SetHLThreshold(G4double hl)
void SetDecayCollimation(const G4ThreeVector &theDir, G4double halfAngle=0.*CLHEP::deg)
virtual void ProcessDescription(std::ostream &outFile) const
G4bool IsRateTableReady(const G4ParticleDefinition &)
void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
void AddUserDecayDataFile(G4int Z, G4int A, G4String filename)
G4double ConvolveSourceTimeProfile(const G4double, const G4double)
void AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition *apartDef, G4double weight, G4double currenTime, std::vector< double > &weights_v, std::vector< double > &times_v, std::vector< G4DynamicParticle * > &secondaries_v)
void CollimateDecay(G4DecayProducts *products)
void GetChainsFromParent(const G4ParticleDefinition &)
Definition: G4Step.hh:62
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)