52 useGivenDaughterMass(
false)
60 G4int theNumberOfDaughters,
72 useGivenDaughterMass(
false)
99 G4cout <<
"G4PhaseSpaceDecayChannel::DecayIt ";
119 G4cout <<
"G4PhaseSpaceDecayChannel::DecayIt ";
140 delete parentparticle;
149 G4cout <<
"G4PhaseSpaceDecayChannel::OneBodyDecayIt ";
150 G4cout <<
" create decay products in rest frame " <<
G4endl;
166 G4double daughtermass[2], daughterwidth[2];
177 delete parentparticle;
180 G4bool withWidth = (daughterwidth[0]>1.0e-3*daughtermass[0])
181 || (daughterwidth[1]>1.0
e-3*daughtermass[1]);
183 G4double sumofdaughterwidthsq = daughterwidth[0]*daughterwidth[0]+daughterwidth[1]*daughterwidth[1];
185 G4double maxDev = (parentmass - daughtermass[0] - daughtermass[1] )/std::sqrt(sumofdaughterwidthsq);
189 G4cout <<
"G4PhaseSpaceDecayChannel::TwoBodyDecayIt "
190 <<
"sum of daughter mass is larger than parent mass" <<
G4endl;
196 G4Exception(
"G4PhaseSpaceDecayChannel::TwoBodyDecayIt",
198 "Can not create decay products: sum of daughter mass is larger than parent mass");
202 if (daughterwidth[0] > 0.) dm1=
DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
204 if (daughterwidth[1] > 0.) dm2=
DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
205 while (dm1+dm2>parentmass){
206 dm1=
DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
207 dm2=
DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
209 daughtermass[0] = dm1;
210 daughtermass[1] = dm2;
217 if (parentmass < daughtermass[0] + daughtermass[1] ){
220 G4cout <<
"G4PhaseSpaceDecayChannel::TwoBodyDecayIt "
221 <<
"sum of daughter mass is larger than parent mass" <<
G4endl;
230 G4Exception(
"G4PhaseSpaceDecayChannel::TwoBodyDecayIt",
232 "Can not create decay products: sum of daughter mass is larger than parent mass");
237 G4double daughtermomentum =
Pmx(parentmass,daughtermass[0],daughtermass[1]);
240 G4double sintheta = std::sqrt((1.0 - costheta)*(1.0 + costheta));
242 G4ThreeVector direction(sintheta*std::cos(phi),sintheta*std::sin(phi),costheta);
245 G4double Ekin = std::sqrt(daughtermomentum*daughtermomentum + daughtermass[0]*daughtermass[0]) - daughtermass[0];
248 Ekin = std::sqrt(daughtermomentum*daughtermomentum + daughtermass[1]*daughtermass[1]) - daughtermass[1];
254 G4cout <<
"G4PhaseSpaceDecayChannel::TwoBodyDecayIt ";
255 G4cout <<
" create decay products in rest frame " <<
G4endl;
271 G4double daughtermass[3], daughterwidth[3];
273 G4double sumofdaughterwidthsq = 0.0;
275 for (
G4int index=0; index<3; index++){
277 sumofdaughtermass += daughtermass[index];
279 sumofdaughterwidthsq += daughterwidth[index]*daughterwidth[index];
280 withWidth = withWidth ||(daughterwidth[index]>1.0e-3*daughtermass[index]);
290 delete parentparticle;
294 G4double maxDev = (parentmass - sumofdaughtermass )/std::sqrt(sumofdaughterwidthsq) ;
298 G4cout <<
"G4PhaseSpaceDecayChannel::ThreeBodyDecayIt "
299 <<
"sum of daughter mass is larger than parent mass" <<
G4endl;
306 G4Exception(
"G4PhaseSpaceDecayChannel::ThreeBodyDecayIt",
308 "Can not create decay products: sum of daughter mass is larger than parent mass");
312 if (daughterwidth[0] > 0.) dm1=
DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
314 if (daughterwidth[1] > 0.) dm2=
DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
316 if (daughterwidth[2] > 0.) dm3=
DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
317 while (dm1+dm2+dm3>parentmass){
318 dm1=
DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
319 dm2=
DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
320 dm3=
DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
322 daughtermass[0] = dm1;
323 daughtermass[1] = dm2;
324 daughtermass[2] = dm3;
325 sumofdaughtermass = dm1+dm2+dm3;
332 sumofdaughtermass = daughtermass[0] + daughtermass[1] + daughtermass[2];
335 if (sumofdaughtermass >parentmass) {
338 G4cout <<
"G4PhaseSpaceDecayChannel::ThreeBodyDecayIt "
339 <<
"sum of daughter mass is larger than parent mass" <<
G4endl;
349 G4Exception(
"G4PhaseSpaceDecayChannel::ThreeBodyDecayIt",
351 "Can not create decay products: sum of daughter mass is larger than parent mass");
361 G4double momentummax=0.0, momentumsum = 0.0;
363 const size_t MAX_LOOP=10000;
365 for (
size_t loop_counter=0; loop_counter <MAX_LOOP; ++loop_counter){
376 energy = rd2*(parentmass - sumofdaughtermass);
377 daughtermomentum[0] = std::sqrt(energy*energy + 2.0*energy* daughtermass[0]);
378 if ( daughtermomentum[0] >momentummax )momentummax = daughtermomentum[0];
379 momentumsum += daughtermomentum[0];
381 energy = (1.-rd1)*(parentmass - sumofdaughtermass);
382 daughtermomentum[1] = std::sqrt(energy*energy + 2.0*energy* daughtermass[1]);
383 if ( daughtermomentum[1] >momentummax )momentummax = daughtermomentum[1];
384 momentumsum += daughtermomentum[1];
386 energy = (rd1-rd2)*(parentmass - sumofdaughtermass);
387 daughtermomentum[2] = std::sqrt(energy*energy + 2.0*energy* daughtermass[2]);
388 if ( daughtermomentum[2] >momentummax )momentummax = daughtermomentum[2];
389 momentumsum += daughtermomentum[2];
390 if (momentummax <= momentumsum - momentummax )
break;
396 G4cout <<
" daughter 0:" << daughtermomentum[0]/
GeV <<
"[GeV/c]" <<
G4endl;
397 G4cout <<
" daughter 1:" << daughtermomentum[1]/
GeV <<
"[GeV/c]" <<
G4endl;
398 G4cout <<
" daughter 2:" << daughtermomentum[2]/
GeV <<
"[GeV/c]" <<
G4endl;
405 G4double costhetan, sinthetan, phin, sinphin, cosphin;
407 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
409 sinphi = std::sin(phi);
410 cosphi = std::cos(phi);
412 G4ThreeVector direction0(sintheta*cosphi,sintheta*sinphi,costheta);
413 G4double Ekin = std::sqrt(daughtermomentum[0]*daughtermomentum[0] + daughtermass[0]*daughtermass[0]) - daughtermass[0];
416 Ekin, daughtermass[0]);
419 costhetan = (daughtermomentum[1]*daughtermomentum[1]-daughtermomentum[2]*daughtermomentum[2]-daughtermomentum[0]*daughtermomentum[0])/(2.0*daughtermomentum[2]*daughtermomentum[0]);
420 sinthetan = std::sqrt((1.0-costhetan)*(1.0+costhetan));
422 sinphin = std::sin(phin);
423 cosphin = std::cos(phin);
425 direction2.
setX( sinthetan*cosphin*costheta*cosphi - sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
426 direction2.
setY( sinthetan*cosphin*costheta*sinphi + sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
427 direction2.
setZ( -sinthetan*cosphin*sintheta + costhetan*costheta);
429 Ekin = std::sqrt(pmom.
mag2() + daughtermass[2]*daughtermass[2]) - daughtermass[2];
432 Ekin, daughtermass[2]);
435 pmom = (direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.
mag()))*(-1.0);
436 Ekin = std::sqrt(pmom.
mag2() + daughtermass[1]*daughtermass[1]) - daughtermass[1];
440 Ekin, daughtermass[1]);
445 G4cout <<
"G4PhaseSpaceDecayChannel::ThreeBodyDecayIt ";
446 G4cout <<
" create decay products in rest frame " <<
G4endl;
480 delete parentparticle;
492 sumofdaughtermass += daughtermass[index];
494 if (sumofdaughtermass >parentmass) {
497 G4cout <<
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt "
498 <<
"sum of daughter mass is larger than parent mass" <<
G4endl;
506 G4Exception(
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt",
508 "Can not create decay products: sum of daughter mass is larger than parent mass");
509 delete [] daughtermass;
520 G4int numberOfTry = 0;
521 const size_t MAX_LOOP=10000;
523 for (
size_t loop_counter=0; loop_counter <MAX_LOOP; ++loop_counter){
528 for(index =1; index < numberOfDaughters -1; index++) rd[index] =
G4UniformRand();
529 rd[ numberOfDaughters -1] = 0.0;
530 for(index =1; index < numberOfDaughters -1; index++) {
532 if (rd[index] < rd[index2]){
541 tmas = parentmass - sumofdaughtermass;
542 temp = sumofdaughtermass;
544 sm[index] = rd[index]*tmas + temp;
545 temp -= daughtermass[index];
547 G4cout << index <<
" rundom number:" << rd[index];
556 for(index =0; index< numberOfDaughters-1 && smOK; index++) {
557 smOK = (sm[index]-daughtermass[index]- sm[index+1] >=0.);
561 index =numberOfDaughters-1;
562 daughtermomentum[index]=
Pmx( sm[index-1],daughtermass[index-1], sm[index]);
566 G4cout <<
" momentum:" << daughtermomentum[index]/
GeV <<
"[GeV/c]" <<
G4endl;
569 for(index =numberOfDaughters-2; index>=0; index--) {
571 daughtermomentum[index]=
Pmx( sm[index],daughtermass[index], sm[index +1]);
572 if(daughtermomentum[index] < 0.0) {
576 G4cout <<
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt ";
577 G4cout <<
" can not calculate daughter momentum " <<
G4endl;
581 G4cout <<
" mass:" << daughtermass[index]/
GeV <<
"[GeV/c/c]" ;
582 G4cout <<
" mass:" << daughtermomentum[index]/
GeV <<
"[GeV/c]" <<
G4endl;
589 delete [] daughtermass;
590 delete [] daughtermomentum;
592 G4Exception(
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt",
594 "Can not create decay products: sum of daughter mass is larger than parent mass");
600 weight *= daughtermomentum[index]/sm[index];
604 G4cout <<
" momentum:" << daughtermomentum[index]/
GeV <<
"[GeV/c]" <<
G4endl;
617 if (numberOfTry++ >100) {
620 G4cout <<
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt: ";
621 G4cout <<
" can not determine Decay Kinematics " <<
G4endl;
630 G4Exception(
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt: ",
632 " Cannot decay : Decay Kinematics cannot be calculated ");
635 delete [] daughtermass;
636 delete [] daughtermomentum;
645 G4cout <<
"Start calulation of daughters momentum vector "<<
G4endl;
653 index = numberOfDaughters -2;
655 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
657 direction.
setZ(costheta);
658 direction.
setY(sintheta*std::sin(phi));
659 direction.
setX(sintheta*std::cos(phi));
663 for (index = numberOfDaughters -3; index >= 0; index--) {
666 sintheta = std::sqrt((1.0-costheta)*(1.0+costheta));
668 direction.
setZ(costheta);
669 direction.
setY(sintheta*std::sin(phi));
670 direction.
setX(sintheta*std::cos(phi));
673 beta = daughtermomentum[index];
674 beta /= std::sqrt( daughtermomentum[index]*daughtermomentum[index] + sm[index+1]*sm[index+1] );
681 p4.
boost( direction.
x()*beta, direction.
y()*beta, direction.
z()*beta);
697 G4cout <<
"G4PhaseSpaceDecayChannel::ManyBodyDecayIt ";
698 G4cout <<
" create decay products in rest frame " <<
G4endl;
703 delete [] daughterparticle;
704 delete [] daughtermomentum;
705 delete [] daughtermass;
736 return (parentMass >= sumOfDaughterMassMin);
742 G4double ppp = (e+p1+p2)*(e+p1-p2)*(e-p1+p2)*(e-p1-p2)/(4.0*e*
e);
743 if (ppp>0)
return std::sqrt(ppp);