Geant4_10
G4ElectronIonPair.cc
Go to the documentation of this file.
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 66241 2012-12-13 18:34:42Z gunter $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4ElectronIonPair
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 08.07.2008
38 //
39 // Modifications:
40 //
41 // -------------------------------------------------------------
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
46 #include "G4ElectronIonPair.hh"
47 #include "G4SystemOfUnits.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 
59 {
60  verbose = 1;
61  curMaterial = 0;
62  curMeanEnergy = 0.0;
63  nMaterials = 0;
64  invFanoFactor = 1.0/0.2;
65  Initialise();
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
71 {}
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
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 
107 std::vector<G4ThreeVector>*
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 
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 
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];
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 
169 {
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];
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 
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 
201 void 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....
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
G4double MeanNumberOfIonsAlongStep(const G4ParticleDefinition *, const G4Material *, G4double edepTotal, G4double edepNIEL=0.0)
virtual ~G4ElectronIonPair()
G4double GetMeanEnergyPerIonPair() const
const G4String & GetName() const
Definition: G4Material.hh:176
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
const XML_Char * name
Definition: expat.h:151
G4int ResidualeChargePostStep(const G4ParticleDefinition *, const G4TrackVector *secondary=0, G4int processSubType=-1)
tuple x
Definition: test.py:50
G4double FindG4MeanEnergyPerIonPair(const G4Material *)
int G4int
Definition: G4Types.hh:78
Double_t edep
Definition: macro.C:13
Float_t mat
Definition: plot.C:40
string material
Definition: eplot.py:19
G4StepPoint * GetPreStepPoint() const
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetPosition() const
G4int SampleNumberOfIonsAlongStep(const G4Step *)
TString part[npart]
Definition: Style.C:32
Definition: G4Step.hh:76
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:571
tuple v
Definition: test.py:18
std::vector< G4Track * > G4TrackVector
G4StepPoint * GetPostStepPoint() const
std::vector< G4ThreeVector > * SampleIonsAlongStep(const G4Step *)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
void SetMeanEnergyPerIonPair(G4double value)