51 parentmass(0.), theDaughterMasses(0)
58 G4int theNumberOfDaughters,
85 G4int theNumberOfDaughters,
95 parentmass(theParentMass),
104 G4int theNumberOfDaughters,
111 theNumberOfDaughters,
115 parentmass(theParentMass),
116 theDaughterMasses(masses)
136 G4cout <<
"G4GeneralPhaseSpaceDecay::DecayIt ";
154 G4cout <<
"G4GeneralPhaseSpaceDecay::DecayIt ";
173 delete parentparticle;
181 G4cout <<
"G4GeneralPhaseSpaceDecay::OneBodyDecayIt ";
182 G4cout <<
" create decay products in rest frame " <<
G4endl;
212 delete parentparticle;
215 daughtermomentum =
Pmx(
parentmass,daughtermass[0],daughtermass[1]);
217 G4double sintheta = std::sqrt((1.0 - costheta)*(1.0 + costheta));
222 G4double Etotal= std::sqrt(daughtermass[0]*daughtermass[0] + daughtermomentum*daughtermomentum);
225 Etotal= std::sqrt(daughtermass[1]*daughtermass[1] + daughtermomentum*daughtermomentum);
231 G4cout <<
"G4GeneralPhaseSpaceDecay::TwoBodyDecayIt ";
232 G4cout <<
" create decay products in rest frame " <<
G4endl;
246 for (
G4int index=0; index<3; index++)
254 sumofdaughtermass += daughtermass[index];
263 delete parentparticle;
269 G4double momentummax=0.0, momentumsum = 0.0;
286 energy = rd2*(
parentmass - sumofdaughtermass);
287 daughtermomentum[0] = std::sqrt(energy*energy + 2.0*energy* daughtermass[0]);
288 if ( daughtermomentum[0] >momentummax )momentummax = daughtermomentum[0];
289 momentumsum += daughtermomentum[0];
292 energy = (1.-rd1)*(
parentmass - sumofdaughtermass);
293 daughtermomentum[1] = std::sqrt(energy*energy + 2.0*energy* daughtermass[1]);
294 if ( daughtermomentum[1] >momentummax )momentummax = daughtermomentum[1];
295 momentumsum += daughtermomentum[1];
298 energy = (rd1-rd2)*(
parentmass - sumofdaughtermass);
299 daughtermomentum[2] = std::sqrt(energy*energy + 2.0*energy* daughtermass[2]);
300 if ( daughtermomentum[2] >momentummax )momentummax = daughtermomentum[2];
301 momentumsum += daughtermomentum[2];
302 }
while (momentummax > momentumsum - momentummax );
306 G4cout <<
" daughter 0:" << daughtermomentum[0]/
GeV <<
"[GeV/c]" <<
G4endl;
307 G4cout <<
" daughter 1:" << daughtermomentum[1]/
GeV <<
"[GeV/c]" <<
G4endl;
308 G4cout <<
" daughter 2:" << daughtermomentum[2]/
GeV <<
"[GeV/c]" <<
G4endl;
313 G4double costheta, sintheta, phi, sinphi, cosphi;
314 G4double costhetan, sinthetan, phin, sinphin, cosphin;
316 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
318 sinphi = std::sin(phi);
319 cosphi = std::cos(phi);
321 G4double Etotal=std::sqrt( daughtermass[0]*daughtermass[0] + daughtermomentum[0]*daughtermomentum[0]);
326 costhetan = (daughtermomentum[1]*daughtermomentum[1]-daughtermomentum[2]*daughtermomentum[2]-daughtermomentum[0]*daughtermomentum[0])/(2.0*daughtermomentum[2]*daughtermomentum[0]);
327 sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
329 sinphin = std::sin(phin);
330 cosphin = std::cos(phin);
332 direction2.setX( sinthetan*cosphin*costheta*cosphi - sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
333 direction2.setY( sinthetan*cosphin*costheta*sinphi + sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
334 direction2.setZ( -sinthetan*cosphin*sintheta + costhetan*costheta);
335 Etotal=std::sqrt( daughtermass[2]*daughtermass[2] + daughtermomentum[2]*daughtermomentum[2]/direction2.mag2());
338 G4ThreeVector mom=(direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0);
339 Etotal= std::sqrt( daughtermass[1]*daughtermass[1] + mom.mag2() );
345 G4cout <<
"G4GeneralPhaseSpaceDecay::ThreeBodyDecayIt ";
346 G4cout <<
" create decay products in rest frame " <<
G4endl;
373 sumofdaughtermass += daughtermass[index];
383 G4int numberOfTry = 0;
391 for(index1 =1; index1 < numberOfDaughters -1; index1++)
393 rd[ numberOfDaughters -1] = 0.0;
394 for(index1 =1; index1 < numberOfDaughters -1; index1++) {
396 if (rd[index1] < rd[index2]){
398 rd[index1] = rd[index2];
406 temp = sumofdaughtermass;
408 sm[index1] = rd[index1]*tmas + temp;
409 temp -= daughtermass[index1];
411 G4cout << index1 <<
" rundom number:" << rd[index1];
419 index1 =numberOfDaughters-1;
420 daughtermomentum[index1]=
Pmx( sm[index1-1],daughtermass[index1-1],sm[index1]);
423 G4cout <<
" momentum:" << daughtermomentum[index1]/
GeV <<
"[GeV/c]" <<
G4endl;
425 for(index1 =numberOfDaughters-2; index1>=0; index1--) {
427 daughtermomentum[index1]=
Pmx( sm[index1],daughtermass[index1], sm[index1 +1]);
428 if(daughtermomentum[index1] < 0.0) {
431 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt ";
432 G4cout <<
" can not calculate daughter momentum " <<
G4endl;
436 G4cout <<
" mass:" << daughtermass[index1]/
GeV <<
"[GeV/c/c]" ;
437 G4cout <<
" mass:" << daughtermomentum[index1]/
GeV <<
"[GeV/c]" <<
G4endl;
440 delete [] daughtermass;
441 delete [] daughtermomentum;
446 weight *= daughtermomentum[index1]/sm[index1];
449 G4cout <<
" momentum:" << daughtermomentum[index1]/
GeV <<
"[GeV/c]" <<
G4endl;
458 if (numberOfTry++ >100) {
460 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt: ";
461 G4cout <<
" can not determine Decay Kinematics " <<
G4endl;
464 delete [] daughtermass;
465 delete [] daughtermomentum;
470 G4cout <<
"Start calulation of daughters momentum vector "<<
G4endl;
477 index1 = numberOfDaughters -2;
479 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
481 direction.setZ(costheta);
482 direction.setY(sintheta*std::sin(phi));
483 direction.setX(sintheta*std::cos(phi));
487 for (index1 = numberOfDaughters -3; index1 >= 0; index1--) {
490 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
492 direction.setZ(costheta);
493 direction.setY(sintheta*std::sin(phi));
494 direction.setX(sintheta*std::cos(phi));
497 beta = daughtermomentum[index1];
498 beta /= std::sqrt( daughtermomentum[index1]*daughtermomentum[index1] + sm[index1+1]*sm[index1+1] );
505 p4.boost( direction.x()*beta, direction.y()*beta, direction.z()*beta);
516 direction.setX(1.0); direction.setY(0.0); direction.setZ(0.0);
519 delete parentparticle;
524 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt ";
525 G4cout <<
" create decay products in rest frame " <<
G4endl;
529 delete [] daughterparticle;
530 delete [] daughtermomentum;
531 delete [] daughtermass;
CLHEP::Hep3Vector G4ThreeVector
G4int PushProducts(G4DynamicParticle *aParticle)
G4DecayProducts * ManyBodyDecayIt()
G4ParticleDefinition * G4MT_parent
G4ParticleDefinition ** G4MT_daughters
G4GeneralPhaseSpaceDecay(G4int Verbose=1)
G4DecayProducts * ThreeBodyDecayIt()
const G4double * theDaughterMasses
G4GLOB_DLL std::ostream G4cout
virtual ~G4GeneralPhaseSpaceDecay()
G4DecayProducts * TwoBodyDecayIt()
G4LorentzVector Get4Momentum() const
virtual G4DecayProducts * DecayIt(G4double mass=0.0)
void Set4Momentum(const G4LorentzVector &momentum)
G4int GetVerboseLevel() const
static G4double Pmx(G4double e, G4double p1, G4double p2)
G4double GetPDGMass() const
G4double energy(const ThreeVector &p, const G4double m)
G4DecayProducts * OneBodyDecayIt()
G4ThreeVector G4ParticleMomentum
G4String ** daughters_name
CLHEP::HepLorentzVector G4LorentzVector