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

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

update ti head

  • 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.5 2010/10/25 17:23:01 vnivanch Exp $
27// GEANT4 tag $Name: emutils-V09-03-23 $
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 "G4Material.hh"
49#include "G4MaterialTable.hh"
50#include "G4StepPoint.hh"
51#include "G4VProcess.hh"
52#include "G4ProcessType.hh"
53#include "G4Track.hh"
54#include "Randomize.hh"
55
56//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57
58G4ElectronIonPair::G4ElectronIonPair()
59{
60  verbose = 1;
61  curMaterial = 0;
62  curMeanEnergy = 0.0;
63  nMaterials = 0;
64  FanoFactor = 0.2;
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 G4Step* step)
109{
110  std::vector<G4ThreeVector>* v = 0;
111
112  G4int nion = SampleNumberOfIonsAlongStep(step);
113
114  // sample ionisation along step
115  if(nion > 0) {
116
117    v = new std::vector<G4ThreeVector>;
118    G4ThreeVector prePos = step->GetPreStepPoint()->GetPosition();
119    G4ThreeVector deltaPos = step->GetPostStepPoint()->GetPosition() - prePos; 
120    for(G4int i=0; i<nion; ++i) {
121      v->push_back( prePos + deltaPos*G4UniformRand() );
122    }
123    if(verbose > 1 ) { 
124      G4cout << "### G4ElectronIonPair::SampleIonisationPoints: "
125             << v->size() << "  ion pairs are added" << G4endl;
126    }
127  }
128  return v;
129}
130
131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132
133G4int G4ElectronIonPair::ResidualeChargePostStep(const G4ParticleDefinition*,
134                                                 const G4TrackVector*,
135                                                 G4int subType)
136{
137  G4int nholes = 0;
138
139  if(2 == subType || 12 == subType || 13 == subType) { nholes = 1; }
140  return nholes;
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
144
145G4double G4ElectronIonPair::FindG4MeanEnergyPerIonPair(const G4Material* mat)
146{
147  G4String name = mat->GetName();
148  G4double res  = 0.0;
149
150  // is this material in the vector? 
151  for(G4int j=0; j<nMaterials; j++) {
152    if(name == g4MatNames[j]) {
153      res = g4MatData[j];
154      mat->GetIonisation()->SetMeanEnergyPerIonPair(res);
155      if(verbose > 0) {
156        G4cout << "### G4ElectronIonPair::FindG4MeanEnergyPerIonPair for "
157               << name << " Epair= " << res/eV << " eV is set"
158               << G4endl;
159      }
160      break;
161    }
162  }
163  return res;
164}
165
166//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
167
168void G4ElectronIonPair:: DumpMeanEnergyPerIonPair()
169{
170  G4int nmat = G4Material::GetNumberOfMaterials();
171  const G4MaterialTable* mtable = G4Material::GetMaterialTable();
172  if(nmat > 0) {
173    G4cout << "### G4ElectronIonPair: mean energy per ion pair avalable:" << G4endl;
174    for(G4int i=0; i<nmat; ++i) {
175      const G4Material* mat = (*mtable)[i];
176      G4double x = mat->GetIonisation()->GetMeanEnergyPerIonPair();
177      if(x > 0.0) {
178        G4cout << "   " << mat->GetName() << "   Epair=  " 
179               << x/eV << " eV" << G4endl;
180      }
181    }
182  }
183}
184
185//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
186
187void G4ElectronIonPair::DumpG4MeanEnergyPerIonPair()
188{
189  if(nMaterials > 0) {
190    G4cout << "### G4ElectronIonPair: mean energy per ion pair "
191           << " for Geant4 materials" << G4endl;
192    for(G4int i=0; i<nMaterials; ++i) {
193      G4cout << "   " << g4MatNames[i] << "    Epair= " 
194             << g4MatData[i]/eV << " eV" << G4endl;
195    }
196  }
197}
198
199//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
200
201void G4ElectronIonPair::Initialise()
202{
203  // ICRU Report 31, 1979
204  g4MatNames.push_back("G4_Si");
205  g4MatData.push_back(3.62*eV);
206
207  g4MatNames.push_back("G4_Ge");
208  g4MatData.push_back(2.97*eV);
209
210  g4MatNames.push_back("G4_He");
211  g4MatData.push_back(44.4*eV);
212
213  g4MatNames.push_back("G4_N");
214  g4MatData.push_back(36.4*eV);
215
216  g4MatNames.push_back("G4_O");
217  g4MatData.push_back(32.3*eV);
218
219  g4MatNames.push_back("G4_Ne");
220  g4MatData.push_back(36.8*eV);
221
222  g4MatNames.push_back("G4_Ar");
223  g4MatData.push_back(26.34*eV);
224
225  g4MatNames.push_back("G4_Kr");
226  g4MatData.push_back(24.1*eV);
227
228  g4MatNames.push_back("G4_Xe");
229  g4MatData.push_back(21.6*eV);
230
231  g4MatNames.push_back("G4_lAr");
232  g4MatData.push_back(23.6*eV);
233
234  g4MatNames.push_back("G4_lKr");
235  g4MatData.push_back(20.5*eV);
236
237  g4MatNames.push_back("G4_lXe");
238  g4MatData.push_back(15.6*eV);
239
240  g4MatNames.push_back("G4_AIR");
241  g4MatData.push_back(35.1*eV);
242
243  nMaterials = g4MatData.size();
244}
245
246//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.