[819] | 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 | // |
---|
| 44 | // 29 February 2000, P R Truscott, DERA UK |
---|
| 45 | // 0.b.3 release. |
---|
| 46 | // |
---|
| 47 | // 13 April 2000, F Lei, DERA UK |
---|
| 48 | // 0.b.4 release. No change to this file |
---|
| 49 | // |
---|
| 50 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 51 | //////////////////////////////////////////////////////////////////////////////// |
---|
| 52 | // |
---|
| 53 | #include "G4ios.hh" |
---|
| 54 | #include "globals.hh" |
---|
| 55 | #include "G4VRestDiscreteProcess.hh" |
---|
| 56 | #include "G4ParticleChangeForRadDecay.hh" |
---|
| 57 | #include "G4RadioactiveDecaymessenger.hh" |
---|
| 58 | |
---|
| 59 | #include "G4NucleusLimits.hh" |
---|
| 60 | #include "G4RadioactiveDecayRate.hh" |
---|
| 61 | #include "G4RadioactiveDecayRateVector.hh" |
---|
| 62 | #include "G4RIsotopeTable.hh" |
---|
| 63 | #include <vector> |
---|
| 64 | |
---|
| 65 | //class G4UserlimitsForRD; |
---|
| 66 | |
---|
| 67 | //////////////////////////////////////////////////////////////////////////////// |
---|
| 68 | // |
---|
| 69 | class G4RadioactiveDecaymessenger; |
---|
| 70 | |
---|
| 71 | typedef std::vector<G4RadioactiveDecayRateVector> G4RadioactiveDecayRateTable; |
---|
| 72 | typedef std::vector<G4RadioactiveDecayRate> G4RadioactiveDecayRates; |
---|
| 73 | |
---|
| 74 | class G4RadioactiveDecay : public G4VRestDiscreteProcess |
---|
| 75 | { |
---|
| 76 | // class description |
---|
| 77 | |
---|
| 78 | // Implementation of nuclear radioactive decay process. |
---|
| 79 | // It simulates the decays of radioactive nuclei, which is submitted to RDM in the form |
---|
| 80 | // of G4Ions. Half-liffe and decay schemes are hold in the Radioactivity database |
---|
| 81 | // All decay products are submitted back to the particle tracking process through |
---|
| 82 | // the G4ParticleChangeForRadDecay object. |
---|
| 83 | |
---|
| 84 | // class description - end |
---|
| 85 | |
---|
| 86 | public: // with description |
---|
| 87 | |
---|
| 88 | G4RadioactiveDecay (const G4String& processName="RadioactiveDecay"); |
---|
| 89 | ~G4RadioactiveDecay(); |
---|
| 90 | // constructor and destructor |
---|
| 91 | // |
---|
| 92 | |
---|
| 93 | G4bool IsApplicable(const G4ParticleDefinition &); |
---|
| 94 | // Returns true if the specified isotope is |
---|
| 95 | // 1) defined as "nucleus" and |
---|
| 96 | // 2) it is within theNucleusLimit |
---|
| 97 | // |
---|
| 98 | G4bool IsLoaded (const G4ParticleDefinition &); |
---|
| 99 | // Returns true if the decay table of the specified nuclei is ready. |
---|
| 100 | // |
---|
| 101 | void SelectAVolume(const G4String aVolume); |
---|
| 102 | // Select a logical volume in which RDM applies. |
---|
| 103 | // |
---|
| 104 | void DeselectAVolume(const G4String aVolume); |
---|
| 105 | // remove a logical volume from the RDM applied list |
---|
| 106 | // |
---|
| 107 | void SelectAllVolumes(); |
---|
| 108 | // Select all logical volumes for the application of RDM. |
---|
| 109 | // |
---|
| 110 | void DeselectAllVolumes(); |
---|
| 111 | // Remove all logical volumes from RDM applications. |
---|
| 112 | // |
---|
| 113 | void SetDecayBias (G4String filename); |
---|
| 114 | // Sets the decay biasing scheme using the data in "filename" |
---|
| 115 | // |
---|
| 116 | void SetSourceTimeProfile (G4String filename) ; |
---|
| 117 | // Sets source exposure function using histograms in "filename" |
---|
| 118 | // |
---|
| 119 | G4bool IsRateTableReady(const G4ParticleDefinition &); |
---|
| 120 | // Returns true if the coefficient and decay time table for all the |
---|
| 121 | // descendants of the specified isotope are ready. |
---|
| 122 | // |
---|
| 123 | // used in VR decay mode only |
---|
| 124 | // |
---|
| 125 | void AddDecayRateTable(const G4ParticleDefinition &); |
---|
| 126 | // Calculates the coefficient and decay time table for all the descendants |
---|
| 127 | // of the specified isotope. Adds the calculated table to the private data |
---|
| 128 | // member "theDecayRateTableVector". |
---|
| 129 | // |
---|
| 130 | // |
---|
| 131 | // used in VR decay mode only |
---|
| 132 | // |
---|
| 133 | void GetDecayRateTable(const G4ParticleDefinition &); |
---|
| 134 | // Used to retrieve the coefficient and decay time table for all the |
---|
| 135 | // descendants of the specified isotope from "theDecayRateTableVector" |
---|
| 136 | // and place it in "theDecayRateTable". |
---|
| 137 | // |
---|
| 138 | // |
---|
| 139 | // used in VR decay mode only |
---|
| 140 | // |
---|
| 141 | void SetDecayRate(G4int,G4int,G4double, G4int, std::vector<G4double>, |
---|
| 142 | std::vector<G4double>); |
---|
| 143 | // Sets "theDecayRate" with data supplied in the arguements. |
---|
| 144 | // |
---|
| 145 | // // |
---|
| 146 | // used in VR decay mode only |
---|
| 147 | // |
---|
| 148 | |
---|
| 149 | G4DecayTable *LoadDecayTable (G4ParticleDefinition & theParentNucleus); |
---|
| 150 | // Load the decay data of isotope theParentNucleus. |
---|
| 151 | // |
---|
| 152 | inline void SetVerboseLevel(G4int value) {verboseLevel = value;} |
---|
| 153 | // Sets the VerboseLevel which controls duggering display. |
---|
| 154 | // |
---|
| 155 | inline G4int GetVerboseLevel() const {return verboseLevel;} |
---|
| 156 | // Returns the VerboseLevel which controls level of debugging output. |
---|
| 157 | // |
---|
| 158 | inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1) |
---|
| 159 | {theNucleusLimits = theNucleusLimits1 ;} |
---|
| 160 | // Sets theNucleusLimits which specifies the range of isotopes |
---|
| 161 | // the G4RadioactiveDecay applies. |
---|
| 162 | // |
---|
| 163 | inline G4NucleusLimits GetNucleusLimits() const |
---|
| 164 | {return theNucleusLimits;} |
---|
| 165 | // Returns theNucleusLimits which specifies the range of isotopes |
---|
| 166 | // the G4RadioactiveDecay applies. |
---|
| 167 | // |
---|
| 168 | inline void SetAnalogueMonteCarlo (G4bool r ) { AnalogueMC = r; } |
---|
| 169 | // Controls whether G4RadioactiveDecay runs in analogue mode or |
---|
| 170 | // variance reduction mode. |
---|
| 171 | inline void SetFBeta (G4bool r ) { FBeta = r; } |
---|
| 172 | // Controls whether G4RadioactiveDecay uses fast beta simulation mode |
---|
| 173 | // |
---|
| 174 | inline G4bool IsAnalogueMonteCarlo () {return AnalogueMC;} |
---|
| 175 | // Returns true if the simulation is an analogue Monte Carlo, and false if |
---|
| 176 | // any of the biassing schemes have been selected. |
---|
| 177 | // |
---|
| 178 | inline void SetBRBias (G4bool r ) { BRBias = r; |
---|
| 179 | SetAnalogueMonteCarlo(0);} |
---|
| 180 | // Sets whether branching ration bias scheme applies. |
---|
| 181 | // |
---|
| 182 | inline void SetSplitNuclei (G4int r) { NSplit = r; SetAnalogueMonteCarlo(0); } |
---|
| 183 | // Sets the N number for the Nuclei spliting bias scheme |
---|
| 184 | // |
---|
| 185 | inline G4int GetSplitNuclei () {return NSplit;} |
---|
| 186 | // Returns the N number used for the Nuclei spliting bias scheme |
---|
| 187 | // |
---|
| 188 | public: |
---|
| 189 | |
---|
| 190 | void BuildPhysicsTable(const G4ParticleDefinition &); |
---|
| 191 | |
---|
| 192 | protected: |
---|
| 193 | |
---|
| 194 | G4VParticleChange* DecayIt( const G4Track& theTrack, |
---|
| 195 | const G4Step& theStep); |
---|
| 196 | |
---|
| 197 | G4DecayProducts* DoDecay(G4ParticleDefinition& theParticleDef); |
---|
| 198 | |
---|
| 199 | G4double GetMeanFreePath(const G4Track& theTrack, |
---|
| 200 | G4double previousStepSize, |
---|
| 201 | G4ForceCondition* condition); |
---|
| 202 | |
---|
| 203 | G4double GetMeanLifeTime(const G4Track& theTrack, |
---|
| 204 | G4ForceCondition* condition); |
---|
| 205 | |
---|
| 206 | G4double GetTaoTime(G4double,G4double); |
---|
| 207 | |
---|
| 208 | G4double GetDecayTime(); |
---|
| 209 | |
---|
| 210 | G4int GetDecayTimeBin(const G4double aDecayTime); |
---|
| 211 | |
---|
| 212 | private: |
---|
| 213 | |
---|
| 214 | G4RadioactiveDecay(const G4RadioactiveDecay &right); |
---|
| 215 | G4RadioactiveDecay & operator=(const G4RadioactiveDecay &right); |
---|
| 216 | |
---|
| 217 | private: |
---|
| 218 | |
---|
| 219 | G4RadioactiveDecaymessenger *theRadioactiveDecaymessenger; |
---|
| 220 | |
---|
| 221 | G4PhysicsTable *aPhysicsTable; |
---|
| 222 | |
---|
| 223 | G4RIsotopeTable *theIsotopeTable; |
---|
| 224 | |
---|
| 225 | G4NucleusLimits theNucleusLimits; |
---|
| 226 | |
---|
| 227 | const G4double HighestBinValue; |
---|
| 228 | const G4double LowestBinValue; |
---|
| 229 | |
---|
| 230 | const G4int TotBin; |
---|
| 231 | |
---|
| 232 | G4bool AnalogueMC; |
---|
| 233 | G4bool BRBias; |
---|
| 234 | G4bool FBeta; |
---|
| 235 | G4int NSplit; |
---|
| 236 | |
---|
| 237 | G4int NSourceBin; |
---|
| 238 | G4double SBin[99]; |
---|
| 239 | G4double SProfile[99]; |
---|
| 240 | |
---|
| 241 | G4int NDecayBin; |
---|
| 242 | G4double DBin[99]; |
---|
| 243 | G4double DProfile[99]; |
---|
| 244 | |
---|
| 245 | std::vector<G4String> LoadedNuclei; |
---|
| 246 | std::vector<G4String> ValidVolumes; |
---|
| 247 | |
---|
| 248 | G4RadioactiveDecayRate theDecayRate; |
---|
| 249 | G4RadioactiveDecayRates theDecayRateVector; |
---|
| 250 | G4RadioactiveDecayRateVector theDecayRateTable; |
---|
| 251 | G4RadioactiveDecayRateTable theDecayRateTableVector; |
---|
| 252 | |
---|
| 253 | static const G4double levelTolerance; |
---|
| 254 | |
---|
| 255 | // Remainder of life time at rest |
---|
| 256 | G4double fRemainderLifeTime; |
---|
| 257 | |
---|
| 258 | G4int verboseLevel; |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | // ParticleChange for decay process |
---|
| 262 | G4ParticleChangeForRadDecay fParticleChangeForRadDecay; |
---|
| 263 | |
---|
| 264 | inline G4double AtRestGetPhysicalInteractionLengt |
---|
| 265 | (const G4Track& track, G4ForceCondition* condition) |
---|
| 266 | {fRemainderLifeTime = G4VRestDiscreteProcess:: |
---|
| 267 | AtRestGetPhysicalInteractionLength(track, condition ); |
---|
| 268 | return fRemainderLifeTime;} |
---|
| 269 | |
---|
| 270 | inline G4VParticleChange* AtRestDoIt |
---|
| 271 | (const G4Track& theTrack, const G4Step& theStep) |
---|
| 272 | {return DecayIt(theTrack, theStep);} |
---|
| 273 | |
---|
| 274 | inline G4VParticleChange* PostStepDoIt |
---|
| 275 | (const G4Track& theTrack, const G4Step& theStep) |
---|
| 276 | {return DecayIt(theTrack, theStep);} |
---|
| 277 | |
---|
| 278 | }; |
---|
| 279 | #endif |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | |
---|