Geant4-11
Functions | Variables
G4INCL::anonymous_namespace{G4INCLPhaseSpaceGenerator.cc} Namespace Reference

Functions

void bias (ParticleList &particles, const ThreeVector &pInVec, const G4double slope)
 Actually perform the biasing. More...
 

Variables

G4ThreadLocal ParticlebiasMe
 
G4ThreadLocal IPhaseSpaceGeneratorthePhaseSpaceGenerator
 

Function Documentation

◆ bias()

void G4INCL::anonymous_namespace{G4INCLPhaseSpaceGenerator.cc}::bias ( ParticleList particles,
const ThreeVector pInVec,
const G4double  slope 
)

Actually perform the biasing.

Parameters
particleslist of particles to bias
pInVecmomentum of the particle to be biased before the collision
slopethe parameter $B$ in $\exp(B\cdot t)$

Definition at line 55 of file G4INCLPhaseSpaceGenerator.cc.

55 {
56 const G4double pIn = pInVec.mag();
57 const ThreeVector collisionAxis = pInVec/pIn;
58 const ThreeVector pMomVec = biasMe->getMomentum();
59 const G4double pMom = pMomVec.mag();
60 if(pMom ==0.) return;
61 const G4double pMomCosAng = pMomVec.dot(collisionAxis)/pMom;
62 const G4double pMomAng = Math::arcCos(pMomCosAng); // Angle between the original axis of the dominant particle and is new one after generate
63
64 // compute the target angle for the biasing
65 // it is drawn from a exp(Bt) distribution
66 const G4double cosAngSlope = 2e-6 * slope * pIn * pMom;
67 const G4double cosAng = 1. + std::log(1. - Random::shoot()*(1.-std::exp(-2.*cosAngSlope)))/cosAngSlope;
68 const G4double ang = Math::arcCos(cosAng);
69
70 // compute the rotation angle
71 const G4double rotationAngle = ang - pMomAng;
72
73 // generate the rotation axis; it is perpendicular to collisionAxis and
74 // pMomVec
75 ThreeVector rotationAxis;
76 if(pMomAng>1E-10) {
77 rotationAxis = collisionAxis.vector(pMomVec);
78 const G4double axisLength = rotationAxis.mag();
79 const G4double oneOverLength = 1./axisLength;
80 rotationAxis *= oneOverLength;
81 } else {
82 // need to jump through some hoops if collisionAxis is nearly aligned
83 // with pMomVec
84 rotationAxis = collisionAxis.anyOrthogonal();
85 }
86
87 // apply the rotation
88 particles.rotateMomentum(rotationAngle, rotationAxis);
89 }
double G4double
Definition: G4Types.hh:83
void rotateMomentum(const G4double angle, const ThreeVector &axis) const
const G4INCL::ThreeVector & getMomentum() const
G4double mag() const
G4double dot(const ThreeVector &v) const
ThreeVector anyOrthogonal() const
Return a vector orthogonal to this.
ThreeVector vector(const ThreeVector &v) const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double arcCos(const G4double x)
Calculates arccos with some tolerance on illegal arguments.

References G4INCL::ThreeVector::anyOrthogonal(), G4INCL::Math::arcCos(), biasMe, G4INCL::ThreeVector::dot(), G4INCL::Particle::getMomentum(), G4INCL::ThreeVector::mag(), G4INCL::ParticleList::rotateMomentum(), G4INCL::Random::shoot(), and G4INCL::ThreeVector::vector().

Referenced by G4INCL::PhaseSpaceGenerator::generateBiased().

Variable Documentation

◆ biasMe

G4ThreadLocal Particle* G4INCL::anonymous_namespace{G4INCLPhaseSpaceGenerator.cc}::biasMe

◆ thePhaseSpaceGenerator

G4ThreadLocal IPhaseSpaceGenerator* G4INCL::anonymous_namespace{G4INCLPhaseSpaceGenerator.cc}::thePhaseSpaceGenerator