[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 | // |
---|
| 27 | // ------------------------------------------------------------------- |
---|
| 28 | // GEANT 4 class file |
---|
| 29 | // |
---|
| 30 | // CERN, Geneva, Switzerland |
---|
| 31 | // |
---|
| 32 | // File name: G4DiscreteGammaTransition |
---|
| 33 | // |
---|
| 34 | // Author: Maria Grazia Pia (pia@genova.infn.it) |
---|
| 35 | // |
---|
| 36 | // Creation date: 23 October 1998 |
---|
| 37 | // |
---|
| 38 | // Modifications: |
---|
[1315] | 39 | // 15 April 1999, Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it) |
---|
| 40 | // Added creation time evaluation for products of evaporation |
---|
[819] | 41 | // |
---|
| 42 | // 21 Nov. 2001, Fan Lei (flei@space.qinetiq.com) |
---|
| 43 | // i) added G4int _nucleusZ initialise it through the constructor |
---|
[1315] | 44 | // ii) modified SelectGamma() to allow the generation of conversion electrons |
---|
[819] | 45 | // iii) added #include G4AtomicShells.hh |
---|
| 46 | // |
---|
[1315] | 47 | // 09 Sep. 2002, Fan Lei (flei@space.qinetiq.com) |
---|
| 48 | // Added renormalization to determine whether transition leads to |
---|
| 49 | // electron or gamma in SelectGamma() |
---|
| 50 | // |
---|
| 51 | // 19 April 2010, J. M. Quesada. |
---|
| 52 | // Corrections added for taking into account mismatch between tabulated |
---|
| 53 | // gamma energies and level energy differences (fake photons eliminated) |
---|
| 54 | // |
---|
| 55 | // 9 May 2010, V.Ivanchenko |
---|
| 56 | // Removed unphysical corretions of gamma energy; fixed default particle |
---|
| 57 | // as gamma; do not subtract bounding energy in case of electron emmision |
---|
[819] | 58 | // |
---|
| 59 | // ------------------------------------------------------------------- |
---|
| 60 | |
---|
| 61 | #include "G4DiscreteGammaTransition.hh" |
---|
| 62 | #include "Randomize.hh" |
---|
| 63 | #include "G4RandGeneralTmp.hh" |
---|
| 64 | #include "G4AtomicShells.hh" |
---|
[1315] | 65 | //JMQ: |
---|
| 66 | #include "G4NuclearLevelStore.hh" |
---|
| 67 | #include "G4Pow.hh" |
---|
[819] | 68 | |
---|
| 69 | G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level): |
---|
| 70 | _gammaEnergy(0.), _level(level), _excitation(0.), _gammaCreationTime(0.) |
---|
| 71 | { } |
---|
| 72 | |
---|
[1315] | 73 | //JMQ: now A is also needed in the constructor |
---|
| 74 | //G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level, G4int Z): |
---|
| 75 | G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level, G4int Z, G4int A): |
---|
[819] | 76 | _nucleusZ(Z), _orbitE(-1), _bondE(0.), _aGamma(true), _icm(false), _gammaEnergy(0.), |
---|
[1315] | 77 | _level(level), _excitation(0.), _gammaCreationTime(0.),_A(A),_Z(Z) |
---|
[819] | 78 | { |
---|
| 79 | _verbose = 0; |
---|
[1315] | 80 | //JMQ: added tolerence in the mismatch |
---|
| 81 | _tolerance = CLHEP::keV; |
---|
[819] | 82 | } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | G4DiscreteGammaTransition::~G4DiscreteGammaTransition() |
---|
| 86 | { } |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | void G4DiscreteGammaTransition::SelectGamma() |
---|
| 90 | { |
---|
[1315] | 91 | // default gamma |
---|
| 92 | _aGamma = true; |
---|
[819] | 93 | _gammaEnergy = 0.; |
---|
[1315] | 94 | |
---|
[819] | 95 | G4int nGammas = _level.NumberOfGammas(); |
---|
| 96 | if (nGammas > 0) |
---|
| 97 | { |
---|
| 98 | G4double random = G4UniformRand(); |
---|
[1315] | 99 | |
---|
| 100 | G4int iGamma; |
---|
| 101 | for(iGamma=0; iGamma<nGammas; ++iGamma) |
---|
[819] | 102 | { |
---|
| 103 | if(random <= (_level.GammaCumulativeProbabilities())[iGamma]) |
---|
[1315] | 104 | { break; } |
---|
[819] | 105 | } |
---|
[1315] | 106 | |
---|
[819] | 107 | // Small correction due to the fact that there are mismatches between |
---|
| 108 | // nominal level energies and emitted gamma energies |
---|
[1315] | 109 | |
---|
| 110 | // 09.05.2010 VI : it is an error ? |
---|
| 111 | G4double eCorrection = _level.Energy() - _excitation; |
---|
[819] | 112 | _gammaEnergy = (_level.GammaEnergies())[iGamma] - eCorrection; |
---|
[1315] | 113 | |
---|
| 114 | //JMQ: |
---|
| 115 | //1)If chosen gamma energy is close enough to excitation energy, the later |
---|
| 116 | // is used instead for gamma dacey to gs (it guarantees energy conservation) |
---|
| 117 | //2)For energy conservation, level energy differences instead of tabulated |
---|
| 118 | // gamma energies must be used (origin of final fake photons) |
---|
| 119 | |
---|
| 120 | if(_excitation - _gammaEnergy < _tolerance) |
---|
| 121 | { |
---|
| 122 | _gammaEnergy =_excitation; |
---|
| 123 | } |
---|
| 124 | else |
---|
| 125 | { |
---|
| 126 | _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(_Z,_A); |
---|
| 127 | _gammaEnergy = _excitation - |
---|
| 128 | _levelManager->NearestLevel(_excitation - _gammaEnergy)->Energy(); |
---|
| 129 | } |
---|
| 130 | |
---|
[819] | 131 | // Warning: the following check is needed to avoid loops: |
---|
| 132 | // Due essentially to missing nuclear levels in data files, it is |
---|
| 133 | // possible that _gammaEnergy is so low as the nucleus doesn't change |
---|
| 134 | // its level after the transition. |
---|
| 135 | // When such case is found, force the full deexcitation of the nucleus. |
---|
| 136 | // |
---|
| 137 | // NOTE: you should force the transition to the next lower level, |
---|
| 138 | // but this change needs a more complex revision of actual design. |
---|
| 139 | // I leave this for a later revision. |
---|
[1315] | 140 | |
---|
| 141 | if (_gammaEnergy < _level.Energy()*10.e-5) _gammaEnergy = _excitation; |
---|
[819] | 142 | |
---|
[1315] | 143 | //G4cout << "G4DiscreteGammaTransition::SelectGamma: " << _gammaEnergy |
---|
| 144 | // << " _icm: " << _icm << G4endl; |
---|
| 145 | |
---|
[819] | 146 | // now decide whether Internal Coversion electron should be emitted instead |
---|
| 147 | if (_icm) { |
---|
| 148 | random = G4UniformRand() ; |
---|
| 149 | if ( random <= (_level.TotalConvertionProbabilities())[iGamma] |
---|
| 150 | *(_level.GammaWeights())[iGamma] |
---|
| 151 | /((_level.TotalConvertionProbabilities())[iGamma]*(_level.GammaWeights())[iGamma] |
---|
| 152 | +(_level.GammaWeights())[iGamma])) |
---|
| 153 | { |
---|
| 154 | G4int iShell = 9; |
---|
| 155 | random = G4UniformRand() ; |
---|
| 156 | if ( random <= (_level.KConvertionProbabilities())[iGamma]) |
---|
| 157 | { iShell = 0;} |
---|
| 158 | else if ( random <= (_level.L1ConvertionProbabilities())[iGamma]) |
---|
| 159 | { iShell = 1;} |
---|
| 160 | else if ( random <= (_level.L2ConvertionProbabilities())[iGamma]) |
---|
| 161 | { iShell = 2;} |
---|
| 162 | else if ( random <= (_level.L3ConvertionProbabilities())[iGamma]) |
---|
| 163 | { iShell = 3;} |
---|
| 164 | else if ( random <= (_level.M1ConvertionProbabilities())[iGamma]) |
---|
| 165 | { iShell = 4;} |
---|
| 166 | else if ( random <= (_level.M2ConvertionProbabilities())[iGamma]) |
---|
| 167 | { iShell = 5;} |
---|
| 168 | else if ( random <= (_level.M3ConvertionProbabilities())[iGamma]) |
---|
| 169 | { iShell = 6;} |
---|
| 170 | else if ( random <= (_level.M4ConvertionProbabilities())[iGamma]) |
---|
| 171 | { iShell = 7;} |
---|
| 172 | else if ( random <= (_level.M5ConvertionProbabilities())[iGamma]) |
---|
| 173 | { iShell = 8;} |
---|
| 174 | // the following is needed to match the ishell to that used in G4AtomicShells |
---|
| 175 | if ( iShell == 9) { |
---|
| 176 | if ( (_nucleusZ < 28) && (_nucleusZ > 20)) { |
---|
| 177 | iShell--; |
---|
| 178 | } else if ( _nucleusZ == 20 || _nucleusZ == 19 ) { |
---|
| 179 | iShell = iShell -2; |
---|
| 180 | } |
---|
| 181 | } |
---|
[1315] | 182 | _bondE = G4AtomicShells::GetBindingEnergy(_nucleusZ, iShell); |
---|
| 183 | if (_verbose > 0) { |
---|
[819] | 184 | G4cout << "G4DiscreteGammaTransition: _nucleusZ = " <<_nucleusZ |
---|
| 185 | << " , iShell = " << iShell |
---|
[1315] | 186 | << " , Shell binding energy = " << _bondE/keV |
---|
[819] | 187 | << " keV " << G4endl; |
---|
[1315] | 188 | } |
---|
| 189 | |
---|
| 190 | // 09.05.2010 VI : it is an error - cannot subtract bond energy from |
---|
| 191 | // transition energy here |
---|
| 192 | //_gammaEnergy = _gammaEnergy - _bondE; |
---|
| 193 | //G4cout << "_gammaEnergy = " << _gammaEnergy << G4endl; |
---|
| 194 | |
---|
[819] | 195 | _orbitE = iShell; |
---|
| 196 | _aGamma = false ; // emitted is not a gamma now |
---|
| 197 | } |
---|
| 198 | } |
---|
[1315] | 199 | |
---|
| 200 | G4double tau = _level.HalfLife() / G4Pow::GetInstance()->logZ(2); |
---|
[819] | 201 | |
---|
[1315] | 202 | //09.05.2010 VI rewrite samling of decay time |
---|
| 203 | // assuming ordinary exponential low |
---|
| 204 | _gammaCreationTime = 0.; |
---|
[1337] | 205 | if(tau > 0.0) { _gammaCreationTime = -tau*std::log(G4UniformRand()); } |
---|
[1315] | 206 | |
---|
| 207 | //G4double tMin = 0; |
---|
| 208 | //G4double tMax = 10.0 * tau; |
---|
[819] | 209 | // Original code, not very efficent |
---|
| 210 | // G4int nBins = 200; |
---|
| 211 | //G4double sampleArray[200]; |
---|
| 212 | |
---|
| 213 | // for(G4int i = 0;i<nBins;i++) |
---|
| 214 | //{ |
---|
| 215 | // G4double t = tMin + ((tMax-tMin)/nBins)*i; |
---|
| 216 | // sampleArray[i] = (std::exp(-t/tau))/tau; |
---|
| 217 | // } |
---|
| 218 | |
---|
| 219 | // G4RandGeneralTmp randGeneral(sampleArray, nBins); |
---|
| 220 | //G4double random = randGeneral.shoot(); |
---|
[1315] | 221 | |
---|
[819] | 222 | //_gammaCreationTime = tMin + (tMax - tMin) * random; |
---|
| 223 | |
---|
| 224 | // new code by Fan Lei |
---|
| 225 | // |
---|
[1315] | 226 | /* |
---|
[819] | 227 | if (tau != 0 ) |
---|
| 228 | { |
---|
| 229 | random = G4UniformRand() ; |
---|
| 230 | _gammaCreationTime = -(std::log(random*(std::exp(-tMax/tau) - std::exp(-tMin/tau)) + |
---|
| 231 | std::exp(-tMin/tau))); |
---|
| 232 | // if(_verbose > 10) |
---|
| 233 | // G4cout << "*---*---* G4DiscreteTransition: _gammaCreationTime = " |
---|
| 234 | // << _gammaCreationTime/second << G4endl; |
---|
| 235 | } else { _gammaCreationTime=0.; } |
---|
[1315] | 236 | */ |
---|
[819] | 237 | } |
---|
| 238 | return; |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | G4double G4DiscreteGammaTransition::GetGammaEnergy() |
---|
| 242 | { |
---|
| 243 | return _gammaEnergy; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | G4double G4DiscreteGammaTransition::GetGammaCreationTime() |
---|
| 247 | { |
---|
| 248 | return _gammaCreationTime; |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | void G4DiscreteGammaTransition::SetEnergyFrom(const G4double energy) |
---|
| 252 | { |
---|
| 253 | _excitation = energy; |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | |
---|
| 260 | |
---|