Geant4  10.03
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 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 
57 #include <vector>
58 #include <map>
59 #include <CLHEP/Units/SystemOfUnits.h>
60 
61 #include "G4ios.hh"
62 #include "globals.hh"
65 
66 #include "G4NucleusLimits.hh"
69 #include "G4RadioactivityTable.hh"
70 #include "G4ThreeVector.hh"
71 #include "G4Threading.hh"
72 
74 
75 typedef std::vector<G4RadioactiveDecayRateVector> G4RadioactiveDecayRateTable;
76 typedef std::vector<G4RadioactiveDecayRate> G4RadioactiveDecayRates;
77 typedef std::map<G4String, G4DecayTable*> DecayTableMap;
78 
79 
81 {
82  // class description
83 
84  // Implementation of the radioactive decay process which simulates the
85  // decays of radioactive nuclei. These nuclei are submitted to RDM as
86  // G4Ions. The required half-lives and decay schemes are retrieved from
87  // the Radioactivity database which was derived from ENSDF.
88  // All decay products are submitted back to the particle tracking process
89  // through the G4ParticleChangeForRadDecay object.
90  // class description - end
91 
92  public: // with description
93 
94  G4RadioactiveDecay(const G4String& processName="RadioactiveDecay");
96 
97  // Return true if the specified isotope is
98  // 1) defined as "nucleus" and
99  // 2) it is within theNucleusLimit
101 
102  // Return decay table if it exists, if not, load it from file
104 
105  // Select a logical volume in which RDM applies
106  void SelectAVolume(const G4String aVolume);
107 
108  // Remove a logical volume from the RDM applied list
109  void DeselectAVolume(const G4String aVolume);
110 
111  // Select all logical volumes for the application of RDM
112  void SelectAllVolumes();
113 
114  // Remove all logical volumes from RDM applications
115  void DeselectAllVolumes();
116 
117  // Set the decay biasing scheme using the data in "filename"
118  void SetDecayBias(G4String filename);
119 
120  // Set the half-life threshold for isomer production
122 
123  // Enable/disable ICM
124  void SetICM(G4bool icm) {applyICM = icm;}
125 
126  // Enable/disable ARM
127  void SetARM(G4bool arm) {applyARM = arm;}
128 
129  // Set source exposure function using histograms in "filename"
130  void SetSourceTimeProfile(G4String filename);
131 
133  // Returns true if the coefficient and decay time table for all the
134  // descendants of the specified isotope are ready.
135  // used in VR decay mode only
136 
138  // Calculates the coefficient and decay time table for all the descendents
139  // of the specified isotope. Adds the calculated table to the private data
140  // member "theDecayRateTableVector".
141  // used in VR decay mode only
142 
144  // Used to retrieve the coefficient and decay time table for all the
145  // descendants of the specified isotope from "theDecayRateTableVector"
146  // and place it in "theDecayRateTable".
147  // used in VR decay mode only
148 
149  void SetDecayRate(G4int,G4int,G4double, G4int, std::vector<G4double>,
150  std::vector<G4double>);
151  // Sets "theDecayRate" with data supplied in the arguements.
152  // used in VR decay mode only
153 
154  std::vector<G4RadioactivityTable*> GetTheRadioactivityTables()
155  {return theRadioactivityTables;}
156  // Return vector of G4Radioactivity map - should be used in VR mode only
157 
158  G4DecayTable* LoadDecayTable(const G4ParticleDefinition& theParentNucleus);
159  // Load the decay data of isotope theParentNucleus
160 
161  void AddUserDecayDataFile(G4int Z, G4int A,G4String filename);
162  // Allow the user to replace the radio-active decay data provided in Geant4
163  // by its own data file for a given isotope
164 
165 
166  inline void SetVerboseLevel(G4int value) {verboseLevel = value;}
167  // Sets the VerboseLevel which controls duggering display
168 
169  inline G4int GetVerboseLevel() const {return verboseLevel;}
170  // Returns the VerboseLevel which controls level of debugging output
171 
172  inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
173  {theNucleusLimits = theNucleusLimits1 ;}
174  // Sets theNucleusLimits which specifies the range of isotopes
175  // the G4RadioactiveDecay applies.
176 
178  {return theNucleusLimits;}
179  // Returns theNucleusLimits which specifies the range of isotopes
180  // the G4RadioactiveDecay applies
181 
182  inline void SetAnalogueMonteCarlo (G4bool r ) {
183  AnalogueMC = r;
185  }
186  // Controls whether G4RadioactiveDecay runs in analogue mode or
187  // variance reduction mode.
188 
189  inline void SetFBeta (G4bool r ) { FBeta = r; }
190  // Controls whether G4RadioactiveDecay uses fast beta simulation mode
191 
193  // Returns true if the simulation is an analogue Monte Carlo, and false if
194  // any of the biassing schemes have been selected.
195 
196  inline void SetBRBias (G4bool r) {
197  BRBias = r;
199  }
200  // Sets whether branching ration bias scheme applies.
201 
202  inline void SetSplitNuclei (G4int r) {
203  NSplit = r;
205  }
206  // Sets the N number for the Nuclei spliting bias scheme
207 
208  inline G4int GetSplitNuclei () {return NSplit;}
209  // Returns the N number used for the Nuclei spliting bias scheme
210 
211  inline void SetDecayDirection(const G4ThreeVector& theDir) {
212  forceDecayDirection = theDir.unit();
213  }
214 
215  inline const G4ThreeVector& GetDecayDirection() const {
216  return forceDecayDirection;
217  }
218 
219  inline void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg) {
221  }
222 
224 
225  inline void SetDecayCollimation(const G4ThreeVector& theDir,
226  G4double halfAngle = 0.*CLHEP::deg) {
227  SetDecayDirection(theDir);
228  SetDecayHalfAngle(halfAngle);
229  }
230 
231  // Force direction (random within half-angle) for "visible" daughters
232  // (applies to electrons, positrons, gammas, neutrons, protons or alphas)
233 
235 
236  G4VParticleChange* DecayIt(const G4Track& theTrack,
237  const G4Step& theStep);
238 
239  protected:
240 
241  G4DecayProducts* DoDecay(const G4ParticleDefinition& theParticleDef);
242 
243  // Apply directional bias for "visible" daughters (e+-, gamma, n, p, alpha)
244  void CollimateDecay(G4DecayProducts* products);
247 
248  G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
250 
251  G4double GetMeanLifeTime(const G4Track& theTrack,
253 
255 
257 
258  G4int GetDecayTimeBin(const G4double aDecayTime);
259 
260  //Add gamma,Xray,conversion,and auger electrons for bias mode
262  G4double weight,
263  G4double currenTime,
264  std::vector<double>& weights_v,
265  std::vector<double>& times_v,
266  std::vector<G4DynamicParticle*>& secondaries_v);
267 
268  private:
269 
272 
274 
276 
282 
286 
287  // Parameters for pre-collimated (biased) decay products
290  static const G4ThreeVector origin; // (0,0,0) for convenience
291 
298 
299  std::vector<G4String> ValidVolumes;
301 
306 
307  // for the radioactivity tables
308  std::vector<G4RadioactivityTable*> theRadioactivityTables;
310  static const G4double levelTolerance;
311 
312  //User define radioactive decay data files replacing some files in the G4RADECAY database
313  std::map<G4int, G4String> theUserRadioactiveDataFiles;
314 
315  // Library of decay tables
317 #ifdef G4MULTITHREADED
318  static DecayTableMap* master_dkmap;
319 #endif
320 
321  // Remainder of life time at rest
324 
325 
326  // ParticleChange for decay process
328 
329  // inline implementations
330  inline
333  {
334  fRemainderLifeTime =
336  return fRemainderLifeTime;
337  }
338 
339  inline
341  const G4Step& theStep)
342  {return DecayIt(theTrack, theStep);}
343 
344  inline
346  const G4Step& theStep)
347  {return DecayIt(theTrack, theStep);}
348 
349 #ifdef G4MULTITHREADED
350  public:
351  static G4Mutex radioactiveDecayMutex;
352 #endif
353 };
354 
355 #endif
356 
G4VParticleChange * PostStepDoIt(const G4Track &theTrack, const G4Step &theStep)
G4double condition(const G4ErrorSymMatrix &m)
std::vector< G4RadioactiveDecayRateVector > G4RadioactiveDecayRateTable
G4RadioactiveDecayRateVector theDecayRateTable
G4DecayProducts * DoDecay(const G4ParticleDefinition &theParticleDef)
G4RadioactiveDecay & operator=(const G4RadioactiveDecay &right)
void SelectAVolume(const G4String aVolume)
std::map< G4String, G4DecayTable * > DecayTableMap
static constexpr double s
Definition: G4SIunits.hh:169
CLHEP::Hep3Vector G4ThreeVector
G4bool IsRateTableReady(const G4ParticleDefinition &)
std::vector< G4String > ValidVolumes
G4double ConvolveSourceTimeProfile(const G4double, const G4double)
std::vector< G4RadioactiveDecayRate > G4RadioactiveDecayRates
G4VParticleChange * AtRestDoIt(const G4Track &theTrack, const G4Step &theStep)
G4RadioactiveDecayRates theDecayRateVector
G4double GetMeanLifeTime(const G4Track &theTrack, G4ForceCondition *condition)
G4int GetVerboseLevel() const
void SetSourceTimeProfile(G4String filename)
G4bool IsApplicable(const G4ParticleDefinition &)
int G4int
Definition: G4Types.hh:78
void SetBRBias(G4bool r)
G4ParticleChangeForRadDecay fParticleChangeForRadDecay
double A(double temperature)
static const G4ThreeVector origin
void SetDecayRate(G4int, G4int, G4double, G4int, std::vector< G4double >, std::vector< G4double >)
std::vector< G4RadioactivityTable * > GetTheRadioactivityTables()
bool G4bool
Definition: G4Types.hh:79
void CollimateDecayProduct(G4DynamicParticle *product)
const G4ThreeVector & GetDecayDirection() const
void SetARM(G4bool arm)
void SetDecayDirection(const G4ThreeVector &theDir)
G4ThreeVector ChooseCollimationDirection() const
G4int GetDecayTimeBin(const G4double aDecayTime)
Definition: G4Step.hh:76
G4NucleusLimits GetNucleusLimits() const
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
G4NucleusLimits theNucleusLimits
G4DecayTable * GetDecayTable(const G4ParticleDefinition *)
G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition)
void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
G4double GetMeanFreePath(const G4Track &theTrack, G4double previousStepSize, G4ForceCondition *condition)
G4RadioactiveDecayRate theDecayRate
static const G4double levelTolerance
G4int G4Mutex
Definition: G4Threading.hh:173
G4RadioactiveDecayRateTable theDecayRateTableVector
std::map< G4int, G4String > theUserRadioactiveDataFiles
void GetDecayRateTable(const G4ParticleDefinition &)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4RadioactiveDecaymessenger * theRadioactiveDecaymessenger
void SetSplitNuclei(G4int r)
G4double GetDecayHalfAngle() const
void AddDecayRateTable(const G4ParticleDefinition &)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4DecayTable * LoadDecayTable(const G4ParticleDefinition &theParentNucleus)
std::vector< G4RadioactivityTable * > theRadioactivityTables
G4RadioactiveDecay(const G4String &processName="RadioactiveDecay")
void SetVerboseLevel(G4int value)
G4ThreeVector forceDecayDirection
void SetDecayCollimation(const G4ThreeVector &theDir, G4double halfAngle=0.*CLHEP::deg)
void SetICM(G4bool icm)
double G4double
Definition: G4Types.hh:76
void SetHLThreshold(G4double hl)
void BuildPhysicsTable(const G4ParticleDefinition &)
static constexpr double deg
Definition: G4SIunits.hh:152
G4ForceCondition
void SetAnalogueMonteCarlo(G4bool r)
void SetDecayHalfAngle(G4double halfAngle=0.*CLHEP::deg)
void DeselectAVolume(const G4String aVolume)
void AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition *apartDef, G4double weight, G4double currenTime, std::vector< double > &weights_v, std::vector< double > &times_v, std::vector< G4DynamicParticle * > &secondaries_v)
void AddUserDecayDataFile(G4int Z, G4int A, G4String filename)
void CollimateDecay(G4DecayProducts *products)
void SetDecayBias(G4String filename)
G4VParticleChange * DecayIt(const G4Track &theTrack, const G4Step &theStep)