34 #define INCLXX_IN_GEANT4_MODE 1
184 maxGeneratedWeight(0.)
195 for(
size_t i=1; i<
wMaxNP; ++i) {
216 const G4int maxIter = 500;
224 }
while(++iter<maxIter && r*weightMax>weight);
226 #ifndef INCLXX_IN_GEANT4_MODE
228 INCL_WARN(
"Number of tries exceeded in PhaseSpaceRauboldLynch::generate()\n"
249 if(availableEnergy<0.)
250 availableEnergy = 0.;
263 eMMin += masses[i-1];
271 #ifndef INCLXX_IN_GEANT4_MODE
273 INCL_WARN(
"The requested number of particles (" <<
nParticles <<
") requires extrapolation the tables in PhaseSpaceRauboldLynch. YMMV." <<
'\n');
277 INCL_WARN(
"The requested available energy (" <<
availableEnergy <<
" MeV) requires extrapolation the tables in PhaseSpaceRauboldLynch. YMMV." <<
'\n');
284 const G4double correction = (*wMaxCorrection)(reducedSqrtS);
297 rnd[nParticles-1] = 1.;
298 std::sort(
rnd.begin()+1,
rnd.begin()+nParticles-1);
307 for(
size_t i=1; i<nParticles-1; ++i) {
313 weight *= momentumCM;
338 const G4double recoilE = std::sqrt(momentum.
mag2() + iM*iM);
339 boostV = -momentum/recoilE;
340 for(
size_t j=0; j<=i; ++j)
341 particles[j]->boost(boostV);
T max(const T t1, const T t2)
brief Return the largest of the two arguments
ThreeVector normVector(G4double norm=1.)
G4double prelog[wMaxNP]
Precalculated coefficients: -ln(n)
G4double computeWeight()
Compute the maximum possible weight.
G4double getMass() const
Get the cached particle mass.
static const size_t wMaxNE
void generateEvent(ParticleList &particles)
Generate an event.
G4double momentumInCM(Particle const *const p1, Particle const *const p2)
gives the momentum in the CM frame of two particles.
std::vector< G4double > rnd
G4double computeMaximumWeightParam()
Compute the maximum possible weight using parametrizations.
static const G4double wMaxCorrectionX[wMaxNE]
G4double computeMaximumWeightNaive()
Compute the maximum possible weight using a naive algorithm.
std::vector< G4double > masses
static const G4double wMaxCorrectionY[wMaxNE]
InterpolationTable * wMaxMassless
Class for interpolating the of a 1-dimensional function.
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
std::vector< G4double > momentaCM
void initialize(ParticleList &particles)
Initialize internal structures (masses and sum of masses)
static const G4double wMaxMasslessY[wMaxNE]
InterpolationTable * wMaxCorrection
G4double getMaxGeneratedWeight() const
Return the largest generated weight.
G4double adjustEnergyFromMomentum()
Recompute the energy to match the momentum.
std::vector< G4double > sumMasses
void generate(const G4double sqrtS, ParticleList &particles)
Generate momenta according to a uniform, Lorentz-invariant phase-space model.
static const G4double wMaxInterpolationMargin
std::vector< G4double > invariantMasses
static const size_t wMaxNP
G4double maxGeneratedWeight
virtual ~PhaseSpaceRauboldLynch()
static const G4double wMaxMasslessX[wMaxNE]