source: trunk/source/processes/electromagnetic/highenergy/src/G4eeToHadronsModel.cc

Last change on this file was 1340, checked in by garnier, 15 years ago

update ti head

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