source: trunk/source/processes/electromagnetic/standard/src/G4ionGasIonisation.cc @ 846

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

import all except CVS

File size: 5.9 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: G4ionGasIonisation.cc,v 1.4 2008/01/14 11:59:45 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-01-patch-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4ionGasIonisation
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 23.07.2007
39//
40// Modifications:
41//
42//
43// -------------------------------------------------------------------
44//
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
48#include "G4ionGasIonisation.hh"
49#include "G4Electron.hh"
50#include "G4Proton.hh"
51#include "G4GenericIon.hh"
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54
55using namespace std;
56
57G4ionGasIonisation::G4ionGasIonisation(const G4String& name)
58  : G4ionIonisation(name),
59    currParticle(0),
60    baseParticle(0),
61    initialised(false)
62{
63  atomXS = CLHEP::pi*CLHEP::Bohr_radius*CLHEP::Bohr_radius;
64  verboseLevel = 1;
65}
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68
69G4ionGasIonisation::~G4ionGasIonisation()
70{}
71
72//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73
74void G4ionGasIonisation::InitialiseEnergyLossProcess(
75                      const G4ParticleDefinition* part,
76                      const G4ParticleDefinition* bpart)
77{
78  G4ionIonisation::InitialiseEnergyLossProcess(part, bpart);
79  if(initialised) return;
80
81  currParticle = part;
82
83  if(part == bpart || part == G4GenericIon::GenericIon()) baseParticle = 0;
84  else if(bpart == 0) baseParticle = G4GenericIon::GenericIon();
85  else                baseParticle = bpart;
86
87  if(baseParticle) basePartMass = baseParticle->GetPDGMass();
88  else             basePartMass = currParticle->GetPDGMass();
89 
90  initialised = true;
91}
92
93//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
94
95void G4ionGasIonisation::PrintInfo()
96{
97  G4ionIonisation::PrintInfo();
98  G4cout << "      Version of ion process with simulation discrete ion/media change exchange."
99         << G4endl;     
100}
101
102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
103
104void G4ionGasIonisation::InitialiseMassCharge(const G4Track& track)
105{
106  // First step of an ion
107  if(track.GetCurrentStepNumber() == 1) {
108    currParticle = track.GetDefinition();
109    ionZ = G4int(currParticle->GetPDGCharge()/eplus + 0.5);
110    currentIonZ = G4int(track.GetDynamicParticle()->GetCharge()/eplus + 0.5);
111    currMassRatio = basePartMass/currParticle->GetPDGMass();
112  }
113  // any step
114  G4double q = eplus*currentIonZ;
115  SetDynamicMassCharge(currMassRatio, q*q);
116  preStepKinEnergy = track.GetKineticEnergy();
117}
118
119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
120
121void G4ionGasIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
122                                              const G4DynamicParticle* dp,
123                                              G4double& eloss,
124                                              G4double& s)
125{
126  const G4ParticleDefinition* part = dp->GetDefinition();
127  const G4Material* mat = couple->GetMaterial();
128  // add corrections
129  if(eloss < preStepKinEnergy) {
130
131    // use Bethe-Bloch with corrections
132    if(preStepKinEnergy*currMassRatio > BetheBlochEnergyThreshold())
133      eloss += s*corr->HighOrderCorrections(part,mat,preStepKinEnergy);
134
135    // effective number of collisions
136    G4double x = mat->GetElectronDensity()*s*atomXS;
137    // equilibrium charge
138    G4double q = fParticleChange.GetProposedCharge(); 
139 
140    // sample charge change during the step
141    fParticleChange.SetProposedCharge(SampleChargeAfterStep(q, x));
142  }
143
144  // use nuclear stopping
145  if(NuclearStoppingFlag()) {
146    G4double nloss = s*corr->NuclearDEDX(part,mat,preStepKinEnergy - eloss*0.5);
147    eloss += nloss;
148    fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
149  }
150}
151
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153
154G4double G4ionGasIonisation::SampleChargeAfterStep(G4double qeff, G4double xeff)
155{
156  // qeff - equilibrium charge
157  // xeff - effective number of collisions
158  // q    - current charge
159  G4double q = eplus*currentIonZ;
160  if(verboseLevel > 1) G4cout << "G4ionGasIonisation: Q1= " << currentIonZ
161                              << " Qeff= " << qeff/eplus << "  Neff= " << xeff
162                              << G4endl;
163  return q;
164}
165
166//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.