ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RadioactiveDecay.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4RadioactiveDecay.hh
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>
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"
73 
74 class G4Fragment;
77 
78 typedef std::vector<G4RadioactiveDecayChainsFromParent> G4RadioactiveDecayParentChainTable;
79 typedef std::vector<G4RadioactiveDecayRatesToDaughter> G4RadioactiveDecayRates;
80 typedef 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"
124 
125  // Set the half-life threshold for isomer production
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 
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;
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.
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) {
227  }
228 
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
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 
279 
282 
284 
290 
294 
295  // Parameters for pre-collimated (biased) decay products
298  static const G4ThreeVector origin; // (0,0,0) for convenience
299 
306 
307  std::vector<G4String> ValidVolumes;
309 
314 
315  // for the radioactivity tables
316  std::vector<G4RadioactivityTable*> theRadioactivityTables;
318  static const G4double levelTolerance;
319 
320  // Radioactive decay database directory path
322 
323  // User-defined radioactive decay data files
324  std::map<G4int, G4String> theUserRadioactiveDataFiles;
325 
326  //The last RadDecayMode
328 
329  // Library of decay tables
331 #ifdef G4MULTITHREADED
332  static DecayTableMap* master_dkmap;
333 #endif
334 
335  // Remainder of life time at rest
338 
339 
340  // ParticleChange for decay process
342 
343  // inline implementations
344  inline
347  {
350  return fRemainderLifeTime;
351  }
352 
353  inline
355  const G4Step& theStep)
356  {return DecayIt(theTrack, theStep);}
357 
358  inline
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