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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/utils/src/G4ElectronIonPair.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4ElectronIonPair.cc (Version 10.7.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 // -------------------------------------------     27 // -------------------------------------------------------------------
 28 //                                                 28 //
 29 // GEANT4 Class file                               29 // GEANT4 Class file
 30 //                                                 30 //
 31 //                                                 31 //
 32 // File name:     G4ElectronIonPair                32 // File name:     G4ElectronIonPair
 33 //                                                 33 //
 34 // Author:        Vladimir Ivanchenko              34 // Author:        Vladimir Ivanchenko
 35 //                                                 35 //
 36 // Creation date: 08.07.2008                       36 // Creation date: 08.07.2008
 37 //                                                 37 //
 38 // Modifications:                                  38 // Modifications:
 39 //                                                 39 //
 40 // -------------------------------------------     40 // -------------------------------------------------------------
 41                                                    41 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 43 //....oooOO0OOooo........oooOO0OOooo........oo     43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 44                                                    44 
 45 #include "G4ElectronIonPair.hh"                    45 #include "G4ElectronIonPair.hh"
 46 #include "G4SystemOfUnits.hh"                      46 #include "G4SystemOfUnits.hh"
 47 #include "G4Material.hh"                           47 #include "G4Material.hh"
 48 #include "G4MaterialTable.hh"                      48 #include "G4MaterialTable.hh"
 49 #include "G4StepPoint.hh"                          49 #include "G4StepPoint.hh"
 50 #include "G4VProcess.hh"                           50 #include "G4VProcess.hh"
 51 #include "G4ProcessType.hh"                        51 #include "G4ProcessType.hh"
 52 #include "G4Track.hh"                              52 #include "G4Track.hh"
 53 #include "Randomize.hh"                            53 #include "Randomize.hh"
 54                                                    54 
 55 //....oooOO0OOooo........oooOO0OOooo........oo     55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 56                                                    56 
 57 G4ElectronIonPair::G4ElectronIonPair(G4int ver     57 G4ElectronIonPair::G4ElectronIonPair(G4int verb)
 58 {                                                  58 {
 59   verbose = verb;                                  59   verbose = verb;
 60   curMaterial = nullptr;                           60   curMaterial = nullptr;
 61   curMeanEnergy = 0.0;                             61   curMeanEnergy = 0.0;
 62   nMaterials = 0;                                  62   nMaterials = 0;
 63   invFanoFactor = 1.0/0.2;                         63   invFanoFactor = 1.0/0.2;
 64   Initialise();                                    64   Initialise();
 65 }                                                  65 }
 66                                                    66 
 67 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 68                                                    68 
 69 G4ElectronIonPair::~G4ElectronIonPair() = defa <<  69 G4ElectronIonPair::~G4ElectronIonPair()
                                                   >>  70 {}
 70                                                    71 
 71 //....oooOO0OOooo........oooOO0OOooo........oo     72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 72                                                    73 
 73 G4double G4ElectronIonPair::MeanNumberOfIonsAl     74 G4double G4ElectronIonPair::MeanNumberOfIonsAlongStep(
 74            const G4ParticleDefinition* part,       75            const G4ParticleDefinition* part, 
 75            const G4Material* material,             76            const G4Material* material,
 76            G4double edep,                          77            G4double edep,
 77            G4double niel)                          78            G4double niel)
 78 {                                                  79 {
 79   G4double nion = 0.0;                             80   G4double nion = 0.0;
 80                                                    81 
 81   // NIEL does not provide ionisation clusters     82   // NIEL does not provide ionisation clusters
 82   if(edep > niel) {                                83   if(edep > niel) {
 83                                                    84 
 84     // neutral particles do not produce ionisa     85     // neutral particles do not produce ionisation along step
 85     if(part->GetPDGCharge() != 0.0) {              86     if(part->GetPDGCharge() != 0.0) {
 86                                                    87 
 87       // select material                           88       // select material
 88       if(material != curMaterial) {                89       if(material != curMaterial) {
 89   curMaterial = material;                          90   curMaterial = material;
 90   curMeanEnergy = material->GetIonisation()->G     91   curMeanEnergy = material->GetIonisation()->GetMeanEnergyPerIonPair();
 91                                                    92 
 92   // if mean energy is not defined then look i     93   // if mean energy is not defined then look into G4 DB
 93   if(0.0 == curMeanEnergy) {                       94   if(0.0 == curMeanEnergy) {
 94     curMeanEnergy = FindG4MeanEnergyPerIonPair     95     curMeanEnergy = FindG4MeanEnergyPerIonPair(material);
 95   }                                                96   } 
 96       }                                            97       }
 97       if(curMeanEnergy > 0.0) { nion = (edep -     98       if(curMeanEnergy > 0.0) { nion = (edep - niel)/curMeanEnergy; }
 98     }                                              99     }
 99   }                                               100   }
100   return nion;                                    101   return nion;
101 }                                                 102 }
102                                                   103 
103 //....oooOO0OOooo........oooOO0OOooo........oo    104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104                                                   105 
105 std::vector<G4ThreeVector>*                       106 std::vector<G4ThreeVector>* 
106 G4ElectronIonPair::SampleIonsAlongStep(const G    107 G4ElectronIonPair::SampleIonsAlongStep(const G4Step* step)
107 {                                                 108 {
108   std::vector<G4ThreeVector>* v = nullptr;     << 109   std::vector<G4ThreeVector>* v = 0;
109                                                   110 
110   G4int nion = SampleNumberOfIonsAlongStep(ste    111   G4int nion = SampleNumberOfIonsAlongStep(step);
111                                                   112 
112   // sample ionisation along step                 113   // sample ionisation along step
113   if(nion > 0) {                                  114   if(nion > 0) {
114                                                   115 
115     v = new std::vector<G4ThreeVector>;           116     v = new std::vector<G4ThreeVector>;
116     G4ThreeVector prePos = step->GetPreStepPoi    117     G4ThreeVector prePos = step->GetPreStepPoint()->GetPosition();
117     G4ThreeVector deltaPos = step->GetPostStep    118     G4ThreeVector deltaPos = step->GetPostStepPoint()->GetPosition() - prePos;  
118     for(G4int i=0; i<nion; ++i) {                 119     for(G4int i=0; i<nion; ++i) {
119       v->push_back( prePos + deltaPos*G4Unifor    120       v->push_back( prePos + deltaPos*G4UniformRand() );
120     }                                             121     }
121     if(verbose > 1 ) {                            122     if(verbose > 1 ) { 
122       G4cout << "### G4ElectronIonPair::Sample    123       G4cout << "### G4ElectronIonPair::SampleIonisationPoints: "
123        << v->size() << "  ion pairs are added"    124        << v->size() << "  ion pairs are added" << G4endl;
124     }                                             125     }
125   }                                               126   }
126   return v;                                       127   return v;
127 }                                                 128 }
128                                                   129 
129 //....oooOO0OOooo........oooOO0OOooo........oo    130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
130                                                   131 
131 G4int                                             132 G4int 
132 G4ElectronIonPair::ResidualeChargePostStep(con    133 G4ElectronIonPair::ResidualeChargePostStep(const G4ParticleDefinition*,
133              const G4TrackVector*,                134              const G4TrackVector*,
134              G4int subType) const                 135              G4int subType) const
135 {                                                 136 {
136   G4int nholes = 0;                               137   G4int nholes = 0;
137                                                   138 
138   if(2 == subType || 12 == subType || 13 == su    139   if(2 == subType || 12 == subType || 13 == subType) { nholes = 1; }
139   return nholes;                                  140   return nholes;
140 }                                                 141 }
141                                                   142 
142 //....oooOO0OOooo........oooOO0OOooo........oo    143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
143                                                   144 
144 G4double                                          145 G4double 
145 G4ElectronIonPair::FindG4MeanEnergyPerIonPair(    146 G4ElectronIonPair::FindG4MeanEnergyPerIonPair(const G4Material* mat) const
146 {                                                 147 {
147   G4String name = mat->GetName();                 148   G4String name = mat->GetName();
148   G4double res  = 0.0;                            149   G4double res  = 0.0;
149                                                   150 
150   // is this material in the vector?              151   // is this material in the vector?  
151   for(G4int j=0; j<nMaterials; ++j) {          << 152   for(G4int j=0; j<nMaterials; j++) {
152     if(name == g4MatNames[j]) {                   153     if(name == g4MatNames[j]) {
153       res = g4MatData[j];                         154       res = g4MatData[j];
154       mat->GetIonisation()->SetMeanEnergyPerIo    155       mat->GetIonisation()->SetMeanEnergyPerIonPair(res);
155       if(verbose > 0) {                           156       if(verbose > 0) {
156   G4cout << "### G4ElectronIonPair::FindG4Mean    157   G4cout << "### G4ElectronIonPair::FindG4MeanEnergyPerIonPair for "
157          << name << " Epair= " << res/eV << "     158          << name << " Epair= " << res/eV << " eV is set"
158          << G4endl;                               159          << G4endl;
159       }                                           160       }
160       break;                                      161       break;
161     }                                             162     }
162   }                                               163   }
163   return res;                                     164   return res;
164 }                                                 165 }
165                                                   166 
166 //....oooOO0OOooo........oooOO0OOooo........oo    167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
167                                                   168 
168 void G4ElectronIonPair:: DumpMeanEnergyPerIonP    169 void G4ElectronIonPair:: DumpMeanEnergyPerIonPair() const
169 {                                                 170 {
170   std::size_t nmat = G4Material::GetNumberOfMa << 171   G4int nmat = G4Material::GetNumberOfMaterials();
171   const G4MaterialTable* mtable = G4Material::    172   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
172   if(nmat > 0) {                                  173   if(nmat > 0) {
173     G4cout << "### G4ElectronIonPair: mean ene    174     G4cout << "### G4ElectronIonPair: mean energy per ion pair available:" 
174      << G4endl;                                   175      << G4endl;
175     for(std::size_t i=0; i<nmat; ++i) {        << 176     for(G4int i=0; i<nmat; ++i) {
176       const G4Material* mat = (*mtable)[i];       177       const G4Material* mat = (*mtable)[i];
177       G4double x = mat->GetIonisation()->GetMe    178       G4double x = mat->GetIonisation()->GetMeanEnergyPerIonPair();
178       if(x > 0.0) {                               179       if(x > 0.0) {
179   G4cout << "   " << mat->GetName() << "   Epa    180   G4cout << "   " << mat->GetName() << "   Epair=  " 
180          << x/eV << " eV" << G4endl;              181          << x/eV << " eV" << G4endl;
181       }                                           182       }
182     }                                             183     }
183   }                                               184   }
184 }                                                 185 }
185                                                   186 
186 //....oooOO0OOooo........oooOO0OOooo........oo    187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
187                                                   188 
188 void G4ElectronIonPair::DumpG4MeanEnergyPerIon    189 void G4ElectronIonPair::DumpG4MeanEnergyPerIonPair() const
189 {                                                 190 {
190   if(nMaterials > 0) {                            191   if(nMaterials > 0) {
191     G4cout << "### G4ElectronIonPair: mean ene    192     G4cout << "### G4ElectronIonPair: mean energy per ion pair "
192      << " for Geant4 materials" << G4endl;        193      << " for Geant4 materials" << G4endl;
193     for(G4int i=0; i<nMaterials; ++i) {           194     for(G4int i=0; i<nMaterials; ++i) {
194       G4cout << "   " << g4MatNames[i] << "       195       G4cout << "   " << g4MatNames[i] << "    Epair= " 
195        << g4MatData[i]/eV << " eV" << G4endl;     196        << g4MatData[i]/eV << " eV" << G4endl;
196     }                                             197     }
197   }                                               198   }
198 }                                                 199 }
199                                                   200 
200 //....oooOO0OOooo........oooOO0OOooo........oo    201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
201                                                   202 
202 void G4ElectronIonPair::Initialise()              203 void G4ElectronIonPair::Initialise()
203 {                                                 204 {
204   // ICRU Report 31, 1979                         205   // ICRU Report 31, 1979
205   g4MatNames.push_back("G4_Si");                  206   g4MatNames.push_back("G4_Si");
206   g4MatData.push_back(3.62*eV);                   207   g4MatData.push_back(3.62*eV);
207                                                   208 
208   g4MatNames.push_back("G4_Ge");                  209   g4MatNames.push_back("G4_Ge");
209   g4MatData.push_back(2.97*eV);                   210   g4MatData.push_back(2.97*eV);
210                                                   211 
211   g4MatNames.push_back("G4_He");                  212   g4MatNames.push_back("G4_He");
212   g4MatData.push_back(44.4*eV);                   213   g4MatData.push_back(44.4*eV);
213                                                   214 
214   g4MatNames.push_back("G4_N");                   215   g4MatNames.push_back("G4_N");
215   g4MatData.push_back(36.4*eV);                   216   g4MatData.push_back(36.4*eV);
216                                                   217 
217   g4MatNames.push_back("G4_O");                   218   g4MatNames.push_back("G4_O");
218   g4MatData.push_back(32.3*eV);                   219   g4MatData.push_back(32.3*eV);
219                                                   220 
220   g4MatNames.push_back("G4_Ne");                  221   g4MatNames.push_back("G4_Ne");
221   g4MatData.push_back(36.8*eV);                   222   g4MatData.push_back(36.8*eV);
222                                                   223 
223   g4MatNames.push_back("G4_Ar");                  224   g4MatNames.push_back("G4_Ar");
224   g4MatData.push_back(26.34*eV);                  225   g4MatData.push_back(26.34*eV);
225                                                   226 
226   g4MatNames.push_back("G4_Kr");                  227   g4MatNames.push_back("G4_Kr");
227   g4MatData.push_back(24.1*eV);                   228   g4MatData.push_back(24.1*eV);
228                                                   229 
229   g4MatNames.push_back("G4_Xe");                  230   g4MatNames.push_back("G4_Xe");
230   g4MatData.push_back(21.6*eV);                   231   g4MatData.push_back(21.6*eV);
231                                                   232 
232   g4MatNames.push_back("G4_lAr");                 233   g4MatNames.push_back("G4_lAr");
233   g4MatData.push_back(23.6*eV);                   234   g4MatData.push_back(23.6*eV);
234                                                   235 
235   g4MatNames.push_back("G4_lKr");                 236   g4MatNames.push_back("G4_lKr");
236   g4MatData.push_back(20.5*eV);                   237   g4MatData.push_back(20.5*eV);
237                                                   238 
238   g4MatNames.push_back("G4_lXe");                 239   g4MatNames.push_back("G4_lXe");
239   g4MatData.push_back(15.6*eV);                   240   g4MatData.push_back(15.6*eV);
240                                                   241 
241   g4MatNames.push_back("G4_AIR");                 242   g4MatNames.push_back("G4_AIR");
242   g4MatData.push_back(35.1*eV);                   243   g4MatData.push_back(35.1*eV);
243                                                   244 
244   nMaterials = (G4int)g4MatData.size();        << 245   nMaterials = g4MatData.size();
245 }                                                 246 }
246                                                   247 
247 //....oooOO0OOooo........oooOO0OOooo........oo    248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
248                                                   249