Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/standard/src/G4MollerBhabhaModel.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/G4MollerBhabhaModel.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4MollerBhabhaModel.cc (Version 9.6)


  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$
 26 //                                                 27 //
 27 // -------------------------------------------     28 // -------------------------------------------------------------------
 28 //                                                 29 //
 29 // GEANT4 Class file                               30 // GEANT4 Class file
 30 //                                                 31 //
 31 //                                                 32 //
 32 // File name:   G4MollerBhabhaModel                33 // File name:   G4MollerBhabhaModel
 33 //                                                 34 //
 34 // Author:        Vladimir Ivanchenko on base      35 // Author:        Vladimir Ivanchenko on base of Laszlo Urban code
 35 //                                                 36 //
 36 // Creation date: 03.01.2002                       37 // Creation date: 03.01.2002
 37 //                                                 38 //
 38 // Modifications:                                  39 // Modifications:
 39 //                                                 40 //
 40 // 13-11-02 Minor fix - use normalised directi     41 // 13-11-02 Minor fix - use normalised direction (V.Ivanchenko)
 41 // 04-12-02 Change G4DynamicParticle construct     42 // 04-12-02 Change G4DynamicParticle constructor in PostStepDoIt (V.Ivanchenko)
 42 // 23-12-02 Change interface in order to move      43 // 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
 43 // 27-01-03 Make models region aware (V.Ivanch     44 // 27-01-03 Make models region aware (V.Ivanchenko)
 44 // 13-02-03 Add name (V.Ivanchenko)                45 // 13-02-03 Add name (V.Ivanchenko)
 45 // 08-04-05 Major optimisation of internal int     46 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
 46 // 25-07-05 Add protection in calculation of r     47 // 25-07-05 Add protection in calculation of recoil direction for the case 
 47 //          of complete energy transfer from e     48 //          of complete energy transfer from e+ to e- (V.Ivanchenko)
 48 // 06-02-06 ComputeCrossSectionPerElectron, Co     49 // 06-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
 49 // 15-05-06 Fix MinEnergyCut (V.Ivanchenko)        50 // 15-05-06 Fix MinEnergyCut (V.Ivanchenko)
 50 //                                                 51 //
 51 //                                                 52 //
 52 // Class Description:                              53 // Class Description:
 53 //                                                 54 //
 54 // Implementation of energy loss and delta-ele     55 // Implementation of energy loss and delta-electron production by e+/e-
 55 //                                                 56 //
 56 // -------------------------------------------     57 // -------------------------------------------------------------------
 57 //                                                 58 //
 58 //....oooOO0OOooo........oooOO0OOooo........oo     59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 59 //....oooOO0OOooo........oooOO0OOooo........oo     60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 60                                                    61 
 61 #include "G4MollerBhabhaModel.hh"                  62 #include "G4MollerBhabhaModel.hh"
 62 #include "G4PhysicalConstants.hh"                  63 #include "G4PhysicalConstants.hh"
 63 #include "G4SystemOfUnits.hh"                      64 #include "G4SystemOfUnits.hh"
 64 #include "G4Electron.hh"                           65 #include "G4Electron.hh"
 65 #include "G4Positron.hh"                           66 #include "G4Positron.hh"
 66 #include "Randomize.hh"                            67 #include "Randomize.hh"
 67 #include "G4ParticleChangeForLoss.hh"              68 #include "G4ParticleChangeForLoss.hh"
 68 #include "G4Log.hh"                            << 
 69 #include "G4DeltaAngle.hh"                     << 
 70                                                    69 
 71 //....oooOO0OOooo........oooOO0OOooo........oo     70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 72                                                    71 
 73 using namespace std;                               72 using namespace std;
 74                                                    73 
 75 G4MollerBhabhaModel::G4MollerBhabhaModel(const     74 G4MollerBhabhaModel::G4MollerBhabhaModel(const G4ParticleDefinition* p,
 76                                          const     75                                          const G4String& nam)
 77   : G4VEmModel(nam),                               76   : G4VEmModel(nam),
 78     particle(nullptr),                         <<  77     particle(0),
 79     isElectron(true),                              78     isElectron(true),
 80     twoln10(2.0*G4Log(10.0)),                  <<  79     twoln10(2.0*log(10.0)),
 81     lowLimit(0.02*keV),                            80     lowLimit(0.02*keV),
 82     isInitialised(false)                           81     isInitialised(false)
 83 {                                                  82 {
 84   theElectron = G4Electron::Electron();            83   theElectron = G4Electron::Electron();
 85   if(nullptr != p) { SetParticle(p); }         <<  84   if(p) { SetParticle(p); }
 86   fParticleChange = nullptr;                   <<  85   fParticleChange = 0;
 87 }                                                  86 }
 88                                                    87 
 89 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 90                                                    89 
 91 G4MollerBhabhaModel::~G4MollerBhabhaModel() =  <<  90 G4MollerBhabhaModel::~G4MollerBhabhaModel()
                                                   >>  91 {}
 92                                                    92 
 93 //....oooOO0OOooo........oooOO0OOooo........oo     93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 94                                                    94 
 95 G4double G4MollerBhabhaModel::MaxSecondaryEner     95 G4double G4MollerBhabhaModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
 96                                                <<  96              G4double kinEnergy) 
 97 {                                                  97 {
 98   G4double tmax = kinEnergy;                       98   G4double tmax = kinEnergy;
 99   if(isElectron) { tmax *= 0.5; }                  99   if(isElectron) { tmax *= 0.5; }
100   return tmax;                                    100   return tmax;
101 }                                                 101 }
102                                                   102 
103 //....oooOO0OOooo........oooOO0OOooo........oo    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104                                                   104 
105 void G4MollerBhabhaModel::Initialise(const G4P    105 void G4MollerBhabhaModel::Initialise(const G4ParticleDefinition* p,
106                                      const G4D    106                                      const G4DataVector&)
107 {                                                 107 {
108   if(p != particle) { SetParticle(p); }        << 108   if(!particle) { SetParticle(p); }
109                                                   109 
110   if(isInitialised) { return; }                   110   if(isInitialised) { return; }
111                                                   111 
112   isInitialised = true;                           112   isInitialised = true;
113   fParticleChange = GetParticleChangeForLoss()    113   fParticleChange = GetParticleChangeForLoss();
114   if(UseAngularGeneratorFlag() && !GetAngularD << 
115     SetAngularDistribution(new G4DeltaAngle()) << 
116   }                                            << 
117 }                                                 114 }
118                                                   115 
119 //....oooOO0OOooo........oooOO0OOooo........oo    116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120                                                   117 
121 G4double G4MollerBhabhaModel::ComputeCrossSect << 118 G4double 
122          const G4ParticleDefinition* p, G4doub << 119 G4MollerBhabhaModel::ComputeCrossSectionPerElectron(const G4ParticleDefinition* p,
123    G4double cutEnergy, G4double maxEnergy)     << 120                 G4double kineticEnergy,
                                                   >> 121                 G4double cutEnergy,
                                                   >> 122                 G4double maxEnergy)
124 {                                                 123 {
125   if(p != particle) { SetParticle(p); }        << 124   if(!particle) { SetParticle(p); }
126                                                   125 
127   G4double cross = 0.0;                           126   G4double cross = 0.0;
128   G4double tmax = MaxSecondaryEnergy(p, kineti    127   G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
129   tmax = std::min(maxEnergy, tmax);               128   tmax = std::min(maxEnergy, tmax);
130   //G4cout << "E= " << kineticEnergy << " cut= << 129 
131   //         << " Emax= " << tmax << G4endl;   << 
132   if(cutEnergy < tmax) {                          130   if(cutEnergy < tmax) {
133                                                   131 
134     G4double xmin  = cutEnergy/kineticEnergy;     132     G4double xmin  = cutEnergy/kineticEnergy;
135     G4double xmax  = tmax/kineticEnergy;          133     G4double xmax  = tmax/kineticEnergy;
136     G4double tau   = kineticEnergy/electron_ma    134     G4double tau   = kineticEnergy/electron_mass_c2;
137     G4double gam   = tau + 1.0;                   135     G4double gam   = tau + 1.0;
138     G4double gamma2= gam*gam;                     136     G4double gamma2= gam*gam;
139     G4double beta2 = tau*(tau + 2)/gamma2;        137     G4double beta2 = tau*(tau + 2)/gamma2;
140                                                   138 
141     //Moller (e-e-) scattering                    139     //Moller (e-e-) scattering
142     if (isElectron) {                             140     if (isElectron) {
143                                                   141 
144       G4double gg = (2.0*gam - 1.0)/gamma2;       142       G4double gg = (2.0*gam - 1.0)/gamma2;
145       cross = ((xmax - xmin)*(1.0 - gg + 1.0/(    143       cross = ((xmax - xmin)*(1.0 - gg + 1.0/(xmin*xmax)
146                               + 1.0/((1.0-xmin << 144             + 1.0/((1.0-xmin)*(1.0 - xmax)))
147             - gg*G4Log( xmax*(1.0 - xmin)/(xmi << 145             - gg*log( xmax*(1.0 - xmin)/(xmin*(1.0 - xmax)) ) ) / beta2;
148                                                   146 
149     //Bhabha (e+e-) scattering                    147     //Bhabha (e+e-) scattering
150     } else {                                      148     } else {
151                                                   149 
152       G4double y   = 1.0/(1.0 + gam);             150       G4double y   = 1.0/(1.0 + gam);
153       G4double y2  = y*y;                         151       G4double y2  = y*y;
154       G4double y12 = 1.0 - 2.0*y;                 152       G4double y12 = 1.0 - 2.0*y;
155       G4double b1  = 2.0 - y2;                    153       G4double b1  = 2.0 - y2;
156       G4double b2  = y12*(3.0 + y2);              154       G4double b2  = y12*(3.0 + y2);
157       G4double y122= y12*y12;                     155       G4double y122= y12*y12;
158       G4double b4  = y122*y12;                    156       G4double b4  = y122*y12;
159       G4double b3  = b4 + y122;                   157       G4double b3  = b4 + y122;
160                                                   158 
161       cross = (xmax - xmin)*(1.0/(beta2*xmin*x    159       cross = (xmax - xmin)*(1.0/(beta2*xmin*xmax) + b2
162             - 0.5*b3*(xmin + xmax)                160             - 0.5*b3*(xmin + xmax)
163             + b4*(xmin*xmin + xmin*xmax + xmax << 161       + b4*(xmin*xmin + xmin*xmax + xmax*xmax)/3.0)
164             - b1*G4Log(xmax/xmin);             << 162             - b1*log(xmax/xmin);
165     }                                             163     }
166                                                   164 
167     cross *= twopi_mc2_rcl2/kineticEnergy;        165     cross *= twopi_mc2_rcl2/kineticEnergy;
168   }                                               166   }
169   return cross;                                   167   return cross;
170 }                                                 168 }
171                                                   169 
172 //....oooOO0OOooo........oooOO0OOooo........oo    170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
173                                                   171 
174 G4double G4MollerBhabhaModel::ComputeCrossSect    172 G4double G4MollerBhabhaModel::ComputeCrossSectionPerAtom(
175                                            con    173                                            const G4ParticleDefinition* p,
176                                                   174                                                  G4double kineticEnergy,
177                                                << 175              G4double Z, G4double,
178                                                   176                                                  G4double cutEnergy,
179                                                   177                                                  G4double maxEnergy)
180 {                                                 178 {
181   return Z*ComputeCrossSectionPerElectron(p,ki    179   return Z*ComputeCrossSectionPerElectron(p,kineticEnergy,cutEnergy,maxEnergy);
182 }                                                 180 }
183                                                   181 
184 //....oooOO0OOooo........oooOO0OOooo........oo    182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
185                                                   183 
186 G4double G4MollerBhabhaModel::CrossSectionPerV    184 G4double G4MollerBhabhaModel::CrossSectionPerVolume(
187                                            con << 185              const G4Material* material,
188                                            con    186                                            const G4ParticleDefinition* p,
189                                                   187                                                  G4double kinEnergy,
190                                                   188                                                  G4double cutEnergy,
191                                                   189                                                  G4double maxEnergy)
192 {                                                 190 {
193   G4double eDensity = material->GetElectronDen    191   G4double eDensity = material->GetElectronDensity();
194   return eDensity*ComputeCrossSectionPerElectr    192   return eDensity*ComputeCrossSectionPerElectron(p,kinEnergy,cutEnergy,maxEnergy);
                                                   >> 193   /*
                                                   >> 194   G4double Zeff     = eDensity/material->GetTotNbOfAtomsPerVolume();
                                                   >> 195   G4double th       = 0.25*sqrt(Zeff)*keV;
                                                   >> 196   G4double cut;  
                                                   >> 197   if(isElectron) { cut  = std::max(th*0.5, cutEnergy); }
                                                   >> 198   else           { cut  = std::max(th, cutEnergy); }
                                                   >> 199   G4double res = 0.0;
                                                   >> 200   // below this threshold no bremsstrahlung
                                                   >> 201   if (kinEnergy > th) { 
                                                   >> 202     res = eDensity*ComputeCrossSectionPerElectron(p,kinEnergy,cut,maxEnergy);
                                                   >> 203   }
                                                   >> 204   return res; 
                                                   >> 205   */
195 }                                                 206 }
196                                                   207 
197 //....oooOO0OOooo........oooOO0OOooo........oo    208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
198                                                   209 
199 G4double G4MollerBhabhaModel::ComputeDEDXPerVo    210 G4double G4MollerBhabhaModel::ComputeDEDXPerVolume(
200                                           cons << 211             const G4Material* material,
201                                           cons    212                                           const G4ParticleDefinition* p,
202                                                   213                                                 G4double kineticEnergy,
203                                                   214                                                 G4double cut)
204 {                                                 215 {
205   if(p != particle) { SetParticle(p); }        << 216   if(!particle) { SetParticle(p); }
206   // calculate the dE/dx due to the ionization    217   // calculate the dE/dx due to the ionization by Seltzer-Berger formula
207   // checl low-energy limit                       218   // checl low-energy limit
208   G4double electronDensity = material->GetElec    219   G4double electronDensity = material->GetElectronDensity();
209                                                   220   
210   G4double Zeff  = material->GetIonisation()-> << 221   G4double Zeff  = electronDensity/material->GetTotNbOfAtomsPerVolume();
211   G4double th    = 0.25*sqrt(Zeff)*keV;           222   G4double th    = 0.25*sqrt(Zeff)*keV;
212   G4double tkin = std::max(kineticEnergy, th); << 223   //  G4double cut;  
                                                   >> 224   // if(isElectron) { cut  = std::max(th*0.5, cutEnergy); }
                                                   >> 225   // else           { cut  = std::max(th, cutEnergy); }
                                                   >> 226   G4double tkin  = kineticEnergy;
                                                   >> 227   if (kineticEnergy < th) { tkin = th; }
213                                                   228  
214   G4double tau   = tkin/electron_mass_c2;         229   G4double tau   = tkin/electron_mass_c2;
215   G4double gam   = tau + 1.0;                     230   G4double gam   = tau + 1.0;
216   G4double gamma2= gam*gam;                       231   G4double gamma2= gam*gam;
217   G4double bg2   = tau*(tau + 2);                 232   G4double bg2   = tau*(tau + 2);
218   G4double beta2 = bg2/gamma2;                    233   G4double beta2 = bg2/gamma2;
219                                                   234 
220   G4double eexc  = material->GetIonisation()->    235   G4double eexc  = material->GetIonisation()->GetMeanExcitationEnergy();
221   eexc          /= electron_mass_c2;              236   eexc          /= electron_mass_c2;
222   G4double eexc2 = eexc*eexc;                     237   G4double eexc2 = eexc*eexc; 
223                                                   238 
224   G4double d = std::min(cut, MaxSecondaryEnerg    239   G4double d = std::min(cut, MaxSecondaryEnergy(p, tkin))/electron_mass_c2;
225   G4double dedx;                                  240   G4double dedx;
226                                                   241 
227   // electron                                     242   // electron
228   if (isElectron) {                               243   if (isElectron) {
229                                                   244 
230     dedx = G4Log(2.0*(tau + 2.0)/eexc2) - 1.0  << 245     dedx = log(2.0*(tau + 2.0)/eexc2) - 1.0 - beta2
231          + G4Log((tau-d)*d) + tau/(tau-d)      << 246          + log((tau-d)*d) + tau/(tau-d)
232          + (0.5*d*d + (2.0*tau + 1.)*G4Log(1.  << 247          + (0.5*d*d + (2.0*tau + 1.)*log(1. - d/tau))/gamma2;
233                                                   248    
234   //positron                                      249   //positron
235   } else {                                        250   } else {
236                                                   251 
237     G4double d2 = d*d*0.5;                        252     G4double d2 = d*d*0.5;
238     G4double d3 = d2*d/1.5;                       253     G4double d3 = d2*d/1.5;
239     G4double d4 = d3*d*0.75;                      254     G4double d4 = d3*d*0.75;
240     G4double y  = 1.0/(1.0 + gam);                255     G4double y  = 1.0/(1.0 + gam);
241     dedx = G4Log(2.0*(tau + 2.0)/eexc2) + G4Lo << 256     dedx = log(2.0*(tau + 2.0)/eexc2) + log(tau*d)
242          - beta2*(tau + 2.0*d - y*(3.0*d2         257          - beta2*(tau + 2.0*d - y*(3.0*d2 
243          + y*(d - d3 + y*(d2 - tau*d3 + d4))))    258          + y*(d - d3 + y*(d2 - tau*d3 + d4))))/tau;
244   }                                               259   } 
245                                                   260 
246   //density correction                            261   //density correction 
247   G4double x = G4Log(bg2)/twoln10;             << 262   G4double x = log(bg2)/twoln10;
248   dedx -= material->GetIonisation()->DensityCo    263   dedx -= material->GetIonisation()->DensityCorrection(x); 
249                                                   264 
250   // now you can compute the total ionization     265   // now you can compute the total ionization loss
251   dedx *= twopi_mc2_rcl2*electronDensity/beta2    266   dedx *= twopi_mc2_rcl2*electronDensity/beta2;
252   if (dedx < 0.0) { dedx = 0.0; }                 267   if (dedx < 0.0) { dedx = 0.0; }
253                                                   268  
254   // lowenergy extrapolation                      269   // lowenergy extrapolation
255                                                   270  
256   if (kineticEnergy < th) {                       271   if (kineticEnergy < th) {
257     x = kineticEnergy/th;                         272     x = kineticEnergy/th;
258     if(x > 0.25) { dedx /= sqrt(x); }             273     if(x > 0.25) { dedx /= sqrt(x); }
259     else { dedx *= 1.4*sqrt(x)/(0.1 + x); }       274     else { dedx *= 1.4*sqrt(x)/(0.1 + x); }
260   }                                               275   }
261   return dedx;                                    276   return dedx;
262 }                                                 277 }
263                                                   278 
264 //....oooOO0OOooo........oooOO0OOooo........oo    279 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
265                                                   280 
266 void                                           << 281 void G4MollerBhabhaModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
267 G4MollerBhabhaModel::SampleSecondaries(std::ve << 282               const G4MaterialCutsCouple*,
268                                        const G << 283               const G4DynamicParticle* dp,
269                                        const G << 284               G4double cutEnergy,
270                                        G4doubl << 285               G4double maxEnergy)
271                                        G4doubl << 
272 {                                                 286 {
273   G4double kineticEnergy = dp->GetKineticEnerg    287   G4double kineticEnergy = dp->GetKineticEnergy();
274   //G4cout << "G4MollerBhabhaModel::SampleSeco << 288   //const G4Material* mat = couple->GetMaterial();
275   //       << " in " << couple->GetMaterial()- << 289   //G4double Zeff = mat->GetElectronDensity()/mat->GetTotNbOfAtomsPerVolume();
                                                   >> 290   // G4double th   = 0.25*sqrt(Zeff)*keV;
276   G4double tmax;                                  291   G4double tmax;
277   G4double tmin = cutEnergy;                      292   G4double tmin = cutEnergy;  
278   if(isElectron) {                                293   if(isElectron) { 
279     tmax = 0.5*kineticEnergy;                     294     tmax = 0.5*kineticEnergy; 
280   } else {                                        295   } else {
281     tmax = kineticEnergy;                         296     tmax = kineticEnergy; 
282   }                                               297   }
283   if(maxEnergy < tmax) { tmax = maxEnergy; }      298   if(maxEnergy < tmax) { tmax = maxEnergy; }
284   if(tmin >= tmax) { return; }                    299   if(tmin >= tmax) { return; }
285                                                   300 
286   G4double energy = kineticEnergy + electron_m    301   G4double energy = kineticEnergy + electron_mass_c2;
                                                   >> 302   G4double totalMomentum = sqrt(kineticEnergy*(energy + electron_mass_c2));
287   G4double xmin   = tmin/kineticEnergy;           303   G4double xmin   = tmin/kineticEnergy;
288   G4double xmax   = tmax/kineticEnergy;           304   G4double xmax   = tmax/kineticEnergy;
289   G4double gam    = energy/electron_mass_c2;      305   G4double gam    = energy/electron_mass_c2;
290   G4double gamma2 = gam*gam;                      306   G4double gamma2 = gam*gam;
291   G4double beta2  = 1.0 - 1.0/gamma2;             307   G4double beta2  = 1.0 - 1.0/gamma2;
292   G4double x, z, grej;                         << 308   G4double x, z, q, grej;
293   CLHEP::HepRandomEngine* rndmEngine = G4Rando << 309 
294   G4double rndm[2];                            << 310   G4ThreeVector direction = dp->GetMomentumDirection();
295                                                   311 
296   //Moller (e-e-) scattering                      312   //Moller (e-e-) scattering
297   if (isElectron) {                               313   if (isElectron) {
298                                                   314 
299     G4double gg = (2.0*gam - 1.0)/gamma2;         315     G4double gg = (2.0*gam - 1.0)/gamma2;
300     G4double y = 1.0 - xmax;                      316     G4double y = 1.0 - xmax;
301     grej = 1.0 - gg*xmax + xmax*xmax*(1.0 - gg    317     grej = 1.0 - gg*xmax + xmax*xmax*(1.0 - gg + (1.0 - gg*y)/(y*y));
302                                                   318 
303     do {                                          319     do {
304       rndmEngine->flatArray(2, rndm);          << 320       q = G4UniformRand();
305       x = xmin*xmax/(xmin*(1.0 - rndm[0]) + xm << 321       x = xmin*xmax/(xmin*(1.0 - q) + xmax*q);
306       y = 1.0 - x;                                322       y = 1.0 - x;
307       z = 1.0 - gg*x + x*x*(1.0 - gg + (1.0 -     323       z = 1.0 - gg*x + x*x*(1.0 - gg + (1.0 - gg*y)/(y*y));
308       /*                                          324       /*
309       if(z > grej) {                              325       if(z > grej) {
310         G4cout << "G4MollerBhabhaModel::Sample    326         G4cout << "G4MollerBhabhaModel::SampleSecondary Warning! "
311                << "Majorant " << grej << " < "    327                << "Majorant " << grej << " < "
312                << z << " for x= " << x            328                << z << " for x= " << x
313                << " e-e- scattering"              329                << " e-e- scattering"
314                << G4endl;                         330                << G4endl;
315       }                                           331       }
316       */                                          332       */
317       // Loop checking, 03-Aug-2015, Vladimir  << 333     } while(grej * G4UniformRand() > z);
318     } while(grej * rndm[1] > z);               << 
319                                                   334 
320   //Bhabha (e+e-) scattering                      335   //Bhabha (e+e-) scattering
321   } else {                                        336   } else {
322                                                   337 
323     G4double y   = 1.0/(1.0 + gam);               338     G4double y   = 1.0/(1.0 + gam);
324     G4double y2  = y*y;                           339     G4double y2  = y*y;
325     G4double y12 = 1.0 - 2.0*y;                   340     G4double y12 = 1.0 - 2.0*y;
326     G4double b1  = 2.0 - y2;                      341     G4double b1  = 2.0 - y2;
327     G4double b2  = y12*(3.0 + y2);                342     G4double b2  = y12*(3.0 + y2);
328     G4double y122= y12*y12;                       343     G4double y122= y12*y12;
329     G4double b4  = y122*y12;                      344     G4double b4  = y122*y12;
330     G4double b3  = b4 + y122;                     345     G4double b3  = b4 + y122;
331                                                   346 
332     y    = xmax*xmax;                             347     y    = xmax*xmax;
333     grej = 1.0 + (y*y*b4 - xmin*xmin*xmin*b3 +    348     grej = 1.0 + (y*y*b4 - xmin*xmin*xmin*b3 + y*b2 - xmin*b1)*beta2; 
334     do {                                          349     do {
335       rndmEngine->flatArray(2, rndm);          << 350       q = G4UniformRand();
336       x = xmin*xmax/(xmin*(1.0 - rndm[0]) + xm << 351       x = xmin*xmax/(xmin*(1.0 - q) + xmax*q);
337       y = x*x;                                    352       y = x*x;
338       z = 1.0 + (y*y*b4 - x*y*b3 + y*b2 - x*b1    353       z = 1.0 + (y*y*b4 - x*y*b3 + y*b2 - x*b1)*beta2; 
339       /*                                          354       /*
340       if(z > grej) {                              355       if(z > grej) {
341         G4cout << "G4MollerBhabhaModel::Sample    356         G4cout << "G4MollerBhabhaModel::SampleSecondary Warning! "
342                << "Majorant " << grej << " < "    357                << "Majorant " << grej << " < "
343                << z << " for x= " << x            358                << z << " for x= " << x
344                << " e+e- scattering"              359                << " e+e- scattering"
345                << G4endl;                         360                << G4endl;
346       }                                           361       }
347       */                                          362       */
348       // Loop checking, 03-Aug-2015, Vladimir  << 363     } while(grej * G4UniformRand() > z);
349     } while(grej * rndm[1] > z);               << 
350   }                                               364   }
351                                                   365 
352   G4double deltaKinEnergy = x * kineticEnergy;    366   G4double deltaKinEnergy = x * kineticEnergy;
353                                                   367 
354   G4ThreeVector deltaDirection;                << 368   G4double deltaMomentum =
                                                   >> 369            sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
                                                   >> 370   G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
                                                   >> 371                                    (deltaMomentum * totalMomentum);
                                                   >> 372   G4double sint = (1.0 - cost)*(1. + cost);
                                                   >> 373   if(sint > 0.0) { sint = sqrt(sint); }
                                                   >> 374   else { sint = 0.0; }
355                                                   375 
356   if(UseAngularGeneratorFlag()) {              << 376   G4double phi = twopi * G4UniformRand() ;
357     const G4Material* mat =  couple->GetMateri << 
358     G4int Z = SelectRandomAtomNumber(mat);     << 
359                                                   377 
360     deltaDirection =                           << 378   G4ThreeVector deltaDirection(sint*cos(phi),sint*sin(phi), cost) ;
361       GetAngularDistribution()->SampleDirectio << 379   deltaDirection.rotateUz(direction);
362                                                << 
363   } else {                                     << 
364                                                << 
365     G4double deltaMomentum =                   << 
366       sqrt(deltaKinEnergy * (deltaKinEnergy +  << 
367     G4double cost = deltaKinEnergy * (energy + << 
368       (deltaMomentum * dp->GetTotalMomentum()) << 
369     if(cost > 1.0) { cost = 1.0; }             << 
370     G4double sint = sqrt((1.0 - cost)*(1.0 + c << 
371                                                << 
372     G4double phi = twopi * rndmEngine->flat()  << 
373                                                << 
374     deltaDirection.set(sint*cos(phi),sint*sin( << 
375     deltaDirection.rotateUz(dp->GetMomentumDir << 
376   }                                            << 
377                                                << 
378   // create G4DynamicParticle object for delta << 
379   auto delta = new G4DynamicParticle(theElectr << 
380   vdp->push_back(delta);                       << 
381                                                   380 
382   // primary change                               381   // primary change
383   kineticEnergy -= deltaKinEnergy;                382   kineticEnergy -= deltaKinEnergy;
384   G4ThreeVector finalP = dp->GetMomentum() - d << 
385   finalP               = finalP.unit();        << 
386                                                << 
387   fParticleChange->SetProposedKineticEnergy(ki    383   fParticleChange->SetProposedKineticEnergy(kineticEnergy);
388   fParticleChange->SetProposedMomentumDirectio << 384 
                                                   >> 385   G4ThreeVector dir = totalMomentum*direction - deltaMomentum*deltaDirection;
                                                   >> 386   direction = dir.unit();
                                                   >> 387   fParticleChange->SetProposedMomentumDirection(direction);
                                                   >> 388 
                                                   >> 389   // create G4DynamicParticle object for delta ray
                                                   >> 390   G4DynamicParticle* delta = new G4DynamicParticle(theElectron,
                                                   >> 391                deltaDirection,deltaKinEnergy);
                                                   >> 392   vdp->push_back(delta);
389 }                                                 393 }
390                                                   394 
391 //....oooOO0OOooo........oooOO0OOooo........oo    395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
392                                                   396