Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/src/G4VEmProcess.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/utils/src/G4VEmProcess.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4VEmProcess.cc (Version 9.0.p2)


  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 // $Id: G4VEmProcess.cc,v 1.40 2007/05/23 08:43:46 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-09-00-patch-01 $
                                                   >>  28 //
 26 // -------------------------------------------     29 // -------------------------------------------------------------------
 27 //                                                 30 //
 28 // GEANT4 Class file                               31 // GEANT4 Class file
 29 //                                                 32 //
 30 //                                                 33 //
 31 // File name:     G4VEmProcess                     34 // File name:     G4VEmProcess
 32 //                                                 35 //
 33 // Author:        Vladimir Ivanchenko on base      36 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 34 //                                                 37 //
 35 // Creation date: 01.10.2003                       38 // Creation date: 01.10.2003
 36 //                                                 39 //
 37 // Modifications: by V.Ivanchenko              <<  40 // Modifications:
                                                   >>  41 // 30-06-04 make it to be pure discrete process (V.Ivanchenko)
                                                   >>  42 // 30-09-08 optimise integral option (V.Ivanchenko)
                                                   >>  43 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
                                                   >>  44 // 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (VI)
                                                   >>  45 // 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
                                                   >>  46 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
                                                   >>  47 // 18-04-05 Use G4ParticleChangeForGamma (V.Ivanchenko)
                                                   >>  48 // 25-07-05 Add protection: integral mode only for charged particles (VI)
                                                   >>  49 // 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko)
                                                   >>  50 // 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
                                                   >>  51 // 12-09-06 add SetModel() (mma)
                                                   >>  52 // 12-04-07 remove double call to Clear model manager (V.Ivanchenko)
 38 //                                                 53 //
 39 // Class Description: based class for discrete <<  54 // Class Description:
 40 //                                                 55 //
 41                                                    56 
 42 // -------------------------------------------     57 // -------------------------------------------------------------------
 43 //                                                 58 //
 44 //....oooOO0OOooo........oooOO0OOooo........oo     59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 45 //....oooOO0OOooo........oooOO0OOooo........oo     60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 46                                                    61 
 47 #include "G4VEmProcess.hh"                         62 #include "G4VEmProcess.hh"
 48 #include "G4PhysicalConstants.hh"              << 
 49 #include "G4SystemOfUnits.hh"                  << 
 50 #include "G4ProcessManager.hh"                 << 
 51 #include "G4LossTableManager.hh"                   63 #include "G4LossTableManager.hh"
 52 #include "G4LossTableBuilder.hh"               << 
 53 #include "G4Step.hh"                               64 #include "G4Step.hh"
 54 #include "G4ParticleDefinition.hh"                 65 #include "G4ParticleDefinition.hh"
 55 #include "G4VEmModel.hh"                           66 #include "G4VEmModel.hh"
 56 #include "G4DataVector.hh"                         67 #include "G4DataVector.hh"
 57 #include "G4PhysicsTable.hh"                       68 #include "G4PhysicsTable.hh"
 58 #include "G4EmDataHandler.hh"                  <<  69 #include "G4PhysicsVector.hh"
 59 #include "G4PhysicsLogVector.hh"                   70 #include "G4PhysicsLogVector.hh"
 60 #include "G4VParticleChange.hh"                    71 #include "G4VParticleChange.hh"
 61 #include "G4ProductionCutsTable.hh"                72 #include "G4ProductionCutsTable.hh"
 62 #include "G4Region.hh"                             73 #include "G4Region.hh"
                                                   >>  74 #include "G4RegionStore.hh"
 63 #include "G4Gamma.hh"                              75 #include "G4Gamma.hh"
 64 #include "G4Electron.hh"                           76 #include "G4Electron.hh"
 65 #include "G4Positron.hh"                           77 #include "G4Positron.hh"
 66 #include "G4PhysicsTableHelper.hh"                 78 #include "G4PhysicsTableHelper.hh"
 67 #include "G4EmBiasingManager.hh"               << 
 68 #include "G4EmParameters.hh"                   << 
 69 #include "G4EmProcessSubType.hh"               << 
 70 #include "G4EmTableUtil.hh"                    << 
 71 #include "G4EmUtility.hh"                      << 
 72 #include "G4DNAModelSubType.hh"                << 
 73 #include "G4GenericIon.hh"                     << 
 74 #include "G4Log.hh"                            << 
 75 #include <iostream>                            << 
 76                                                    79 
 77 //....oooOO0OOooo........oooOO0OOooo........oo     80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 78                                                    81 
 79 G4VEmProcess::G4VEmProcess(const G4String& nam     82 G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
 80   G4VDiscreteProcess(name, type)               <<  83                       G4VDiscreteProcess(name, type),
                                                   >>  84   selectedModel(0),         
                                                   >>  85   theLambdaTable(0),
                                                   >>  86   theEnergyOfCrossSectionMax(0),
                                                   >>  87   theCrossSectionMax(0),
                                                   >>  88   particle(0),
                                                   >>  89   secondaryParticle(0),
                                                   >>  90   nLambdaBins(90),
                                                   >>  91   lambdaFactor(0.8),
                                                   >>  92   currentCouple(0),
                                                   >>  93   integral(false),
                                                   >>  94   buildLambdaTable(true),
                                                   >>  95   applyCuts(false),
                                                   >>  96   startFromNull(true),
                                                   >>  97   nRegions(0)
 81 {                                                  98 {
 82   theParameters = G4EmParameters::Instance();  << 
 83   SetVerboseLevel(1);                              99   SetVerboseLevel(1);
 84                                                << 100   minKinEnergy = 0.1*keV;
 85   // Size of tables                            << 101   maxKinEnergy = 100.0*GeV;
 86   minKinEnergy = 0.1*CLHEP::keV;               << 102   theGamma     = G4Gamma::Gamma();
 87   maxKinEnergy = 100.0*CLHEP::TeV;             << 103   theElectron  = G4Electron::Electron();
 88                                                << 104   thePositron  = G4Positron::Positron();
 89   // default lambda factor                     << 
 90   invLambdaFactor = 1.0/lambdaFactor;          << 
 91                                                << 
 92   // particle types                            << 
 93   theGamma = G4Gamma::Gamma();                 << 
 94   theElectron = G4Electron::Electron();        << 
 95   thePositron = G4Positron::Positron();        << 
 96                                                   105 
 97   pParticleChange = &fParticleChange;             106   pParticleChange = &fParticleChange;
 98   fParticleChange.SetSecondaryWeightByProcess( << 
 99   secParticles.reserve(5);                        107   secParticles.reserve(5);
100                                                   108 
101   modelManager = new G4EmModelManager();          109   modelManager = new G4EmModelManager();
102   lManager = G4LossTableManager::Instance();   << 110   (G4LossTableManager::Instance())->Register(this);
103   lManager->Register(this);                    << 
104   isTheMaster = lManager->IsMaster();          << 
105   G4LossTableBuilder* bld = lManager->GetTable << 
106   theDensityFactor = bld->GetDensityFactors(); << 
107   theDensityIdx = bld->GetCoupleIndexes();     << 
108 }                                                 111 }
109                                                   112 
110 //....oooOO0OOooo........oooOO0OOooo........oo    113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
111                                                   114 
112 G4VEmProcess::~G4VEmProcess()                     115 G4VEmProcess::~G4VEmProcess()
113 {                                                 116 {
114   if(isTheMaster) {                            << 117   if(1 < verboseLevel) 
115     delete theData;                            << 118     G4cout << "G4VEmProcess destruct " << GetProcessName() 
116     delete theEnergyOfCrossSectionMax;         << 119      << G4endl;
117   }                                            << 120   Clear();
                                                   >> 121   if(theLambdaTable) theLambdaTable->clearAndDestroy();
118   delete modelManager;                            122   delete modelManager;
119   delete biasManager;                          << 123   (G4LossTableManager::Instance())->DeRegister(this);
120   lManager->DeRegister(this);                  << 
121 }                                                 124 }
122                                                   125 
123 //....oooOO0OOooo........oooOO0OOooo........oo    126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
124                                                   127 
125 void G4VEmProcess::AddEmModel(G4int order, G4V << 128 void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
126                               const G4Region*  << 
127 {                                                 129 {
128   if(nullptr == ptr) { return; }               << 130   if(!particle) particle = &part;
129   G4VEmFluctuationModel* fm = nullptr;         << 131   if(1 < verboseLevel) {
130   modelManager->AddEmModel(order, ptr, fm, reg << 132     G4cout << "G4VEmProcess::PreparePhysicsTable() for "
131   ptr->SetParticleChange(pParticleChange);     << 133            << GetProcessName()
132 }                                              << 134            << " and particle " << part.GetParticleName()
133                                                << 135      << " local particle " << particle->GetParticleName() 
134 //....oooOO0OOooo........oooOO0OOooo........oo << 136            << G4endl;
                                                   >> 137   }
135                                                   138 
136 void G4VEmProcess::SetEmModel(G4VEmModel* ptr, << 139   if(particle == &part) {
137 {                                              << 140     Clear();
138   if(nullptr == ptr) { return; }               << 141     InitialiseProcess(particle);
139   if(!emModels.empty()) {                      << 142     theCutsGamma =
140     for(auto & em : emModels) { if(em == ptr)  << 143         modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
                                                   >> 144     const G4ProductionCutsTable* theCoupleTable=
                                                   >> 145           G4ProductionCutsTable::GetProductionCutsTable();
                                                   >> 146     theCutsGamma    = theCoupleTable->GetEnergyCutsVector(idxG4GammaCut);
                                                   >> 147     theCutsElectron = theCoupleTable->GetEnergyCutsVector(idxG4ElectronCut);
                                                   >> 148     theCutsPositron = theCoupleTable->GetEnergyCutsVector(idxG4PositronCut);
                                                   >> 149     if(buildLambdaTable)
                                                   >> 150       theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
141   }                                               151   }
142   emModels.push_back(ptr);                     << 
143 }                                                 152 }
144                                                   153 
145 //....oooOO0OOooo........oooOO0OOooo........oo    154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
146                                                   155 
147 void G4VEmProcess::PreparePhysicsTable(const G << 156 void G4VEmProcess::Clear()
148 {                                              << 157 {
149   if(nullptr == particle) { SetParticle(&part) << 158   if(theEnergyOfCrossSectionMax) delete [] theEnergyOfCrossSectionMax;
150                                                << 159   if(theCrossSectionMax) delete [] theCrossSectionMax;
151   if(part.GetParticleType() == "nucleus" &&    << 160   theEnergyOfCrossSectionMax = 0;
152      part.GetParticleSubType() == "generic") { << 161   theCrossSectionMax = 0;
153                                                << 162   currentCouple = 0;
154     G4String pname = part.GetParticleName();   << 
155     if(pname != "deuteron" && pname != "triton << 
156        pname != "He3" && pname != "alpha" && p << 
157        pname != "helium" && pname != "hydrogen << 
158                                                << 
159       particle = G4GenericIon::GenericIon();   << 
160       isIon = true;                            << 
161     }                                          << 
162   }                                            << 
163   if(particle != &part) { return; }            << 
164                                                << 
165   lManager->PreparePhysicsTable(&part, this);  << 
166                                                << 
167   // for new run                               << 
168   currentCouple = nullptr;                     << 
169   preStepLambda = 0.0;                            163   preStepLambda = 0.0;
170   fLambdaEnergy = 0.0;                         << 164   mfpKinEnergy  = DBL_MAX;
171                                                << 
172   InitialiseProcess(particle);                 << 
173                                                << 
174   G4LossTableBuilder* bld = lManager->GetTable << 
175   const G4ProductionCutsTable* theCoupleTable= << 
176     G4ProductionCutsTable::GetProductionCutsTa << 
177   theCutsGamma    = theCoupleTable->GetEnergyC << 
178   theCutsElectron = theCoupleTable->GetEnergyC << 
179   theCutsPositron = theCoupleTable->GetEnergyC << 
180                                                << 
181   // initialisation of the process             << 
182   if(!actMinKinEnergy) { minKinEnergy = thePar << 
183   if(!actMaxKinEnergy) { maxKinEnergy = thePar << 
184                                                << 
185   applyCuts       = theParameters->ApplyCuts() << 
186   lambdaFactor    = theParameters->LambdaFacto << 
187   invLambdaFactor = 1.0/lambdaFactor;          << 
188   theParameters->DefineRegParamForEM(this);    << 
189                                                << 
190   // integral option may be disabled           << 
191   if(!theParameters->Integral()) { fXSType = f << 
192                                                << 
193   // prepare tables                            << 
194   if(isTheMaster) {                            << 
195     if(nullptr == theData) { theData = new G4E << 
196                                                << 
197     if(buildLambdaTable) {                     << 
198       theLambdaTable = theData->MakeTable(0);  << 
199       bld->InitialiseBaseMaterials(theLambdaTa << 
200     }                                          << 
201     // high energy table                       << 
202     if(minKinEnergyPrim < maxKinEnergy) {      << 
203       theLambdaTablePrim = theData->MakeTable( << 
204       bld->InitialiseBaseMaterials(theLambdaTa << 
205     }                                          << 
206   }                                            << 
207   // models                                    << 
208   baseMat = bld->GetBaseMaterialFlag();        << 
209   numberOfModels = modelManager->NumberOfModel << 
210   currentModel = modelManager->GetModel(0);    << 
211   if(nullptr != lManager->AtomDeexcitation())  << 
212     modelManager->SetFluoFlag(true);           << 
213   }                                            << 
214   // forced biasing                            << 
215   if(nullptr != biasManager) {                 << 
216     biasManager->Initialise(part, GetProcessNa << 
217     biasFlag = false;                          << 
218   }                                            << 
219                                                << 
220   theCuts =                                    << 
221     G4EmTableUtil::PrepareEmProcess(this, part << 
222                                     modelManag << 
223                                     secID, tri << 
224                                     verboseLev << 
225 }                                                 165 }
226                                                   166 
227 //....oooOO0OOooo........oooOO0OOooo........oo    167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
228                                                   168 
229 void G4VEmProcess::BuildPhysicsTable(const G4P    169 void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
230 {                                                 170 {
231   if(nullptr == masterProc) {                  << 171   if(1 < verboseLevel) {
232     if(isTheMaster) { masterProc = this; }     << 172     G4cout << "G4VEmProcess::BuildPhysicsTable() for "
233     else { masterProc = static_cast<const G4VE << 173            << GetProcessName()
234   }                                            << 174            << " and particle " << part.GetParticleName()
235   G4int nModels = modelManager->NumberOfModels << 175      << " buildLambdaTable= " << buildLambdaTable
236   G4bool isLocked = theParameters->IsPrintLock << 176            << G4endl;
237   G4bool toBuild = (buildLambdaTable || minKin << 
238                                                << 
239   G4EmTableUtil::BuildEmProcess(this, masterPr << 
240                                 nModels, verbo << 
241                                 isLocked, toBu << 
242 }                                              << 
243                                                << 
244 //....oooOO0OOooo........oooOO0OOooo........oo << 
245                                                << 
246 void G4VEmProcess::BuildLambdaTable()          << 
247 {                                              << 
248   G4double scale = theParameters->MaxKinEnergy << 
249   G4int nbin =                                 << 
250     theParameters->NumberOfBinsPerDecade()*G4l << 
251   if(actBinning) { nbin = std::max(nbin, nLamb << 
252   scale = nbin/G4Log(scale);                   << 
253                                                << 
254   G4LossTableBuilder* bld = lManager->GetTable << 
255   G4EmTableUtil::BuildLambdaTable(this, partic << 
256                                   bld, theLamb << 
257                                   minKinEnergy << 
258                                   maxKinEnergy << 
259                                   startFromNul << 
260 }                                              << 
261                                                << 
262 //....oooOO0OOooo........oooOO0OOooo........oo << 
263                                                << 
264 void G4VEmProcess::StreamInfo(std::ostream& ou << 
265                   const G4ParticleDefinition&  << 
266 {                                              << 
267   G4String indent = (rst ? "  " : "");         << 
268   out << std::setprecision(6);                 << 
269   out << G4endl << indent << GetProcessName()  << 
270   if (!rst) {                                  << 
271     out << " for " << part.GetParticleName();  << 
272   }                                            << 
273   if(fXSType != fEmNoIntegral)  { out << " XSt << 
274   if(applyCuts) { out << " applyCuts:1 "; }    << 
275   G4int subtype = GetProcessSubType();         << 
276   out << " SubType=" << subtype;               << 
277   if (subtype == fAnnihilation) {              << 
278     G4int mod = theParameters->PositronAtRestM << 
279     const G4String namp[2] = {"Simple", "Allis << 
280     out << " AtRestModel:" << namp[mod];       << 
281   }                                               177   }
282   if(biasFactor != 1.0) { out << "  BiasingFac << 178 
283   out << " BuildTable=" << buildLambdaTable << << 
284   if(buildLambdaTable) {                          179   if(buildLambdaTable) {
285     if(particle == &part) {                    << 180     BuildLambdaTable();
286       for(auto & v : *theLambdaTable) {        << 181     FindLambdaMax();
287         if(nullptr != v) {                     << 
288           out << "      Lambda table from ";   << 
289           G4double emin = v->Energy(0);        << 
290           G4double emax = v->GetMaxEnergy();   << 
291           G4int nbin = G4int(v->GetVectorLengt << 
292           if(emin > minKinEnergy) { out << "th << 
293           else { out << G4BestUnit(emin,"Energ << 
294           out << " to "                        << 
295               << G4BestUnit(emax,"Energy")     << 
296               << ", " << G4lrint(nbin/std::log << 
297               << " bins/decade, spline: "      << 
298               << splineFlag << G4endl;         << 
299           break;                               << 
300         }                                      << 
301       }                                        << 
302     } else {                                   << 
303       out << "      Used Lambda table of "     << 
304       << particle->GetParticleName() << G4endl << 
305     }                                          << 
306   }                                            << 
307   if(minKinEnergyPrim < maxKinEnergy) {        << 
308     if(particle == &part) {                    << 
309       for(auto & v : *theLambdaTablePrim) {    << 
310         if(nullptr != v) {                     << 
311           out << "      LambdaPrime table from << 
312               << G4BestUnit(v->Energy(0),"Ener << 
313               << " to "                        << 
314               << G4BestUnit(v->GetMaxEnergy(), << 
315               << " in " << v->GetVectorLength( << 
316               << " bins " << G4endl;           << 
317           break;                               << 
318         }                                      << 
319       }                                        << 
320     } else {                                   << 
321       out << "      Used LambdaPrime table of  << 
322                << particle->GetParticleName()  << 
323     }                                          << 
324   }                                               182   }
325   StreamProcessInfo(out);                      << 183   if(0 < verboseLevel) PrintInfoDefinition();
326   modelManager->DumpModelList(out, verboseLeve << 
327                                                   184 
328   if(verboseLevel > 2 && buildLambdaTable) {   << 185   if(1 < verboseLevel) {
329     out << "      LambdaTable address= " << th << 186     G4cout << "G4VEmProcess::BuildPhysicsTable() done for "
330     if(theLambdaTable && particle == &part) {  << 187            << GetProcessName()
331       out << (*theLambdaTable) << G4endl;      << 188            << " and particle " << part.GetParticleName()
332     }                                          << 189            << G4endl;
333   }                                               190   }
334 }                                                 191 }
335                                                   192 
336 //....oooOO0OOooo........oooOO0OOooo........oo    193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
337                                                   194 
338 void G4VEmProcess::StartTracking(G4Track* trac << 195 void G4VEmProcess::BuildLambdaTable()
339 {                                                 196 {
340   // reset parameters for the new track        << 197   if(1 < verboseLevel) {
341   currentParticle = track->GetParticleDefiniti << 198     G4cout << "G4EmProcess::BuildLambdaTable() for process "
342   theNumberOfInteractionLengthLeft = -1.0;     << 199            << GetProcessName() << " and particle "
343   mfpKinEnergy = DBL_MAX;                      << 200            << particle->GetParticleName()
344   preStepLambda = 0.0;                         << 201            << G4endl;
345                                                << 
346   if(isIon) { massRatio = proton_mass_c2/curre << 
347                                                << 
348   // forced biasing only for primary particles << 
349   if(biasManager) {                            << 
350     if(0 == track->GetParentID()) {            << 
351       // primary particle                      << 
352       biasFlag = true;                         << 
353       biasManager->ResetForcedInteraction();   << 
354     }                                          << 
355   }                                               202   }
356 }                                              << 
357                                                   203 
358 //....oooOO0OOooo........oooOO0OOooo........oo << 204   // Access to materials
359                                                << 205   const G4ProductionCutsTable* theCoupleTable=
360 G4double G4VEmProcess::PostStepGetPhysicalInte << 206         G4ProductionCutsTable::GetProductionCutsTable();
361                              const G4Track& tr << 207   size_t numOfCouples = theCoupleTable->GetTableSize();
362                              G4double   previo << 208   for(size_t i=0; i<numOfCouples; i++) {
363                              G4ForceCondition* << 209 
364 {                                              << 210     if (theLambdaTable->GetFlag(i)) {
365   *condition = NotForced;                      << 211 
366   G4double x = DBL_MAX;                        << 212       // create physics vector and fill it
367                                                << 213       const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
368   DefineMaterial(track.GetMaterialCutsCouple() << 214       G4PhysicsVector* aVector = LambdaPhysicsVector(couple);
369   preStepKinEnergy = track.GetKineticEnergy(); << 215       modelManager->FillLambdaVector(aVector, couple, startFromNull);
370   const G4double scaledEnergy = preStepKinEner << 216       G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
371   SelectModel(scaledEnergy, currentCoupleIndex << 
372   /*                                           << 
373   G4cout << "PostStepGetPhysicalInteractionLen << 
374          << "  couple: " << currentCouple << G << 
375   */                                           << 
376   if(!currentModel->IsActive(scaledEnergy)) {  << 
377     theNumberOfInteractionLengthLeft = -1.0;   << 
378     currentInteractionLength = DBL_MAX;        << 
379     mfpKinEnergy = DBL_MAX;                    << 
380     preStepLambda = 0.0;                       << 
381     return x;                                  << 
382   }                                            << 
383                                                << 
384   // forced biasing only for primary particles << 
385   if(biasManager) {                            << 
386     if(0 == track.GetParentID()) {             << 
387       if(biasFlag &&                           << 
388          biasManager->ForcedInteractionRegion( << 
389         return biasManager->GetStepLimit((G4in << 
390       }                                        << 
391     }                                             217     }
392   }                                               218   }
393                                                   219 
394   // compute mean free path                    << 220   if(1 < verboseLevel) {
395                                                << 221     G4cout << "Lambda table is built for "
396   ComputeIntegralLambda(preStepKinEnergy, trac << 222            << particle->GetParticleName()
397                                                << 223            << G4endl;
398   // zero cross section                        << 224     if(2 < verboseLevel) {
399   if(preStepLambda <= 0.0) {                   << 225       G4cout << *theLambdaTable << G4endl;
400     theNumberOfInteractionLengthLeft = -1.0;   << 
401     currentInteractionLength = DBL_MAX;        << 
402                                                << 
403   } else {                                     << 
404                                                << 
405     // non-zero cross section                  << 
406     if (theNumberOfInteractionLengthLeft < 0.0 << 
407                                                << 
408       // beggining of tracking (or just after  << 
409       theNumberOfInteractionLengthLeft = -G4Lo << 
410       theInitialNumberOfInteractionLength = th << 
411                                                << 
412     } else {                                   << 
413                                                << 
414       theNumberOfInteractionLengthLeft -=      << 
415         previousStepSize/currentInteractionLen << 
416       theNumberOfInteractionLengthLeft =       << 
417         std::max(theNumberOfInteractionLengthL << 
418     }                                             226     }
419                                                << 
420     // new mean free path and step limit for t << 
421     currentInteractionLength = 1.0/preStepLamb << 
422     x = theNumberOfInteractionLengthLeft * cur << 
423   }                                               227   }
424   return x;                                    << 
425 }                                                 228 }
426                                                   229 
427 //....oooOO0OOooo........oooOO0OOooo........oo    230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
428                                                   231 
429 void G4VEmProcess::ComputeIntegralLambda(G4dou << 232 void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, 
                                                   >> 233             const G4Region* region)
430 {                                                 234 {
431   if (fXSType == fEmNoIntegral) {              << 235   modelManager->AddEmModel(order, p, 0, region);
432     preStepLambda = GetCurrentLambda(e, LogEki << 236   if(p) p->SetParticleChange(pParticleChange);
433                                                << 
434   } else if (fXSType == fEmIncreasing) {       << 
435     if(e*invLambdaFactor < mfpKinEnergy) {     << 
436       preStepLambda = GetCurrentLambda(e, LogE << 
437       mfpKinEnergy = (preStepLambda > 0.0) ? e << 
438     }                                          << 
439                                                << 
440   } else if(fXSType == fEmDecreasing) {        << 
441     if(e < mfpKinEnergy) {                     << 
442       const G4double e1 = e*lambdaFactor;      << 
443       preStepLambda = GetCurrentLambda(e1);    << 
444       mfpKinEnergy = e1;                       << 
445     }                                          << 
446                                                << 
447   } else if(fXSType == fEmOnePeak) {           << 
448     const G4double epeak = (*theEnergyOfCrossS << 
449     if(e <= epeak) {                           << 
450       if(e*invLambdaFactor < mfpKinEnergy) {   << 
451         preStepLambda = GetCurrentLambda(e, Lo << 
452         mfpKinEnergy = (preStepLambda > 0.0) ? << 
453       }                                        << 
454     } else if(e < mfpKinEnergy) {              << 
455       const G4double e1 = std::max(epeak, e*la << 
456       preStepLambda = GetCurrentLambda(e1);    << 
457       mfpKinEnergy = e1;                       << 
458     }                                          << 
459   } else {                                     << 
460     preStepLambda = GetCurrentLambda(e, LogEki << 
461   }                                            << 
462 }                                                 237 }
463                                                   238 
464 //....oooOO0OOooo........oooOO0OOooo........oo    239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
465                                                   240 
466 G4VParticleChange* G4VEmProcess::PostStepDoIt(    241 G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
467                                                << 242                                               const G4Step&)
468 {                                                 243 {
469   // clear number of interaction lengths in an << 
470   theNumberOfInteractionLengthLeft = -1.0;     << 
471   mfpKinEnergy = DBL_MAX;                      << 
472                                                << 
473   fParticleChange.InitializeForPostStep(track)    244   fParticleChange.InitializeForPostStep(track);
474                                                   245 
475   // Do not make anything if particle is stopp    246   // Do not make anything if particle is stopped, the annihilation then
476   // should be performed by the AtRestDoIt!       247   // should be performed by the AtRestDoIt!
477   if (track.GetTrackStatus() == fStopButAlive) << 248   if (track.GetTrackStatus() == fStopButAlive) return &fParticleChange;
478                                                   249 
479   const G4double finalT = track.GetKineticEner << 250   G4double finalT = track.GetKineticEnergy();
480                                                   251 
481   // forced process - should happen only once  << 252   // Integral approach
482   if(biasFlag) {                               << 253   if (integral) {
483     if(biasManager->ForcedInteractionRegion((G << 254     G4double lx = GetLambda(finalT, currentCouple);
484       biasFlag = false;                        << 255     if(preStepLambda<lx && 1 < verboseLevel) {
                                                   >> 256       G4cout << "WARING: for " << particle->GetParticleName() 
                                                   >> 257              << " and " << GetProcessName()
                                                   >> 258              << " E(MeV)= " << finalT/MeV
                                                   >> 259              << " preLambda= " << preStepLambda << " < " << lx << " (postLambda) "
                                                   >> 260        << G4endl;  
485     }                                             261     }
486   }                                            << 
487                                                   262 
488   // check active and select model             << 263     if(preStepLambda*G4UniformRand() > lx) {
489   const G4double scaledEnergy = finalT*massRat << 264       ClearNumberOfInteractionLengthLeft();
490   SelectModel(scaledEnergy, currentCoupleIndex << 
491   if(!currentModel->IsActive(scaledEnergy)) {  << 
492                                                << 
493   // Integral approach                         << 
494   if (fXSType != fEmNoIntegral) {              << 
495     const G4double logFinalT =                 << 
496       track.GetDynamicParticle()->GetLogKineti << 
497     const G4double lx = std::max(GetCurrentLam << 
498 #ifdef G4VERBOSE                               << 
499     if(preStepLambda < lx && 1 < verboseLevel) << 
500       G4cout << "WARNING: for " << currentPart << 
501              << " and " << GetProcessName() << << 
502              << " preLambda= " << preStepLambd << 
503              << " < " << lx << " (postLambda)  << 
504     }                                          << 
505 #endif                                         << 
506     // if false interaction then use new cross << 
507     // if both values are zero - no interactio << 
508     if(preStepLambda*G4UniformRand() >= lx) {  << 
509       return &fParticleChange;                    265       return &fParticleChange;
510     }                                             266     }
511   }                                               267   }
512                                                   268 
513   // define new weight for primary and seconda << 269   G4VEmModel* currentModel = SelectModel(finalT);
514   G4double weight = fParticleChange.GetParentW << 270 
515   if(weightFlag) {                             << 271   /*  
516     weight /= biasFactor;                      << 272   if(0 < verboseLevel) {
517     fParticleChange.ProposeWeight(weight);     << 
518   }                                            << 
519                                                << 
520 #ifdef G4VERBOSE                               << 
521   if(1 < verboseLevel) {                       << 
522     G4cout << "G4VEmProcess::PostStepDoIt: Sam    273     G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
523            << finalT/MeV                          274            << finalT/MeV
524            << " MeV; model= (" << currentModel    275            << " MeV; model= (" << currentModel->LowEnergyLimit()
525            << ", " <<  currentModel->HighEnerg    276            << ", " <<  currentModel->HighEnergyLimit() << ")"
526            << G4endl;                             277            << G4endl;
527   }                                               278   }
528 #endif                                         << 279   */
529                                                   280 
                                                   >> 281   
530   // sample secondaries                           282   // sample secondaries
531   secParticles.clear();                           283   secParticles.clear();
532   currentModel->SampleSecondaries(&secParticle    284   currentModel->SampleSecondaries(&secParticles, 
533                                   currentCoupl << 285           currentCouple, 
534                                   track.GetDyn << 286           track.GetDynamicParticle());
535                                   (*theCuts)[c << 
536                                                << 
537   G4int num0 = (G4int)secParticles.size();     << 
538                                                << 
539   // splitting or Russian roulette             << 
540   if(biasManager) {                            << 
541     if(biasManager->SecondaryBiasingRegion((G4 << 
542       G4double eloss = 0.0;                    << 
543       weight *= biasManager->ApplySecondaryBia << 
544         secParticles, track, currentModel, &fP << 
545         (G4int)currentCoupleIndex, (*theCuts)[ << 
546         step.GetPostStepPoint()->GetSafety()); << 
547       if(eloss > 0.0) {                        << 
548         eloss += fParticleChange.GetLocalEnerg << 
549         fParticleChange.ProposeLocalEnergyDepo << 
550       }                                        << 
551     }                                          << 
552   }                                            << 
553                                                   287 
554   // save secondaries                             288   // save secondaries
555   G4int num = (G4int)secParticles.size();      << 289   G4int num = secParticles.size();
556   if(num > 0) {                                   290   if(num > 0) {
557                                                   291 
558     fParticleChange.SetNumberOfSecondaries(num    292     fParticleChange.SetNumberOfSecondaries(num);
559     G4double edep = fParticleChange.GetLocalEn    293     G4double edep = fParticleChange.GetLocalEnergyDeposit();
560     G4double time = track.GetGlobalTime();     << 
561                                                << 
562     G4int n1(0), n2(0);                        << 
563     if(num0 > mainSecondaries) {               << 
564       currentModel->FillNumberOfSecondaries(n1 << 
565     }                                          << 
566                                                   294      
567     for (G4int i=0; i<num; ++i) {              << 295     for (G4int i=0; i<num; i++) {
568       G4DynamicParticle* dp = secParticles[i];    296       G4DynamicParticle* dp = secParticles[i];
569       if (nullptr != dp) {                     << 297       const G4ParticleDefinition* p = dp->GetDefinition();
570         const G4ParticleDefinition* p = dp->Ge << 298       G4double e = dp->GetKineticEnergy();
571         G4double e = dp->GetKineticEnergy();   << 299       G4bool good = true;
572         G4bool good = true;                    << 300       if(applyCuts) {
573         if(applyCuts) {                        << 301   if (p == theGamma) {
574           if (p == theGamma) {                 << 302     if (e < (*theCutsGamma)[currentMaterialIndex]) good = false;
575             if (e < (*theCutsGamma)[currentCou << 303 
576                                                << 304   } else if (p == theElectron) {
577           } else if (p == theElectron) {       << 305     if (e < (*theCutsElectron)[currentMaterialIndex]) good = false;
578             if (e < (*theCutsElectron)[current << 306 
579                                                << 307   } else if (p == thePositron) {
580           } else if (p == thePositron) {       << 308     if (e < (*theCutsPositron)[currentMaterialIndex]) {
581             if (electron_mass_c2 < (*theCutsGa << 309       good = false;
582                 e < (*theCutsPositron)[current << 310       e += 2.0*electron_mass_c2;
583               good = false;                    << 311     }
584               e += 2.0*electron_mass_c2;       << 312   }
585             }                                  << 313         if(!good) {
586           }                                    << 314     delete dp;
587           // added secondary if it is good     << 315     edep += e;
588         }                                      << 316   }
589         if (good) {                            << 317       }
590           G4Track* t = new G4Track(dp, time, t << 318       if (good) fParticleChange.AddSecondary(dp);
591           t->SetTouchableHandle(track.GetTouch << 319     } 
592           if (biasManager) {                   << 
593             t->SetWeight(weight * biasManager- << 
594           } else {                             << 
595             t->SetWeight(weight);              << 
596           }                                    << 
597           pParticleChange->AddSecondary(t);    << 
598                                                << 
599           // define type of secondary          << 
600           if(i < mainSecondaries) {            << 
601             t->SetCreatorModelID(secID);       << 
602             if(GetProcessSubType() == fCompton << 
603               t->SetCreatorModelID(_ComptonGam << 
604             }                                  << 
605           } else if(i < mainSecondaries + n1)  << 
606             t->SetCreatorModelID(tripletID);   << 
607           } else if(i < mainSecondaries + n1 + << 
608             t->SetCreatorModelID(_IonRecoil);  << 
609           } else {                             << 
610             if(i < num0) {                     << 
611               if(p == theGamma) {              << 
612                 t->SetCreatorModelID(fluoID);  << 
613               } else {                         << 
614                 t->SetCreatorModelID(augerID); << 
615               }                                << 
616             } else {                           << 
617               t->SetCreatorModelID(biasID);    << 
618             }                                  << 
619           }                                    << 
620           /*                                   << 
621           G4cout << "Secondary(post step) has  << 
622                  << ", Ekin= " << t->GetKineti << 
623                  << GetProcessName() << " fluo << 
624                  << " augerID= " << augerID << << 
625           */                                   << 
626         } else {                               << 
627           delete dp;                           << 
628           edep += e;                           << 
629         }                                      << 
630       }                                        << 
631     }                                          << 
632     fParticleChange.ProposeLocalEnergyDeposit(    320     fParticleChange.ProposeLocalEnergyDeposit(edep);
633   }                                               321   }
634                                                   322 
635   if(0.0 == fParticleChange.GetProposedKinetic << 323   ClearNumberOfInteractionLengthLeft();
636      fAlive == fParticleChange.GetTrackStatus( << 
637     if(particle->GetProcessManager()->GetAtRes << 
638          { fParticleChange.ProposeTrackStatus( << 
639     else { fParticleChange.ProposeTrackStatus( << 
640   }                                            << 
641                                                << 
642   return &fParticleChange;                        324   return &fParticleChange;
643 }                                                 325 }
644                                                   326 
645 //....oooOO0OOooo........oooOO0OOooo........oo    327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
646                                                   328 
647 G4bool G4VEmProcess::StorePhysicsTable(const G << 329 void G4VEmProcess::PrintInfoDefinition()
648                                        const G << 
649                                        G4bool  << 
650 {                                                 330 {
651   if(!isTheMaster || part != particle) { retur << 331   if(verboseLevel > 0) {
652   if(G4EmTableUtil::StoreTable(this, part, the << 332     G4cout << G4endl << GetProcessName() << ": " ;
653              directory, "Lambda",              << 333     PrintInfo();
654                                verboseLevel, a << 334     if(integral) {
655      G4EmTableUtil::StoreTable(this, part, the << 335       G4cout << "      Integral mode is used  "<< G4endl;
656              directory, "LambdaPrim",          << 336     }
657                                verboseLevel, a << 
658      return true;                              << 
659   }                                               337   }
660   return false;                                << 
661 }                                              << 
662                                                << 
663 //....oooOO0OOooo........oooOO0OOooo........oo << 
664                                                   338 
665 G4bool G4VEmProcess::RetrievePhysicsTable(cons << 339   if (!buildLambdaTable)  return;
666                                           cons << 340   
667                                           G4bo << 341   if(verboseLevel > 0) {
668 {                                              << 342     G4cout << "      tables are built for  "
669   if(!isTheMaster || part != particle) { retur << 343            << particle->GetParticleName()
670   G4bool yes = true;                           << 344            << G4endl
671   if(buildLambdaTable) {                       << 345            << "      Lambda tables from "
672     yes = G4EmTableUtil::RetrieveTable(this, p << 346            << G4BestUnit(minKinEnergy,"Energy") 
673                                        "Lambda << 347            << " to "
674                                        ascii,  << 348            << G4BestUnit(maxKinEnergy,"Energy")
675   }                                            << 349            << " in " << nLambdaBins << " bins."
676   if(yes && minKinEnergyPrim < maxKinEnergy) { << 350            << G4endl;
677     yes = G4EmTableUtil::RetrieveTable(this, p << 
678                                        "Lambda << 
679                                        ascii,  << 
680   }                                               351   }
681   return yes;                                  << 
682 }                                              << 
683                                                << 
684 //....oooOO0OOooo........oooOO0OOooo........oo << 
685                                                << 
686 G4double G4VEmProcess::GetCrossSection(G4doubl << 
687                                        const G << 
688 {                                              << 
689   CurrentSetup(couple, kinEnergy);             << 
690   return GetCurrentLambda(kinEnergy, G4Log(kin << 
691 }                                              << 
692                                                << 
693 //....oooOO0OOooo........oooOO0OOooo........oo << 
694                                                   352 
695 G4double G4VEmProcess::GetMeanFreePath(const G << 353   if(verboseLevel > 1) {
696                                        G4doubl << 354     G4cout << "Tables are built for " << particle->GetParticleName()
697                                        G4Force << 355            << G4endl;
698 {                                              << 
699   *condition = NotForced;                      << 
700   return G4VEmProcess::MeanFreePath(track);    << 
701 }                                              << 
702                                                << 
703 //....oooOO0OOooo........oooOO0OOooo........oo << 
704                                                   356 
705 G4double                                       << 357   if(verboseLevel > 2) {
706 G4VEmProcess::ComputeCrossSectionPerAtom(G4dou << 358     G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
707                                          G4dou << 359     if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
708 {                                              << 360     }
709   SelectModel(kinEnergy, currentCoupleIndex);  << 361   }
710   return (currentModel) ?                      << 
711     currentModel->ComputeCrossSectionPerAtom(c << 
712                                              Z << 
713 }                                                 362 }
714                                                   363 
715 //....oooOO0OOooo........oooOO0OOooo........oo    364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
716                                                   365 
717 G4PhysicsVector*                               << 366 G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
718 G4VEmProcess::LambdaPhysicsVector(const G4Mate << 367                                          const G4MaterialCutsCouple* couple)
719 {                                                 368 {
                                                   >> 369   // Cross section per atom is calculated
720   DefineMaterial(couple);                         370   DefineMaterial(couple);
721   G4PhysicsVector* newv = new G4PhysicsLogVect << 371   G4double cross = 0.0;
722                                                << 372   G4bool b;
723   return newv;                                 << 373   if(theLambdaTable) {
724 }                                              << 374     cross = (((*theLambdaTable)[currentMaterialIndex])->
725                                                << 375                            GetValue(kineticEnergy, b));
726 //....oooOO0OOooo........oooOO0OOooo........oo << 
727                                                << 
728 const G4Element* G4VEmProcess::GetCurrentEleme << 
729 {                                              << 
730   return (nullptr != currentModel) ?           << 
731     currentModel->GetCurrentElement(currentMat << 
732 }                                              << 
733                                                   376 
734 //....oooOO0OOooo........oooOO0OOooo........oo << 377     cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
                                                   >> 378   } else {
                                                   >> 379     G4VEmModel* model = SelectModel(kineticEnergy);
                                                   >> 380     cross = 
                                                   >> 381       model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
                                                   >> 382   }
735                                                   383 
736 const G4Element* G4VEmProcess::GetTargetElemen << 384   return cross;
737 {                                              << 
738   return (nullptr != currentModel) ?           << 
739     currentModel->GetCurrentElement(currentMat << 
740 }                                                 385 }
741                                                   386 
742 //....oooOO0OOooo........oooOO0OOooo........oo    387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
743                                                   388 
744 const G4Isotope* G4VEmProcess::GetTargetIsotop << 389 G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
                                                   >> 390                const G4String& directory,
                                                   >> 391                      G4bool ascii)
745 {                                                 392 {
746   return (nullptr != currentModel) ?           << 393   G4bool yes = true;
747     currentModel->GetCurrentIsotope(GetCurrent << 
748 }                                              << 
749                                                   394 
750 //....oooOO0OOooo........oooOO0OOooo........oo << 395   if ( theLambdaTable && part == particle) {
                                                   >> 396     const G4String name = 
                                                   >> 397       GetPhysicsTableFileName(part,directory,"Lambda",ascii);
                                                   >> 398     yes = theLambdaTable->StorePhysicsTable(name,ascii);
751                                                   399 
752 void G4VEmProcess::SetCrossSectionBiasingFacto << 400     if ( yes ) {
753 {                                              << 401       G4cout << "Physics tables are stored for " << particle->GetParticleName()
754   if(f > 0.0) {                                << 
755     biasFactor = f;                            << 
756     weightFlag = flag;                         << 
757     if(1 < verboseLevel) {                     << 
758       G4cout << "### SetCrossSectionBiasingFac << 
759              << particle->GetParticleName()    << 
760              << " and process " << GetProcessN    402              << " and process " << GetProcessName()
761              << " biasFactor= " << f << " weig << 403        << " in the directory <" << directory
762              << G4endl;                        << 404        << "> " << G4endl;
                                                   >> 405     } else {
                                                   >> 406       G4cout << "Fail to store Physics Tables for " 
                                                   >> 407        << particle->GetParticleName()
                                                   >> 408              << " and process " << GetProcessName()
                                                   >> 409        << " in the directory <" << directory
                                                   >> 410        << "> " << G4endl;
763     }                                             411     }
764   }                                               412   }
                                                   >> 413   return yes;
765 }                                                 414 }
766                                                   415 
767 //....oooOO0OOooo........oooOO0OOooo........oo << 416 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
768                                                   417 
769 void                                           << 418 G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
770 G4VEmProcess::ActivateForcedInteraction(G4doub << 419                     const G4String& directory,
771                                         G4bool << 420                           G4bool ascii)
772 {                                                 421 {
773   if(nullptr == biasManager) { biasManager = n << 
774   if(1 < verboseLevel) {                          422   if(1 < verboseLevel) {
775     G4cout << "### ActivateForcedInteraction:  << 423     G4cout << "G4VEmProcess::RetrievePhysicsTable() for "
776            << particle->GetParticleName()      << 424            << part->GetParticleName() << " and process "
777            << " and process " << GetProcessNam << 425      << GetProcessName() << G4endl;
778            << " length(mm)= " << length/mm     << 
779            << " in G4Region <" << r            << 
780            << "> weightFlag= " << flag         << 
781            << G4endl;                          << 
782   }                                               426   }
783   weightFlag = flag;                           << 427   G4bool yes = true;
784   biasManager->ActivateForcedInteraction(lengt << 
785 }                                              << 
786                                                << 
787 //....oooOO0OOooo........oooOO0OOooo........oo << 
788                                                   428 
789 void                                           << 429   if(!buildLambdaTable || particle != part) return yes;
790 G4VEmProcess::ActivateSecondaryBiasing(const G << 
791                  G4double factor,              << 
792                  G4double energyLimit)         << 
793 {                                              << 
794   if (0.0 <= factor) {                         << 
795                                                   430 
796     // Range cut can be applied only for e-    << 431   const G4String particleName = part->GetParticleName();
797     if(0.0 == factor && secondaryParticle != G << 432   G4String filename;
798       { return; }                              << 
799                                                   433 
800     if(!biasManager) { biasManager = new G4EmB << 434   filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
801     biasManager->ActivateSecondaryBiasing(regi << 435   yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,
802     if(1 < verboseLevel) {                     << 436                filename,ascii);
803       G4cout << "### ActivateSecondaryBiasing: << 437   if ( yes ) {
804        << " process " << GetProcessName()      << 438     if (0 < verboseLevel) {
805        << " factor= " << factor                << 439       G4cout << "Lambda table for " << particleName << " is Retrieved from <"
806        << " in G4Region <" << region           << 440              << filename << ">"
807        << "> energyLimit(MeV)= " << energyLimi << 441              << G4endl;
808        << G4endl;                              << 442     }
                                                   >> 443   } else {
                                                   >> 444     if (1 < verboseLevel) {
                                                   >> 445       G4cout << "Lambda table for " << particleName << " in file <"
                                                   >> 446              << filename << "> is not exist"
                                                   >> 447              << G4endl;
809     }                                             448     }
810   }                                               449   }
811 }                                              << 
812                                                << 
813 //....oooOO0OOooo........oooOO0OOooo........oo << 
814                                                << 
815 void G4VEmProcess::SetLambdaBinning(G4int n)   << 
816 {                                              << 
817   if(5 < n && n < 10000000) {                  << 
818     nLambdaBins = n;                           << 
819     actBinning = true;                         << 
820   } else {                                     << 
821     G4double e = (G4double)n;                  << 
822     PrintWarning("SetLambdaBinning", e);       << 
823   }                                            << 
824 }                                              << 
825                                                << 
826 //....oooOO0OOooo........oooOO0OOooo........oo << 
827                                                << 
828 void G4VEmProcess::SetMinKinEnergy(G4double e) << 
829 {                                              << 
830   if(1.e-3*eV < e && e < maxKinEnergy) {       << 
831     nLambdaBins = G4lrint(nLambdaBins*G4Log(ma << 
832                           /G4Log(maxKinEnergy/ << 
833     minKinEnergy = e;                          << 
834     actMinKinEnergy = true;                    << 
835   } else { PrintWarning("SetMinKinEnergy", e); << 
836 }                                              << 
837                                                << 
838 //....oooOO0OOooo........oooOO0OOooo........oo << 
839                                                << 
840 void G4VEmProcess::SetMaxKinEnergy(G4double e) << 
841 {                                              << 
842   if(minKinEnergy < e && e < 1.e+6*TeV) {      << 
843     nLambdaBins = G4lrint(nLambdaBins*G4Log(e/ << 
844                           /G4Log(maxKinEnergy/ << 
845     maxKinEnergy = e;                          << 
846     actMaxKinEnergy = true;                    << 
847   } else { PrintWarning("SetMaxKinEnergy", e); << 
848 }                                              << 
849                                                << 
850 //....oooOO0OOooo........oooOO0OOooo........oo << 
851                                                << 
852 void G4VEmProcess::SetMinKinEnergyPrim(G4doubl << 
853 {                                              << 
854   if(theParameters->MinKinEnergy() <= e &&     << 
855      e <= theParameters->MaxKinEnergy()) { min << 
856   else { PrintWarning("SetMinKinEnergyPrim", e << 
857 }                                              << 
858                                                << 
859 //....oooOO0OOooo........oooOO0OOooo........oo << 
860                                                << 
861 G4VEmProcess* G4VEmProcess::GetEmProcess(const << 
862 {                                              << 
863   return (nam == GetProcessName()) ? this : nu << 
864 }                                              << 
865                                                << 
866 //....oooOO0OOooo........oooOO0OOooo........oo << 
867                                                   450 
868 G4double G4VEmProcess::PolarAngleLimit() const << 451   return yes;
869 {                                              << 
870   return theParameters->MscThetaLimit();       << 
871 }                                                 452 }
872                                                   453 
873 //....oooOO0OOooo........oooOO0OOooo........oo    454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
874                                                   455 
875 void G4VEmProcess::PrintWarning(G4String tit,  << 456 void G4VEmProcess::FindLambdaMax()
876 {                                                 457 {
877   G4String ss = "G4VEmProcess::" + tit;        << 458   if(1 < verboseLevel) {
878   G4ExceptionDescription ed;                   << 459     G4cout << "### G4VEmProcess::FindLambdaMax: " 
879   ed << "Parameter is out of range: " << val   << 460      << particle->GetParticleName() 
880      << " it will have no effect!\n" << "  Pro << 461            << " and process " << GetProcessName() << G4endl; 
881      << GetProcessName() << "  nbins= " << the << 462   }
882      << " Emin(keV)= " << theParameters->MinKi << 463   size_t n = theLambdaTable->length();
883      << " Emax(GeV)= " << theParameters->MaxKi << 464   G4PhysicsVector* pv = (*theLambdaTable)[0];
884   G4Exception(ss, "em0044", JustWarning, ed);  << 465   G4double e, s, emax, smax;
                                                   >> 466   theEnergyOfCrossSectionMax = new G4double [n];
                                                   >> 467   theCrossSectionMax = new G4double [n];
                                                   >> 468   G4bool b;
                                                   >> 469 
                                                   >> 470   for (size_t i=0; i<n; i++) {
                                                   >> 471     pv = (*theLambdaTable)[i];
                                                   >> 472     emax = DBL_MAX;
                                                   >> 473     smax = 0.0;
                                                   >> 474     if(pv) {
                                                   >> 475       size_t nb = pv->GetVectorLength();
                                                   >> 476       emax = pv->GetLowEdgeEnergy(nb);
                                                   >> 477       smax = 0.0;
                                                   >> 478       for (size_t j=0; j<nb; j++) {
                                                   >> 479   e = pv->GetLowEdgeEnergy(j);
                                                   >> 480   s = pv->GetValue(e,b);
                                                   >> 481   if(s > smax) {
                                                   >> 482     smax = s;
                                                   >> 483     emax = e;
                                                   >> 484   }
                                                   >> 485       }
                                                   >> 486     }
                                                   >> 487     theEnergyOfCrossSectionMax[i] = emax;
                                                   >> 488     theCrossSectionMax[i] = smax;
                                                   >> 489     if(2 < verboseLevel) {
                                                   >> 490       G4cout << "For " << particle->GetParticleName() 
                                                   >> 491        << " Max CS at i= " << i << " emax(MeV)= " << emax/MeV
                                                   >> 492        << " lambda= " << smax << G4endl;
                                                   >> 493     }
                                                   >> 494   }
885 }                                                 495 }
886                                                   496 
887 //....oooOO0OOooo........oooOO0OOooo........oo    497 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
888                                                   498 
889 void G4VEmProcess::ProcessDescription(std::ost << 499 G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
890 {                                                 500 {
891   if(nullptr != particle) {                    << 501   G4PhysicsVector* v = 
892     StreamInfo(out, *particle, true);          << 502     new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
893   }                                            << 503   return v;
894 }                                                 504 }
895                                                   505 
896 //....oooOO0OOooo........oooOO0OOooo........oo    506 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
897                                                   507