Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/highenergy/src/G4eeToHadronsModel.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/highenergy/src/G4eeToHadronsModel.cc (Version 11.3.0) and /processes/electromagnetic/highenergy/src/G4eeToHadronsModel.cc (Version 8.1.p1)


  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: G4eeToHadronsModel.cc,v 1.7 2006/06/29 19:32:46 gunter Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class header file                        31 // GEANT4 Class header file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4eeToHadronsModel               34 // File name:     G4eeToHadronsModel
 33 //                                                 35 //
 34 // Author:        Vladimir Ivanchenko              36 // Author:        Vladimir Ivanchenko
 35 //                                                 37 //
 36 // Creation date: 12.08.2003                       38 // Creation date: 12.08.2003
 37 //                                                 39 //
 38 // Modifications:                                  40 // Modifications:
 39 // 08-04-05 Major optimisation of internal int     41 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
 40 // 18-05-05 Use optimized interfaces (V.Ivantc     42 // 18-05-05 Use optimized interfaces (V.Ivantchenko)
 41 //                                                 43 //
 42 //                                                 44 //
 43 // -------------------------------------------     45 // -------------------------------------------------------------------
 44 //                                                 46 //
 45                                                    47 
 46                                                    48 
 47 //....oooOO0OOooo........oooOO0OOooo........oo     49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 48 //....oooOO0OOooo........oooOO0OOooo........oo     50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 49                                                    51 
 50 #include "G4eeToHadronsModel.hh"                   52 #include "G4eeToHadronsModel.hh"
 51 #include "Randomize.hh"                            53 #include "Randomize.hh"
 52 #include "G4PhysicalConstants.hh"              << 
 53 #include "G4SystemOfUnits.hh"                  << 
 54 #include "G4Electron.hh"                           54 #include "G4Electron.hh"
 55 #include "G4Gamma.hh"                              55 #include "G4Gamma.hh"
 56 #include "G4Positron.hh"                           56 #include "G4Positron.hh"
 57 #include "G4PionPlus.hh"                           57 #include "G4PionPlus.hh"
 58 #include "Randomize.hh"                            58 #include "Randomize.hh"
 59 #include "G4Vee2hadrons.hh"                        59 #include "G4Vee2hadrons.hh"
 60 #include "G4PhysicsVector.hh"                      60 #include "G4PhysicsVector.hh"
 61 #include "G4PhysicsLogVector.hh"                   61 #include "G4PhysicsLogVector.hh"
 62 #include "G4Log.hh"                            << 
 63 #include "G4Exp.hh"                            << 
 64                                                    62 
 65 //....oooOO0OOooo........oooOO0OOooo........oo     63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 66                                                    64 
 67 using namespace std;                               65 using namespace std;
 68                                                    66 
 69 G4eeToHadronsModel::G4eeToHadronsModel(G4Vee2h <<  67 G4eeToHadronsModel::G4eeToHadronsModel(const G4Vee2hadrons* m,
                                                   >>  68                      G4int ver,
 70                                        const G     69                                        const G4String& nam)
 71   : G4VEmModel(nam),                               70   : G4VEmModel(nam),
 72     model(mod),                                <<  71   model(m),
 73     verbose(ver)                               <<  72   crossPerElectron(0),
                                                   >>  73   crossBornPerElectron(0),
                                                   >>  74   isInitialised(false),
                                                   >>  75   nbins(100),
                                                   >>  76   verbose(ver)
 74 {                                                  77 {
 75   theGamma = G4Gamma::Gamma();                 <<  78   theGamma      = G4Gamma::Gamma();
 76   highKinEnergy = HighEnergyLimit();           << 
 77   lowKinEnergy  = LowEnergyLimit();            << 
 78   emin = lowKinEnergy;                         << 
 79   emax = highKinEnergy;                        << 
 80   peakKinEnergy = highKinEnergy;               << 
 81   epeak = emax;                                << 
 82   //verbose = 1;                               << 
 83 }                                                  79 }
 84                                                    80 
 85 //....oooOO0OOooo........oooOO0OOooo........oo     81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 86                                                    82 
 87 G4eeToHadronsModel::~G4eeToHadronsModel()          83 G4eeToHadronsModel::~G4eeToHadronsModel()
 88 {                                                  84 {
 89   delete model;                                    85   delete model;
                                                   >>  86   delete crossPerElectron;
                                                   >>  87   delete crossBornPerElectron;
 90 }                                                  88 }
 91                                                    89 
 92 //....oooOO0OOooo........oooOO0OOooo........oo     90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 93                                                    91 
 94 void G4eeToHadronsModel::Initialise(const G4Pa     92 void G4eeToHadronsModel::Initialise(const G4ParticleDefinition*,
 95                                     const G4Da     93                                     const G4DataVector&)
 96 {                                                  94 {
 97   if(isInitialised) { return; }                <<  95   if(isInitialised) return;
 98   isInitialised  = true;                           96   isInitialised  = true;
 99                                                    97 
100   // CM system                                 <<  98   highKinEnergy = HighEnergyLimit();
101   emin = model->LowEnergy();                   <<  99   lowKinEnergy  = LowEnergyLimit();
102   emax = model->HighEnergy();                  << 100 
103                                                << 101   emin  = model->ThresholdEnergy();
104   // peak energy                               << 102   emax = 2.0*electron_mass_c2*sqrt(1.0 + 0.5*highKinEnergy/electron_mass_c2);
105   epeak = std::min(model->PeakEnergy(), emax); << 103   if(emin > emax) emin = emax;
106                                                << 104 
                                                   >> 105   lowKinEnergy  = 0.5*emin*emin/electron_mass_c2 - 2.0*electron_mass_c2;
                                                   >> 106 
                                                   >> 107   epeak = min(model->PeakEnergy(), emax);
                                                   >> 108   peakKinEnergy  = 0.5*epeak*epeak/electron_mass_c2 - 2.0*electron_mass_c2;
                                                   >> 109 
107   if(verbose>0) {                                 110   if(verbose>0) {
108     G4cout << "G4eeToHadronsModel::Initialise:    111     G4cout << "G4eeToHadronsModel::Initialise: " << G4endl;
109     G4cout << "CM System: emin(MeV)= " << emin << 112     G4cout << "LabSystem: emin(GeV)= " << lowKinEnergy/GeV
                                                   >> 113            << " epeak(GeV)= " << peakKinEnergy/GeV
                                                   >> 114            << " emax(GeV)= " << highKinEnergy/GeV
                                                   >> 115            << G4endl;
                                                   >> 116     G4cout << "SM System: emin(MeV)= " << emin/MeV
110            << " epeak(MeV)= " << epeak/MeV        117            << " epeak(MeV)= " << epeak/MeV
111            << " emax(MeV)= " << emax/MeV          118            << " emax(MeV)= " << emax/MeV
112            << G4endl;                             119            << G4endl;
113   }                                               120   }
114                                                   121 
115   crossBornPerElectron = model->PhysicsVector( << 122   if(lowKinEnergy < peakKinEnergy) {
116   crossPerElectron     = model->PhysicsVector( << 123     crossBornPerElectron = model->PhysicsVector(emin, emax);
117   nbins = (G4int)crossPerElectron->GetVectorLe << 124     crossPerElectron     = model->PhysicsVector(emin, emax);
118   for(G4int i=0; i<nbins; ++i) {               << 125     nbins = crossPerElectron->GetVectorLength();
119     G4double e  = crossPerElectron->Energy(i); << 126     for(G4int i=0; i<nbins; i++) {
120     G4double cs = model->ComputeCrossSection(e << 127       G4double e  = crossPerElectron->GetLowEdgeEnergy(i);
121     crossBornPerElectron->PutValue(i, cs);     << 128       G4double cs = model->ComputeCrossSection(e);
                                                   >> 129       crossBornPerElectron->PutValue(i, cs);
                                                   >> 130     }
                                                   >> 131     ComputeCMCrossSectionPerElectron();
122   }                                               132   }
123   ComputeCMCrossSectionPerElectron();          << 
124                                                << 
125   if(verbose>1) {                                 133   if(verbose>1) {
126     G4cout << "G4eeToHadronsModel: Cross secti << 134     G4cout << "G4eeToHadronsModel: Cross secsions per electron"
127            << " nbins= " << nbins                 135            << " nbins= " << nbins
128            << " emin(MeV)= " << emin/MeV          136            << " emin(MeV)= " << emin/MeV
129            << " emax(MeV)= " << emax/MeV          137            << " emax(MeV)= " << emax/MeV
130            << G4endl;                             138            << G4endl;
131     for(G4int i=0; i<nbins; ++i) {             << 139     G4bool b;
132       G4double e  = crossPerElectron->Energy(i << 140     for(G4int i=0; i<nbins; i++) {
133       G4double s1 = crossPerElectron->Value(e) << 141       G4double e  = crossPerElectron->GetLowEdgeEnergy(i);
134       G4double s2 = crossBornPerElectron->Valu << 142       G4double s1 = crossPerElectron->GetValue(e, b);
                                                   >> 143       G4double s2 = crossBornPerElectron->GetValue(e, b);
135       G4cout << "E(MeV)= " << e/MeV               144       G4cout << "E(MeV)= " << e/MeV
136              << "  cross(nb)= " << s1/nanobarn    145              << "  cross(nb)= " << s1/nanobarn
137              << "  crossBorn(nb)= " << s2/nano    146              << "  crossBorn(nb)= " << s2/nanobarn
138        << G4endl;                                 147        << G4endl;
139     }                                             148     }
140   }                                               149   }
141 }                                                 150 }
142                                                   151 
143 //....oooOO0OOooo........oooOO0OOooo........oo    152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
144                                                   153 
145 G4double G4eeToHadronsModel::CrossSectionPerVo << 
146               const G4Material* mat,           << 
147               const G4ParticleDefinition* p,   << 
148               G4double kineticEnergy,          << 
149               G4double, G4double)              << 
150 {                                              << 
151   return mat->GetElectronDensity()*            << 
152     ComputeCrossSectionPerElectron(p, kineticE << 
153 }                                              << 
154                                                << 
155 //....oooOO0OOooo........oooOO0OOooo........oo << 
156                                                << 
157 G4double G4eeToHadronsModel::ComputeCrossSecti << 
158                                       const G4 << 
159               G4double kineticEnergy,          << 
160               G4double Z, G4double,            << 
161               G4double, G4double)              << 
162 {                                              << 
163   return Z*ComputeCrossSectionPerElectron(p, k << 
164 }                                              << 
165                                                << 
166 //....oooOO0OOooo........oooOO0OOooo........oo << 
167                                                << 
168 G4double G4eeToHadronsModel::ComputeCrossSecti    154 G4double G4eeToHadronsModel::ComputeCrossSectionPerElectron(
169                                           cons    155                                           const G4ParticleDefinition*,
170                                                << 156                                                 G4double kineticEnergy,
171                                                   157                                                 G4double, G4double)
172 {                                                 158 {
173   return crossPerElectron->Value(energy);      << 159   G4double cross = 0.0;
                                                   >> 160   if(crossPerElectron) {
                                                   >> 161     G4bool b;
                                                   >> 162     G4double e = 2.0*electron_mass_c2*
                                                   >> 163                  sqrt(1.0 + 0.5*kineticEnergy/electron_mass_c2);
                                                   >> 164     cross = crossPerElectron->GetValue(e, b);
                                                   >> 165   }
                                                   >> 166   //  G4cout << "e= " << kineticEnergy << " cross= " << cross << G4endl;
                                                   >> 167   return cross;
174 }                                                 168 }
175                                                   169 
176 //....oooOO0OOooo........oooOO0OOooo........oo    170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
177                                                   171 
178 void G4eeToHadronsModel::SampleSecondaries(std << 172 std::vector<G4DynamicParticle*>* G4eeToHadronsModel::SampleSecondaries(
179              const G4MaterialCutsCouple*,      << 173                              const G4MaterialCutsCouple*,
180              const G4DynamicParticle* dParticl << 174                              const G4DynamicParticle* dParticle,
181              G4double,                         << 175                                    G4double,
182              G4double)                         << 176                                    G4double)
183 {                                                 177 {
184   G4double t = dParticle->GetKineticEnergy() + << 178   std::vector<G4DynamicParticle*>* newp = 0;
185   G4LorentzVector inlv = dParticle->Get4Moment << 179   if(crossPerElectron) {
186     G4LorentzVector(0.0,0.0,0.0,electron_mass_ << 180     G4double t = dParticle->GetKineticEnergy();
187   G4double e = inlv.m();                       << 181     G4double e = 2.0*electron_mass_c2*sqrt(1.0 + 0.5*t/electron_mass_c2);
188   G4ThreeVector inBoost = inlv.boostVector();  << 182     G4LorentzVector inlv = dParticle->Get4Momentum();
189   //G4cout << "G4eeToHadronsModel::SampleSecon << 183     G4ThreeVector inBoost = inlv.boostVector();
190   //     << " " << inlv << " " << inBoost <<G4 << 184     if(e > emin) {
191   if(e > emin) {                               << 185       G4DynamicParticle* gamma = GenerateCMPhoton(e);
192     G4DynamicParticle* gamma = GenerateCMPhoto << 186       G4LorentzVector gLv = gamma->Get4Momentum();
193     G4LorentzVector gLv = gamma->Get4Momentum( << 187       G4LorentzVector lv(0.0,0.0,0.0,e);
194     G4LorentzVector lv(0.0,0.0,0.0,e);         << 188       lv -= gLv;
195     lv -= gLv;                                 << 189       G4double m = lv.m();
196     G4double mass = lv.m();                    << 190       G4ThreeVector boost = lv.boostVector();
197     //G4cout << "mass= " << mass << " " << lv  << 191       const G4ThreeVector dir = gamma->GetMomentumDirection();
198     G4ThreeVector boost = lv.boostVector();    << 192       newp = model->SampleSecondaries(m, dir);
199     //G4cout << "mass= " << mass << " " << boo << 193       if(newp) {
200     const G4ThreeVector dir = gamma->GetMoment << 194         G4int np = newp->size();
201     model->SampleSecondaries(newp, mass, dir); << 195         for(G4int j=0; j<np; j++) {
202     std::size_t np = newp->size();             << 196           G4DynamicParticle* dp = (*newp)[j];
203     for(std::size_t j=0; j<np; ++j) {          << 197           G4LorentzVector v = dp->Get4Momentum();
204       G4DynamicParticle* dp = (*newp)[j];      << 198           v.boost(boost);
205       G4LorentzVector v = dp->Get4Momentum();  << 199           v.boost(inBoost);
206       v.boost(boost);                          << 200           dp->Set4Momentum(v);
207       //G4cout << j << ". " << v << G4endl;    << 201   }
208       v.boost(inBoost);                        << 202       } else {
209       //G4cout << "   " << v << G4endl;        << 203         newp = new std::vector<G4DynamicParticle*>;
210       dp->Set4Momentum(v);                     << 204       }
211       t -= v.e();                              << 205       gLv.boost(inBoost);
212     }                                          << 206       gamma->Set4Momentum(gLv);
213     //G4cout << "Gamma   " << gLv << G4endl;   << 207       newp->push_back(gamma);
214     gLv.boost(inBoost);                        << 
215     //G4cout << "        " << gLv << G4endl;   << 
216     gamma->Set4Momentum(gLv);                  << 
217     t -= gLv.e();                              << 
218     newp->push_back(gamma);                    << 
219     if(std::abs(t) > CLHEP::MeV) {             << 
220       G4cout << "G4eeToHadronsModel::SampleSec << 
221        << t/MeV << " primary 4-momentum: " <<  << 
222     }                                             208     }
223   }                                               209   }
                                                   >> 210   return newp;
224 }                                                 211 }
225                                                   212 
226 //....oooOO0OOooo........oooOO0OOooo........oo    213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
227                                                   214 
228 void G4eeToHadronsModel::ComputeCMCrossSection    215 void G4eeToHadronsModel::ComputeCMCrossSectionPerElectron()
229 {                                                 216 {
                                                   >> 217   G4bool b;
230   for(G4int i=0; i<nbins; i++) {                  218   for(G4int i=0; i<nbins; i++) {
231     G4double e  = crossPerElectron->Energy(i); << 219     G4double e  = crossPerElectron->GetLowEdgeEnergy(i);
232     G4double cs = 0.0;                            220     G4double cs = 0.0;
233     if(i > 0) {                                   221     if(i > 0) {
234       G4double LL   = 2.0*G4Log(e/electron_mas << 222       G4double L   = 2.0*log(e/electron_mass_c2);
235       G4double bt  = 2.0*fine_structure_const* << 223       G4double bt  = 2.0*fine_structure_const*(L - 1.0)/pi;
236       G4double btm1= bt - 1.0;                    224       G4double btm1= bt - 1.0;
237       G4double del = 1. + fine_structure_const << 225       G4double del = 1. + fine_structure_const*(1.5*L + pi*pi/3. -2.)/pi;
238       G4double s1  = crossBornPerElectron->Val << 226       G4double s1  = crossBornPerElectron->GetValue(e, b);
239       G4double e1  = crossPerElectron->Energy( << 227       G4double e1  = crossPerElectron->GetLowEdgeEnergy(i-1);
240       G4double x1  = 1. - e1/e;                   228       G4double x1  = 1. - e1/e;
241       cs += s1*(del*G4Exp(G4Log(x1)*bt) - bt*( << 229       cs += s1*(del*pow(x1,bt) - bt*(x1 - 0.25*x1*x1));
242       if(i > 1) {                                 230       if(i > 1) {
243   G4double e2  = e1;                              231   G4double e2  = e1;
244   G4double x2  = x1;                              232   G4double x2  = x1;
245   G4double s2  = crossBornPerElectron->Value(e << 233   G4double s2  = crossBornPerElectron->GetValue(e2, b);
246   G4double w2  = bt*(del*G4Exp(G4Log(x2)*btm1) << 234   G4double w2  = bt*(del*pow(x2,btm1) - 1.0 + 0.5*x2);
247         G4double w1;                           << 235      
248                                                << 236   for(G4int j=i-2; j>=0; j--) {
249   for(G4int j=i-2; j>=0; --j) {                << 237     e1  = crossPerElectron->GetLowEdgeEnergy(j);
250     e1  = crossPerElectron->Energy(j);         << 
251     x1  = 1. - e1/e;                              238     x1  = 1. - e1/e;
252     s1  = crossBornPerElectron->Value(e1);     << 239     G4double s1 = crossBornPerElectron->GetValue(e1, b);
253     w1  = bt*(del*G4Exp(G4Log(x1)*btm1) - 1.0  << 240     G4double w1 = bt*(del*pow(x1,btm1) - 1.0 + 0.5*x1);
254     cs += 0.5*(x1 - x2)*(w2*s2 + w1*s1);          241     cs += 0.5*(x1 - x2)*(w2*s2 + w1*s1);
255     e2 = e1;                                      242     e2 = e1;
256     x2 = x1;                                      243     x2 = x1;
257     s2 = s1;                                      244     s2 = s1;
258     w2 = w1;                                      245     w2 = w1;
259   }                                               246   }
260       }                                           247       }
261     }                                             248     }
262     crossPerElectron->PutValue(i, cs);            249     crossPerElectron->PutValue(i, cs);
                                                   >> 250     //    G4cout << "e= " << e << "  cs= " << cs << G4endl;
263   }                                               251   }
264 }                                                 252 }
265                                                   253 
266 //....oooOO0OOooo........oooOO0OOooo........oo    254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
267                                                   255 
268 G4DynamicParticle* G4eeToHadronsModel::Generat    256 G4DynamicParticle* G4eeToHadronsModel::GenerateCMPhoton(G4double e)
269 {                                                 257 {
                                                   >> 258   G4bool b;   
270   G4double x;                                     259   G4double x;
271   G4DynamicParticle* gamma = nullptr;          << 260   G4DynamicParticle* gamma = 0;
272   G4double LL   = 2.0*G4Log(e/electron_mass_c2 << 261   G4double L   = 2.0*log(e/electron_mass_c2);
273   G4double bt  = 2.0*fine_structure_const*(LL  << 262   G4double bt  = 2.0*fine_structure_const*(L - 1.)/pi;
274   G4double btm1= bt - 1.0;                        263   G4double btm1= bt - 1.0;
275   G4double del = 1. + fine_structure_const*(1. << 264   G4double del = 1. + fine_structure_const*(1.5*L + pi*pi/3. -2.)/pi;
276                                                   265 
277   G4double s0 = crossBornPerElectron->Value(e) << 266   G4double s0 = crossBornPerElectron->GetValue(e, b);
278   G4double de = (emax - emin)/(G4double)nbins;    267   G4double de = (emax - emin)/(G4double)nbins;
279   G4double xmax = 0.5*(1.0 - (emin*emin)/(e*e) << 268   G4double x0 = min(de,e - emin)/e;
280   G4double xmin = std::min(de/e, xmax);        << 269   G4double ds = crossBornPerElectron->GetValue(e, b)
281   G4double ds = s0*(del*G4Exp(G4Log(xmin)*bt)  << 270               *(del*pow(x0,bt) - bt*(x0 - 0.25*x0*x0));
282   G4double e1 = e*(1. - xmin);                 << 271   G4double e1 = e*(1. - x0);
283                                                << 272 
284   //G4cout << "e1= " << e1 << G4endl;          << 
285   if(e1 < emax && s0*G4UniformRand()<ds) {        273   if(e1 < emax && s0*G4UniformRand()<ds) { 
286     x = xmin*G4Exp(G4Log(G4UniformRand())/bt); << 274     x = x0*pow(G4UniformRand(),1./bt);
287   } else {                                        275   } else {    
288                                                   276 
289     x = xmin;                                  << 277     x  = 1. - e1/e;
290     G4double s1 = crossBornPerElectron->Value( << 278     G4double s1 = crossBornPerElectron->GetValue(e1, b);
291     G4double w1 = bt*(del*G4Exp(G4Log(x)*btm1) << 279     G4double w1 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
292     G4double grej = s1*w1;                        280     G4double grej = s1*w1;
293     G4double f;                                   281     G4double f;
294     /*                                         << 282     //    G4cout << "e= " << e/GeV << " epeak= " << epeak/GeV 
295      G4cout << "e(GeV)= " << e/GeV << " epeak( << 283     //       << " s1= " << s1 << " w1= " << w1 
296            << " s1= " << s1 << " w1= " << w1   << 284     //       << " grej= " << grej << G4endl;
297            << " grej= " << grej << G4endl;     << 285     // Above emax cross section is 0
298     */                                         << 
299     // Above emax cross section is const       << 
300     if(e1 > emax) {                               286     if(e1 > emax) {
301       x  = 0.5*(1. - (emax*emax)/(e*e));       << 287       x  = 1. - emax/e;
302       G4double s2 = crossBornPerElectron->Valu << 288       G4double s2 = crossBornPerElectron->GetValue(emax, b);
303       G4double w2 = bt*(del*G4Exp(G4Log(x)*btm << 289       G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
304       grej = s2*w2;                               290       grej = s2*w2;
305       //G4cout << "emax= " << emax << " s2= "  << 291       //  G4cout << "emax= " << emax << " s2= " << s2 << " w2= " << w2 
306       // << " grej= " << grej << G4endl;       << 292       //   << " grej= " << grej << G4endl;
307     }                                             293     }
308                                                   294 
309     if(e1 > epeak) {                              295     if(e1 > epeak) {
310       x = 0.5*(1.0 - (epeak*epeak)/(e*e));     << 296       x  = 1. - epeak/e;
311       G4double s2 = crossBornPerElectron->Valu << 297       G4double s2 = crossBornPerElectron->GetValue(epeak, b);
312       G4double w2 = bt*(del*G4Exp(G4Log(x)*btm << 298       G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
313       grej = std::max(grej,s2*w2);             << 299       grej = max(grej,s2*w2);
314       //G4cout << "epeak= " << epeak << " s2=     300       //G4cout << "epeak= " << epeak << " s2= " << s2 << " w2= " << w2 
315       //     << " grej= " << grej << G4endl;      301       //     << " grej= " << grej << G4endl;
316     }                                             302     }
317     G4int ii = 0;                              << 303     G4double xmin = 1. - e1/e;
318     const G4int iimax = 1000;                  << 304     if(e1 > emax) xmin = 1. - emax/e;
                                                   >> 305     G4double xmax = 1. - emin/e;
319     do {                                          306     do {
320       x = xmin + G4UniformRand()*(xmax - xmin)    307       x = xmin + G4UniformRand()*(xmax - xmin);
321                                                << 308       G4double s2 = crossBornPerElectron->GetValue((1.0 - x)*e, b);
322       G4double s2 = crossBornPerElectron->Valu << 309       G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
323       G4double w2 = bt*(del*G4Exp(G4Log(x)*btm << 310       //G4cout << "x= " << x << " xmin= " << xmin << " xmax= " << xmax
324       /*                                       << 311       //     << " s2= " << s2 << " w2= " << w2 
325       G4cout << "x= " << x << " xmin= " << xmi << 312       //     << G4endl;
326            << " s2= " << s2 << " w2= " << w2 < << 
327       */                                       << 
328       f = s2*w2;                                  313       f = s2*w2;
329       if(f > grej) {                              314       if(f > grej) {
330   G4cout << "G4DynamicParticle* G4eeToHadronsM    315   G4cout << "G4DynamicParticle* G4eeToHadronsModel:WARNING "
331          << f << " > " << grej << " majorant i    316          << f << " > " << grej << " majorant is`small!" 
332          << G4endl;                               317          << G4endl; 
333       }                                           318       }
334       if(++ii >= iimax) { break; }             << 
335       // Loop checking, 07-Aug-2015, Vladimir  << 
336     } while (f < grej*G4UniformRand());           319     } while (f < grej*G4UniformRand());
337   }                                               320   }
338                                                   321 
339   G4ThreeVector dir(0.0,0.0,1.0);                 322   G4ThreeVector dir(0.0,0.0,1.0);
340   if(G4UniformRand() > 0.5) { dir.set(0.0,0.0, << 
341   //G4cout << "Egamma(MeV)= " << x*e <<  " " < << 
342   gamma = new G4DynamicParticle(theGamma,dir,x    323   gamma = new G4DynamicParticle(theGamma,dir,x*e);
343   return gamma;                                   324   return gamma;
344 }                                                 325 }
345                                                   326 
346 //....oooOO0OOooo........oooOO0OOooo........oo    327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
                                                   >> 328 
347                                                   329