Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.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/standard/src/G4eCoulombScatteringModel.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc (Version 10.7.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 //                                                 26 //
 27 // -------------------------------------------     27 // -------------------------------------------------------------------
 28 //                                                 28 //
 29 // GEANT4 Class file                               29 // GEANT4 Class file
 30 //                                                 30 //
 31 //                                                 31 //
 32 // File name:     G4eCoulombScatteringModel        32 // File name:     G4eCoulombScatteringModel
 33 //                                                 33 //
 34 // Author:        Vladimir Ivanchenko              34 // Author:        Vladimir Ivanchenko 
 35 //                                                 35 //
 36 // Creation date: 22.08.2005                       36 // Creation date: 22.08.2005
 37 //                                                 37 //
 38 // Modifications: V.Ivanchenko                     38 // Modifications: V.Ivanchenko
 39 //                                                 39 //
 40 //                                                 40 //
 41 //                                                 41 //
 42 // Class Description:                              42 // Class Description:
 43 //                                                 43 //
 44 // -------------------------------------------     44 // -------------------------------------------------------------------
 45 //                                                 45 //
 46 //....oooOO0OOooo........oooOO0OOooo........oo     46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 47 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 48                                                    48 
 49 #include "G4eCoulombScatteringModel.hh"            49 #include "G4eCoulombScatteringModel.hh"
 50 #include "G4PhysicalConstants.hh"                  50 #include "G4PhysicalConstants.hh"
 51 #include "G4SystemOfUnits.hh"                      51 #include "G4SystemOfUnits.hh"
 52 #include "Randomize.hh"                            52 #include "Randomize.hh"
 53 #include "G4DataVector.hh"                         53 #include "G4DataVector.hh"
 54 #include "G4ElementTable.hh"                       54 #include "G4ElementTable.hh"
 55 #include "G4ParticleChangeForGamma.hh"             55 #include "G4ParticleChangeForGamma.hh"
 56 #include "G4Proton.hh"                             56 #include "G4Proton.hh"
 57 #include "G4ParticleTable.hh"                      57 #include "G4ParticleTable.hh"
 58 #include "G4IonTable.hh"                           58 #include "G4IonTable.hh"
 59 #include "G4ProductionCutsTable.hh"                59 #include "G4ProductionCutsTable.hh"
 60 #include "G4NucleiProperties.hh"                   60 #include "G4NucleiProperties.hh"
 61 #include "G4Pow.hh"                                61 #include "G4Pow.hh"
 62 #include "G4NistManager.hh"                        62 #include "G4NistManager.hh"
 63                                                    63 
 64 //....oooOO0OOooo........oooOO0OOooo........oo     64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 65                                                    65 
 66 using namespace std;                               66 using namespace std;
 67                                                    67 
 68 G4eCoulombScatteringModel::G4eCoulombScatterin     68 G4eCoulombScatteringModel::G4eCoulombScatteringModel(G4bool combined)
 69   : G4VEmModel("eCoulombScattering"), isCombin <<  69   : G4VEmModel("eCoulombScattering"),
                                                   >>  70     cosThetaMin(1.0),
                                                   >>  71     cosThetaMax(-1.0),
                                                   >>  72     isCombined(combined)
 70 {                                                  73 {
                                                   >>  74   fParticleChange = nullptr;
 71   fNistManager = G4NistManager::Instance();        75   fNistManager = G4NistManager::Instance();
 72   theIonTable  = G4ParticleTable::GetParticleT     76   theIonTable  = G4ParticleTable::GetParticleTable()->GetIonTable();
 73   theProton    = G4Proton::Proton();               77   theProton    = G4Proton::Proton();
                                                   >>  78   currentMaterial = nullptr; 
                                                   >>  79   fixedCut = -1.0;
                                                   >>  80 
                                                   >>  81   pCuts = nullptr;
                                                   >>  82 
                                                   >>  83   recoilThreshold = 0.0; // by default does not work
                                                   >>  84 
                                                   >>  85   particle = nullptr;
                                                   >>  86   currentCouple = nullptr;
 74                                                    87 
 75   wokvi = new G4WentzelOKandVIxSection(isCombi     88   wokvi = new G4WentzelOKandVIxSection(isCombined);
 76                                                    89 
                                                   >>  90   currentMaterialIndex = 0;
 77   mass = CLHEP::proton_mass_c2;                    91   mass = CLHEP::proton_mass_c2;
                                                   >>  92   elecRatio = 0.0;
 78 }                                                  93 }
 79                                                    94 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 81                                                    96 
 82 G4eCoulombScatteringModel::~G4eCoulombScatteri     97 G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
 83 {                                                  98 {
 84   delete wokvi;                                    99   delete wokvi;
 85 }                                                 100 }
 86                                                   101 
 87 //....oooOO0OOooo........oooOO0OOooo........oo    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 88                                                   103 
 89 void G4eCoulombScatteringModel::Initialise(con    104 void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
 90              const G4DataVector& cuts)            105              const G4DataVector& cuts)
 91 {                                                 106 {
 92   SetupParticle(part);                            107   SetupParticle(part);
 93   currentCouple = nullptr;                        108   currentCouple = nullptr;
 94                                                   109 
 95   G4double tet = PolarAngleLimit();            << 
 96                                                << 
 97   // defined theta limit between single and mu    110   // defined theta limit between single and multiple scattering 
 98   if(isCombined) {                                111   if(isCombined) {
 99     if(tet >= CLHEP::pi) { cosThetaMin = -1.0; << 112     cosThetaMin = 1.0;
100     else if(tet > 0.0) { cosThetaMin = std::co << 113     G4double tet = PolarAngleLimit();
101                                                << 114     if(tet >= pi)      { cosThetaMin = -1.0; }
102     // single scattering without multiple      << 115     else if(tet > 0.0) { cosThetaMin = cos(tet); }
103   } else if(tet > 0.0) {                       << 
104     cosThetaMin = std::cos(std::min(tet, CLHEP << 
105   }                                               116   }
106                                                   117 
107   wokvi->Initialise(part, cosThetaMin);           118   wokvi->Initialise(part, cosThetaMin);
108   pCuts = &cuts;                                  119   pCuts = &cuts;
109   /*                                              120   /*
110   G4cout << "G4eCoulombScatteringModel::Initia    121   G4cout << "G4eCoulombScatteringModel::Initialise for " 
111      << part->GetParticleName() << " 1-cos(Tet    122      << part->GetParticleName() << " 1-cos(TetMin)= " << 1.0 - cosThetaMin 
112      << " 1-cos(TetMax)= " << 1. - cosThetaMax    123      << " 1-cos(TetMax)= " << 1. - cosThetaMax << G4endl;
113   G4cout << "cut[0]= " << (*pCuts)[0] << G4end    124   G4cout << "cut[0]= " << (*pCuts)[0] << G4endl;
114   */                                              125   */
115   if(nullptr == fParticleChange) {             << 126   if(!fParticleChange) {
116     fParticleChange = GetParticleChangeForGamm    127     fParticleChange = GetParticleChangeForGamma();
117   }                                               128   }
118   if(IsMaster() && mass < GeV && part->GetPart    129   if(IsMaster() && mass < GeV && part->GetParticleName() != "GenericIon") {
119     InitialiseElementSelectors(part, cuts);       130     InitialiseElementSelectors(part, cuts);
120   }                                               131   }
121 }                                                 132 }
122                                                   133 
123 //....oooOO0OOooo........oooOO0OOooo........oo    134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124                                                   135 
125 void G4eCoulombScatteringModel::InitialiseLoca    136 void G4eCoulombScatteringModel::InitialiseLocal(const G4ParticleDefinition*, 
126             G4VEmModel* masterModel)              137             G4VEmModel* masterModel)
127 {                                                 138 {
128   SetElementSelectors(masterModel->GetElementS    139   SetElementSelectors(masterModel->GetElementSelectors());
129 }                                                 140 }
130                                                   141 
131 //....oooOO0OOooo........oooOO0OOooo........oo    142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132                                                   143 
133 G4double                                          144 G4double 
134 G4eCoulombScatteringModel::MinPrimaryEnergy(co    145 G4eCoulombScatteringModel::MinPrimaryEnergy(const G4Material* material,
135               const G4ParticleDefinition* part    146               const G4ParticleDefinition* part,
136               G4double)                           147               G4double)
137 {                                                 148 {
138   SetupParticle(part);                            149   SetupParticle(part);
139                                                   150 
140   // define cut using cuts for proton             151   // define cut using cuts for proton
141   G4double cut =                                  152   G4double cut = 
142     std::max(recoilThreshold, (*pCuts)[Current    153     std::max(recoilThreshold, (*pCuts)[CurrentCouple()->GetIndex()]);
143                                                   154 
144   // find out lightest element                    155   // find out lightest element
145   const G4ElementVector* theElementVector = ma    156   const G4ElementVector* theElementVector = material->GetElementVector();
146   std::size_t nelm = material->GetNumberOfElem << 157   G4int nelm = material->GetNumberOfElements();
147                                                   158 
148   // select lightest element                      159   // select lightest element
149   G4int Z = 300;                                  160   G4int Z = 300;
150   for (std::size_t j=0; j<nelm; ++j) {         << 161   for (G4int j=0; j<nelm; ++j) {
151     Z = std::min(Z,(*theElementVector)[j]->Get    162     Z = std::min(Z,(*theElementVector)[j]->GetZasInt());
152   }                                               163   }
153   G4int A = G4lrint(fNistManager->GetAtomicMas    164   G4int A = G4lrint(fNistManager->GetAtomicMassAmu(Z));
154   G4double targetMass = G4NucleiProperties::Ge    165   G4double targetMass = G4NucleiProperties::GetNuclearMass(A, Z);
155   G4double t = std::max(cut, 0.5*(cut + sqrt(2    166   G4double t = std::max(cut, 0.5*(cut + sqrt(2*cut*targetMass)));
156                                                   167 
157   return t;                                       168   return t;
158 }                                                 169 }
159                                                   170 
160 //....oooOO0OOooo........oooOO0OOooo........oo    171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161                                                   172 
162 G4double G4eCoulombScatteringModel::ComputeCro    173 G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
163                 const G4ParticleDefinition* p,    174                 const G4ParticleDefinition* p,
164     G4double kinEnergy,                           175     G4double kinEnergy,
165     G4double Z, G4double,                         176     G4double Z, G4double,
166     G4double cutEnergy, G4double)                 177     G4double cutEnergy, G4double)
167 {                                                 178 {
168   /*                                           << 179   /*
169   G4cout << "### G4eCoulombScatteringModel::Co    180   G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom  for " 
170    << p->GetParticleName()<<" Z= "<<Z<<" e(MeV    181    << p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV 
171    << G4endl;                                     182    << G4endl; 
172   */                                              183   */
173   G4double cross = 0.0;                           184   G4double cross = 0.0;
174   elecRatio = 0.0;                                185   elecRatio = 0.0;
175   if(p != particle) { SetupParticle(p); }         186   if(p != particle) { SetupParticle(p); }
176                                                   187 
177   // cross section is set to zero to avoid pro    188   // cross section is set to zero to avoid problems in sample secondary
178   if(kinEnergy <= 0.0) { return cross; }          189   if(kinEnergy <= 0.0) { return cross; }
179   DefineMaterial(CurrentCouple());                190   DefineMaterial(CurrentCouple());
180   G4double costmin = wokvi->SetupKinematic(kin    191   G4double costmin = wokvi->SetupKinematic(kinEnergy, currentMaterial);
181                                                   192 
182   //G4cout << "cosThetaMax= "<<cosThetaMax<<"     193   //G4cout << "cosThetaMax= "<<cosThetaMax<<" costmin= "<<costmin<< G4endl;
183                                                   194 
184   if(cosThetaMax < costmin) {                     195   if(cosThetaMax < costmin) {
185     G4int iz = G4lrint(Z);                        196     G4int iz = G4lrint(Z);
186     G4double cut = (0.0 < fixedCut) ? fixedCut    197     G4double cut = (0.0 < fixedCut) ? fixedCut : cutEnergy;
187     costmin = wokvi->SetupTarget(iz, cut);        198     costmin = wokvi->SetupTarget(iz, cut);
188     //G4cout << "SetupTarget: Z= " << iz << "     199     //G4cout << "SetupTarget: Z= " << iz << "  cut= " << cut << "  "
189     //     << costmin << G4endl;                  200     //     << costmin << G4endl;
190     G4double costmax = (1 == iz && particle ==    201     G4double costmax = (1 == iz && particle == theProton && cosThetaMax < 0.0)
191       ? 0.0 : cosThetaMax;                        202       ? 0.0 : cosThetaMax; 
192     if(costmin > costmax) {                       203     if(costmin > costmax) {
193       cross = wokvi->ComputeNuclearCrossSectio    204       cross = wokvi->ComputeNuclearCrossSection(costmin, costmax)
194         + wokvi->ComputeElectronCrossSection(c    205         + wokvi->ComputeElectronCrossSection(costmin, costmax);
195     }                                             206     }
196     /*                                            207     /*    
197     if(p->GetParticleName() == "e-")              208     if(p->GetParticleName() == "e-") 
198     G4cout << "Z= " << Z << " e(MeV)= " << kin    209     G4cout << "Z= " << Z << " e(MeV)= " << kinEnergy/MeV 
199      << " cross(b)= " << cross/barn << " 1-cos    210      << " cross(b)= " << cross/barn << " 1-costmin= " << 1-costmin
200      << " 1-costmax= " << 1-costmax               211      << " 1-costmax= " << 1-costmax 
201      << " 1-cosThetaMax= " << 1-cosThetaMax       212      << " 1-cosThetaMax= " << 1-cosThetaMax
202      << "  " << currentMaterial->GetName()        213      << "  " << currentMaterial->GetName()
203      << G4endl;                                   214      << G4endl;
204     */                                            215     */
205   }                                               216   }
206   //G4cout << "====== cross= " << cross << G4e    217   //G4cout << "====== cross= " << cross << G4endl;
207   return cross;                                   218   return cross;  
208 }                                                 219 }
209                                                   220 
210 //....oooOO0OOooo........oooOO0OOooo........oo    221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
211                                                   222 
212 void G4eCoulombScatteringModel::SampleSecondar    223 void G4eCoulombScatteringModel::SampleSecondaries(
213                 std::vector<G4DynamicParticle*    224                 std::vector<G4DynamicParticle*>* fvect,
214     const G4MaterialCutsCouple* couple,           225     const G4MaterialCutsCouple* couple,
215     const G4DynamicParticle* dp,                  226     const G4DynamicParticle* dp,
216     G4double cutEnergy,                           227     G4double cutEnergy,
217     G4double)                                     228     G4double)
218 {                                                 229 {
219   G4double kinEnergy = dp->GetKineticEnergy();    230   G4double kinEnergy = dp->GetKineticEnergy();
220   SetupParticle(dp->GetDefinition());             231   SetupParticle(dp->GetDefinition());
221   DefineMaterial(couple);                         232   DefineMaterial(couple);
222   /*                                              233   /*
223   G4cout << "G4eCoulombScatteringModel::Sample    234   G4cout << "G4eCoulombScatteringModel::SampleSecondaries e(MeV)= " 
224      << kinEnergy << "  " << particle->GetPart    235      << kinEnergy << "  " << particle->GetParticleName() 
225      << " cut= " << cutEnergy<< G4endl;           236      << " cut= " << cutEnergy<< G4endl;
226   */                                              237   */
227   // Choose nucleus                               238   // Choose nucleus
228   G4double cut = (0.0 < fixedCut) ? fixedCut :    239   G4double cut = (0.0 < fixedCut) ? fixedCut : cutEnergy;
229                                                   240 
230   wokvi->SetupKinematic(kinEnergy, currentMate    241   wokvi->SetupKinematic(kinEnergy, currentMaterial);
231                                                   242 
232   const G4Element* currentElement = SelectTarg    243   const G4Element* currentElement = SelectTargetAtom(couple,particle,kinEnergy,
233                                        dp->Get    244                                        dp->GetLogKineticEnergy(),cut,kinEnergy);
234   G4int iz = currentElement->GetZasInt();         245   G4int iz = currentElement->GetZasInt();
235                                                   246 
236   G4double costmin = wokvi->SetupTarget(iz, cu    247   G4double costmin = wokvi->SetupTarget(iz, cut);
237   G4double costmax = (1 == iz && particle == t    248   G4double costmax = (1 == iz && particle == theProton && cosThetaMax < 0.0) 
238     ? 0.0 :  cosThetaMax;                         249     ? 0.0 :  cosThetaMax; 
239   if(costmin <= costmax) { return; }              250   if(costmin <= costmax) { return; }
240                                                   251 
241   G4double cross = wokvi->ComputeNuclearCrossS    252   G4double cross = wokvi->ComputeNuclearCrossSection(costmin, costmax);
242   G4double ecross = wokvi->ComputeElectronCros    253   G4double ecross = wokvi->ComputeElectronCrossSection(costmin, costmax);
243   G4double ratio = ecross/(cross + ecross);       254   G4double ratio = ecross/(cross + ecross);
244                                                   255 
245   G4int ia = SelectIsotopeNumber(currentElemen    256   G4int ia = SelectIsotopeNumber(currentElement);
246   G4double targetMass = G4NucleiProperties::Ge    257   G4double targetMass = G4NucleiProperties::GetNuclearMass(ia, iz);
247   wokvi->SetTargetMass(targetMass);               258   wokvi->SetTargetMass(targetMass);
248                                                   259 
249   G4ThreeVector newDirection =                    260   G4ThreeVector newDirection = 
250     wokvi->SampleSingleScattering(costmin, cos    261     wokvi->SampleSingleScattering(costmin, costmax, ratio);
251   G4double cost = newDirection.z();               262   G4double cost = newDirection.z();
252     /*                                            263     /*
253       G4cout << "SampleSec: e(MeV)= " << kinEn    264       G4cout << "SampleSec: e(MeV)= " << kinEnergy/MeV   
254              << " 1-costmin= " << 1-costmin       265              << " 1-costmin= " << 1-costmin
255              << " 1-costmax= " << 1-costmax       266              << " 1-costmax= " << 1-costmax
256              << " 1-cost= " << 1-cost             267              << " 1-cost= " << 1-cost
257              << " ratio= " << ratio               268              << " ratio= " << ratio
258              << G4endl;                           269              << G4endl;
259     */                                            270     */
260   G4ThreeVector direction = dp->GetMomentumDir    271   G4ThreeVector direction = dp->GetMomentumDirection(); 
261   newDirection.rotateUz(direction);               272   newDirection.rotateUz(direction);   
262                                                   273 
263   fParticleChange->ProposeMomentumDirection(ne    274   fParticleChange->ProposeMomentumDirection(newDirection);   
264                                                   275 
265   // recoil sampling assuming a small recoil      276   // recoil sampling assuming a small recoil
266   // and first order correction to primary 4-m    277   // and first order correction to primary 4-momentum
267   G4double mom2 = wokvi->GetMomentumSquare();     278   G4double mom2 = wokvi->GetMomentumSquare();
268   G4double trec = mom2*(1.0 - cost)               279   G4double trec = mom2*(1.0 - cost)
269     /(targetMass + (mass + kinEnergy)*(1.0 - c    280     /(targetMass + (mass + kinEnergy)*(1.0 - cost));
270                                                   281 
271   // the check likely not needed                  282   // the check likely not needed
272   trec = std::min(trec, kinEnergy);               283   trec = std::min(trec, kinEnergy);
273   G4double finalT = kinEnergy - trec;             284   G4double finalT = kinEnergy - trec; 
274   G4double edep = 0.0;                            285   G4double edep = 0.0;
275     /*                                            286     /*
276     G4cout<<"G4eCoulombScatteringModel: finalT    287     G4cout<<"G4eCoulombScatteringModel: finalT= "<<finalT<<" Trec= "
277     <<trec << " Z= " << iz << " A= " << ia        288     <<trec << " Z= " << iz << " A= " << ia
278     << " tcut(keV)= " << (*pCuts)[currentMater    289     << " tcut(keV)= " << (*pCuts)[currentMaterialIndex]/keV << G4endl;
279     */                                            290     */
280   G4double tcut = recoilThreshold;                291   G4double tcut = recoilThreshold;
281   if(pCuts) { tcut= std::max(tcut,(*pCuts)[cur    292   if(pCuts) { tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]); }
282                                                   293 
283   if(trec > tcut) {                               294   if(trec > tcut) {
284     G4ParticleDefinition* ion = theIonTable->G    295     G4ParticleDefinition* ion = theIonTable->GetIon(iz, ia, 0);
285     G4ThreeVector dir = (direction*sqrt(mom2)     296     G4ThreeVector dir = (direction*sqrt(mom2) - 
286        newDirection*sqrt(finalT*(2*mass + fina    297        newDirection*sqrt(finalT*(2*mass + finalT))).unit();
287     auto newdp = new G4DynamicParticle(ion, di << 298     G4DynamicParticle* newdp = new G4DynamicParticle(ion, dir, trec);
288     fvect->push_back(newdp);                      299     fvect->push_back(newdp);
289   } else {                                        300   } else {
290     edep = trec;                                  301     edep = trec;
291     fParticleChange->ProposeNonIonizingEnergyD    302     fParticleChange->ProposeNonIonizingEnergyDeposit(edep);
292   }                                               303   }
293                                                   304 
294     // finelize primary energy and energy bala    305     // finelize primary energy and energy balance
295     // this threshold may be applied only beca    306     // this threshold may be applied only because for low-enegry
296     // e+e- msc model is applied                  307     // e+e- msc model is applied
297   if(finalT < 0.0) {                              308   if(finalT < 0.0) { 
298     edep += finalT;                               309     edep += finalT;  
299     finalT = 0.0;                                 310     finalT = 0.0;
300   }                                               311   } 
301   edep = std::max(edep, 0.0);                     312   edep = std::max(edep, 0.0);
302   fParticleChange->SetProposedKineticEnergy(fi    313   fParticleChange->SetProposedKineticEnergy(finalT);
303   fParticleChange->ProposeLocalEnergyDeposit(e    314   fParticleChange->ProposeLocalEnergyDeposit(edep);
304 }                                                 315 }
305                                                   316 
306 //....oooOO0OOooo........oooOO0OOooo........oo    317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307                                                   318