source: trunk/source/processes/electromagnetic/utils/src/G4ElectronIonPair.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

  • Property svn:executable set to *
File size: 7.4 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: G4ElectronIonPair.cc,v 1.2 2008/10/17 14:46:16 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4ElectronIonPair
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 08.07.2008
39//
40// Modifications:
41//
42// -------------------------------------------------------------
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47#include "G4ElectronIonPair.hh"
48#include "G4Gamma.hh"
49#include "G4Material.hh"
50#include "G4MaterialTable.hh"
51#include "G4StepPoint.hh"
52#include "G4VProcess.hh"
53#include "G4ProcessType.hh"
54#include "G4Track.hh"
55#include "Randomize.hh"
56
57//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58
59G4ElectronIonPair::G4ElectronIonPair()
60{
61  verbose = 1;
62  curMaterial = 0;
63  curMeanEnergy = 0.0;
64  nMaterials = 0;
65  Initialise();
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69
70G4ElectronIonPair::~G4ElectronIonPair()
71{}
72
73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74
75G4double G4ElectronIonPair::MeanNumberOfIonsAlongStep(
76                                   const G4ParticleDefinition* part, 
77                                   const G4Material* material,
78                                   G4double edep,
79                                   G4double niel)
80{
81  G4double nion = 0.0;
82
83  // NIEL does not provide ionisation clusters
84  if(edep > niel) {
85
86    // neutral particles do not produce ionisation along step
87    if(part->GetPDGCharge() != 0.0) {
88
89      // select material
90      if(material != curMaterial) {
91        curMaterial = material;
92        curMeanEnergy = material->GetIonisation()->GetMeanEnergyPerIonPair();
93
94        // if mean energy is not defined then look into G4 DB
95        if(0.0 == curMeanEnergy) {
96          curMeanEnergy = FindG4MeanEnergyPerIonPair(material);
97        } 
98      }
99      if(curMeanEnergy > 0.0) nion = (edep - niel)/curMeanEnergy;
100    }
101  }
102  return nion;
103}
104
105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
106
107std::vector<G4ThreeVector>* 
108G4ElectronIonPair::SampleIonsAlongStep(const G4ThreeVector& prePos,
109                                       const G4ThreeVector& postPos,
110                                       G4double meanion)
111{
112  std::vector<G4ThreeVector>* v = new std::vector<G4ThreeVector>;
113
114  G4double sig = 0.2*std::sqrt(meanion);
115  G4int nion = G4int(G4RandGauss::shoot(meanion,sig) + 0.5);
116
117  // sample ionisation along step
118  if(nion > 0) {
119
120    G4ThreeVector deltaPos = postPos - prePos; 
121    for(G4int i=0; i<nion; i++) {
122      v->push_back( prePos + deltaPos*G4UniformRand() );
123    }
124    if(verbose > 1 ) { 
125      G4cout << "### G4ElectronIonPair::SampleIonisationPoints: "
126             << v->size() << "  ion pairs are added" << G4endl;
127    }
128  }
129  return v;
130}
131
132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
133
134G4int G4ElectronIonPair::ResidualeChargePostStep(const G4ParticleDefinition*,
135                                                 const G4TrackVector*,
136                                                 G4int subType)
137{
138  G4int nholes = 0;
139
140  if(2 == subType || 12 == subType || 13 == subType) nholes = 1;
141  return nholes;
142}
143
144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
145
146G4double G4ElectronIonPair::FindG4MeanEnergyPerIonPair(const G4Material* mat)
147{
148  G4String name = mat->GetName();
149  G4double res  = 0.0;
150
151  // is this material in the vector? 
152  for(G4int j=0; j<nMaterials; j++) {
153    if(name == g4MatNames[j]) {
154      res = g4MatData[j];
155      mat->GetIonisation()->SetMeanEnergyPerIonPair(res);
156      if(verbose > 0) {
157        G4cout << "### G4ElectronIonPair::FindG4MeanEnergyPerIonPair for "
158               << name << " Epair= " << res/eV << " eV is set"
159               << G4endl;
160      }
161      break;
162    }
163  }
164  return res;
165}
166
167//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168
169void G4ElectronIonPair:: DumpMeanEnergyPerIonPair()
170{
171  G4int nmat = G4Material::GetNumberOfMaterials();
172  const G4MaterialTable* mtable = G4Material::GetMaterialTable();
173  if(nmat > 0) {
174    G4cout << "### G4ElectronIonPair: mean energy per ion pair avalable:" << G4endl;
175    for(G4int i=0; i<nmat; i++) {
176      const G4Material* mat = (*mtable)[i];
177      G4double x = mat->GetIonisation()->GetMeanEnergyPerIonPair();
178      if(x > 0.0) {
179        G4cout << "   " << mat->GetName() << "   Epair=  " 
180               << x/eV << " eV" << G4endl;
181      }
182    }
183  }
184}
185
186//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
187
188void G4ElectronIonPair::DumpG4MeanEnergyPerIonPair()
189{
190  if(nMaterials > 0) {
191    G4cout << "### G4ElectronIonPair: mean energy per ion pair "
192           << " for Geant4 materials" << G4endl;
193    for(G4int i=0; i<nMaterials; i++) {
194      G4cout << "   " << g4MatNames[i] << "    Epair= " 
195             << g4MatData[i]/eV << " eV" << G4endl;
196    }
197  }
198}
199
200//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
201
202void G4ElectronIonPair::Initialise()
203{
204  // ICRU Report 31, 1979
205  g4MatNames.push_back("G4_Si");
206  g4MatData.push_back(3.62*eV);
207
208  g4MatNames.push_back("G4_Ge");
209  g4MatData.push_back(2.97*eV);
210
211  g4MatNames.push_back("G4_He");
212  g4MatData.push_back(44.4*eV);
213
214  g4MatNames.push_back("G4_N");
215  g4MatData.push_back(36.4*eV);
216
217  g4MatNames.push_back("G4_O");
218  g4MatData.push_back(32.3*eV);
219
220  g4MatNames.push_back("G4_Ne");
221  g4MatData.push_back(36.8*eV);
222
223  g4MatNames.push_back("G4_Ar");
224  g4MatData.push_back(26.34*eV);
225
226  g4MatNames.push_back("G4_Kr");
227  g4MatData.push_back(24.1*eV);
228
229  g4MatNames.push_back("G4_Xe");
230  g4MatData.push_back(21.6*eV);
231
232  g4MatNames.push_back("G4_lAr");
233  g4MatData.push_back(23.6*eV);
234
235  g4MatNames.push_back("G4_lKr");
236  g4MatData.push_back(20.5*eV);
237
238  g4MatNames.push_back("G4_lXe");
239  g4MatData.push_back(15.6*eV);
240
241  g4MatNames.push_back("G4_AIR");
242  g4MatData.push_back(35.1*eV);
243
244  nMaterials = g4MatData.size();
245}
246
247//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.