34#define INCLXX_IN_GEANT4_MODE 1
55 void bias(ParticleList &particles,
const ThreeVector &pInVec,
const G4double slope) {
57 const ThreeVector collisionAxis = pInVec/pIn;
58 const ThreeVector pMomVec = biasMe->getMomentum();
61 const G4double pMomCosAng = pMomVec.dot(collisionAxis)/pMom;
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;
71 const G4double rotationAngle = ang - pMomAng;
75 ThreeVector rotationAxis;
77 rotationAxis = collisionAxis.vector(pMomVec);
78 const G4double axisLength = rotationAxis.mag();
79 const G4double oneOverLength = 1./axisLength;
80 rotationAxis *= oneOverLength;
84 rotationAxis = collisionAxis.anyOrthogonal();
88 particles.rotateMomentum(rotationAngle, rotationAxis);
93 namespace PhaseSpaceGenerator {
95 return thePhaseSpaceGenerator->generate(sqrtS, particles);
102 biasMe = particles[index];
106 if(pInVec.
mag() != 0.) bias(particles, pInVec, slope);
110 thePhaseSpaceGenerator = g;
114 return thePhaseSpaceGenerator;
118 delete thePhaseSpaceGenerator;
119 thePhaseSpaceGenerator = NULL;
PhaseSpaceGeneratorType getPhaseSpaceGeneratorType() const
Get the phase-space-generator type.
Abstract interface for the phase-space generators.
Generate momenta using the Kopylov method.
Generate momenta using the RauboldLynch method.
G4double arcCos(const G4double x)
Calculates arccos with some tolerance on illegal arguments.
void initialize(Config const *const theConfig)
void setPhaseSpaceGenerator(IPhaseSpaceGenerator *g)
void deletePhaseSpaceGenerator()
void generateBiased(const G4double sqrtS, ParticleList &particles, const size_t index, const G4double slope)
Generate a biased event in the CM system.
IPhaseSpaceGenerator * getPhaseSpaceGenerator()
void generate(const G4double sqrtS, ParticleList &particles)
Generate an event in the CM system.