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 #include <cmath>
00034
00035 #include "G4InuclSpecialFunctions.hh"
00036 #include "G4PhysicalConstants.hh"
00037 #include "G4LorentzVector.hh"
00038 #include "G4ThreeVector.hh"
00039 #include "Randomize.hh"
00040
00041
00042 G4double G4InuclSpecialFunctions::getAL(G4int A) {
00043 return 0.76 + 2.2 / G4cbrt(A);
00044 }
00045
00046 G4double G4InuclSpecialFunctions::csNN(G4double e) {
00047 G4double snn;
00048
00049 if (e < 40.0) {
00050 snn = -1174.8 / (e * e) + 3088.5 / e + 5.3107;
00051 } else {
00052 snn = 93074.0 / (e * e) - 11.148 / e + 22.429;
00053 }
00054
00055 return snn;
00056 }
00057
00058 G4double G4InuclSpecialFunctions::csPN(G4double e) {
00059 G4double spn;
00060
00061 if (e < 40.0) {
00062 spn = -5057.4 / (e * e) + 9069.2 / e + 6.9466;
00063 } else {
00064 spn = 239380.0 / (e * e) + 1802.0 / e + 27.147;
00065 }
00066
00067 return spn;
00068 }
00069
00070
00071
00072 G4double G4InuclSpecialFunctions::FermiEnergy(G4int A, G4int Z, G4int ntype) {
00073 const G4double C = 55.4;
00074 G4double arg = (ntype==0) ? G4double(A-Z)/A : G4double(Z)/A;
00075
00076 return C * G4cbrt(arg*arg);
00077 }
00078
00079 G4double G4InuclSpecialFunctions::G4cbrt(G4double x) {
00080 return x==0 ? 0. : (x<0?-1.:1.)*std::exp(std::log(std::fabs(x))/3.);
00081 }
00082
00083 G4double G4InuclSpecialFunctions::inuclRndm() {
00084 return G4UniformRand();
00085 }
00086
00087 G4double G4InuclSpecialFunctions::randomGauss(G4double sigma) {
00088 const G4double eps = 1.0e-6;
00089 G4double r1 = inuclRndm();
00090 r1 = r1 > eps ? r1 : eps;
00091 G4double r2 = inuclRndm();
00092 r2 = r2 > eps ? r2 : eps;
00093 r2 = r2 < 1.0 - eps ? r2 : 1.0 - eps;
00094
00095 return sigma * std::sin(twopi * r1) * std::sqrt(-2.0 * std::log(r2));
00096 }
00097
00098 G4double G4InuclSpecialFunctions::randomPHI() {
00099 return twopi * inuclRndm();
00100 }
00101
00102 std::pair<G4double, G4double> G4InuclSpecialFunctions::randomCOS_SIN() {
00103 G4double CT = 1.0 - 2.0 * inuclRndm();
00104
00105 return std::pair<G4double, G4double>(CT, std::sqrt(1.0 - CT*CT));
00106 }
00107
00108 G4LorentzVector
00109 G4InuclSpecialFunctions::generateWithFixedTheta(G4double ct, G4double p,
00110 G4double mass) {
00111 G4double phi = randomPHI();
00112 G4double pt = p * std::sqrt(std::fabs(1.0 - ct * ct));
00113
00114 static G4ThreeVector pvec;
00115 static G4LorentzVector momr;
00116
00117 pvec.set(pt*std::cos(phi), pt*std::sin(phi), p*ct);
00118 momr.setVectM(pvec, mass);
00119
00120 return momr;
00121 }
00122
00123 G4LorentzVector
00124 G4InuclSpecialFunctions::generateWithRandomAngles(G4double p, G4double mass) {
00125 std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
00126 G4double phi = randomPHI();
00127 G4double pt = p * COS_SIN.second;
00128
00129 static G4ThreeVector pvec;
00130 static G4LorentzVector momr;
00131
00132 pvec.set(pt*std::cos(phi), pt*std::sin(phi), p*COS_SIN.first);
00133 momr.setVectM(pvec, mass);
00134
00135 return momr;
00136 }