Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 92921 2015-09-21 15:06:51Z gcosmo $
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 = verb;
61  curMaterial = nullptr;
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 
133 G4int
135  const G4TrackVector*,
136  G4int subType) const
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 
146 G4double
148 {
149  G4String name = mat->GetName();
150  G4double res = 0.0;
151 
152  // is this material in the vector?
153  for(G4int j=0; j<nMaterials; j++) {
154  if(name == g4MatNames[j]) {
155  res = g4MatData[j];
157  if(verbose > 0) {
158  G4cout << "### G4ElectronIonPair::FindG4MeanEnergyPerIonPair for "
159  << name << " Epair= " << res/eV << " eV is set"
160  << G4endl;
161  }
162  break;
163  }
164  }
165  return res;
166 }
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
169 
171 {
174  if(nmat > 0) {
175  G4cout << "### G4ElectronIonPair: mean energy per ion pair avalable:"
176  << G4endl;
177  for(G4int i=0; i<nmat; ++i) {
178  const G4Material* mat = (*mtable)[i];
180  if(x > 0.0) {
181  G4cout << " " << mat->GetName() << " Epair= "
182  << x/eV << " eV" << G4endl;
183  }
184  }
185  }
186 }
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
189 
191 {
192  if(nMaterials > 0) {
193  G4cout << "### G4ElectronIonPair: mean energy per ion pair "
194  << " for Geant4 materials" << G4endl;
195  for(G4int i=0; i<nMaterials; ++i) {
196  G4cout << " " << g4MatNames[i] << " Epair= "
197  << g4MatData[i]/eV << " eV" << G4endl;
198  }
199  }
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
203 
204 void G4ElectronIonPair::Initialise()
205 {
206  // ICRU Report 31, 1979
207  g4MatNames.push_back("G4_Si");
208  g4MatData.push_back(3.62*eV);
209 
210  g4MatNames.push_back("G4_Ge");
211  g4MatData.push_back(2.97*eV);
212 
213  g4MatNames.push_back("G4_He");
214  g4MatData.push_back(44.4*eV);
215 
216  g4MatNames.push_back("G4_N");
217  g4MatData.push_back(36.4*eV);
218 
219  g4MatNames.push_back("G4_O");
220  g4MatData.push_back(32.3*eV);
221 
222  g4MatNames.push_back("G4_Ne");
223  g4MatData.push_back(36.8*eV);
224 
225  g4MatNames.push_back("G4_Ar");
226  g4MatData.push_back(26.34*eV);
227 
228  g4MatNames.push_back("G4_Kr");
229  g4MatData.push_back(24.1*eV);
230 
231  g4MatNames.push_back("G4_Xe");
232  g4MatData.push_back(21.6*eV);
233 
234  g4MatNames.push_back("G4_lAr");
235  g4MatData.push_back(23.6*eV);
236 
237  g4MatNames.push_back("G4_lKr");
238  g4MatData.push_back(20.5*eV);
239 
240  g4MatNames.push_back("G4_lXe");
241  g4MatData.push_back(15.6*eV);
242 
243  g4MatNames.push_back("G4_AIR");
244  g4MatData.push_back(35.1*eV);
245 
246  nMaterials = g4MatData.size();
247 }
248 
249 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const XML_Char * name
Definition: expat.h:151
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:226
G4double MeanNumberOfIonsAlongStep(const G4ParticleDefinition *, const G4Material *, G4double edepTotal, G4double edepNIEL=0.0)
virtual ~G4ElectronIonPair()
G4double GetMeanEnergyPerIonPair() const
const G4String & GetName() const
Definition: G4Material.hh:178
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
G4int ResidualeChargePostStep(const G4ParticleDefinition *, const G4TrackVector *secondary=nullptr, G4int processSubType=-1) const
string material
Definition: eplot.py:19
G4StepPoint * GetPreStepPoint() const
G4ElectronIonPair(G4int verb)
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetPosition() const
G4int SampleNumberOfIonsAlongStep(const G4Step *)
static constexpr double eV
Definition: G4SIunits.hh:215
Definition: G4Step.hh:76
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
void DumpG4MeanEnergyPerIonPair() const
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
void DumpMeanEnergyPerIonPair() const
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
G4double FindG4MeanEnergyPerIonPair(const G4Material *) const
void SetMeanEnergyPerIonPair(G4double value)