50 parentmass(0.), theDaughterMasses(0)
57 G4int theNumberOfDaughters,
84 G4int theNumberOfDaughters,
94 parentmass(theParentMass),
103 G4int theNumberOfDaughters,
110 theNumberOfDaughters,
114 parentmass(theParentMass),
115 theDaughterMasses(masses)
123 G4int theNumberOfDaughters,
131 theNumberOfDaughters,
136 parentmass(theParentMass),
137 theDaughterMasses(masses)
157 G4cout <<
"G4GeneralPhaseSpaceDecay::DecayIt ";
175 G4cout <<
"G4GeneralPhaseSpaceDecay::DecayIt ";
194 delete parentparticle;
202 G4cout <<
"G4GeneralPhaseSpaceDecay::OneBodyDecayIt ";
203 G4cout <<
" create decay products in rest frame " <<
G4endl;
233 delete parentparticle;
236 daughtermomentum =
Pmx(
parentmass,daughtermass[0],daughtermass[1]);
238 G4double sintheta = std::sqrt((1.0 - costheta)*(1.0 + costheta));
243 G4double Etotal= std::sqrt(daughtermass[0]*daughtermass[0] + daughtermomentum*daughtermomentum);
246 Etotal= std::sqrt(daughtermass[1]*daughtermass[1] + daughtermomentum*daughtermomentum);
252 G4cout <<
"G4GeneralPhaseSpaceDecay::TwoBodyDecayIt ";
253 G4cout <<
" create decay products in rest frame " <<
G4endl;
267 for (
G4int index=0; index<3; index++)
275 sumofdaughtermass += daughtermass[index];
284 delete parentparticle;
290 G4double momentummax=0.0, momentumsum = 0.0;
292 const G4int maxNumberOfLoops = 10000;
293 G4int loopCounter = 0;
309 energy = rd2*(
parentmass - sumofdaughtermass);
310 daughtermomentum[0] = std::sqrt(energy*energy + 2.0*energy* daughtermass[0]);
311 if ( daughtermomentum[0] >momentummax )momentummax = daughtermomentum[0];
312 momentumsum += daughtermomentum[0];
315 energy = (1.-rd1)*(
parentmass - sumofdaughtermass);
316 daughtermomentum[1] = std::sqrt(energy*energy + 2.0*energy* daughtermass[1]);
317 if ( daughtermomentum[1] >momentummax )momentummax = daughtermomentum[1];
318 momentumsum += daughtermomentum[1];
321 energy = (rd1-rd2)*(
parentmass - sumofdaughtermass);
322 daughtermomentum[2] = std::sqrt(energy*energy + 2.0*energy* daughtermass[2]);
323 if ( daughtermomentum[2] >momentummax )momentummax = daughtermomentum[2];
324 momentumsum += daughtermomentum[2];
325 }
while ( ( momentummax > momentumsum - momentummax ) &&
326 ++loopCounter < maxNumberOfLoops );
327 if ( loopCounter >= maxNumberOfLoops ) {
329 ed <<
" Failed sampling after maxNumberOfLoops attempts : forced exit" <<
G4endl;
335 G4cout <<
" daughter 0:" << daughtermomentum[0]/
GeV <<
"[GeV/c]" <<
G4endl;
336 G4cout <<
" daughter 1:" << daughtermomentum[1]/
GeV <<
"[GeV/c]" <<
G4endl;
337 G4cout <<
" daughter 2:" << daughtermomentum[2]/
GeV <<
"[GeV/c]" <<
G4endl;
343 G4double costhetan, sinthetan, phin, sinphin, cosphin;
345 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
347 sinphi = std::sin(phi);
348 cosphi = std::cos(phi);
350 G4double Etotal=std::sqrt( daughtermass[0]*daughtermass[0] + daughtermomentum[0]*daughtermomentum[0]);
355 costhetan = (daughtermomentum[1]*daughtermomentum[1]-daughtermomentum[2]*daughtermomentum[2]-daughtermomentum[0]*daughtermomentum[0])/(2.0*daughtermomentum[2]*daughtermomentum[0]);
356 sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
358 sinphin = std::sin(phin);
359 cosphin = std::cos(phin);
361 direction2.
setX( sinthetan*cosphin*costheta*cosphi - sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
362 direction2.
setY( sinthetan*cosphin*costheta*sinphi + sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
363 direction2.
setZ( -sinthetan*cosphin*sintheta + costhetan*costheta);
364 Etotal=std::sqrt( daughtermass[2]*daughtermass[2] + daughtermomentum[2]*daughtermomentum[2]/direction2.
mag2());
367 G4ThreeVector mom=(direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.
mag()))*(-1.0);
368 Etotal= std::sqrt( daughtermass[1]*daughtermass[1] + mom.
mag2() );
374 G4cout <<
"G4GeneralPhaseSpaceDecay::ThreeBodyDecayIt ";
375 G4cout <<
" create decay products in rest frame " <<
G4endl;
402 sumofdaughtermass += daughtermass[index];
412 G4int numberOfTry = 0;
420 for(index1 =1; index1 < numberOfDaughters -1; index1++)
422 rd[ numberOfDaughters -1] = 0.0;
423 for(index1 =1; index1 < numberOfDaughters -1; index1++) {
425 if (rd[index1] < rd[
index2]){
435 temp = sumofdaughtermass;
438 temp -= daughtermass[
index1];
448 index1 =numberOfDaughters-1;
449 daughtermomentum[
index1]=
Pmx( sm[index1-1],daughtermass[index1-1],sm[index1]);
454 for(index1 =numberOfDaughters-2; index1>=0; index1--) {
456 daughtermomentum[
index1]=
Pmx( sm[index1],daughtermass[index1], sm[index1 +1]);
457 if(daughtermomentum[index1] < 0.0) {
460 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt ";
461 G4cout <<
" can not calculate daughter momentum " <<
G4endl;
469 delete [] daughtermass;
470 delete [] daughtermomentum;
487 if (numberOfTry++ >100) {
489 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt: ";
490 G4cout <<
" can not determine Decay Kinematics " <<
G4endl;
493 delete [] daughtermass;
494 delete [] daughtermomentum;
499 G4cout <<
"Start calulation of daughters momentum vector "<<
G4endl;
506 index1 = numberOfDaughters -2;
508 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
510 direction.
setZ(costheta);
511 direction.
setY(sintheta*std::sin(phi));
512 direction.
setX(sintheta*std::cos(phi));
516 for (index1 = numberOfDaughters -3; index1 >= 0; index1--) {
519 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
521 direction.
setZ(costheta);
522 direction.
setY(sintheta*std::sin(phi));
523 direction.
setX(sintheta*std::cos(phi));
526 beta = daughtermomentum[
index1];
527 beta /= std::sqrt( daughtermomentum[index1]*daughtermomentum[index1] + sm[index1+1]*sm[index1+1] );
534 p4.
boost( direction.
x()*beta, direction.
y()*beta, direction.
z()*beta);
545 direction.
setX(1.0); direction.
setY(0.0); direction.
setZ(0.0);
548 delete parentparticle;
553 G4cout <<
"G4GeneralPhaseSpaceDecay::ManyBodyDecayIt ";
554 G4cout <<
" create decay products in rest frame " <<
G4endl;
558 delete [] daughterparticle;
559 delete [] daughtermomentum;
560 delete [] daughtermass;