source: trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4DiscreteGammaTransition.cc @ 819

Last change on this file since 819 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 7.7 KB
Line 
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:
39//        09 Sep. 2002, Fan Lei  (flei@space.qinetiq.com)
40//              Added renormalization to determine whether transition leads to
41//              electron or gamma in SelectGamma()
42//
43//        21 Nov. 2001, Fan Lei (flei@space.qinetiq.com)
44//              i) added G4int _nucleusZ initialise it through the constructor
45//              ii) modified SelectGamma() to allow the generation of conversion electrons     
46//              iii) added #include G4AtomicShells.hh
47//     
48//        15 April 1999, Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it)
49//              Added creation time evaluation for products of evaporation
50//     
51// -------------------------------------------------------------------
52
53#include "G4DiscreteGammaTransition.hh"
54#include "Randomize.hh"
55#include "G4RandGeneralTmp.hh"
56#include "G4AtomicShells.hh"
57
58G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level): 
59  _gammaEnergy(0.), _level(level), _excitation(0.), _gammaCreationTime(0.)
60{ }
61
62G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level, G4int Z): 
63  _nucleusZ(Z), _orbitE(-1), _bondE(0.), _aGamma(true), _icm(false), _gammaEnergy(0.), 
64  _level(level), _excitation(0.),  _gammaCreationTime(0.)
65{
66  _verbose = 0;
67}
68
69
70G4DiscreteGammaTransition::~G4DiscreteGammaTransition() 
71{ }
72
73
74void G4DiscreteGammaTransition::SelectGamma()
75{
76
77  _gammaEnergy = 0.;
78
79  G4int nGammas = _level.NumberOfGammas();
80  if (nGammas > 0)
81    {
82      G4double random = G4UniformRand();
83
84      G4int iGamma = 0;
85      for(iGamma=0;iGamma < nGammas;iGamma++)
86        {
87          if(random <= (_level.GammaCumulativeProbabilities())[iGamma])
88            break;
89        }
90
91
92      // Small correction due to the fact that there are mismatches between
93      // nominal level energies and emitted gamma energies
94
95      G4double eCorrection = _level.Energy() - _excitation;
96
97      _gammaEnergy = (_level.GammaEnergies())[iGamma] - eCorrection;
98
99      //  Warning: the following check is needed to avoid loops:
100      //  Due essentially to missing nuclear levels in data files, it is
101      //  possible that _gammaEnergy is so low as the nucleus doesn't change
102      //  its level after the transition.
103      //  When such case is found, force the full deexcitation of the nucleus.
104      //
105      //    NOTE: you should force the transition to the next lower level,
106      //          but this change needs a more complex revision of actual design.
107      //          I leave this for a later revision.
108
109      if (_gammaEnergy < _level.Energy()*10e-5) _gammaEnergy = _excitation;
110      // now decide whether Internal Coversion electron should be emitted instead
111      if (_icm) {
112        random = G4UniformRand() ;
113        if ( random <= (_level.TotalConvertionProbabilities())[iGamma]
114             *(_level.GammaWeights())[iGamma]
115             /((_level.TotalConvertionProbabilities())[iGamma]*(_level.GammaWeights())[iGamma]
116               +(_level.GammaWeights())[iGamma])) 
117          {
118            G4int iShell = 9;
119            random = G4UniformRand() ;
120            if ( random <= (_level.KConvertionProbabilities())[iGamma]) 
121              { iShell = 0;}
122            else if ( random <= (_level.L1ConvertionProbabilities())[iGamma]) 
123              { iShell = 1;}
124            else if ( random <= (_level.L2ConvertionProbabilities())[iGamma]) 
125              { iShell = 2;}
126            else if ( random <= (_level.L3ConvertionProbabilities())[iGamma]) 
127              { iShell = 3;}   
128            else if ( random <= (_level.M1ConvertionProbabilities())[iGamma]) 
129              { iShell = 4;}
130            else if ( random <= (_level.M2ConvertionProbabilities())[iGamma]) 
131              { iShell = 5;}
132            else if ( random <= (_level.M3ConvertionProbabilities())[iGamma]) 
133              { iShell = 6;}
134            else if ( random <= (_level.M4ConvertionProbabilities())[iGamma]) 
135              { iShell = 7;}
136            else if ( random <= (_level.M5ConvertionProbabilities())[iGamma]) 
137              { iShell = 8;}
138            // the following is needed to match the ishell to that used in  G4AtomicShells
139            if ( iShell == 9) {
140              if ( (_nucleusZ < 28) && (_nucleusZ > 20)) {
141                iShell--;
142              } else if ( _nucleusZ == 20 || _nucleusZ == 19 ) {
143                iShell = iShell -2;
144              }
145            }
146            if (_verbose > 0)
147              G4cout << "G4DiscreteGammaTransition: _nucleusZ = " <<_nucleusZ
148                     << " , iShell = " << iShell 
149                     << " , Shell binding energy = " << G4AtomicShells::GetBindingEnergy(_nucleusZ, iShell) / keV
150                     << " keV " << G4endl;
151            _bondE = G4AtomicShells::GetBindingEnergy(_nucleusZ, iShell);
152            _gammaEnergy = _gammaEnergy - _bondE;
153            _orbitE = iShell;     
154            _aGamma = false ;   // emitted is not a gamma now
155          }
156      }
157   
158      G4double tau = _level.HalfLife() / std::log(2.0);
159
160      G4double tMin = 0;
161      G4double tMax = 10.0 * tau;
162      //  Original code, not very efficent
163      //  G4int nBins = 200;
164      //G4double sampleArray[200];
165
166      //  for(G4int i = 0;i<nBins;i++)
167      //{
168      //  G4double t = tMin + ((tMax-tMin)/nBins)*i;
169      //  sampleArray[i] = (std::exp(-t/tau))/tau;
170      // }
171
172      //  G4RandGeneralTmp randGeneral(sampleArray, nBins);
173      //G4double random = randGeneral.shoot();
174 
175      //_gammaCreationTime = tMin + (tMax - tMin) * random;
176
177      // new code by Fan Lei
178      //
179      if (tau != 0 ) 
180      {
181          random = G4UniformRand() ;
182          _gammaCreationTime = -(std::log(random*(std::exp(-tMax/tau) - std::exp(-tMin/tau)) + 
183                                        std::exp(-tMin/tau)));
184          //  if(_verbose > 10)
185          //    G4cout << "*---*---* G4DiscreteTransition: _gammaCreationTime = "
186          //       << _gammaCreationTime/second << G4endl;
187       } else { _gammaCreationTime=0.; }
188    }
189  return;
190}
191
192
193//G4bool G4DiscreteGammaTransition::IsAGamma()
194//{
195//  return _aGamma;
196//}
197
198
199G4double G4DiscreteGammaTransition::GetGammaEnergy()
200{
201  return _gammaEnergy;
202}
203
204G4double G4DiscreteGammaTransition::GetGammaCreationTime()
205{
206  return _gammaCreationTime;
207}
208
209void G4DiscreteGammaTransition::SetEnergyFrom(const G4double energy)
210{
211  _excitation = energy;
212  return;
213}
214
215
216
217
218
219
Note: See TracBrowser for help on using the repository browser.