source: trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc @ 1316

Last change on this file since 1316 was 1315, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 15.0 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// $Id: G4BetheBlochModel.cc,v 1.37 2010/05/27 10:25:59 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class header file
32//
33//
34// File name:     G4BetheBlochModel
35//
36// Author:        Vladimir Ivanchenko on base of Laszlo Urban code
37//
38// Creation date: 03.01.2002
39//
40// Modifications:
41//
42// 04-12-02 Fix problem of G4DynamicParticle constructor (V.Ivanchenko)
43// 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
44// 27-01-03 Make models region aware (V.Ivanchenko)
45// 13-02-03 Add name (V.Ivanchenko)
46// 24-03-05 Add G4EmCorrections (V.Ivanchenko)
47// 11-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
48// 11-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
49// 12-02-06 move G4LossTableManager::Instance()->EmCorrections()
50//          in constructor (mma)
51// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
52//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
53//
54// -------------------------------------------------------------------
55//
56
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
61#include "G4BetheBlochModel.hh"
62#include "Randomize.hh"
63#include "G4Electron.hh"
64#include "G4LossTableManager.hh"
65#include "G4EmCorrections.hh"
66#include "G4ParticleChangeForLoss.hh"
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70using namespace std;
71
72G4BetheBlochModel::G4BetheBlochModel(const G4ParticleDefinition* p, 
73                                     const G4String& nam)
74  : G4VEmModel(nam),
75    particle(0),
76    tlimit(DBL_MAX),
77    twoln10(2.0*log(10.0)),
78    bg2lim(0.0169),
79    taulim(8.4146e-3),
80    isIon(false),
81    isInitialised(false)
82{
83  fParticleChange = 0;
84  if(p) {
85    SetGenericIon(p);
86    SetParticle(p);
87  }
88  theElectron = G4Electron::Electron();
89  corr = G4LossTableManager::Instance()->EmCorrections(); 
90  nist = G4NistManager::Instance();
91  SetLowEnergyLimit(2.0*MeV);
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
96G4BetheBlochModel::~G4BetheBlochModel()
97{}
98
99//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100
101G4double G4BetheBlochModel::MinEnergyCut(const G4ParticleDefinition*,
102                                         const G4MaterialCutsCouple* couple)
103{
104  return couple->GetMaterial()->GetIonisation()->GetMeanExcitationEnergy();
105}
106
107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108
109void G4BetheBlochModel::Initialise(const G4ParticleDefinition* p,
110                                   const G4DataVector&)
111{
112  SetGenericIon(p);
113  SetParticle(p);
114
115  //G4cout << "G4BetheBlochModel::Initialise for " << p->GetParticleName()
116  //     << "  isIon= " << isIon
117  //     << G4endl;
118
119  corrFactor = chargeSquare;
120  // always false before the run
121  SetDeexcitationFlag(false);
122
123  if(!isInitialised) {
124    isInitialised = true;
125    fParticleChange = GetParticleChangeForLoss();
126  }
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130
131G4double G4BetheBlochModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
132                                                 const G4Material* mat,
133                                                 G4double kineticEnergy)
134{
135  // this method is called only for ions
136  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy);
137  corrFactor = q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy);
138  return corrFactor;
139}
140
141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
142
143G4double G4BetheBlochModel::GetParticleCharge(const G4ParticleDefinition* p,
144                                              const G4Material* mat,
145                                              G4double kineticEnergy)
146{
147  // this method is called only for ions, so no check if it is an ion
148  return corr->GetParticleCharge(p,mat,kineticEnergy);
149}
150
151//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
152
153void G4BetheBlochModel::SetupParameters()
154{
155  mass = particle->GetPDGMass();
156  spin = particle->GetPDGSpin();
157  G4double q = particle->GetPDGCharge()/eplus;
158  chargeSquare = q*q;
159  ratio = electron_mass_c2/mass;
160  G4double magmom = 
161    particle->GetPDGMagneticMoment()*mass/(0.5*eplus*hbar_Planck*c_squared);
162  magMoment2 = magmom*magmom - 1.0;
163  formfact = 0.0;
164  if(particle->GetLeptonNumber() == 0) {
165    G4double x = 0.8426*GeV;
166    if(spin == 0.0 && mass < GeV) {x = 0.736*GeV;}
167    else if(mass > GeV) {
168      x /= nist->GetZ13(mass/proton_mass_c2);
169      //        tlimit = 51.2*GeV*A13[iz]*A13[iz];
170    }
171    formfact = 2.0*electron_mass_c2/(x*x);
172    tlimit   = 2.0/formfact;
173  }
174}
175
176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177
178G4double
179G4BetheBlochModel::ComputeCrossSectionPerElectron(const G4ParticleDefinition* p,
180                                                  G4double kineticEnergy,
181                                                  G4double cutEnergy,
182                                                  G4double maxKinEnergy)       
183{
184  G4double cross = 0.0;
185  G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
186  G4double maxEnergy = min(tmax,maxKinEnergy);
187  if(cutEnergy < maxEnergy) {
188
189    G4double totEnergy = kineticEnergy + mass;
190    G4double energy2   = totEnergy*totEnergy;
191    G4double beta2     = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
192
193    cross = 1.0/cutEnergy - 1.0/maxEnergy
194      - beta2*log(maxEnergy/cutEnergy)/tmax;
195
196    // +term for spin=1/2 particle
197    if( 0.5 == spin ) { cross += 0.5*(maxEnergy - cutEnergy)/energy2; }
198
199    // High order correction different for hadrons and ions
200    // nevetheless they are applied to reduce high energy transfers
201    //    if(!isIon)
202    //cross += corr->FiniteSizeCorrectionXS(p,currentMaterial,
203    //                                    kineticEnergy,cutEnergy);
204
205    cross *= twopi_mc2_rcl2*chargeSquare/beta2;
206  }
207 
208   // G4cout << "BB: e= " << kineticEnergy << " tmin= " << cutEnergy
209   //        << " tmax= " << tmax << " cross= " << cross << G4endl;
210 
211  return cross;
212}
213
214//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
215
216G4double G4BetheBlochModel::ComputeCrossSectionPerAtom(
217                                           const G4ParticleDefinition* p,
218                                                 G4double kineticEnergy,
219                                                 G4double Z, G4double,
220                                                 G4double cutEnergy,
221                                                 G4double maxEnergy)
222{
223  G4double cross = Z*ComputeCrossSectionPerElectron
224                                         (p,kineticEnergy,cutEnergy,maxEnergy);
225  return cross;
226}
227
228//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229
230G4double G4BetheBlochModel::CrossSectionPerVolume(
231                                           const G4Material* material,
232                                           const G4ParticleDefinition* p,
233                                                 G4double kineticEnergy,
234                                                 G4double cutEnergy,
235                                                 G4double maxEnergy)
236{
237  currentMaterial   = material;
238  G4double eDensity = material->GetElectronDensity();
239  G4double cross = eDensity*ComputeCrossSectionPerElectron
240                                         (p,kineticEnergy,cutEnergy,maxEnergy);
241  return cross;
242}
243
244//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245
246G4double G4BetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
247                                                 const G4ParticleDefinition* p,
248                                                 G4double kineticEnergy,
249                                                 G4double cut)
250{
251  G4double tmax      = MaxSecondaryEnergy(p, kineticEnergy);
252  G4double cutEnergy = std::min(cut,tmax);
253
254  G4double tau   = kineticEnergy/mass;
255  G4double gam   = tau + 1.0;
256  G4double bg2   = tau * (tau+2.0);
257  G4double beta2 = bg2/(gam*gam);
258
259  G4double eexc  = material->GetIonisation()->GetMeanExcitationEnergy();
260  G4double eexc2 = eexc*eexc;
261
262  G4double eDensity = material->GetElectronDensity();
263
264  G4double dedx = log(2.0*electron_mass_c2*bg2*cutEnergy/eexc2)
265                - (1.0 + cutEnergy/tmax)*beta2;
266
267  if(0.5 == spin) {
268    G4double del = 0.5*cutEnergy/(kineticEnergy + mass);
269    dedx += del*del;
270  }
271
272  // density correction
273  G4double x = log(bg2)/twoln10;
274  dedx -= material->GetIonisation()->DensityCorrection(x);
275
276  // shell correction
277  dedx -= 2.0*corr->ShellCorrection(p,material,kineticEnergy);
278
279  // now compute the total ionization loss
280
281  if (dedx < 0.0) dedx = 0.0 ;
282
283  dedx *= twopi_mc2_rcl2*chargeSquare*eDensity/beta2;
284
285  //High order correction different for hadrons and ions
286  if(isIon) {
287    dedx += corr->IonBarkasCorrection(p,material,kineticEnergy);
288  } else {     
289    dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
290  }
291  return dedx;
292}
293
294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
295
296void G4BetheBlochModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
297                                             const G4DynamicParticle* dp,
298                                             G4double& eloss,
299                                             G4double&,
300                                             G4double length)
301{
302  if(isIon) {
303    const G4ParticleDefinition* p = dp->GetDefinition();
304    const G4Material* mat = couple->GetMaterial();
305    G4double preKinEnergy = dp->GetKineticEnergy();
306    G4double e = preKinEnergy - eloss*0.5;
307    if(e < 0.0) e = preKinEnergy*0.5;
308
309    G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,e);
310    GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
311    G4double qfactor = q2*corr->EffectiveChargeCorrection(p,mat,e)/corrFactor;
312    G4double highOrder = length*corr->IonHighOrderCorrections(p,couple,e);
313    eloss *= qfactor; 
314    eloss += highOrder;
315    //G4cout << "G4BetheBlochModel::CorrectionsAlongStep: e= " << preKinEnergy
316    //     << " qfactor= " << qfactor
317    //     << " highOrder= " << highOrder << " (" << highOrder/eloss << ")" << G4endl;   
318  }
319}
320
321//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
322
323void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
324                                          const G4MaterialCutsCouple*,
325                                          const G4DynamicParticle* dp,
326                                          G4double minKinEnergy,
327                                          G4double maxEnergy)
328{
329  G4double kineticEnergy = dp->GetKineticEnergy();
330  G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
331
332  G4double maxKinEnergy = std::min(maxEnergy,tmax);
333  if(minKinEnergy >= maxKinEnergy) return;
334
335  G4double totEnergy     = kineticEnergy + mass;
336  G4double etot2         = totEnergy*totEnergy;
337  G4double beta2         = kineticEnergy*(kineticEnergy + 2.0*mass)/etot2;
338
339  G4double deltaKinEnergy, f; 
340  G4double f1 = 0.0;
341  G4double fmax = 1.0;
342  if( 0.5 == spin ) fmax += 0.5*maxKinEnergy*maxKinEnergy/etot2; 
343
344  // sampling without nuclear size effect
345  do {
346    G4double q = G4UniformRand();
347    deltaKinEnergy = minKinEnergy*maxKinEnergy
348                    /(minKinEnergy*(1.0 - q) + maxKinEnergy*q);
349
350    f = 1.0 - beta2*deltaKinEnergy/tmax;
351    if( 0.5 == spin ) {
352      f1 = 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
353      f += f1;
354    }
355
356  } while( fmax*G4UniformRand() > f);
357
358  // projectile formfactor - suppresion of high energy
359  // delta-electron production at high energy
360 
361  G4double x = formfact*deltaKinEnergy;
362  if(x > 1.e-6) {
363
364    G4double x1 = 1.0 + x;
365    G4double g  = 1.0/(x1*x1);
366    if( 0.5 == spin ) {
367      G4double x2 = 0.5*electron_mass_c2*deltaKinEnergy/(mass*mass);
368      g *= (1.0 + magMoment2*(x2 - f1/f)/(1.0 + x2));
369    }
370    if(g > 1.0) {
371      G4cout << "### G4BetheBlochModel WARNING: g= " << g
372             << dp->GetDefinition()->GetParticleName()
373             << " Ekin(MeV)= " <<  kineticEnergy
374             << " delEkin(MeV)= " << deltaKinEnergy
375             << G4endl;
376    }
377    if(G4UniformRand() > g) return;
378  }
379
380  // delta-electron is produced
381  G4double totMomentum = totEnergy*sqrt(beta2);
382  G4double deltaMomentum =
383           sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
384  G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
385                                   (deltaMomentum * totMomentum);
386  /*
387  if(cost > 1.0) {
388    G4cout << "### G4BetheBlochModel WARNING: cost= "
389           << cost << " > 1 for "
390           << dp->GetDefinition()->GetParticleName()
391           << " Ekin(MeV)= " <<  kineticEnergy
392           << " p(MeV/c)= " <<  totMomentum
393           << " delEkin(MeV)= " << deltaKinEnergy
394           << " delMom(MeV/c)= " << deltaMomentum
395           << " tmin(MeV)= " << minKinEnergy
396           << " tmax(MeV)= " << maxKinEnergy
397           << " dir= " << dp->GetMomentumDirection()
398           << G4endl;
399    cost = 1.0;
400  }
401  */
402  G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
403
404  G4double phi = twopi * G4UniformRand() ;
405
406
407  G4ThreeVector deltaDirection(sint*cos(phi),sint*sin(phi), cost);
408  G4ThreeVector direction = dp->GetMomentumDirection();
409  deltaDirection.rotateUz(direction);
410
411  // create G4DynamicParticle object for delta ray
412  G4DynamicParticle* delta = new G4DynamicParticle(theElectron,
413                                                   deltaDirection,deltaKinEnergy);
414
415  vdp->push_back(delta);
416
417  // Change kinematics of primary particle
418  kineticEnergy       -= deltaKinEnergy;
419  G4ThreeVector finalP = direction*totMomentum - deltaDirection*deltaMomentum;
420  finalP               = finalP.unit();
421 
422  fParticleChange->SetProposedKineticEnergy(kineticEnergy);
423  fParticleChange->SetProposedMomentumDirection(finalP);
424}
425
426//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
427
428G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
429                                               G4double kinEnergy) 
430{
431  // here particle type is checked for any method
432  SetParticle(pd);
433  G4double tau  = kinEnergy/mass;
434  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
435                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
436  return std::min(tmax,tlimit);
437}
438
439//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.