Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4SauterGavrilaAngularDistribution.cc
이 파일의 문서화 페이지로 가기
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: G4SauterGavrilaAngularDistribution.cc 104021 2017-05-08 07:35:57Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4SauterGavrilaAngularDistribution
34 //
35 // Author: Vladimir Ivanchenko using Michel Maire algorithm
36 // developed for Geant3
37 //
38 // Creation date: 23 July 2012
39 //
40 // Modified:
41 // 04.05.2017 Marilena Bandieramonte implemented Penelope 2014 algorithm
42 // -------------------------------------------------------------------
43 //
44 
46 #include "G4PhysicalConstants.hh"
47 #include "Randomize.hh"
48 
50  : G4VEmAngularDistribution("AngularGenSauterGavrila")
51 {}
52 
54 {}
55 
57  const G4DynamicParticle* dp, G4double, G4int, const G4Material*)
58 {
59  static const G4double emin = 1*CLHEP::eV;
60  static const G4double emax = 100*CLHEP::MeV;
61 
63  if (energy > emax) {
65  } else {
66  // Initial algorithm according Penelope 2008 manual and
67  // F.Sauter Ann. Physik 9, 217(1931); 11, 454(1931).
68  // Modified according Penelope 2014 manual
69  G4double costheta = 0.0;
70 
71  // 1) initialize energy-dependent variables
72  // Variable naming according to Eq. (2.24) of Penelope Manual
73  // (pag. 44)
74  G4double tau = energy/electron_mass_c2;
75  G4double gamma = 1.0 + tau;
76  G4double beta = std::sqrt(tau*(tau + 2.0))/gamma;
77 
78  // ac corresponds to "A" of Eq. (2.31)
79  //
80  G4double ac = (1.0 - beta)/beta;
81  G4double a1 = 0.5*beta*gamma*tau*(gamma-2.0);
82  G4double a2 = ac + 2.0;
83  // gtmax = maximum of the rejection function according to Eq. (2.28),
84  // obtained for tsam=0
85  G4double gtmax = 2.0*(a1 + 1.0/ac);
86 
87  G4double tsam = 0.0;
88  G4double gtr = 0.0;
89 
90  //2) sampling. Eq. (2.31) of Penelope Manual
91  // tsam = 1-std::cos(theta)
92  // gtr = rejection function according to Eq. (2.28)
93  do{
94  G4double rand = G4UniformRand();
95  tsam = 2.0*ac * (2.0*rand + a2*std::sqrt(rand)) / (a2*a2 - 4.0*rand);
96  gtr = (2.0 - tsam) * (a1 + 1.0/(ac+tsam));
97  // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
98  } while(G4UniformRand()*gtmax > gtr);
99 
100  costheta = 1.0 - tsam;
101 
102  G4double sint = std::sqrt(tsam*(2.0 - tsam));
104 
105  fLocalDirection.set(sint*std::cos(phi), sint*std::sin(phi), costheta);
107  }
108  return fLocalDirection;
109 }
110 
112 {
113  G4cout << "\n" << G4endl;
114  G4cout << "Non-polarized photoelectric effect angular generator." << G4endl;
115  G4cout << "The Sauter-Gavrila distribution for the K-shell is used."<<G4endl;
116  G4cout << "Originally developed by M.Maire for Geant3"
117  << G4endl;
118 }
119 
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double e=0.0, G4int shellId=0, const G4Material *mat=0) final
#define G4endl
Definition: G4ios.hh:61
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:38
static const G4double emax
Double_t beta
double G4double
Definition: G4Types.hh:76
static constexpr double electron_mass_c2
static constexpr double MeV
#define G4UniformRand()
Definition: Randomize.hh:53
double energy
Definition: plottest35.C:25
static constexpr double eV
static constexpr double twopi
Definition: SystemOfUnits.h:55
int G4int
Definition: G4Types.hh:78
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout