Geant4  10.00.p03
G4eeToHadronsModel.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4eeToHadronsModel.cc 84488 2014-10-16 09:28:02Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class header file
31 //
32 //
33 // File name: G4eeToHadronsModel
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 12.08.2003
38 //
39 // Modifications:
40 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
41 // 18-05-05 Use optimized interfaces (V.Ivantchenko)
42 //
43 //
44 // -------------------------------------------------------------------
45 //
46 
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
51 #include "G4eeToHadronsModel.hh"
52 #include "Randomize.hh"
53 #include "G4PhysicalConstants.hh"
54 #include "G4SystemOfUnits.hh"
55 #include "G4Electron.hh"
56 #include "G4Gamma.hh"
57 #include "G4Positron.hh"
58 #include "G4PionPlus.hh"
59 #include "Randomize.hh"
60 #include "G4Vee2hadrons.hh"
61 #include "G4PhysicsVector.hh"
62 #include "G4PhysicsLogVector.hh"
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65 
66 using namespace std;
67 
69  const G4String& nam)
70  : G4VEmModel(nam),
71  model(mod),
72  crossPerElectron(0),
73  crossBornPerElectron(0),
74  isInitialised(false),
75  nbins(100),
76  verbose(ver)
77 {
84  epeak = emax;
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
88 
90 {
91  delete model;
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95 
97  const G4DataVector&)
98 {
99  if(isInitialised) { return; }
100  isInitialised = true;
101 
102  // CM system
103  emin = model->LowEnergy();
104  emax = model->HighEnergy();
105 
106  // peak energy
108 
109  if(verbose>0) {
110  G4cout << "G4eeToHadronsModel::Initialise: " << G4endl;
111  G4cout << "CM System: emin(MeV)= " << emin/MeV
112  << " epeak(MeV)= " << epeak/MeV
113  << " emax(MeV)= " << emax/MeV
114  << G4endl;
115  }
116 
120  for(G4int i=0; i<nbins; i++) {
124  }
126 
127  if(verbose>1) {
128  G4cout << "G4eeToHadronsModel: Cross secsions per electron"
129  << " nbins= " << nbins
130  << " emin(MeV)= " << emin/MeV
131  << " emax(MeV)= " << emax/MeV
132  << G4endl;
133  for(G4int i=0; i<nbins; i++) {
137  G4cout << "E(MeV)= " << e/MeV
138  << " cross(nb)= " << s1/nanobarn
139  << " crossBorn(nb)= " << s2/nanobarn
140  << G4endl;
141  }
142  }
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
146 
148  const G4Material* mat,
149  const G4ParticleDefinition* p,
150  G4double kineticEnergy,
152 {
153  return mat->GetElectronDensity()*
154  ComputeCrossSectionPerElectron(p, kineticEnergy);
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
158 
160  const G4ParticleDefinition* p,
161  G4double kineticEnergy,
162  G4double Z, G4double,
164 {
165  return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
166 }
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
169 
171  const G4ParticleDefinition*,
174 {
175  G4double cross = 0.0;
176  if(crossPerElectron) {
177  cross = crossPerElectron->Value(energy);
178  }
179  return cross;
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
183 
184 void G4eeToHadronsModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
185  const G4MaterialCutsCouple*,
186  const G4DynamicParticle* dParticle,
187  G4double,
188  G4double)
189 {
190  if(crossPerElectron) {
191  G4double t = dParticle->GetKineticEnergy();
192  G4double e = 2.0*electron_mass_c2*sqrt(1.0 + 0.5*t/electron_mass_c2);
193  G4LorentzVector inlv = dParticle->Get4Momentum();
194  G4ThreeVector inBoost = inlv.boostVector();
195  if(e > emin) {
197  G4LorentzVector gLv = gamma->Get4Momentum();
198  G4LorentzVector lv(0.0,0.0,0.0,e);
199  lv -= gLv;
200  G4double mass = lv.m();
201  G4ThreeVector boost = lv.boostVector();
202  const G4ThreeVector dir = gamma->GetMomentumDirection();
203  model->SampleSecondaries(newp, mass, dir);
204  G4int np = newp->size();
205  for(G4int j=0; j<np; j++) {
206  G4DynamicParticle* dp = (*newp)[j];
207  G4LorentzVector v = dp->Get4Momentum();
208  v.boost(boost);
209  v.boost(inBoost);
210  dp->Set4Momentum(v);
211  }
212  gLv.boost(inBoost);
213  gamma->Set4Momentum(gLv);
214  newp->push_back(gamma);
215  }
216  }
217 }
218 
219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
220 
222 {
223  for(G4int i=0; i<nbins; i++) {
225  G4double cs = 0.0;
226  if(i > 0) {
227  G4double L = 2.0*log(e/electron_mass_c2);
228  G4double bt = 2.0*fine_structure_const*(L - 1.0)/pi;
229  G4double btm1= bt - 1.0;
230  G4double del = 1. + fine_structure_const*(1.5*L + pi*pi/3. -2.)/pi;
233  G4double x1 = 1. - e1/e;
234  cs += s1*(del*pow(x1,bt) - bt*(x1 - 0.25*x1*x1));
235  if(i > 1) {
236  G4double e2 = e1;
237  G4double x2 = x1;
239  G4double w2 = bt*(del*pow(x2,btm1) - 1.0 + 0.5*x2);
240  G4double w1;
241 
242  for(G4int j=i-2; j>=0; j--) {
244  x1 = 1. - e1/e;
245  s1 = crossBornPerElectron->Value(e1);
246  w1 = bt*(del*pow(x1,btm1) - 1.0 + 0.5*x1);
247  cs += 0.5*(x1 - x2)*(w2*s2 + w1*s1);
248  e2 = e1;
249  x2 = x1;
250  s2 = s1;
251  w2 = w1;
252  }
253  }
254  }
255  crossPerElectron->PutValue(i, cs);
256  }
257 }
258 
259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
260 
262 {
263  G4double x;
264  G4DynamicParticle* gamma = 0;
265  G4double L = 2.0*log(e/electron_mass_c2);
266  G4double bt = 2.0*fine_structure_const*(L - 1.)/pi;
267  G4double btm1= bt - 1.0;
268  G4double del = 1. + fine_structure_const*(1.5*L + pi*pi/3. -2.)/pi;
269 
271  G4double de = (emax - emin)/(G4double)nbins;
272  G4double x0 = min(de,e - emin)/e;
274  *(del*pow(x0,bt) - bt*(x0 - 0.25*x0*x0));
275  G4double e1 = e*(1. - x0);
276 
277  if(e1 < emax && s0*G4UniformRand()<ds) {
278  x = x0*pow(G4UniformRand(),1./bt);
279  } else {
280 
281  x = 1. - e1/e;
283  G4double w1 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
284  G4double grej = s1*w1;
285  G4double f;
286  // G4cout << "e= " << e/GeV << " epeak= " << epeak/GeV
287  // << " s1= " << s1 << " w1= " << w1
288  // << " grej= " << grej << G4endl;
289  // Above emax cross section is 0
290  if(e1 > emax) {
291  x = 1. - emax/e;
293  G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
294  grej = s2*w2;
295  // G4cout << "emax= " << emax << " s2= " << s2 << " w2= " << w2
296  // << " grej= " << grej << G4endl;
297  }
298 
299  if(e1 > epeak) {
300  x = 1. - epeak/e;
302  G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
303  grej = max(grej,s2*w2);
304  //G4cout << "epeak= " << epeak << " s2= " << s2 << " w2= " << w2
305  // << " grej= " << grej << G4endl;
306  }
307  G4double xmin = 1. - e1/e;
308  if(e1 > emax) xmin = 1. - emax/e;
309  G4double xmax = 1. - emin/e;
310  do {
311  x = xmin + G4UniformRand()*(xmax - xmin);
312  G4double s2 = crossBornPerElectron->Value((1.0 - x)*e);
313  G4double w2 = bt*(del*pow(x,btm1) - 1.0 + 0.5*x);
314  //G4cout << "x= " << x << " xmin= " << xmin << " xmax= " << xmax
315  // << " s2= " << s2 << " w2= " << w2
316  // << G4endl;
317  f = s2*w2;
318  if(f > grej) {
319  G4cout << "G4DynamicParticle* G4eeToHadronsModel:WARNING "
320  << f << " > " << grej << " majorant is`small!"
321  << G4endl;
322  }
323  } while (f < grej*G4UniformRand());
324  }
325 
326  G4ThreeVector dir(0.0,0.0,1.0);
327  gamma = new G4DynamicParticle(theGamma,dir,x*e);
328  return gamma;
329 }
330 
331 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
332 
G4double LowEnergy() const
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:599
static const double MeV
Definition: G4SIunits.hh:193
static const double nanobarn
Definition: G4SIunits.hh:98
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:592
G4eeToHadronsModel(G4Vee2hadrons *, G4int ver=0, const G4String &nam="eeToHadrons")
G4PhysicsVector * PhysicsVector() const
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin=0.0, G4double maxEnergy=DBL_MAX)
const G4double pi
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy, G4double maxEnergy)
static const G4double e2
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
size_t GetVectorLength() const
G4double GetLowEdgeEnergy(size_t binNumber) const
int G4int
Definition: G4Types.hh:78
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kineticEnergy, G4double Z, G4double A, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
static const G4int L[nN]
G4PhysicsVector * crossPerElectron
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, G4double, const G4ThreeVector &)=0
G4double GetElectronDensity() const
Definition: G4Material.hh:215
const G4ThreeVector & GetMomentumDirection() const
void PutValue(size_t index, G4double theValue)
G4PhysicsVector * crossBornPerElectron
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
G4LorentzVector Get4Momentum() const
static const G4double e1
virtual G4double PeakEnergy() const =0
void Set4Momentum(const G4LorentzVector &momentum)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
G4DynamicParticle * GenerateCMPhoton(G4double)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define G4endl
Definition: G4ios.hh:61
G4double HighEnergy() const
G4ParticleDefinition * theGamma
virtual G4double ComputeCrossSectionPerElectron(const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
double G4double
Definition: G4Types.hh:76
virtual G4double ComputeCrossSection(G4double) const =0
CLHEP::HepLorentzVector G4LorentzVector