Geant4 Cross Reference

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


  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: G4VAtomDeexcitation.cc 74376 2013-10-04 08:25:47Z gcosmo $
 26 //                                                 27 //
 27 // -------------------------------------------     28 // -------------------------------------------------------------------
 28 //                                                 29 //
 29 // GEANT4 Class class file                         30 // GEANT4 Class class file
 30 //                                                 31 //
 31 //                                                 32 //
 32 // File name:     G4VAtomDeexcitation              33 // File name:     G4VAtomDeexcitation
 33 //                                                 34 //
 34 // Author:        Alfonso Mantero & Vladimir I     35 // Author:        Alfonso Mantero & Vladimir Ivanchenko
 35 //                                                 36 //
 36 // Creation date: 21.04.2010                       37 // Creation date: 21.04.2010
 37 //                                                 38 //
 38 // Modifications:                                  39 // Modifications:
 39 //                                                 40 //
 40 // Class Description:                              41 // Class Description:
 41 //                                                 42 //
 42 // Abstract interface to energy loss models        43 // Abstract interface to energy loss models
 43                                                    44 
 44 // -------------------------------------------     45 // -------------------------------------------------------------------
 45 //                                                 46 //
 46                                                    47 
 47 #include "G4VAtomDeexcitation.hh"                  48 #include "G4VAtomDeexcitation.hh"
 48 #include "G4SystemOfUnits.hh"                      49 #include "G4SystemOfUnits.hh"
 49 #include "G4EmParameters.hh"                   << 
 50 #include "G4ParticleDefinition.hh"                 50 #include "G4ParticleDefinition.hh"
 51 #include "G4DynamicParticle.hh"                    51 #include "G4DynamicParticle.hh"
 52 #include "G4Step.hh"                               52 #include "G4Step.hh"
 53 #include "G4Region.hh"                             53 #include "G4Region.hh"
 54 #include "G4RegionStore.hh"                        54 #include "G4RegionStore.hh"
 55 #include "G4MaterialCutsCouple.hh"                 55 #include "G4MaterialCutsCouple.hh"
 56 #include "G4MaterialCutsCouple.hh"                 56 #include "G4MaterialCutsCouple.hh"
 57 #include "G4Material.hh"                           57 #include "G4Material.hh"
 58 #include "G4Element.hh"                            58 #include "G4Element.hh"
 59 #include "G4ElementVector.hh"                      59 #include "G4ElementVector.hh"
 60 #include "Randomize.hh"                            60 #include "Randomize.hh"
 61 #include "G4VParticleChange.hh"                    61 #include "G4VParticleChange.hh"
 62 #include "G4EmSecondaryParticleType.hh"        <<  62 #include "G4PhysicsModelCatalog.hh"
 63 #include "G4Gamma.hh"                              63 #include "G4Gamma.hh"
 64 #include "G4Log.hh"                            << 
 65                                                << 
 66 #ifdef G4MULTITHREADED                         << 
 67   G4Mutex G4VAtomDeexcitation::atomDeexcitatio << 
 68 #endif                                         << 
 69                                                    64 
 70 //....oooOO0OOooo........oooOO0OOooo........oo     65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 71                                                    66 
 72 G4VAtomDeexcitation::G4VAtomDeexcitation(const <<  67 G4int G4VAtomDeexcitation::pixeIDg = -1;
 73   : name(modname)                              <<  68 G4int G4VAtomDeexcitation::pixeIDe = -1;
                                                   >>  69 
                                                   >>  70 G4VAtomDeexcitation::G4VAtomDeexcitation(const G4String& modname, 
                                                   >>  71            const G4String& pname) 
                                                   >>  72   : lowestKinEnergy(keV), verbose(1), name(modname), namePIXE(pname), 
                                                   >>  73     nameElectronPIXE(""), isActive(false), flagAuger(false), flagPIXE(false)
 74 {                                                  74 {
 75   vdyn.reserve(5);                                 75   vdyn.reserve(5);
 76   theCoupleTable = nullptr;                    <<  76   theCoupleTable = 0;
                                                   >>  77   G4String gg = "gammaPIXE";
                                                   >>  78   G4String ee = "e-PIXE";
                                                   >>  79   if(pixeIDg < 0) { pixeIDg = G4PhysicsModelCatalog::Register(gg); }
                                                   >>  80   if(pixeIDe < 0) { pixeIDe = G4PhysicsModelCatalog::Register(ee); }
 77   gamma = G4Gamma::Gamma();                        81   gamma = G4Gamma::Gamma();
 78 }                                                  82 }
 79                                                    83 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 81                                                    85 
 82 G4VAtomDeexcitation::~G4VAtomDeexcitation() =  <<  86 G4VAtomDeexcitation::~G4VAtomDeexcitation()
                                                   >>  87 {}
 83                                                    88 
 84 //....oooOO0OOooo........oooOO0OOooo........oo     89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 85                                                    90 
 86 void G4VAtomDeexcitation::InitialiseAtomicDeex     91 void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
 87 {                                                  92 {
 88   G4EmParameters* theParameters = G4EmParamete << 
 89   theParameters->DefineRegParamForDeex(this);  << 
 90                                                << 
 91   // Define list of couples                        93   // Define list of couples
 92   theCoupleTable = G4ProductionCutsTable::GetP     94   theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable();
 93   nCouples = (G4int)theCoupleTable->GetTableSi <<  95   size_t numOfCouples = theCoupleTable->GetTableSize();
 94                                                    96 
 95   // needed for unit tests                         97   // needed for unit tests
 96   std::size_t nn = std::max(nCouples, 1);      <<  98   if(0 == numOfCouples) { numOfCouples = 1; }
 97   if(activeDeexcitationMedia.size() != nn) {   << 
 98     activeDeexcitationMedia.resize(nn, false); << 
 99     activeAugerMedia.resize(nn, false);        << 
100     activePIXEMedia.resize(nn, false);         << 
101   }                                            << 
102   if(activeZ.size() != 93) { activeZ.resize(93 << 
103                                                    99 
104   // initialisation of flags and options       << 100   activeDeexcitationMedia.resize(numOfCouples, false);
105   // normally there is no locksed flags        << 101   activeAugerMedia.resize(numOfCouples, false);
106   if(!isActiveLocked) { isActive  = theParamet << 102   activePIXEMedia.resize(numOfCouples, false);
107   if(!isAugerLocked)  { flagAuger = theParamet << 103   activeZ.resize(93, false);
108   if(!isPIXELocked)   { flagPIXE  = theParamet << 
109   ignoreCuts = theParameters->DeexcitationIgno << 
110                                                   104 
111   // Define list of regions                    << 
112   std::size_t nRegions = deRegions.size();     << 
113   // check if deexcitation is active for the g    105   // check if deexcitation is active for the given run
114   if(!isActive && 0 == nRegions) { return; }   << 106   if( !isActive ) { return; }
                                                   >> 107 
                                                   >> 108   // Define list of regions
                                                   >> 109   size_t nRegions = deRegions.size();
115                                                   110 
116   // if no active regions add a world          << 
117   if(0 == nRegions) {                             111   if(0 == nRegions) {
118     SetDeexcitationActiveRegion("World",isActi    112     SetDeexcitationActiveRegion("World",isActive,flagAuger,flagPIXE);
119     nRegions = deRegions.size();               << 113     nRegions = 1;
120   }                                               114   }
121                                                   115 
122   if(0 < verbose) {                               116   if(0 < verbose) {
123     G4cout << G4endl;                             117     G4cout << G4endl;
124     G4cout << "### ===  Deexcitation model " <    118     G4cout << "### ===  Deexcitation model " << name 
125            << " is activated for " << nRegions << 119      << " is activated for " << nRegions;
126     if(1 == nRegions) { G4cout << " region:" <    120     if(1 == nRegions) { G4cout << " region:" << G4endl; }
127     else              { G4cout << " regions:"     121     else              { G4cout << " regions:" << G4endl;}
128   }                                               122   }
129                                                   123 
130   // Identify active media                        124   // Identify active media
131   const G4RegionStore* regionStore = G4RegionS << 125   G4RegionStore* regionStore = G4RegionStore::GetInstance();
132   for(std::size_t j=0; j<nRegions; ++j) {      << 126   for(size_t j=0; j<nRegions; ++j) {
133     const G4Region* reg = regionStore->GetRegi    127     const G4Region* reg = regionStore->GetRegion(activeRegions[j], false);
134     if(nullptr != reg && 0 < nCouples) {       << 128     const G4ProductionCuts* rpcuts = reg->GetProductionCuts();
135       const G4ProductionCuts* rpcuts = reg->Ge << 129     if(0 < verbose) {
136       if(0 < verbose) {                        << 130       G4cout << "          " << activeRegions[j] << G4endl;  
137         G4cout << "          " << activeRegion << 
138                << "  " << deRegions[j]  << "   << 
139                << "  " << PIXERegions[j] << G4 << 
140       }                                        << 
141       for(G4int i=0; i<nCouples; ++i) {        << 
142         const G4MaterialCutsCouple* couple =   << 
143           theCoupleTable->GetMaterialCutsCoupl << 
144         if (couple->GetProductionCuts() == rpc << 
145           activeDeexcitationMedia[i] = deRegio << 
146           activeAugerMedia[i] = AugerRegions[j << 
147           activePIXEMedia[i] = PIXERegions[j]; << 
148         }                                      << 
149       }                                        << 
150     }                                             131     }
151   }                                            << 132   
152   std::size_t nelm = G4Element::GetNumberOfEle << 133     for(size_t i=0; i<numOfCouples; ++i) {
153   //G4cout << nelm << G4endl;                  << 134       const G4MaterialCutsCouple* couple =
154   for(std::size_t k=0; k<nelm; ++k) {          << 135   theCoupleTable->GetMaterialCutsCouple(i);
155     G4int Z = (*(G4Element::GetElementTable()) << 136       if (couple->GetProductionCuts() == rpcuts) {
156     if(Z > 5 && Z < 93) {                      << 137   activeDeexcitationMedia[i] = deRegions[j];
157       activeZ[Z] = true;                       << 138   activeAugerMedia[i] = AugerRegions[j];
158       //G4cout << "!!! Active de-excitation Z= << 139   activePIXEMedia[i] = PIXERegions[j];
                                                   >> 140   const G4Material* mat = couple->GetMaterial();
                                                   >> 141   const G4ElementVector* theElementVector = 
                                                   >> 142     mat->GetElementVector();
                                                   >> 143   G4int nelm = mat->GetNumberOfElements();
                                                   >> 144   if(deRegions[j]) {
                                                   >> 145     for(G4int k=0; k<nelm; ++k) {
                                                   >> 146       G4int Z = G4lrint(((*theElementVector)[k])->GetZ());
                                                   >> 147       if(Z > 5 && Z < 93) { 
                                                   >> 148         activeZ[Z] = true;
                                                   >> 149         //G4cout << "!!! Active de-excitation Z= " << Z << G4endl;  
                                                   >> 150       }
                                                   >> 151     }
                                                   >> 152   }
                                                   >> 153       }
159     }                                             154     }
160   }                                               155   }
161                                                   156 
162   // Initialise derived class                     157   // Initialise derived class
163   InitialiseForNewRun();                          158   InitialiseForNewRun();
164                                                   159 
165   if(0 < verbose && flagAuger) {               << 
166     G4cout << "### ===  Auger flag: " << flagA << 
167            << G4endl;                          << 
168   }                                            << 
169   if(0 < verbose) {                            << 
170     G4cout << "### ===  Ignore cuts flag:   "  << 
171            << G4endl;                          << 
172   }                                            << 
173   if(0 < verbose && flagPIXE) {                   160   if(0 < verbose && flagPIXE) {
174     G4cout << "### ===  PIXE model for hadrons << 161     G4cout << "### ===  PIXE model for hadrons: " << namePIXE
175            << theParameters->PIXECrossSectionM << 162      << "  " <<  IsPIXEActive()
176            << G4endl;                          << 163      << G4endl;  
177     G4cout << "### ===  PIXE model for e+-:    << 164     G4cout << "### ===  PIXE model for e+-:     " << nameElectronPIXE
178            << theParameters->PIXEElectronCross << 165      << "  " <<  IsPIXEActive()
179            << G4endl;                          << 166      << G4endl;  
180   }                                               167   }
181 }                                                 168 }
182                                                   169 
183 //....oooOO0OOooo........oooOO0OOooo........oo    170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184                                                   171 
185 void                                              172 void 
186 G4VAtomDeexcitation::SetDeexcitationActiveRegi    173 G4VAtomDeexcitation::SetDeexcitationActiveRegion(const G4String& rname,
187                                                << 174              G4bool valDeexcitation,
188                                                << 175              G4bool valAuger,
189                                                << 176              G4bool valPIXE)
190 {                                                 177 {
191   // no PIXE in parallel world                 << 
192   if(rname == "DefaultRegionForParallelWorld") << 
193                                                << 
194   G4String ss = rname;                            178   G4String ss = rname;
195   /*                                           << 179   //G4cout << "### G4VAtomDeexcitation::SetDeexcitationActiveRegion " << ss 
196   G4cout << "### G4VAtomDeexcitation::SetDeexc << 180   //   << "  " << valDeexcitation << "  " << valAuger
197          << "  " << valDeexcitation << "  " << << 181   //   << "  " << valPIXE << G4endl;
198          << "  " << valPIXE << G4endl;         << 
199   */                                           << 
200   if(ss == "world" || ss == "World" || ss == "    182   if(ss == "world" || ss == "World" || ss == "WORLD") {
201     ss = "DefaultRegionForTheWorld";              183     ss = "DefaultRegionForTheWorld";
202   }                                               184   }
203   std::size_t n = deRegions.size();            << 185   size_t n = deRegions.size();
204   for(std::size_t i=0; i<n; ++i) {             << 186   if(n > 0) {
                                                   >> 187     for(size_t i=0; i<n; ++i) {
205                                                   188  
206     // Region already exist                    << 189       // Region already exist
207     if(ss == activeRegions[i]) {               << 190       if(ss == activeRegions[i]) {
208       deRegions[i] = valDeexcitation;          << 191   deRegions[i] = valDeexcitation;
209       AugerRegions[i] = valAuger;              << 192   AugerRegions[i] = valAuger;
210       PIXERegions[i] = valPIXE;                << 193   PIXERegions[i] = valPIXE;
211       return;                                  << 194   return; 
                                                   >> 195       } 
212     }                                             196     }
213   }                                               197   }
214   // New region                                   198   // New region
215   activeRegions.push_back(ss);                    199   activeRegions.push_back(ss);
216   deRegions.push_back(valDeexcitation);           200   deRegions.push_back(valDeexcitation);
217   AugerRegions.push_back(valAuger);               201   AugerRegions.push_back(valAuger);
218   PIXERegions.push_back(valPIXE);                 202   PIXERegions.push_back(valPIXE);
219                                                << 
220   // if de-excitation defined for the world vo << 
221   // it should be active for all G4Regions     << 
222   if(ss == "DefaultRegionForTheWorld") {       << 
223     G4RegionStore* regions = G4RegionStore::Ge << 
224     std::size_t nn = regions->size();          << 
225     for(std::size_t i=0; i<nn; ++i) {          << 
226       if(ss == (*regions)[i]->GetName()) { con << 
227       SetDeexcitationActiveRegion((*regions)[i << 
228                                   valAuger, va << 
229                                                << 
230     }                                          << 
231   }                                            << 
232 }                                              << 
233                                                << 
234 void G4VAtomDeexcitation::GenerateParticles(st << 
235                                             co << 
236                                             G4 << 
237 {                                              << 
238   G4double gCut = DBL_MAX;                     << 
239   if(ignoreCuts) {                             << 
240     gCut = 0.0;                                << 
241   } else if (nullptr != theCoupleTable) {      << 
242     gCut = (*(theCoupleTable->GetEnergyCutsVec << 
243   }                                            << 
244   if(gCut < as->BindingEnergy()) {             << 
245     G4double eCut = DBL_MAX;                   << 
246     if(CheckAugerActiveRegion(idx)) {          << 
247       if(ignoreCuts) {                         << 
248         eCut = 0.0;                            << 
249       } else if (nullptr != theCoupleTable) {  << 
250         eCut = (*(theCoupleTable->GetEnergyCut << 
251       }                                        << 
252     }                                          << 
253     GenerateParticles(v, as, Z, gCut, eCut);   << 
254   }                                            << 
255 }                                                 203 }
256                                                   204 
257 //....oooOO0OOooo........oooOO0OOooo........oo    205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
258                                                   206 
259 void                                              207 void
260 G4VAtomDeexcitation::AlongStepDeexcitation(std    208 G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
261                                            con << 209              const G4Step& step, 
262                                            G4d << 210              G4double& eLossMax,
263                                            G4i    211                                            G4int coupleIndex)
264 {                                                 212 {
265   G4double truelength = step.GetStepLength();     213   G4double truelength = step.GetStepLength();
266   if(!flagPIXE && !activePIXEMedia[coupleIndex    214   if(!flagPIXE && !activePIXEMedia[coupleIndex]) { return; }
267   if(eLossMax <= 0.0 || truelength <= 0.0)        215   if(eLossMax <= 0.0 || truelength <= 0.0)       { return; }
268                                                   216 
269   // step parameters                              217   // step parameters
270   const G4StepPoint* preStep = step.GetPreStep    218   const G4StepPoint* preStep = step.GetPreStepPoint();
271   const G4ThreeVector prePos = preStep->GetPos << 219   G4ThreeVector prePos = preStep->GetPosition();
272   const G4ThreeVector delta = step.GetPostStep << 220   G4ThreeVector delta = step.GetPostStepPoint()->GetPosition() - prePos;
273   const G4double preTime = preStep->GetGlobalT << 221   G4double preTime = preStep->GetGlobalTime();
274   const G4double dt = step.GetPostStepPoint()- << 222   G4double dt = step.GetPostStepPoint()->GetGlobalTime() - preTime;
275                                                   223 
276   // particle parameters                          224   // particle parameters
277   const G4Track* track = step.GetTrack();         225   const G4Track* track = step.GetTrack();
278   const G4ParticleDefinition* part = track->Ge    226   const G4ParticleDefinition* part = track->GetDefinition();
279   G4double ekin = preStep->GetKineticEnergy();    227   G4double ekin = preStep->GetKineticEnergy(); 
280                                                   228 
281   // media parameters                             229   // media parameters
282   G4double gCut = (*theCoupleTable->GetEnergyC    230   G4double gCut = (*theCoupleTable->GetEnergyCutsVector(0))[coupleIndex];
283   if(ignoreCuts) { gCut = 0.0; }               << 
284   G4double eCut = DBL_MAX;                        231   G4double eCut = DBL_MAX;
285   if(CheckAugerActiveRegion(coupleIndex)) {       232   if(CheckAugerActiveRegion(coupleIndex)) { 
286     eCut = (*theCoupleTable->GetEnergyCutsVect    233     eCut = (*theCoupleTable->GetEnergyCutsVector(1))[coupleIndex];
287     if(ignoreCuts) { eCut = 0.0; }             << 
288   }                                               234   }
289                                                   235 
290   //G4cout<<"!Sample PIXE gCut(MeV)= "<<gCut<<    236   //G4cout<<"!Sample PIXE gCut(MeV)= "<<gCut<<"  eCut(MeV)= "<<eCut
291   //        <<" Ekin(MeV)= " << ekin/MeV << G4 << 237   //  <<" Ekin(MeV)= " << ekin/MeV << G4endl;
292                                                   238 
293   const G4Material* material = preStep->GetMat    239   const G4Material* material = preStep->GetMaterial();
294   const G4ElementVector* theElementVector = ma    240   const G4ElementVector* theElementVector = material->GetElementVector();
295   const G4double* theAtomNumDensityVector =       241   const G4double* theAtomNumDensityVector = 
296     material->GetVecNbOfAtomsPerVolume();         242     material->GetVecNbOfAtomsPerVolume();
297   const std::size_t nelm = material->GetNumber << 243   G4int nelm = material->GetNumberOfElements();
298                                                   244 
299   // loop over deexcitations                      245   // loop over deexcitations
300   for(std::size_t i=0; i<nelm; ++i) {          << 246   for(G4int i=0; i<nelm; ++i) {
301     G4int Z = (*theElementVector)[i]->GetZasIn << 247     G4int Z = G4lrint((*theElementVector)[i]->GetZ());
302     if(activeZ[Z] && Z < 93) {                    248     if(activeZ[Z] && Z < 93) {  
303       G4int nshells =                             249       G4int nshells = 
304         std::min(9,(*theElementVector)[i]->Get << 250   std::min(9,(*theElementVector)[i]->GetNbOfAtomicShells());
305       G4double rho = truelength*theAtomNumDens    251       G4double rho = truelength*theAtomNumDensityVector[i];
306       //G4cout<<"   Z "<< Z <<" is active  x(m    252       //G4cout<<"   Z "<< Z <<" is active  x(mm)= " << truelength/mm << G4endl;
307       for(G4int ii=0; ii<nshells; ++ii) {         253       for(G4int ii=0; ii<nshells; ++ii) {
308         auto as = (G4AtomicShellEnumerator)(ii << 254   G4AtomicShellEnumerator as = G4AtomicShellEnumerator(ii);
309         const G4AtomicShell* shell = GetAtomic << 255   const G4AtomicShell* shell = GetAtomicShell(Z, as);
310         const G4double bindingEnergy = shell-> << 256   G4double bindingEnergy = shell->BindingEnergy();
311                                                << 257 
312         if(gCut > bindingEnergy) { break; }    << 258   if(gCut > bindingEnergy) { break; }
313                                                << 259 
314         if(eLossMax > bindingEnergy) {         << 260   if(eLossMax > bindingEnergy) { 
315           G4double sig = rho*                  << 261     G4double sig = rho*
316             GetShellIonisationCrossSectionPerA << 262       GetShellIonisationCrossSectionPerAtom(part, Z, as, ekin, material);
317                                                << 263 
318           // mfp is mean free path in units of << 264     // mfp is mean free path in units of step size
319           if(sig > 0.0) {                      << 265     if(sig > 0.0) {
320             G4double mfp = 1.0/sig;            << 266       G4double mfp = 1.0/sig;
321             G4double stot = 0.0;               << 267       G4double stot = 0.0;
322             //G4cout << " Shell " << ii << " m << 268       //G4cout << " Shell " << ii << " mfp(mm)= " << mfp/mm << G4endl;
323             // sample ionisation points        << 269       // sample ionisation points
324             do {                               << 270       do {
325               stot -= mfp*G4Log(G4UniformRand( << 271         stot -= mfp*std::log(G4UniformRand());
326               if( stot > 1.0 || eLossMax < bin << 272         if( stot > 1.0 || eLossMax < bindingEnergy) { break; }
327               // sample deexcitation           << 273         // sample deexcitation
328               vdyn.clear();                    << 274         vdyn.clear();
329               GenerateParticles(&vdyn, shell,  << 275         GenerateParticles(&vdyn, shell, Z, gCut, eCut); 
330               std::size_t nsec = vdyn.size();  << 276         G4int nsec = vdyn.size();
331               if(nsec > 0) {                   << 277         if(nsec > 0) {
332                 G4ThreeVector r = prePos  + st << 278     G4ThreeVector r = prePos  + stot*delta;
333                 G4double time   = preTime + st << 279     G4double time   = preTime + stot*dt;
334                 for(std::size_t j=0; j<nsec; + << 280     for(G4int j=0; j<nsec; ++j) {
335                   G4DynamicParticle* dp = vdyn << 281       G4DynamicParticle* dp = vdyn[j];
336                   G4double e = dp->GetKineticE << 282       G4double e = dp->GetKineticEnergy();
337                                                << 283 
338                   // save new secondary if the << 284       // save new secondary if there is enough energy
339                   if(eLossMax >= e) {          << 285       if(eLossMax >= e) {
340                     eLossMax -= e;             << 286         eLossMax -= e;        
341                     G4Track* t = new G4Track(d << 287         G4Track* t = new G4Track(dp, time, r);
342                                                   288 
343                     // defined secondary type  << 289         // defined secondary type
344                     if(dp->GetDefinition() ==     290                     if(dp->GetDefinition() == gamma) { 
345                       t->SetCreatorModelID(_Ga << 291           t->SetCreatorModelIndex(pixeIDg);
346                     } else {                   << 292         } else {
347                       t->SetCreatorModelID(_eP << 293           t->SetCreatorModelIndex(pixeIDe);
348                     }                          << 294         }
349                     tracks.push_back(t);       << 295 
350                   } else {                     << 296         tracks.push_back(t);
351                     delete dp;                 << 297       } else {
352                   }                            << 298         delete dp;
353                 }                              << 299       }
354               }                                << 300     }
355               // Loop checking, 03-Aug-2015, V << 301         }
356             } while (stot < 1.0);              << 302       } while (stot < 1.0);
357           }                                    << 303     }
358         }                                      << 304   }
359       }                                           305       }
360     }                                             306     } 
361   }                                               307   }
362   return;                                         308   return;
363 }                                                 309 }
364                                                   310 
365 //....oooOO0OOooo........oooOO0OOooo........oo    311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
366                                                   312