Geant4_10
G4MuBremsstrahlungModel.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: G4MuBremsstrahlungModel.cc 75168 2013-10-29 09:20:52Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4MuBremsstrahlungModel
34 //
35 // Author: Vladimir Ivanchenko on base of Laszlo Urban code
36 //
37 // Creation date: 24.06.2002
38 //
39 // Modifications:
40 //
41 // 04-12-02 Change G4DynamicParticle constructor in PostStepDoIt (V.Ivanchenko)
42 // 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
43 // 24-01-03 Fix for compounds (V.Ivanchenko)
44 // 27-01-03 Make models region aware (V.Ivanchenko)
45 // 13-02-03 Add name (V.Ivanchenko)
46 // 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
47 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
48 // 03-08-05 Angular correlations according to PRM (V.Ivanchenko)
49 // 13-02-06 add ComputeCrossSectionPerAtom (mma)
50 // 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI)
51 // 07-11-07 Improve sampling of final state (A.Bogdanov)
52 // 28-02-08 Use precomputed Z^1/3 and Log(A) (V.Ivanchenko)
53 // 31-05-13 Use element selectors instead of local data structure (V.Ivanchenko)
54 //
55 
56 //
57 // Class Description:
58 //
59 //
60 // -------------------------------------------------------------------
61 //
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 #include "G4PhysicalConstants.hh"
67 #include "G4SystemOfUnits.hh"
68 #include "G4Gamma.hh"
69 #include "G4MuonMinus.hh"
70 #include "G4MuonPlus.hh"
71 #include "Randomize.hh"
72 #include "G4Material.hh"
73 #include "G4Element.hh"
74 #include "G4ElementVector.hh"
75 #include "G4ProductionCutsTable.hh"
77 #include "G4LossTableManager.hh"
78 #include "G4Log.hh"
79 #include "G4Exp.hh"
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
84 using namespace std;
85 
86 const G4double G4MuBremsstrahlungModel::xgi[] =
87  {0.03377,0.16940,0.38069,0.61931,0.83060,0.96623};
88 const G4double G4MuBremsstrahlungModel::wgi[] =
89  {0.08566,0.18038,0.23396,0.23396,0.18038,0.08566};
90 G4double G4MuBremsstrahlungModel::fDN[] = {0.0};
91 
93  const G4String& nam)
94  : G4VEmModel(nam),
95  particle(0),
96  sqrte(sqrt(G4Exp(1.))),
97  bh(202.4),
98  bh1(446.),
99  btf(183.),
100  btf1(1429.),
101  fParticleChange(0),
102  lowestKinEnergy(1.0*GeV),
103  minThreshold(0.9*keV)
104 {
105  theGamma = G4Gamma::Gamma();
107 
108  lowestKinEnergy = 1.*GeV;
109 
110  mass = rmass = cc = coeff = 1.0;
111 
112  if(0.0 == fDN[1]) {
113  for(G4int i=1; i<93; ++i) {
114  G4double dn = 1.54*nist->GetA27(i);
115  fDN[i] = dn;
116  if(1 < i) {
117  fDN[i] /= std::pow(dn, 1./G4double(i));
118  }
119  }
120  }
121 
122  if(p) { SetParticle(p); }
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
126 
128 {}
129 
130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
131 
133  const G4MaterialCutsCouple*)
134 {
135  return minThreshold;
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
139 
141  const G4ParticleDefinition*,
142  G4double cut)
143 {
144  return std::max(lowestKinEnergy,cut);
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
150  const G4DataVector& cuts)
151 {
152  if(p) { SetParticle(p); }
153 
154  if(IsMaster() && p == particle) { InitialiseElementSelectors(p, cuts); }
155 
156  // define pointer to G4ParticleChange
157  if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
161 
163  G4VEmModel* masterModel)
164 {
165  if(p == particle) {
167  }
168 }
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171 
173  const G4Material* material,
174  const G4ParticleDefinition*,
175  G4double kineticEnergy,
176  G4double cutEnergy)
177 {
178  G4double dedx = 0.0;
179  if (kineticEnergy <= lowestKinEnergy) { return dedx; }
180 
181  G4double tmax = kineticEnergy;
182  G4double cut = std::min(cutEnergy,tmax);
183  if(cut < minThreshold) { cut = minThreshold; }
184 
185  const G4ElementVector* theElementVector = material->GetElementVector();
186  const G4double* theAtomicNumDensityVector =
187  material->GetAtomicNumDensityVector();
188 
189  // loop for elements in the material
190  for (size_t i=0; i<material->GetNumberOfElements(); i++) {
191 
192  G4double loss =
193  ComputMuBremLoss((*theElementVector)[i]->GetZ(), kineticEnergy, cut);
194 
195  dedx += loss*theAtomicNumDensityVector[i];
196  }
197  // G4cout << "BR e= " << kineticEnergy << " dedx= " << dedx << G4endl;
198  if(dedx < 0.) dedx = 0.;
199  return dedx;
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
203 
205  G4double tkin, G4double cut)
206 {
207  G4double totalEnergy = mass + tkin;
208  static const G4double ak1 = 0.05;
209  static const G4int k2=5;
210  G4double loss = 0.;
211 
212  G4double vcut = cut/totalEnergy;
213  G4double vmax = tkin/totalEnergy;
214 
215  G4double aaa = 0.;
216  G4double bbb = vcut;
217  if(vcut>vmax) { bbb = vmax; }
218  G4int kkk = (G4int)((bbb-aaa)/ak1)+k2;
219  if(kkk < 1) { kkk = 1; }
220 
221  G4double hhh=(bbb-aaa)/G4double(kkk);
222 
223  G4double aa = aaa;
224  for(G4int l=0; l<kkk; l++)
225  {
226  for(G4int i=0; i<6; i++)
227  {
228  G4double ep = (aa + xgi[i]*hhh)*totalEnergy;
229  loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
230  }
231  aa += hhh;
232  }
233 
234  loss *=hhh*totalEnergy ;
235 
236  return loss;
237 }
238 
239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
240 
242  G4double tkin,
243  G4double Z,
244  G4double cut)
245 {
246  G4double totalEnergy = tkin + mass;
247  static const G4double ak1 = 2.3;
248  static const G4int k2 = 4;
249  G4double cross = 0.;
250 
251  if(cut >= tkin) return cross;
252 
253  G4double vcut = cut/totalEnergy;
254  G4double vmax = tkin/totalEnergy;
255 
256  G4double aaa = G4Log(vcut);
257  G4double bbb = G4Log(vmax);
258  G4int kkk = (G4int)((bbb-aaa)/ak1)+k2 ;
259  if(kkk < 1) { kkk = 1; }
260 
261  G4double hhh = (bbb-aaa)/G4double(kkk);
262 
263  G4double aa = aaa;
264 
265  for(G4int l=0; l<kkk; l++)
266  {
267  for(G4int i=0; i<6; i++)
268  {
269  G4double ep = G4Exp(aa + xgi[i]*hhh)*totalEnergy;
270  cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
271  }
272  aa += hhh;
273  }
274 
275  cross *=hhh;
276 
277  //G4cout << "BR e= " << tkin<< " cross= " << cross/barn << G4endl;
278 
279  return cross;
280 }
281 
282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
283 
285  G4double tkin,
286  G4double Z,
287  G4double gammaEnergy)
288 // differential cross section
289 {
290  G4double dxsection = 0.;
291 
292  if(gammaEnergy > tkin) { return dxsection; }
293 
294  G4double E = tkin + mass ;
295  G4double v = gammaEnergy/E ;
296  G4double delta = 0.5*mass*mass*v/(E-gammaEnergy) ;
297  G4double rab0 = delta*sqrte ;
298 
299  G4int iz = G4lrint(Z);
300  if(iz < 1) { iz = 1; }
301  else if(iz > 92) { iz = 92; }
302 
303  G4double z13 = 1.0/nist->GetZ13(iz);
304  G4double dnstar = fDN[iz];
305 
306  G4double b,b1;
307 
308  if(1 == iz) {
309  b = bh;
310  b1 = bh1;
311  } else {
312  b = btf;
313  b1 = btf1;
314  }
315 
316  // nucleus contribution logarithm
317  G4double rab1=b*z13;
318  G4double fn=G4Log(rab1/(dnstar*(electron_mass_c2+rab0*rab1))*
319  (mass+delta*(dnstar*sqrte-2.))) ;
320  if(fn <0.) { fn = 0.; }
321  // electron contribution logarithm
322  G4double epmax1=E/(1.+0.5*mass*rmass/E) ;
323  G4double fe=0.;
324  if(gammaEnergy<epmax1)
325  {
326  G4double rab2=b1*z13*z13 ;
327  fe=G4Log(rab2*mass/((1.+delta*rmass/(electron_mass_c2*sqrte))*
328  (electron_mass_c2+rab0*rab2))) ;
329  if(fe<0.) { fe=0.; }
330  }
331 
332  dxsection = coeff*(1.-v*(1. - 0.75*v))*Z*(fn*Z + fe)/gammaEnergy;
333 
334  return dxsection;
335 }
336 
337 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
338 
340  const G4ParticleDefinition*,
341  G4double kineticEnergy,
343  G4double cutEnergy,
344  G4double maxEnergy)
345 {
346  G4double cross = 0.0;
347  if (kineticEnergy <= lowestKinEnergy) return cross;
348  G4double tmax = std::min(maxEnergy, kineticEnergy);
349  G4double cut = std::min(cutEnergy, kineticEnergy);
350  if(cut < minThreshold) cut = minThreshold;
351  if (cut >= tmax) return cross;
352 
353  cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
354  if(tmax < kineticEnergy) {
355  cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
356  }
357  return cross;
358 }
359 
360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
361 
363  std::vector<G4DynamicParticle*>* vdp,
364  const G4MaterialCutsCouple* couple,
365  const G4DynamicParticle* dp,
366  G4double minEnergy,
367  G4double maxEnergy)
368 {
369  G4double kineticEnergy = dp->GetKineticEnergy();
370  // check against insufficient energy
371  G4double tmax = std::min(kineticEnergy, maxEnergy);
372  G4double tmin = std::min(kineticEnergy, minEnergy);
373  if(tmin < minThreshold) tmin = minThreshold;
374  if(tmin >= tmax) return;
375 
376  // ===== sampling of energy transfer ======
377 
378  G4ParticleMomentum partDirection = dp->GetMomentumDirection();
379 
380  // select randomly one element constituing the material
381  const G4Element* anElement = SelectRandomAtom(couple,particle,kineticEnergy);
382  G4double Z = anElement->GetZ();
383 
384  G4double totalEnergy = kineticEnergy + mass;
385  G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass));
386 
387  G4double func1 = tmin*
388  ComputeDMicroscopicCrossSection(kineticEnergy,Z,tmin);
389 
390  G4double lnepksi, epksi;
391  G4double func2;
392 
393  G4double xmin = G4Log(tmin/MeV);
394  G4double xmax = G4Log(kineticEnergy/tmin);
395 
396  do {
397  lnepksi = xmin + G4UniformRand()*xmax;
398  epksi = MeV*G4Exp(lnepksi);
399  func2 = epksi*ComputeDMicroscopicCrossSection(kineticEnergy,Z,epksi);
400 
401  } while(func2 < func1*G4UniformRand());
402 
403  G4double gEnergy = epksi;
404 
405  // ===== sample angle =====
406 
407  G4double gam = totalEnergy/mass;
408  G4double rmax = gam*std::min(1.0, totalEnergy/gEnergy - 1.0);
409  G4double rmax2= rmax*rmax;
410  G4double x = G4UniformRand()*rmax2/(1.0 + rmax2);
411 
412  G4double theta = sqrt(x/(1.0 - x))/gam;
413  G4double sint = sin(theta);
414  G4double phi = twopi * G4UniformRand() ;
415  G4double dirx = sint*cos(phi), diry = sint*sin(phi), dirz = cos(theta) ;
416 
417  G4ThreeVector gDirection(dirx, diry, dirz);
418  gDirection.rotateUz(partDirection);
419 
420  partDirection *= totalMomentum;
421  partDirection -= gEnergy*gDirection;
422  partDirection = partDirection.unit();
423 
424  // primary change
425  kineticEnergy -= gEnergy;
426  fParticleChange->SetProposedKineticEnergy(kineticEnergy);
427  fParticleChange->SetProposedMomentumDirection(partDirection);
428 
429  // save secondary
430  G4DynamicParticle* aGamma =
431  new G4DynamicParticle(theGamma,gDirection,gEnergy);
432  vdp->push_back(aGamma);
433 }
434 
435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuBremsstrahlungModel(const G4ParticleDefinition *p=0, const G4String &nam="MuBrem")
G4ParticleChangeForLoss * GetParticleChangeForLoss()
Definition: G4VEmModel.cc:107
int func1(int i)
Definition: XFunc.cc:40
std::vector< G4Element * > G4ElementVector
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
G4double GetKineticEnergy() const
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
Definition: G4VEmModel.cc:135
int func2(int i)
Definition: XFunc.cc:51
G4double ComputeMicroscopicCrossSection(G4double tkin, G4double Z, G4double cut)
const char * p
Definition: xmltok.h:285
G4double GetZ() const
Definition: G4Element.hh:131
G4double GetZ13(G4double Z)
G4bool IsMaster() const
Definition: G4VEmModel.hh:676
G4double GetA27(G4int Z)
tuple x
Definition: test.py:50
void SetParticle(const G4ParticleDefinition *)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin, G4double Z, G4double gammaEnergy)
string material
Definition: eplot.py:19
tuple b
Definition: test.py:12
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
#define G4UniformRand()
Definition: Randomize.hh:87
Float_t Z
Definition: plot.C:39
const G4ParticleDefinition * particle
const G4ThreeVector & GetMomentumDirection() const
G4double iz
Definition: TRTMaterials.hh:39
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:72
void SetProposedKineticEnergy(G4double proposedKinEnergy)
float electron_mass_c2
Definition: hepunit.py:274
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
std::vector< G4EmElementSelector * > * GetElementSelectors()
Definition: G4VEmModel.hh:760
void SetProposedMomentumDirection(const G4ThreeVector &dir)
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:214
tuple v
Definition: test.py:18
G4double G4Log(G4double x)
Definition: G4Log.hh:227
virtual G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy)
G4double ComputMuBremLoss(G4double Z, G4double tkin, G4double cut)
void SetElementSelectors(std::vector< G4EmElementSelector * > *)
Definition: G4VEmModel.hh:768
int G4lrint(double ad)
Definition: templates.hh:163
T max(const T t1, const T t2)
brief Return the largest of the two arguments
Hep3Vector unit() const
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kineticEnergy, G4double Z, G4double A, G4double cutEnergy, G4double maxEnergy)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
TH1F * hhh
Definition: AddMC.C:5
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.hh:510
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4fissionEvent * fe