63 using namespace G4InuclSpecialFunctions;
78 momDist(0), angDist(0), multiplicity(0), bullet_ekin(0.) {;}
95 const std::vector<G4int>& particle_kinds) {
110 kinds = particle_kinds;
140 <<
" is " << is <<
" fs " << fs <<
G4endl;
147 G4int kw = (fs==is) ? 1 : 2;
166 std::vector<G4LorentzVector>& finalState) {
184 <<
"\n pmod " << pscm
185 <<
"\n before rotation px " <<
mom.
x() <<
" py " <<
mom.
y()
189 finalState.resize(2);
191 finalState[0].setVectM(
mom, masses[0]);
195 G4cout <<
" after rotation px " << finalState[0].x() <<
" py "
196 << finalState[0].y() <<
" pz " << finalState[0].z() <<
G4endl;
199 finalState[1].setVectM(-finalState[0].vect(), masses[1]);
207 std::vector<G4LorentzVector>& finalState) {
242 G4cout <<
" knd_last " <<
kinds.back() <<
" mass_last "
258 if (pmod <
small)
break;
259 eleft -= std::sqrt(pmod*pmod + masses[i]*masses[i]);
263 <<
" mass2 " << masses[i]*masses[i] <<
" eleft " << eleft
264 <<
"\n x1 " << eleft - mass_last <<
G4endl;
267 if (eleft <= mass_last)
break;
272 if (i < multiplicity-1)
continue;
274 G4double plast = eleft * eleft - masses.back()*masses.back();
277 if (plast <=
small)
continue;
279 plast = std::sqrt(plast);
287 G4cerr <<
" Unable to generate momenta for multiplicity "
301 return ( (pmod.size() != 3) ||
302 !(pmod[0] < std::fabs(pmod[1] - pmod[2]) ||
303 pmod[0] > pmod[1] + pmod[2] ||
304 pmod[1] < std::fabs(pmod[0] - pmod[2]) ||
305 pmod[1] > pmod[0] + pmod[2] ||
306 pmod[2] < std::fabs(pmod[0] - pmod[1]) ||
307 pmod[2] > pmod[1] + pmod[0])
315 std::vector<G4LorentzVector>& finalState) {
331 std::vector<G4LorentzVector>& finalState) {
335 finalState.resize(3);
355 finalState[0] =
toSCM.
rotate(finalState[2], finalState[0]);
358 finalState[1].
set(0.,0.,0.,initialMass);
359 finalState[1] -= finalState[0] + finalState[2];
364 std::vector<G4LorentzVector>& finalState) {
381 std::accumulate(finalState.begin(), finalState.end()-2,
G4LorentzVector());
384 costh = -0.5 * (pmod*pmod +
387 / pmod /
modules[multiplicity-2];
400 finalState[multiplicity-2] =
402 masses[multiplicity-2]);
403 finalState[multiplicity-2] =
toSCM.
rotate(psum, finalState[multiplicity-2]);
406 finalState[multiplicity-1].
set(0.,0.,0.,initialMass);
407 finalState[multiplicity-1] -= psum + finalState[multiplicity-2];
416 G4cout <<
" >>> " <<
GetName() <<
"::GenerateCosTheta " << ptype
425 G4double p0 = ptype<3 ? 0.36 : 0.25;
426 G4double alf = 1.0 / p0 / (p0 - (pmod+p0)*
G4Exp(-pmod / p0));
436 G4cout <<
" s1 * alf * G4Exp(-s1 / p0) " << salf
437 <<
" s2 " << s2 <<
G4endl;
440 if (salf > s2) sinth = s1 / pmod;
444 G4cout <<
" itry1 " << itry1 <<
" sinth " << sinth <<
G4endl;
448 G4cout <<
" high energy angles generation: itry1 " << itry1 <<
G4endl;
454 G4double costh = std::sqrt(1.0 - sinth * sinth);
466 const std::vector<G4double>& masses,
467 std::vector<G4LorentzVector>& finalState) {
473 size_t N = masses.size();
474 finalState.resize(N);
476 G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
484 for (
size_t k=N-1; k>0; --k) {
497 finalState[k].setVectM(momV,masses[k]);
500 finalState[k].boost(boostV);
501 recoil.
boost(boostV);
505 finalState[0] = recoil;
513 G4double Fmax = std::sqrt(g4pow->
powN(xN/(xN+1.),N)/(xN+1.));
518 F = std::sqrt(g4pow->
powN(chi,N)*(1.-chi));
virtual const G4String & GetName() const
void Configure(G4InuclElementaryParticle *bullet, G4InuclElementaryParticle *target, const std::vector< G4int > &particle_kinds)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static const G4VTwoBodyAngDst * GetDist(G4int is, G4int fs, G4int kw)
void FillDirections(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
G4double GenerateCosTheta(G4int ptype, G4double pmod) const
virtual G4double GetCosTheta(const G4double &ekin, const G4double &pcm) const =0
G4double UniformPhi() const
void setBullet(const G4InuclParticle *bullet)
void FillDirThreeBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
G4int GetVerboseLevel() const
virtual ~G4CascadeFinalStateAlgorithm()
const G4VMultiBodyMomDst * momDist
void setVerbose(G4int vb=0)
G4CascadeFinalStateAlgorithm()
const G4VTwoBodyAngDst * angDist
void FillDirManyBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void SaveKinematics(G4InuclElementaryParticle *bullet, G4InuclElementaryParticle *target)
G4LorentzVector rotate(const G4LorentzVector &mom) const
G4LorentzVector generateWithFixedTheta(G4double ct, G4double p, G4double mass=0.)
void FillMagnitudes(G4double initialMass, const std::vector< G4double > &masses)
std::vector< G4int > kinds
G4bool satisfyTriangle(const std::vector< G4double > &pmod) const
G4double powN(G4double x, G4int n) const
G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const
virtual void SetVerboseLevel(G4int verbose)
static G4Pow * GetInstance()
static G4bool usePhaseSpace()
void ChooseGenerators(G4int is, G4int fs)
static const G4double oneOverE
static void setVerboseLevel(G4int vb=0)
virtual G4double GetMomentum(G4int ptype, const G4double &ekin) const =0
void set(double x, double y, double z, double t)
G4GLOB_DLL std::ostream G4cerr
static void setVerboseLevel(G4int vb=0)
static const G4int itry_max
static const G4VMultiBodyMomDst * GetDist(G4int is, G4int mult)
void setTarget(const G4InuclParticle *target)
G4double BetaKopylov(G4int K) const
void setRThetaPhi(double r, double theta, double phi)
G4double getKinEnergyInTheTRS() const
G4GLOB_DLL std::ostream G4cout
virtual void GenerateMultiBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
Hep3Vector boostVector() const
void FillUsingKopylov(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
static const G4double small
CLHEP::HepLorentzVector G4LorentzVector
virtual const G4String & GetName() const
virtual void GenerateTwoBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
virtual void SetVerboseLevel(G4int verbose)
std::vector< G4double > modules
const G4String & GetName() const
G4double UniformTheta() const
HepLorentzVector & boost(double, double, double)
void setVectM(const Hep3Vector &spatial, double mass)
static const G4double maxCosTheta