56 : Theta(0.), Phi(0.), posDist(0),angRndm(0)
93 if(atype !=
"iso" && atype !=
"cos" && atype !=
"user" && atype !=
"planar"
94 && atype !=
"beam1d" && atype !=
"beam2d" && atype !=
"focused")
95 G4cout <<
"Error, distribution must be iso, cos, planar, beam1d, beam2d, focused or user" <<
G4endl;
110 if(refname ==
"angref1")
112 else if(refname ==
"angref2")
268 theta = std::sqrt (px*px + py*py);
270 phi = std::acos(px/theta);
271 if ( py < 0.) phi = -phi;
276 px = -std::sin(theta) * std::cos(phi);
277 py = -std::sin(theta) * std::sin(phi);
278 pz = -std::cos(theta);
280 finx = px, finy =py, finz =pz;
287 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
307 G4cout <<
"Generating focused vector: " << mom <<
G4endl;
318 G4double sintheta, sinphi,costheta,cosphi;
321 sintheta = std::sqrt(1. - costheta*costheta);
325 sinphi = std::sin(
Phi);
326 cosphi = std::cos(
Phi);
328 px = -sintheta * cosphi;
329 py = -sintheta * sinphi;
361 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
372 G4cout <<
"Generating isotropic vector: " << mom <<
G4endl;
381 G4double sintheta, sinphi,costheta,cosphi;
385 costheta = std::sqrt(1. -sintheta*sintheta);
389 sinphi = std::sin(
Phi);
390 cosphi = std::cos(
Phi);
392 px = -sintheta * cosphi;
393 py = -sintheta * sinphi;
423 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
435 G4cout <<
"Resultant cosine-law unit momentum vector " << mom <<
G4endl;
446 G4cout <<
"Resultant Planar wave momentum vector " << mom <<
G4endl;
471 Theta = std::acos(1. - (2. * rndm));
486 px = -std::sin(
Theta) * std::cos(
Phi);
487 py = -std::sin(
Theta) * std::sin(
Phi);
488 pz = -std::cos(
Theta);
490 pmag = std::sqrt((px*px) + (py*py) + (pz*pz));
505 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
520 G4cout <<
"Raw Unit vector "<<pxh<<
","<<pyh<<
","<<pzh<<
G4endl;
531 G4double ResMag = std::sqrt((resultx*resultx) + (resulty*resulty) + (resultz*resultz));
532 resultx = resultx/ResMag;
533 resulty = resulty/ResMag;
534 resultz = resultz/ResMag;
573 for(ii=1;ii<maxbin;ii++)
576 vals[ii] =
UDefThetaH(
size_t(ii)) + vals[ii-1];
579 for(ii=0;ii<maxbin;ii++)
581 vals[ii] = vals[ii]/
sum;
620 for(ii=1;ii<maxbin;ii++)
623 vals[ii] =
UDefPhiH(
size_t(ii)) + vals[ii-1];
626 for(ii=0;ii<maxbin;ii++)
628 vals[ii] = vals[ii]/
sum;
644 if (atype ==
"theta") {
647 else if (atype ==
"phi"){
674 G4cout <<
"Error: AngDistType has unusual value" <<
G4endl;
void SetBiasRndm(G4SPSRandomGenerator *a)
#define G4MUTEXDESTROY(mutex)
void SetBeamSigmaInAngY(G4double)
G4ThreeVector G4ParticleMomentum
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GetSideRefVec1() const
std::vector< ExP01TrackerHit * > a
G4ThreeVector GetDirection()
G4double GetLowEdgeEnergy(size_t binNumber) const
void InsertValues(G4double energy, G4double value)
G4PhysicsOrderedFreeVector UDefThetaH
G4PhysicsOrderedFreeVector UDefPhiH
G4ParticleMomentum particle_momentum_direction
void DefineAngRefAxes(G4String, G4ThreeVector)
void SetFocusPoint(G4ThreeVector)
G4double GetEnergy(G4double aValue)
void SetPosDistribution(G4SPSPosDistribution *a)
G4PhysicsOrderedFreeVector ZeroPhysVector
void GeneratePlanarFlux(G4ParticleMomentum &outputMom)
G4ThreeVector GetSideRefVec3() const
void GenerateCosineLawFlux(G4ParticleMomentum &outputMom)
void SetUseUserAngAxis(G4bool)
void GenerateIsotropicFlux(G4ParticleMomentum &outputMom)
void SetBeamSigmaInAngX(G4double)
void SetUserWRTSurface(G4bool)
void UserDefAngPhi(G4ThreeVector)
void SetMaxTheta(G4double)
#define G4MUTEXINIT(mutex)
G4ThreeVector GetParticlePos() const
G4double GenerateUserDefTheta()
G4SPSPosDistribution * posDist
G4double GenerateUserDefPhi()
static constexpr double twopi
G4ThreeVector GetSideRefVec2() const
void SetMinTheta(G4double)
G4PhysicsOrderedFreeVector IPDFPhiH
void SetBeamSigmaInAngR(G4double)
ThreeVector shoot(const G4int Ap, const G4int Af)
G4ParticleMomentum GenerateOne()
Hep3Vector cross(const Hep3Vector &) const
void GenerateBeamFlux(G4ParticleMomentum &outputMom)
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat
DLL_API const Hep3Vector HepZHat
G4GLOB_DLL std::ostream G4cout
void SetVerbosity(G4int a)
G4String GetSourcePosType() const
static constexpr double pi
G4SPSRandomGenerator * angRndm
void UserDefAngTheta(G4ThreeVector)
void GenerateFocusedFlux(G4ParticleMomentum &outputMom)
void GenerateUserDefFlux(G4ParticleMomentum &outputMom)
size_t GetVectorLength() const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void SetAngDistType(G4String)
G4PhysicsOrderedFreeVector IPDFThetaH