00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include "G4PhotoElectricAngularGeneratorSauterGavrila.hh"
00051 #include "G4PhysicalConstants.hh"
00052 #include "Randomize.hh"
00053
00054 G4PhotoElectricAngularGeneratorSauterGavrila::G4PhotoElectricAngularGeneratorSauterGavrila():
00055 G4VEmAngularDistribution("AngularGenSauterGavrilaLowE")
00056 {}
00057
00058 G4PhotoElectricAngularGeneratorSauterGavrila::~G4PhotoElectricAngularGeneratorSauterGavrila()
00059 {}
00060
00061 G4ThreeVector&
00062 G4PhotoElectricAngularGeneratorSauterGavrila::SampleDirection(
00063 const G4DynamicParticle* dp,
00064 G4double, G4int, const G4Material*)
00065 {
00066
00067
00068
00069
00070
00071 G4double costeta = 1.;
00072 G4double Phi = twopi * G4UniformRand();
00073 G4double cosphi = std::cos(Phi);
00074 G4double sinphi = std::sin(Phi);
00075 G4double sinteta = 0;
00076 G4double gamma = 1. + dp->GetKineticEnergy()/electron_mass_c2;
00077
00078 if (gamma > 5.) {
00079 fLocalDirection = dp->GetMomentumDirection();
00080 return fLocalDirection;
00081
00082
00083 }
00084
00085 G4double beta = std::sqrt((gamma - 1)*(gamma + 1))/gamma;
00086 G4double b = 0.5*gamma*(gamma - 1)*(gamma - 2);
00087
00088 G4double rndm,term,greject,grejsup;
00089 if (gamma < 2.) grejsup = gamma*gamma*(1.+b-beta*b);
00090 else grejsup = gamma*gamma*(1.+b+beta*b);
00091
00092 do { rndm = 1.-2*G4UniformRand();
00093 costeta = (rndm+beta)/(rndm*beta+1.);
00094 term = 1.-beta*costeta;
00095 greject = (1.-costeta*costeta)*(1.+b*term)/(term*term);
00096 } while(greject < G4UniformRand()*grejsup);
00097
00098 sinteta = std::sqrt((1 - costeta)*(1 + costeta));
00099 fLocalDirection.set(sinteta*cosphi, sinteta*sinphi, costeta);
00100 fLocalDirection.rotateUz(dp->GetMomentumDirection());
00101 return fLocalDirection;
00102 }
00103
00104 void G4PhotoElectricAngularGeneratorSauterGavrila::PrintGeneratorInformation() const
00105 {
00106 G4cout << "\n" << G4endl;
00107 G4cout << "" << G4endl;
00108 G4cout << "Re-implementation of the photolectric angular distribution" << G4endl;
00109 G4cout << "developed my M. Maire for the Standard EM Physics G4PhotoElectricEffect" << G4endl;
00110 G4cout << "It computes the theta distribution of the emitted electron, with respect to the" << G4endl;
00111 G4cout << "incident Gamma, using the Sauter-Gavrila distribution for the K-shell\n" << G4endl;
00112 }