Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/muons/src/G4TablesForExtrapolator.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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/muons/src/G4TablesForExtrapolator.cc (Version 11.3.0) and /processes/electromagnetic/muons/src/G4TablesForExtrapolator.cc (Version 11.2.1)


  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 // ClassName:    G4TablesForExtrapolator           28 // ClassName:    G4TablesForExtrapolator
 29 //                                                 29 //  
 30 // Description:  This class provide calculatio     30 // Description:  This class provide calculation of energy loss, fluctuation, 
 31 //               and msc angle                     31 //               and msc angle
 32 //                                                 32 //
 33 // Author:       09.12.04 V.Ivanchenko             33 // Author:       09.12.04 V.Ivanchenko 
 34 //                                                 34 //
 35 // Modification:                                   35 // Modification: 
 36 // 08-04-05 Rename Propogator -> Extrapolator      36 // 08-04-05 Rename Propogator -> Extrapolator (V.Ivanchenko)
 37 // 16-03-06 Add muon tables and fix bug in uni     37 // 16-03-06 Add muon tables and fix bug in units (V.Ivanchenko)
 38 // 21-03-06 Add verbosity defined in the const     38 // 21-03-06 Add verbosity defined in the constructor and Initialisation
 39 //          start only when first public metho     39 //          start only when first public method is called (V.Ivanchenko)
 40 // 03-05-06 Remove unused pointer G4Material*      40 // 03-05-06 Remove unused pointer G4Material* from number of methods (VI)
 41 // 12-05-06 SEt linLossLimit=0.001 (VI)            41 // 12-05-06 SEt linLossLimit=0.001 (VI)
 42 //                                                 42 //
 43 //--------------------------------------------     43 //----------------------------------------------------------------------------
 44 //                                                 44 //
 45                                                    45  
 46 //....oooOO0OOooo........oooOO0OOooo........oo     46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 47                                                    47 
 48 #include "G4TablesForExtrapolator.hh"              48 #include "G4TablesForExtrapolator.hh"
 49 #include "G4PhysicalConstants.hh"                  49 #include "G4PhysicalConstants.hh"
 50 #include "G4SystemOfUnits.hh"                      50 #include "G4SystemOfUnits.hh"
 51 #include "G4LossTableManager.hh"                   51 #include "G4LossTableManager.hh"
 52 #include "G4PhysicsLogVector.hh"                   52 #include "G4PhysicsLogVector.hh"
 53 #include "G4ParticleDefinition.hh"                 53 #include "G4ParticleDefinition.hh"
 54 #include "G4Material.hh"                           54 #include "G4Material.hh"
 55 #include "G4MaterialCutsCouple.hh"                 55 #include "G4MaterialCutsCouple.hh"
 56 #include "G4Electron.hh"                           56 #include "G4Electron.hh"
 57 #include "G4Positron.hh"                           57 #include "G4Positron.hh"
 58 #include "G4Proton.hh"                             58 #include "G4Proton.hh"
 59 #include "G4MuonPlus.hh"                           59 #include "G4MuonPlus.hh"
 60 #include "G4MuonMinus.hh"                          60 #include "G4MuonMinus.hh"
 61 #include "G4EmParameters.hh"                       61 #include "G4EmParameters.hh"
 62 #include "G4MollerBhabhaModel.hh"                  62 #include "G4MollerBhabhaModel.hh"
 63 #include "G4BetheBlochModel.hh"                    63 #include "G4BetheBlochModel.hh"
 64 #include "G4eBremsstrahlungRelModel.hh"            64 #include "G4eBremsstrahlungRelModel.hh"
 65 #include "G4MuPairProductionModel.hh"              65 #include "G4MuPairProductionModel.hh"
 66 #include "G4MuBremsstrahlungModel.hh"              66 #include "G4MuBremsstrahlungModel.hh"
 67 #include "G4ProductionCuts.hh"                     67 #include "G4ProductionCuts.hh"
 68 #include "G4LossTableBuilder.hh"                   68 #include "G4LossTableBuilder.hh"
 69 #include "G4WentzelVIModel.hh"                     69 #include "G4WentzelVIModel.hh"
 70 #include "G4ios.hh"                                70 #include "G4ios.hh"
 71                                                    71 
 72 //....oooOO0OOooo........oooOO0OOooo........oo     72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 73                                                    73 
 74 G4TablesForExtrapolator::G4TablesForExtrapolat     74 G4TablesForExtrapolator::G4TablesForExtrapolator(G4int verb, G4int bins, 
 75                                                    75                                                  G4double e1, G4double e2)
 76   : emin(e1), emax(e2), verbose(verb), nbins(b     76   : emin(e1), emax(e2), verbose(verb), nbins(bins)
 77 {                                                  77 {
 78   electron = G4Electron::Electron();               78   electron = G4Electron::Electron();
 79   positron = G4Positron::Positron();               79   positron = G4Positron::Positron();
 80   proton   = G4Proton::Proton();                   80   proton   = G4Proton::Proton();
 81   muonPlus = G4MuonPlus::MuonPlus();               81   muonPlus = G4MuonPlus::MuonPlus();
 82   muonMinus= G4MuonMinus::MuonMinus();             82   muonMinus= G4MuonMinus::MuonMinus();
 83 }                                                  83 }
 84                                                    84 
 85 //....oooOO0OOooo........oooOO0OOooo........oo     85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 86                                                    86 
 87 G4TablesForExtrapolator::~G4TablesForExtrapola     87 G4TablesForExtrapolator::~G4TablesForExtrapolator()
 88 {                                                  88 {
 89   if(nullptr != dedxElectron) {                    89   if(nullptr != dedxElectron) {
 90     dedxElectron->clearAndDestroy();               90     dedxElectron->clearAndDestroy();
 91     delete dedxElectron;                           91     delete dedxElectron;
 92   }                                                92   }
 93   if(nullptr != dedxPositron) {                    93   if(nullptr != dedxPositron) {
 94     dedxPositron->clearAndDestroy();               94     dedxPositron->clearAndDestroy();
 95     delete dedxPositron;                           95     delete dedxPositron;
 96   }                                                96   }
 97   if(nullptr != dedxProton) {                      97   if(nullptr != dedxProton) {
 98     dedxProton->clearAndDestroy();                 98     dedxProton->clearAndDestroy();
 99     delete dedxProton;                             99     delete dedxProton;
100   }                                               100   }
101   if(nullptr != dedxMuon) {                       101   if(nullptr != dedxMuon) {
102     dedxMuon->clearAndDestroy();                  102     dedxMuon->clearAndDestroy();
103     delete dedxMuon;                              103     delete dedxMuon;
104   }                                               104   }
105   if(nullptr != rangeElectron) {                  105   if(nullptr != rangeElectron) {
106     rangeElectron->clearAndDestroy();             106     rangeElectron->clearAndDestroy();
107     delete rangeElectron;                         107     delete rangeElectron;
108   }                                               108   }
109   if(nullptr != rangePositron) {                  109   if(nullptr != rangePositron) {
110     rangePositron->clearAndDestroy();             110     rangePositron->clearAndDestroy();
111     delete rangePositron;                         111     delete rangePositron;
112   }                                               112   }
113   if(nullptr != rangeProton) {                    113   if(nullptr != rangeProton) {
114     rangeProton->clearAndDestroy();               114     rangeProton->clearAndDestroy();
115     delete rangeProton;                           115     delete rangeProton;
116   }                                               116   }
117   if(nullptr != rangeMuon) {                      117   if(nullptr != rangeMuon) {
118     rangeMuon->clearAndDestroy();                 118     rangeMuon->clearAndDestroy();
119     delete rangeMuon;                             119     delete rangeMuon;
120   }                                               120   }
121   if(nullptr != invRangeElectron) {               121   if(nullptr != invRangeElectron) {
122     invRangeElectron->clearAndDestroy();          122     invRangeElectron->clearAndDestroy();
123     delete invRangeElectron;                      123     delete invRangeElectron;
124   }                                               124   }
125   if(nullptr != invRangePositron) {               125   if(nullptr != invRangePositron) {
126     invRangePositron->clearAndDestroy();          126     invRangePositron->clearAndDestroy();
127     delete invRangePositron;                      127     delete invRangePositron;
128   }                                               128   }
129   if(nullptr != invRangeProton) {                 129   if(nullptr != invRangeProton) {
130     invRangeProton->clearAndDestroy();            130     invRangeProton->clearAndDestroy();
131     delete invRangeProton;                        131     delete invRangeProton;
132   }                                               132   }
133   if(nullptr != invRangeMuon) {                   133   if(nullptr != invRangeMuon) {
134     invRangeMuon->clearAndDestroy();              134     invRangeMuon->clearAndDestroy();
135     delete invRangeMuon;                          135     delete invRangeMuon;
136   }                                               136   }
137   if(nullptr != mscElectron) {                    137   if(nullptr != mscElectron) {
138     mscElectron->clearAndDestroy();               138     mscElectron->clearAndDestroy();
139     delete mscElectron;                           139     delete mscElectron;
140   }                                               140   }
141   delete pcuts;                                   141   delete pcuts;
142   delete builder;                                 142   delete builder;
143 }                                                 143 }
144                                                   144 
145 //....oooOO0OOooo........oooOO0OOooo........oo    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
146                                                   146 
147 const G4PhysicsTable*                             147 const G4PhysicsTable* 
148 G4TablesForExtrapolator::GetPhysicsTable(ExtTa    148 G4TablesForExtrapolator::GetPhysicsTable(ExtTableType type) const
149 {                                                 149 {
150   const G4PhysicsTable* table = nullptr;          150   const G4PhysicsTable* table = nullptr;
151   switch (type)                                   151   switch (type) 
152     {                                             152     {
153     case fDedxElectron:                           153     case fDedxElectron:
154       table = dedxElectron;                       154       table = dedxElectron;
155       break;                                      155       break;
156     case fDedxPositron:                           156     case fDedxPositron:
157       table = dedxPositron;                       157       table = dedxPositron;
158       break;                                      158       break;
159     case fDedxProton:                             159     case fDedxProton:
160       table = dedxProton;                         160       table = dedxProton;
161       break;                                      161       break;
162     case fDedxMuon:                               162     case fDedxMuon:
163       table = dedxMuon;                           163       table = dedxMuon;
164       break;                                      164       break;
165     case fRangeElectron:                          165     case fRangeElectron:
166       table = rangeElectron;                      166       table = rangeElectron;
167       break;                                      167       break;
168     case fRangePositron:                          168     case fRangePositron:
169       table = rangePositron;                      169       table = rangePositron;
170       break;                                      170       break;
171     case fRangeProton:                            171     case fRangeProton:
172       table = rangeProton;                        172       table = rangeProton;
173       break;                                      173       break;
174     case fRangeMuon:                              174     case fRangeMuon:
175       table = rangeMuon;                          175       table = rangeMuon;
176       break;                                      176       break;
177     case fInvRangeElectron:                       177     case fInvRangeElectron:
178       table = invRangeElectron;                   178       table = invRangeElectron;
179       break;                                      179       break;
180     case fInvRangePositron:                       180     case fInvRangePositron:
181       table = invRangePositron;                   181       table = invRangePositron;
182       break;                                      182       break;
183     case fInvRangeProton:                         183     case fInvRangeProton:
184       table = invRangeProton;                     184       table = invRangeProton;
185       break;                                      185       break;
186     case fInvRangeMuon:                           186     case fInvRangeMuon:
187       table = invRangeMuon;                       187       table = invRangeMuon;
188       break;                                      188       break;
189     case fMscElectron:                            189     case fMscElectron:
190       table = mscElectron;                        190       table = mscElectron;
191     }                                             191     }
192   return table;                                   192   return table;
193 }                                                 193 }
194                                                   194 
195 //....oooOO0OOooo........oooOO0OOooo........oo    195 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
196                                                   196 
197 void G4TablesForExtrapolator::Initialisation()    197 void G4TablesForExtrapolator::Initialisation()
198 {                                                 198 {
199   if(verbose>1) {                                 199   if(verbose>1) {
200     G4cout << "### G4TablesForExtrapolator::In    200     G4cout << "### G4TablesForExtrapolator::Initialisation" << G4endl;
201   }                                               201   }
202   G4int num = (G4int)G4Material::GetNumberOfMa    202   G4int num = (G4int)G4Material::GetNumberOfMaterials();
203   if(nmat == num) { return; }                     203   if(nmat == num) { return; }
204   nmat = num;                                     204   nmat = num;
205   cuts.resize(nmat, DBL_MAX);                     205   cuts.resize(nmat, DBL_MAX);
206   couples.resize(nmat, nullptr);                  206   couples.resize(nmat, nullptr);
207                                                   207 
208   const G4MaterialTable* mtable = G4Material::    208   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
209   if(!pcuts) { pcuts = new G4ProductionCuts();    209   if(!pcuts) { pcuts = new G4ProductionCuts(); }
210                                                   210 
211   for(G4int i=0; i<nmat; ++i) {                   211   for(G4int i=0; i<nmat; ++i) {
212     couples[i] = new G4MaterialCutsCouple((*mt    212     couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
213   }                                               213   }
214                                                   214 
215   dedxElectron     = PrepareTable(dedxElectron    215   dedxElectron     = PrepareTable(dedxElectron);
216   dedxPositron     = PrepareTable(dedxPositron    216   dedxPositron     = PrepareTable(dedxPositron);
217   dedxMuon         = PrepareTable(dedxMuon);      217   dedxMuon         = PrepareTable(dedxMuon);
218   dedxProton       = PrepareTable(dedxProton);    218   dedxProton       = PrepareTable(dedxProton);
219   rangeElectron    = PrepareTable(rangeElectro    219   rangeElectron    = PrepareTable(rangeElectron);
220   rangePositron    = PrepareTable(rangePositro    220   rangePositron    = PrepareTable(rangePositron);
221   rangeMuon        = PrepareTable(rangeMuon);     221   rangeMuon        = PrepareTable(rangeMuon);
222   rangeProton      = PrepareTable(rangeProton)    222   rangeProton      = PrepareTable(rangeProton);
223   invRangeElectron = PrepareTable(invRangeElec    223   invRangeElectron = PrepareTable(invRangeElectron);
224   invRangePositron = PrepareTable(invRangePosi    224   invRangePositron = PrepareTable(invRangePositron);
225   invRangeMuon     = PrepareTable(invRangeMuon    225   invRangeMuon     = PrepareTable(invRangeMuon);
226   invRangeProton   = PrepareTable(invRangeProt    226   invRangeProton   = PrepareTable(invRangeProton);
227   mscElectron      = PrepareTable(mscElectron)    227   mscElectron      = PrepareTable(mscElectron);
228                                                   228 
229   builder = new G4LossTableBuilder(true);         229   builder = new G4LossTableBuilder(true);
230   builder->SetBaseMaterialActive(false);          230   builder->SetBaseMaterialActive(false);
231                                                   231 
232   if(verbose>1) {                                 232   if(verbose>1) {
233     G4cout << "### G4TablesForExtrapolator Bui    233     G4cout << "### G4TablesForExtrapolator Builds electron tables" 
234      << G4endl;                                   234      << G4endl;
235   }                                               235   }
236   ComputeElectronDEDX(electron, dedxElectron);    236   ComputeElectronDEDX(electron, dedxElectron);
237   builder->BuildRangeTable(dedxElectron,rangeE    237   builder->BuildRangeTable(dedxElectron,rangeElectron);  
238   builder->BuildInverseRangeTable(rangeElectro    238   builder->BuildInverseRangeTable(rangeElectron, invRangeElectron);  
239                                                   239 
240   if(verbose>1) {                                 240   if(verbose>1) {
241     G4cout << "### G4TablesForExtrapolator Bui    241     G4cout << "### G4TablesForExtrapolator Builds positron tables" 
242      << G4endl;                                   242      << G4endl;
243   }                                               243   }
244   ComputeElectronDEDX(positron, dedxPositron);    244   ComputeElectronDEDX(positron, dedxPositron);
245   builder->BuildRangeTable(dedxPositron, range    245   builder->BuildRangeTable(dedxPositron, rangePositron);  
246   builder->BuildInverseRangeTable(rangePositro    246   builder->BuildInverseRangeTable(rangePositron, invRangePositron);  
247                                                   247 
248   if(verbose>1) {                                 248   if(verbose>1) {
249     G4cout << "### G4TablesForExtrapolator Bui    249     G4cout << "### G4TablesForExtrapolator Builds muon tables" << G4endl;
250   }                                               250   }
251   ComputeMuonDEDX(muonPlus, dedxMuon);            251   ComputeMuonDEDX(muonPlus, dedxMuon);
252   builder->BuildRangeTable(dedxMuon, rangeMuon    252   builder->BuildRangeTable(dedxMuon, rangeMuon);  
253   builder->BuildInverseRangeTable(rangeMuon, i    253   builder->BuildInverseRangeTable(rangeMuon, invRangeMuon);  
254                                                   254   
255   if(verbose>2) {                                 255   if(verbose>2) {
256     G4cout << "DEDX MUON" << G4endl;              256     G4cout << "DEDX MUON" << G4endl;
257     G4cout << *dedxMuon << G4endl;                257     G4cout << *dedxMuon << G4endl;
258     G4cout << "RANGE MUON" << G4endl;             258     G4cout << "RANGE MUON" << G4endl;
259     G4cout << *rangeMuon << G4endl;               259     G4cout << *rangeMuon << G4endl;
260     G4cout << "INVRANGE MUON" << G4endl;          260     G4cout << "INVRANGE MUON" << G4endl;
261     G4cout << *invRangeMuon << G4endl;            261     G4cout << *invRangeMuon << G4endl;
262   }                                               262   }
263   if(verbose>1) {                                 263   if(verbose>1) {
264     G4cout << "### G4TablesForExtrapolator Bui    264     G4cout << "### G4TablesForExtrapolator Builds proton tables" 
265      << G4endl;                                   265      << G4endl;
266   }                                               266   }
267   ComputeProtonDEDX(proton, dedxProton);          267   ComputeProtonDEDX(proton, dedxProton);
268   builder->BuildRangeTable(dedxProton, rangePr    268   builder->BuildRangeTable(dedxProton, rangeProton);  
269   builder->BuildInverseRangeTable(rangeProton,    269   builder->BuildInverseRangeTable(rangeProton, invRangeProton);  
270                                                   270 
271   ComputeTrasportXS(electron, mscElectron);       271   ComputeTrasportXS(electron, mscElectron);
272 }                                                 272 }
273                                                   273 
274 //....oooOO0OOooo........oooOO0OOooo........oo    274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
275                                                   275 
276 G4PhysicsTable* G4TablesForExtrapolator::Prepa    276 G4PhysicsTable* G4TablesForExtrapolator::PrepareTable(G4PhysicsTable* ptr)
277 {                                                 277 {
278   G4PhysicsTable* table = ptr;                    278   G4PhysicsTable* table = ptr;
279   if(nullptr == ptr) { table = new G4PhysicsTa    279   if(nullptr == ptr) { table = new G4PhysicsTable(); }
280   G4int n = (G4int)table->length();               280   G4int n = (G4int)table->length();
281   for(G4int i=n; i<nmat; ++i) {                   281   for(G4int i=n; i<nmat; ++i) {  
282     G4PhysicsVector* v = new G4PhysicsLogVecto    282     G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins, splineFlag);
283     table->push_back(v);                          283     table->push_back(v);
284   }                                               284   }
285   return table;                                   285   return table;
286 }                                                 286 }
287                                                   287 
288 //....oooOO0OOooo........oooOO0OOooo........oo    288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
289                                                   289 
290 void G4TablesForExtrapolator::ComputeElectronD    290 void G4TablesForExtrapolator::ComputeElectronDEDX(
291                                   const G4Part    291                                   const G4ParticleDefinition* part,
292           G4PhysicsTable* table)                  292           G4PhysicsTable* table) 
293 {                                                 293 {
294   G4MollerBhabhaModel* ioni = new G4MollerBhab    294   G4MollerBhabhaModel* ioni = new G4MollerBhabhaModel();
295   G4eBremsstrahlungRelModel* brem = new G4eBre    295   G4eBremsstrahlungRelModel* brem = new G4eBremsstrahlungRelModel();
296   ioni->Initialise(part, cuts);                   296   ioni->Initialise(part, cuts);
297   brem->Initialise(part, cuts);                   297   brem->Initialise(part, cuts);
298   ioni->SetUseBaseMaterials(false);               298   ioni->SetUseBaseMaterials(false);
299   brem->SetUseBaseMaterials(false);               299   brem->SetUseBaseMaterials(false);
300                                                   300 
301   mass    = electron_mass_c2;                     301   mass    = electron_mass_c2;
302   charge2 = 1.0;                                  302   charge2 = 1.0;
303   currentParticle = part;                         303   currentParticle = part;
304                                                   304 
305   const G4MaterialTable* mtable = G4Material::    305   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
306   if(0<verbose) {                                 306   if(0<verbose) {
307     G4cout << "G4TablesForExtrapolator::Comput    307     G4cout << "G4TablesForExtrapolator::ComputeElectronDEDX for " 
308            << part->GetParticleName()             308            << part->GetParticleName() 
309            << G4endl;                             309            << G4endl;
310   }                                               310   }
311   for(G4int i=0; i<nmat; ++i) {                   311   for(G4int i=0; i<nmat; ++i) {  
312                                                   312 
313     const G4Material* mat = (*mtable)[i];         313     const G4Material* mat = (*mtable)[i];
314     if(1<verbose) {                               314     if(1<verbose) {
315       G4cout << "i= " << i << "  mat= " << mat    315       G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
316     }                                             316     }
317     G4PhysicsVector* aVector = (*table)[i];       317     G4PhysicsVector* aVector = (*table)[i];
318                                                   318 
319     for(G4int j=0; j<=nbins; ++j) {               319     for(G4int j=0; j<=nbins; ++j) {
320                                                   320         
321        G4double e = aVector->Energy(j);           321        G4double e = aVector->Energy(j);
322        G4double dedx = ioni->ComputeDEDXPerVol    322        G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e) 
323    + brem->ComputeDEDXPerVolume(mat,part,e,e);    323    + brem->ComputeDEDXPerVolume(mat,part,e,e);
324        if(1<verbose) {                            324        if(1<verbose) {
325          G4cout << "j= " << j                     325          G4cout << "j= " << j
326                 << "  e(MeV)= " << e/MeV          326                 << "  e(MeV)= " << e/MeV  
327                 << " dedx(Mev/cm)= " << dedx*c    327                 << " dedx(Mev/cm)= " << dedx*cm/MeV
328                 << " dedx(Mev.cm2/g)= "           328                 << " dedx(Mev.cm2/g)= " 
329     << dedx/((MeV*mat->GetDensity())/(g/cm2))     329     << dedx/((MeV*mat->GetDensity())/(g/cm2)) 
330     << G4endl;                                    330     << G4endl;
331        }                                          331        }
332        aVector->PutValue(j,dedx);                 332        aVector->PutValue(j,dedx);
333     }                                             333     }
334     if(splineFlag) { aVector->FillSecondDeriva    334     if(splineFlag) { aVector->FillSecondDerivatives(); }
335   }                                               335   }
336 }                                                 336 } 
337                                                   337 
338 //....oooOO0OOooo........oooOO0OOooo........oo    338 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
339                                                   339 
340 void                                              340 void 
341 G4TablesForExtrapolator::ComputeMuonDEDX(const    341 G4TablesForExtrapolator::ComputeMuonDEDX(const G4ParticleDefinition* part, 
342            G4PhysicsTable* table)                 342            G4PhysicsTable* table)
343 {                                                 343 {
344   G4BetheBlochModel* ioni = new G4BetheBlochMo    344   G4BetheBlochModel* ioni = new G4BetheBlochModel();
345   G4MuPairProductionModel* pair = new G4MuPair    345   G4MuPairProductionModel* pair = new G4MuPairProductionModel(part);
346   G4MuBremsstrahlungModel* brem = new G4MuBrem    346   G4MuBremsstrahlungModel* brem = new G4MuBremsstrahlungModel(part);
347   ioni->Initialise(part, cuts);                   347   ioni->Initialise(part, cuts);
348   pair->Initialise(part, cuts);                   348   pair->Initialise(part, cuts);
349   brem->Initialise(part, cuts);                   349   brem->Initialise(part, cuts);
350   ioni->SetUseBaseMaterials(false);               350   ioni->SetUseBaseMaterials(false);
351   pair->SetUseBaseMaterials(false);               351   pair->SetUseBaseMaterials(false);
352   brem->SetUseBaseMaterials(false);               352   brem->SetUseBaseMaterials(false);
353                                                   353 
354   mass    = part->GetPDGMass();                   354   mass    = part->GetPDGMass();
355   charge2 = 1.0;                                  355   charge2 = 1.0;
356   currentParticle = part;                         356   currentParticle = part;
357                                                   357 
358   const G4MaterialTable* mtable = G4Material::    358   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
359                                                   359 
360   if(0<verbose) {                                 360   if(0<verbose) {
361     G4cout << "G4TablesForExtrapolator::Comput    361     G4cout << "G4TablesForExtrapolator::ComputeMuonDEDX for " 
362      << part->GetParticleName()                   362      << part->GetParticleName() 
363            << G4endl;                             363            << G4endl;
364   }                                               364   }
365                                                   365  
366   for(G4int i=0; i<nmat; ++i) {                   366   for(G4int i=0; i<nmat; ++i) {  
367                                                   367 
368     const G4Material* mat = (*mtable)[i];         368     const G4Material* mat = (*mtable)[i];
369     if(1<verbose) {                               369     if(1<verbose) {
370       G4cout << "i= " << i << "  mat= " << mat    370       G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
371     }                                             371     }
372     G4PhysicsVector* aVector = (*table)[i];       372     G4PhysicsVector* aVector = (*table)[i];
373     for(G4int j=0; j<=nbins; ++j) {               373     for(G4int j=0; j<=nbins; ++j) {
374                                                   374         
375        G4double e = aVector->Energy(j);           375        G4double e = aVector->Energy(j);
376        G4double dedx = ioni->ComputeDEDXPerVol    376        G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e) +
377                  pair->ComputeDEDXPerVolume(ma    377                  pair->ComputeDEDXPerVolume(mat,part,e,e) +
378                  brem->ComputeDEDXPerVolume(ma    378                  brem->ComputeDEDXPerVolume(mat,part,e,e);
379        aVector->PutValue(j,dedx);                 379        aVector->PutValue(j,dedx);
380        if(1<verbose) {                            380        if(1<verbose) {
381          G4cout << "j= " << j                     381          G4cout << "j= " << j
382                 << "  e(MeV)= " << e/MeV          382                 << "  e(MeV)= " << e/MeV  
383                 << " dedx(Mev/cm)= " << dedx*c    383                 << " dedx(Mev/cm)= " << dedx*cm/MeV
384                 << " dedx(Mev/(g/cm2)= "          384                 << " dedx(Mev/(g/cm2)= " 
385                 << dedx/((MeV*mat->GetDensity(    385                 << dedx/((MeV*mat->GetDensity())/(g/cm2))
386     << G4endl;                                    386     << G4endl;
387        }                                          387        }
388     }                                             388     }
389     if(splineFlag) { aVector->FillSecondDeriva    389     if(splineFlag) { aVector->FillSecondDerivatives(); }
390   }                                               390   }
391 }                                                 391 }
392                                                   392 
393 //....oooOO0OOooo........oooOO0OOooo........oo    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
394                                                   394 
395 void                                              395 void 
396 G4TablesForExtrapolator::ComputeProtonDEDX(con    396 G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part, 
397                                G4PhysicsTable*    397                                G4PhysicsTable* table)
398 {                                                 398 {
399   G4BetheBlochModel* ioni = new G4BetheBlochMo    399   G4BetheBlochModel* ioni = new G4BetheBlochModel();
400   ioni->Initialise(part, cuts);                   400   ioni->Initialise(part, cuts);
401   ioni->SetUseBaseMaterials(false);               401   ioni->SetUseBaseMaterials(false);
402                                                   402 
403   mass    = part->GetPDGMass();                   403   mass    = part->GetPDGMass();
404   charge2 = 1.0;                                  404   charge2 = 1.0;
405   currentParticle = part;                         405   currentParticle = part;
406                                                   406 
407   const G4MaterialTable* mtable = G4Material::    407   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
408                                                   408 
409   if(0<verbose) {                                 409   if(0<verbose) {
410     G4cout << "G4TablesForExtrapolator::Comput    410     G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for " 
411      << part->GetParticleName()                   411      << part->GetParticleName() 
412            << G4endl;                             412            << G4endl;
413   }                                               413   }
414                                                   414  
415   for(G4int i=0; i<nmat; ++i) {                   415   for(G4int i=0; i<nmat; ++i) {  
416                                                   416 
417     const G4Material* mat = (*mtable)[i];         417     const G4Material* mat = (*mtable)[i];
418     if(1<verbose)                                 418     if(1<verbose)
419       G4cout << "i= " << i << "  mat= " << mat    419       G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
420     G4PhysicsVector* aVector = (*table)[i];       420     G4PhysicsVector* aVector = (*table)[i];
421     for(G4int j=0; j<=nbins; ++j) {               421     for(G4int j=0; j<=nbins; ++j) {
422                                                   422         
423        G4double e = aVector->Energy(j);           423        G4double e = aVector->Energy(j);
424        G4double dedx = ioni->ComputeDEDXPerVol    424        G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e);
425        aVector->PutValue(j,dedx);                 425        aVector->PutValue(j,dedx);
426        if(1<verbose) {                            426        if(1<verbose) {
427          G4cout << "j= " << j                     427          G4cout << "j= " << j
428                 << "  e(MeV)= " << e/MeV          428                 << "  e(MeV)= " << e/MeV  
429                 << " dedx(Mev/cm)= " << dedx*c    429                 << " dedx(Mev/cm)= " << dedx*cm/MeV
430                 << " dedx(Mev.cm2/g)= " << ded    430                 << " dedx(Mev.cm2/g)= " << dedx/((mat->GetDensity())/(g/cm2)) 
431     << G4endl;                                    431     << G4endl;
432        }                                          432        }
433     }                                             433     }
434     if(splineFlag) { aVector->FillSecondDeriva    434     if(splineFlag) { aVector->FillSecondDerivatives(); }
435   }                                               435   }
436 }                                                 436 }
437                                                   437 
438 //....oooOO0OOooo........oooOO0OOooo........oo    438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
439                                                   439 
440 void                                              440 void 
441 G4TablesForExtrapolator::ComputeTrasportXS(con    441 G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part, 
442              G4PhysicsTable* table)               442              G4PhysicsTable* table)
443 {                                                 443 {
444   G4WentzelVIModel* msc = new G4WentzelVIModel    444   G4WentzelVIModel* msc = new G4WentzelVIModel();
445   msc->SetPolarAngleLimit(CLHEP::pi);             445   msc->SetPolarAngleLimit(CLHEP::pi);
446   msc->Initialise(part, cuts);                    446   msc->Initialise(part, cuts);
447   msc->SetUseBaseMaterials(false);                447   msc->SetUseBaseMaterials(false);
448                                                   448 
449   mass    = part->GetPDGMass();                   449   mass    = part->GetPDGMass();
450   charge2 = 1.0;                                  450   charge2 = 1.0;
451   currentParticle = part;                         451   currentParticle = part;
452                                                   452 
453   const G4MaterialTable* mtable = G4Material::    453   const G4MaterialTable* mtable = G4Material::GetMaterialTable();
454                                                   454 
455   if(0<verbose) {                                 455   if(0<verbose) {
456     G4cout << "G4TablesForExtrapolator::Comput    456     G4cout << "G4TablesForExtrapolator::ComputeTransportXS for " 
457      << part->GetParticleName()                   457      << part->GetParticleName() 
458            << G4endl;                             458            << G4endl;
459   }                                               459   }
460                                                   460  
461   for(G4int i=0; i<nmat; ++i) {                   461   for(G4int i=0; i<nmat; ++i) {  
462                                                   462 
463     const G4Material* mat = (*mtable)[i];         463     const G4Material* mat = (*mtable)[i];
464     msc->SetCurrentCouple(couples[i]);            464     msc->SetCurrentCouple(couples[i]);
465     if(1<verbose)                                 465     if(1<verbose)
466       G4cout << "i= " << i << "  mat= " << mat    466       G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
467     G4PhysicsVector* aVector = (*table)[i];       467     G4PhysicsVector* aVector = (*table)[i];
468     for(G4int j=0; j<=nbins; ++j) {               468     for(G4int j=0; j<=nbins; ++j) {
469                                                   469         
470        G4double e = aVector->Energy(j);           470        G4double e = aVector->Energy(j);
471        G4double xs = msc->CrossSectionPerVolum    471        G4double xs = msc->CrossSectionPerVolume(mat,part,e);
472        aVector->PutValue(j,xs);                   472        aVector->PutValue(j,xs);
473        if(1<verbose) {                            473        if(1<verbose) {
474          G4cout << "j= " << j << "  e(MeV)= "     474          G4cout << "j= " << j << "  e(MeV)= " << e/MeV  
475                 << " xs(1/mm)= " << xs*mm << G    475                 << " xs(1/mm)= " << xs*mm << G4endl;
476        }                                          476        }
477     }                                             477     }
478     if(splineFlag) { aVector->FillSecondDeriva    478     if(splineFlag) { aVector->FillSecondDerivatives(); }
479   }                                               479   }
480 }                                                 480 }
481                                                   481 
482 //....oooOO0OOooo........oooOO0OOooo........oo    482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
483                                                   483 
484                                                   484