543{
545 static const G4double expxl = -expxu;
546
550
551 static const G4int numMul = 1200;
552 static const G4int numSec = 60;
553
559
562
563 static G4bool first =
true;
564 static G4double protmul[numMul], protnorm[numSec];
565 static G4double neutmul[numMul], neutnorm[numSec];
566
567
568
569
570 G4int i, counter, nt, npos, nneg, nzero;
571
572 if (first) {
573
574 first = false;
575 for( i=0; i<numMul; i++ )protmul[i] = 0.0;
576 for( i=0; i<numSec; i++ )protnorm[i] = 0.0;
577 counter = -1;
578 for(npos=0; npos<(numSec/3); npos++) {
579 for(nneg=std::max(0,npos-2); nneg<=npos; nneg++) {
580 for(nzero=0; nzero<numSec/3; nzero++) {
581 if(++counter < numMul) {
582 nt = npos+nneg+nzero;
583 if( (nt>0) && (nt<=numSec) ) {
584 protmul[counter] =
pmltpc(npos,nneg,nzero,nt,protb,c) ;
585 protnorm[nt-1] += protmul[counter];
586 }
587 }
588 }
589 }
590 }
591
592 for( i=0; i<numMul; i++ )neutmul[i] = 0.0;
593 for( i=0; i<numSec; i++ )neutnorm[i] = 0.0;
594 counter = -1;
595 for(npos=0; npos<numSec/3; npos++) {
596 for(nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++) {
597 for(nzero=0; nzero<numSec/3; nzero++) {
598 if(++counter < numMul) {
599 nt = npos+nneg+nzero;
600 if( (nt>0) && (nt<=numSec) ) {
601 neutmul[counter] =
pmltpc(npos,nneg,nzero,nt,neutb,c);
602 neutnorm[nt-1] += neutmul[counter];
603 }
604 }
605 }
606 }
607 }
608
609 for(i=0; i<numSec; i++) {
610 if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
611 if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
612 }
613 }
614
615
616
617 pv[0] = incidentParticle;
618 pv[1] = targetParticle;
619 vecLen = 2;
620
622 return;
623
624
625
626 npos = 0, nneg = 0, nzero = 0;
627 G4double cech[] = { 1., 1., 1., 0.70, 0.60, 0.55, 0.35, 0.25, 0.18, 0.15};
628 G4int iplab =
G4int( incidentTotalMomentum*5.);
630 G4int ipl = std::min(19,
G4int( incidentTotalMomentum*5.));
631 G4double cnk0[] = {0.17, 0.18, 0.17, 0.24, 0.26, 0.20, 0.22, 0.21, 0.34, 0.45,
632 0.58, 0.55, 0.36, 0.29, 0.29, 0.32, 0.32, 0.33, 0.33, 0.33};
634 if(targetCode == protonCode) {
635 return;
636 } else {
639 return;
640 }
641 }
642
644 if(targetCode == protonCode) {
645
646
647 if( ran < 0.25 ) {
648 ;
649 } else if (ran < 0.50) {
652 } else if (ran < 0.75) {
653 ;
654 } else {
657 }
658 } else {
659
660
661 if( ran < 0.25 ) {
664 } else if (ran < 0.50) {
667 } else if (ran < 0.75) {
670 } else {
673 }
674 }
675 return;
676
677 } else {
678
679
680 G4double aleab = std::log(availableEnergy);
681 G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514
682 + aleab*(0.117712+0.0136912*aleab))) - 2.0;
683
684
685
687
688 for (nt=1; nt<=numSec; nt++) {
689 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
690 dum =
pi*nt/(2.0*
n*
n);
691 if (std::fabs(dum) < 1.0) {
692 if( test >= 1.0e-10 )anpn += dum*test;
693 } else {
694 anpn += dum*test;
695 }
696 }
697
700 if (targetCode == protonCode) {
701 counter = -1;
702 for (npos=0; npos<numSec/3; npos++) {
703 for (nneg=std::max(0,npos-2); nneg<=npos; nneg++) {
704 for (nzero=0; nzero<numSec/3; nzero++) {
705 if (++counter < numMul) {
706 nt = npos+nneg+nzero;
707 if( (nt>0) && (nt<=numSec) ) {
708 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
709 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
710
711 if (std::fabs(dum) < 1.0) {
712 if( test >= 1.0e-10 )excs += dum*test;
713 } else {
714 excs += dum*test;
715 }
716
717 if (ran < excs) goto outOfLoop;
718 }
719 }
720 }
721 }
722 }
723
724 inElastic = false;
725 return;
726
727 } else {
728 counter = -1;
729 for (npos=0; npos<numSec/3; npos++) {
730 for (nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++) {
731 for (nzero=0; nzero<numSec/3; nzero++) {
732 if (++counter < numMul) {
733 nt = npos+nneg+nzero;
734 if( (nt>=1) && (nt<=numSec) ) {
735 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
736 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
737
738 if (std::fabs(dum) < 1.0) {
739 if( test >= 1.0e-10 )excs += dum*test;
740 } else {
741 excs += dum*test;
742 }
743
744 if (ran < excs) goto outOfLoop;
745 }
746 }
747 }
748 }
749 }
750
751 inElastic = false;
752 return;
753 }
754 }
755 outOfLoop:
756
757 if( targetCode == protonCode)
758 {
759 if( npos == nneg)
760 {
761 }
762 else if (npos == (1+nneg))
763 {
765 {
767 }
768 else
769 {
771 }
772 }
773 else
774 {
777 }
778 }
779 else
780 {
781 if( npos == nneg)
782 {
784 {
785 }
786 else
787 {
790 }
791 }
792 else if ( npos == (1+nneg))
793 {
795 }
796 else
797 {
799 }
800 }
801
802
804 {
805 if( ( (pv[0].getCode() == kaonMinusCode)
807 || ( (pv[0].
getCode() == kaonZeroCode)
808 && (pv[1].getCode() == protonCode) )
809 || ( (pv[0].
getCode() == antiKaonZeroCode)
810 && (pv[1].getCode() == protonCode) ) )
811 {
813 if( pv[1].getCode() == protonCode)
814 {
815 if(ran < 0.68)
816 {
819 }
820 else if (ran < 0.84)
821 {
824 }
825 else
826 {
829 }
830 }
831 else
832 {
833 if(ran < 0.68)
834 {
837 }
838 else if (ran < 0.84)
839 {
842 }
843 else
844 {
847 }
848 }
849 }
850 else
851 {
853 if (ran < 0.67)
854 {
857 }
858 else if (ran < 0.78)
859 {
862 }
863 else if (ran < 0.89)
864 {
867 }
868 else
869 {
872 }
873 }
874 }
875
876 nt = npos + nneg + nzero;
877 while ( nt > 0) {
880 if( npos > 0 ) {
882 npos--;
883 }
884 }
else if (ran < (
G4double)(npos+nneg)/nt) {
885 if( nneg > 0 ) {
887 nneg--;
888 }
889 } else {
890 if( nzero > 0 ) {
892 nzero--;
893 }
894 }
895 nt = npos + nneg + nzero;
896 }
897
899 G4cout <<
"Particles produced: " ;
902 for (i=2; i < vecLen; i++)
G4cout << pv[i].getName() <<
" " ;
904 }
905
906 return;
907}
G4double pmltpc(G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c)
G4double getTotalMomentum() const