#include <G4SPSEneDistribution.hh>
Definition at line 146 of file G4SPSEneDistribution.hh.
G4SPSEneDistribution::G4SPSEneDistribution | ( | ) |
Definition at line 53 of file G4SPSEneDistribution.cc.
00054 : particle_definition(0), eneRndm(0), Splinetemp(0) 00055 { 00056 // 00057 // Initialise all variables 00058 particle_energy = 1.0 * MeV; 00059 00060 EnergyDisType = "Mono"; 00061 weight = 1.; 00062 MonoEnergy = 1 * MeV; 00063 Emin = 0.; 00064 Emax = 1.e30; 00065 alpha = 0.; 00066 biasalpha = 0.; 00067 prob_norm = 1.0; 00068 Ezero = 0.; 00069 SE = 0.; 00070 Temp = 0.; 00071 grad = 0.; 00072 cept = 0.; 00073 Biased = false; // not biased 00074 EnergySpec = true; // true - energy spectra, false - momentum spectra 00075 DiffSpec = true; // true - differential spec, false integral spec 00076 IntType = "NULL"; // Interpolation type 00077 IPDFEnergyExist = false; 00078 IPDFArbExist = false; 00079 00080 ArbEmin = 0.; 00081 ArbEmax = 1.e30; 00082 00083 verbosityLevel = 0; 00084 00085 }
G4SPSEneDistribution::~G4SPSEneDistribution | ( | ) |
void G4SPSEneDistribution::ArbEnergyHisto | ( | G4ThreeVector | ) |
Definition at line 157 of file G4SPSEneDistribution.cc.
References G4cout, G4endl, and G4PhysicsOrderedFreeVector::InsertValues().
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00157 { 00158 G4double ehi, val; 00159 ehi = input.x(); 00160 val = input.y(); 00161 if (verbosityLevel > 1) { 00162 G4cout << "In ArbEnergyHisto" << G4endl; 00163 G4cout << " " << ehi << " " << val << G4endl; 00164 } 00165 ArbEnergyH.InsertValues(ehi, val); 00166 }
void G4SPSEneDistribution::ArbEnergyHistoFile | ( | G4String | ) |
Definition at line 168 of file G4SPSEneDistribution.cc.
References FatalException, G4Exception(), and G4PhysicsOrderedFreeVector::InsertValues().
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00168 { 00169 std::ifstream infile(filename, std::ios::in); 00170 if (!infile) 00171 G4Exception("G4SPSEneDistribution::ArbEnergyHistoFile", 00172 "Event0301",FatalException, 00173 "Unable to open the histo ASCII file"); 00174 G4double ehi, val; 00175 while (infile >> ehi >> val) { 00176 ArbEnergyH.InsertValues(ehi, val); 00177 } 00178 }
void G4SPSEneDistribution::ArbInterpolate | ( | G4String | ) |
Definition at line 295 of file G4SPSEneDistribution.cc.
References G4cout, G4endl, G4PhysicsOrderedFreeVector::GetMaxLowEdgeEnergy(), and G4PhysicsOrderedFreeVector::GetMinLowEdgeEnergy().
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00295 { 00296 if (EnergyDisType != "Arb") 00297 G4cout << "Error: this is for arbitrary distributions" << G4endl; 00298 IntType = IType; 00299 ArbEmax = ArbEnergyH.GetMaxLowEdgeEnergy(); 00300 ArbEmin = ArbEnergyH.GetMinLowEdgeEnergy(); 00301 00302 // Now interpolate points 00303 if (IntType == "Lin") 00304 LinearInterpolation(); 00305 if (IntType == "Log") 00306 LogInterpolation(); 00307 if (IntType == "Exp") 00308 ExpInterpolation(); 00309 if (IntType == "Spline") 00310 SplineInterpolation(); 00311 }
void G4SPSEneDistribution::Calculate | ( | ) |
Definition at line 193 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00193 { 00194 if (EnergyDisType == "Cdg") 00195 CalculateCdgSpectrum(); 00196 else if (EnergyDisType == "Bbody") 00197 CalculateBbodySpectrum(); 00198 }
void G4SPSEneDistribution::EpnEnergyHisto | ( | G4ThreeVector | ) |
Definition at line 180 of file G4SPSEneDistribution.cc.
References G4cout, G4endl, and G4PhysicsOrderedFreeVector::InsertValues().
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00180 { 00181 G4double ehi, val; 00182 ehi = input.x(); 00183 val = input.y(); 00184 if (verbosityLevel > 1) { 00185 G4cout << "In EpnEnergyHisto" << G4endl; 00186 G4cout << " " << ehi << " " << val << G4endl; 00187 } 00188 EpnEnergyH.InsertValues(ehi, val); 00189 Emax = ehi; 00190 Epnflag = true; 00191 }
G4double G4SPSEneDistribution::GenerateOne | ( | G4ParticleDefinition * | ) |
Definition at line 1217 of file G4SPSEneDistribution.cc.
References G4cout.
Referenced by G4SingleParticleSource::GeneratePrimaryVertex().
01217 { 01218 particle_definition = a; 01219 particle_energy = -1.; 01220 01221 while ((EnergyDisType == "Arb") ? (particle_energy < ArbEmin 01222 || particle_energy > ArbEmax) : (particle_energy < Emin 01223 || particle_energy > Emax)) { 01224 if (Biased) { 01225 GenerateBiasPowEnergies(); 01226 } else { 01227 if (EnergyDisType == "Mono") 01228 GenerateMonoEnergetic(); 01229 else if (EnergyDisType == "Lin") 01230 GenerateLinearEnergies(); 01231 else if (EnergyDisType == "Pow") 01232 GeneratePowEnergies(); 01233 else if (EnergyDisType == "Exp") 01234 GenerateExpEnergies(); 01235 else if (EnergyDisType == "Gauss") 01236 GenerateGaussEnergies(); 01237 else if (EnergyDisType == "Brem") 01238 GenerateBremEnergies(); 01239 else if (EnergyDisType == "Bbody") 01240 GenerateBbodyEnergies(); 01241 else if (EnergyDisType == "Cdg") 01242 GenerateCdgEnergies(); 01243 else if (EnergyDisType == "User") 01244 GenUserHistEnergies(); 01245 else if (EnergyDisType == "Arb") 01246 GenArbPointEnergies(); 01247 else if (EnergyDisType == "Epn") 01248 GenEpnHistEnergies(); 01249 else 01250 G4cout << "Error: EnergyDisType has unusual value" << G4endl; 01251 } 01252 } 01253 return particle_energy; 01254 }
G4double G4SPSEneDistribution::Getalpha | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetArbEmax | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetArbEmin | ( | ) | [inline] |
G4PhysicsOrderedFreeVector G4SPSEneDistribution::GetArbEnergyHisto | ( | ) | [inline] |
G4double G4SPSEneDistribution::Getcept | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetEmax | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetEmin | ( | ) | [inline] |
G4String G4SPSEneDistribution::GetEnergyDisType | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetEzero | ( | ) | [inline] |
G4double G4SPSEneDistribution::Getgrad | ( | ) | [inline] |
G4String G4SPSEneDistribution::GetIntType | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetMonoEnergy | ( | ) | [inline] |
Definition at line 1256 of file G4SPSEneDistribution.cc.
References G4cout, and G4PhysicsVector::Value().
01256 { 01257 G4double prob = 1.; 01258 01259 if (EnergyDisType == "Lin") { 01260 if (prob_norm == 1.) { 01261 prob_norm = 0.5*grad*Emax*Emax + cept*Emax - 0.5*grad*Emin*Emin - cept*Emin; 01262 } 01263 prob = cept + grad * ene; 01264 prob /= prob_norm; 01265 } 01266 else if (EnergyDisType == "Pow") { 01267 if (prob_norm == 1.) { 01268 if (alpha != -1.) { 01269 G4double emina = std::pow(Emin, alpha + 1); 01270 G4double emaxa = std::pow(Emax, alpha + 1); 01271 prob_norm = 1./(1.+alpha) * (emaxa - emina); 01272 } else { 01273 prob_norm = std::log(Emax) - std::log(Emin) ; 01274 } 01275 } 01276 prob = std::pow(ene, alpha)/prob_norm; 01277 } 01278 else if (EnergyDisType == "Exp"){ 01279 if (prob_norm == 1.) { 01280 prob_norm = -Ezero*(std::exp(-Emax/Ezero) - std::exp(Emin/Ezero)); 01281 } 01282 prob = std::exp(-ene / Ezero); 01283 prob /= prob_norm; 01284 } 01285 else if (EnergyDisType == "Arb") { 01286 prob = ArbEnergyH.Value(ene); 01287 // prob = ArbEInt->CubicSplineInterpolation(ene); 01288 //G4double deltaY; 01289 //prob = ArbEInt->PolynomInterpolation(ene, deltaY); 01290 if (prob <= 0.) { 01291 //G4cout << " Warning:G4SPSEneDistribution::GetProbability: prob<= 0. "<<prob <<" "<<ene << " " <<deltaY<< G4endl; 01292 G4cout << " Warning:G4SPSEneDistribution::GetProbability: prob<= 0. "<<prob <<" "<<ene << G4endl; 01293 prob = 1e-30; 01294 } 01295 // already normalised 01296 } 01297 else 01298 G4cout << "Error: EnergyDisType not supported" << G4endl; 01299 01300 return prob; 01301 }
G4double G4SPSEneDistribution::GetSE | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetTemp | ( | ) | [inline] |
G4PhysicsOrderedFreeVector G4SPSEneDistribution::GetUserDefinedEnergyHisto | ( | ) | [inline] |
G4double G4SPSEneDistribution::GetWeight | ( | ) | [inline] |
Definition at line 208 of file G4SPSEneDistribution.hh.
Referenced by G4SingleParticleSource::GeneratePrimaryVertex().
void G4SPSEneDistribution::InputDifferentialSpectra | ( | G4bool | ) |
Definition at line 288 of file G4SPSEneDistribution.cc.
References G4cout, and G4endl.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00288 { 00289 // Allows user to specify integral or differential spectra 00290 DiffSpec = value; // true = differential, false = integral 00291 if (verbosityLevel > 1) 00292 G4cout << "Diffspec has value " << DiffSpec << G4endl; 00293 }
void G4SPSEneDistribution::InputEnergySpectra | ( | G4bool | ) |
Definition at line 281 of file G4SPSEneDistribution.cc.
References G4cout, and G4endl.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00281 { 00282 // Allows user to specifiy spectrum is momentum 00283 EnergySpec = value; // false if momentum 00284 if (verbosityLevel > 1) 00285 G4cout << "EnergySpec has value " << EnergySpec << G4endl; 00286 }
void G4SPSEneDistribution::ReSetHist | ( | G4String | ) |
Definition at line 1199 of file G4SPSEneDistribution.cc.
References G4cout.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
01199 { 01200 if (atype == "energy") { 01201 UDefEnergyH = IPDFEnergyH = ZeroPhysVector; 01202 IPDFEnergyExist = false; 01203 Emin = 0.; 01204 Emax = 1e30; 01205 } else if (atype == "arb") { 01206 ArbEnergyH = IPDFArbEnergyH = ZeroPhysVector; 01207 IPDFArbExist = false; 01208 } else if (atype == "epn") { 01209 UDefEnergyH = IPDFEnergyH = ZeroPhysVector; 01210 IPDFEnergyExist = false; 01211 EpnEnergyH = ZeroPhysVector; 01212 } else { 01213 G4cout << "Error, histtype not accepted " << G4endl; 01214 } 01215 }
void G4SPSEneDistribution::SetAlpha | ( | G4double | ) |
Definition at line 120 of file G4SPSEneDistribution.cc.
Referenced by G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator(), and G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetBeamSigmaInE | ( | G4double | ) |
Definition at line 117 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetBiasAlpha | ( | G4double | ) |
Definition at line 124 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetBiasRndm | ( | G4SPSRandomGenerator * | a | ) | [inline] |
Definition at line 196 of file G4SPSEneDistribution.hh.
Referenced by G4SingleParticleSource::G4SingleParticleSource().
void G4SPSEneDistribution::SetEmax | ( | G4double | ) |
Definition at line 109 of file G4SPSEneDistribution.cc.
Referenced by G4AdjointPrimaryGenerator::GenerateAdjointPrimaryVertex(), and G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetEmin | ( | G4double | ) |
Definition at line 105 of file G4SPSEneDistribution.cc.
Referenced by G4AdjointPrimaryGenerator::GenerateAdjointPrimaryVertex(), and G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetEnergyDisType | ( | G4String | ) |
Definition at line 90 of file G4SPSEneDistribution.cc.
Referenced by G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator(), and G4GeneralParticleSourceMessenger::SetNewValue().
00090 { 00091 EnergyDisType = DisType; 00092 if (EnergyDisType == "User") { 00093 UDefEnergyH = IPDFEnergyH = ZeroPhysVector; 00094 IPDFEnergyExist = false; 00095 } else if (EnergyDisType == "Arb") { 00096 ArbEnergyH = IPDFArbEnergyH = ZeroPhysVector; 00097 IPDFArbExist = false; 00098 } else if (EnergyDisType == "Epn") { 00099 UDefEnergyH = IPDFEnergyH = ZeroPhysVector; 00100 IPDFEnergyExist = false; 00101 EpnEnergyH = ZeroPhysVector; 00102 } 00103 }
void G4SPSEneDistribution::SetEzero | ( | G4double | ) |
Definition at line 133 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetGradient | ( | G4double | ) |
Definition at line 137 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetInterCept | ( | G4double | ) |
Definition at line 141 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetMonoEnergy | ( | G4double | ) |
Definition at line 113 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetTemp | ( | G4double | ) |
Definition at line 129 of file G4SPSEneDistribution.cc.
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
void G4SPSEneDistribution::SetVerbosity | ( | G4int | a | ) | [inline] |
Definition at line 203 of file G4SPSEneDistribution.hh.
Referenced by G4SingleParticleSource::SetVerbosity().
void G4SPSEneDistribution::UserEnergyHisto | ( | G4ThreeVector | ) |
Definition at line 145 of file G4SPSEneDistribution.cc.
References G4cout, G4endl, and G4PhysicsOrderedFreeVector::InsertValues().
Referenced by G4GeneralParticleSourceMessenger::SetNewValue().
00145 { 00146 G4double ehi, val; 00147 ehi = input.x(); 00148 val = input.y(); 00149 if (verbosityLevel > 1) { 00150 G4cout << "In UserEnergyHisto" << G4endl; 00151 G4cout << " " << ehi << " " << val << G4endl; 00152 } 00153 UDefEnergyH.InsertValues(ehi, val); 00154 Emax = ehi; 00155 }