422 {
423
425
426 if (projectileSpecies.theType==
antiProton && (targetA==1 || targetA==2) && targetZ==1 && targetS==0) {
427
428 if (targetA==1) {
429 preCascade_pbarH1(projectileSpecies, kineticEnergy);
430 } else {
431 preCascade_pbarH2(projectileSpecies, kineticEnergy);
432 theEventInfo.annihilationP = false;
433 theEventInfo.annihilationN = false;
434
436
437 ThreeVector dummy(0.,0.,0.);
439 if (rndm <= SpOverSn) {
440 theEventInfo.annihilationP = true;
441 Particle *p2 =
new Particle(
Neutron, dummy, dummy);
442 starlistH2.push_back(p2);
443
444 } else {
445 theEventInfo.annihilationN = true;
446 Particle *p2 =
new Particle(
Proton, dummy, dummy);
447 starlistH2.push_back(p2);
448
449 }
450 }
451
452
453#ifdef INCLXX_IN_GEANT4_MODE
456 ed << " Data missing: set environment variable G4INCLDATA\n"
457 << " to point to the directory containing data files needed\n"
458 <<
" by the INCL++ model" <<
G4endl;
460 }
462 const G4String& dataPathppbar(dataPath0 + "/rawppbarFS.dat");
463 const G4String& dataPathnpbar(dataPath0 + "/rawnpbarFS.dat");
464 const G4String& dataPathppbark(dataPath0 + "/rawppbarFSkaonic.dat");
465 const G4String& dataPathnpbark(dataPath0 + "/rawnpbarFSkaonic.dat");
466
467 const G4String dataPathnbarp(dataPath0 + "/rawnbarpFS.dat");
468 const G4String dataPathnbarn(dataPath0 + "/rawnbarnFS.dat");
469#else
470 std::string path;
471 if (theConfig) path = theConfig->getINCLXXDataFilePath();
472 const std::string& dataPathppbar(path + "/rawppbarFS.dat");
473 INCL_DEBUG(
"Reading https://doi.org/10.1016/0375-9474(92)90362-N ppbar final states" << dataPathppbar <<
'\n');
474 const std::string& dataPathnpbar(path + "/rawnpbarFS.dat");
475 INCL_DEBUG(
"Reading https://doi.org/10.1016/0375-9474(92)90362-N npbar final states" << dataPathnpbar <<
'\n');
476 const std::string& dataPathppbark(path + "/rawppbarFSkaonic.dat");
477 INCL_DEBUG(
"Reading https://doi.org/10.1016/j.physrep.2005.03.002 ppbar kaonic final states" << dataPathppbark <<
'\n');
478 const std::string& dataPathnpbark(path + "/rawnpbarFSkaonic.dat");
479 INCL_DEBUG(
"Reading https://doi.org/10.1007/BF02818764 and https://link.springer.com/article/10.1007/BF02754930 npbar kaonic final states" << dataPathnpbark <<
'\n');
480
481 const std::string& dataPathnbarp(path + "/rawnnbarpFS.dat ");
482 INCL_DEBUG(
"Reading nbarp final states" << dataPathnbarp <<
'\n');
483 const std::string& dataPathnbarpk(path + "/rawnbarpFSkaonic.dat");
484 INCL_DEBUG(
"Reading nbarp kaonic final states");
485 const std::string& dataPathnbarn(path + "/rawnbarnFS.dat");
486 INCL_DEBUG(
"Reading nbarn final states" << dataPathnbarn <<
'\n');
487#endif
488
489
490 std::vector<G4double> probabilities;
491 std::vector<std::vector<G4String>> particle_types;
494
496 ThreeVector mommy;
497
499 ThreeVector annihilationPosition(0.,0.,0.);
500 if (rdm < (1.-kaonicFSprob)) {
501 INCL_DEBUG(
"pionic pp final state chosen" <<
'\n');
502 if (targetA==1 || (targetA==2 && theEventInfo.annihilationP))
503 {sum = read_file(dataPathppbar, probabilities, particle_types);}
504 else
505 {sum = read_file(dataPathnpbar, probabilities, particle_types);}
506 rdm = (rdm/(1.-kaonicFSprob))*sum;
507
508 G4int n = findStringNumber(rdm, std::move(probabilities))-1;
509 if ( n < 0 ) return theEventInfo;
510 for (
G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++) {
511 if (particle_types[n][j] == "pi0") {
512 Particle *p =
new Particle(
PiZero, mommy, annihilationPosition);
513 starlist.push_back(p);
514 } else if (particle_types[n][j] == "pi-") {
515 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
516 starlist.push_back(p);
517 } else if (particle_types[n][j] == "pi+") {
518 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
519 starlist.push_back(p);
520 } else if (particle_types[n][j] == "omega") {
521 Particle *p =
new Particle(
Omega, mommy, annihilationPosition);
522 starlist.push_back(p);
523 } else if (particle_types[n][j] == "eta") {
524 Particle *p =
new Particle(
Eta, mommy, annihilationPosition);
525 starlist.push_back(p);
526 } else if (particle_types[n][j] == "rho-") {
527 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
528 starlist.push_back(p);
529 Particle *
pp =
new Particle(
PiZero, mommy, annihilationPosition);
530 starlist.push_back(pp);
531 } else if (particle_types[n][j] == "rho+") {
532 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
533 starlist.push_back(p);
534 Particle *
pp =
new Particle(
PiZero, mommy, annihilationPosition);
535 starlist.push_back(pp);
536 } else if (particle_types[n][j] == "rho0") {
537 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
538 starlist.push_back(p);
539 Particle *
pp =
new Particle(
PiPlus, mommy, annihilationPosition);
540 starlist.push_back(pp);
541 } else {
542 INCL_ERROR(
"Some non-existing FS particle detected when reading pbar FS files");
543 for (
G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++) {
544#ifdef INCLXX_IN_GEANT4_MODE
546#else
547 std::cout <<
"gotcha! " << particle_types[
n][jj] << std::endl;
548#endif
549 }
550#ifdef INCLXX_IN_GEANT4_MODE
551 G4cout <<
"Some non-existing FS particle detected when reading pbar FS files" <<
G4endl;
552#else
553 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
554#endif
555 }
556 }
557 } else {
558 INCL_DEBUG(
"kaonic pp final state chosen" <<
'\n');
559 if (targetA==1 || (targetA==2 && theEventInfo.annihilationP))
560 {sum = read_file(dataPathppbark, probabilities, particle_types);}
561 else
562 {sum = read_file(dataPathnpbark, probabilities, particle_types);}
563 rdm = ((1.-rdm)/kaonicFSprob)*sum;
564
565 G4int n = findStringNumber(rdm, std::move(probabilities))-1;
566 if ( n < 0 ) return theEventInfo;
567 for (
G4int j = 0; j < static_cast<G4int>(particle_types[n].size()); j++) {
568 if (particle_types[n][j] == "pi0") {
569 Particle *p =
new Particle(
PiZero, mommy, annihilationPosition);
570 starlist.push_back(p);
571 } else if (particle_types[n][j] == "pi-") {
572 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
573 starlist.push_back(p);
574 } else if (particle_types[n][j] == "pi+") {
575 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
576 starlist.push_back(p);
577 } else if (particle_types[n][j] == "omega") {
578 Particle *p =
new Particle(
Omega, mommy, annihilationPosition);
579 starlist.push_back(p);
580 } else if (particle_types[n][j] == "eta") {
581 Particle *p =
new Particle(
Eta, mommy, annihilationPosition);
582 starlist.push_back(p);
583 } else if (particle_types[n][j] == "K-") {
584 Particle *p =
new Particle(
KMinus, mommy, annihilationPosition);
585 starlist.push_back(p);
586 } else if (particle_types[n][j] == "K+") {
587 Particle *p =
new Particle(
KPlus, mommy, annihilationPosition);
588 starlist.push_back(p);
589 } else if (particle_types[n][j] == "K0") {
590 Particle *p =
new Particle(
KZero, mommy, annihilationPosition);
591 starlist.push_back(p);
592 } else if (particle_types[n][j] == "K0b") {
593 Particle *p =
new Particle(
KZeroBar, mommy, annihilationPosition);
594 starlist.push_back(p);
595 } else {
596 INCL_ERROR(
"Some non-existing FS particle detected when reading pbar FS files");
597 for (
G4int jj = 0; jj < static_cast<G4int>(particle_types[n].size()); jj++) {
598#ifdef INCLXX_IN_GEANT4_MODE
600#else
601 std::cout <<
"gotcha! " << particle_types[
n][jj] << std::endl;
602#endif
603 }
604#ifdef INCLXX_IN_GEANT4_MODE
605 G4cout <<
"Some non-existing FS particle detected when reading pbar FS files" <<
G4endl;
606#else
607 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
608#endif
609 }
610 }
611 }
612
613
615 if (starlist.size() < 2) {
616 INCL_ERROR(
"should never happen, at least 2 final state particles!" <<
'\n');
617 } else if (starlist.size() == 2) {
622 G4double s = energyOfMesonStar*energyOfMesonStar;
623 G4double mom1 = std::sqrt(s/4. - (std::pow(m1,2) + std::pow(m2,2))/2. - std::pow(m1,2)*std::pow(m2,2)/s + (std::pow(m1,4) + 2.*std::pow(m1*m2,2) + std::pow(m2,4))/(4.*s));
625 (*first)->setMomentum(momentello);
626 (*first)->adjustEnergyFromMomentum();
627 (*last)->setMomentum(-momentello);
628 (*last)->adjustEnergyFromMomentum();
629 } else {
631 }
632
633 if (targetA==1) postCascade_pbarH1(starlist);
634 else postCascade_pbarH2(starlist,starlistH2);
635
636 theGlobalInfo.nShots++;
637 return theEventInfo;
638 }
639
640 if ((projectileSpecies.theType==
antiNeutron)&& (targetA==1 || targetA==2) && targetZ==1 && targetS==0) {
641
642 if (targetA==1) {
643 preCascade_nbarH1(projectileSpecies, kineticEnergy);
644 } else {
645 preCascade_nbarH2(projectileSpecies, kineticEnergy);
646 theEventInfo.annihilationP = false;
647 theEventInfo.annihilationN = false;
648
650
651 ThreeVector dummy(0.,0.,0.);
653 if (rndm <= SpOverSn) {
654 theEventInfo.annihilationP = true;
655 Particle *p2 =
new Particle(
Neutron, dummy, dummy);
656 starlistH2.push_back(p2);
657
658 } else {
659 theEventInfo.annihilationN = true;
660 Particle *p2 =
new Particle(
Proton, dummy, dummy);
661 starlistH2.push_back(p2);
662
663 }
664 }
665
666
667#ifdef INCLXX_IN_GEANT4_MODE
670 ed << " Data missing: set environment variable G4INCLDATA\n"
671 << " to point to the directory containing data files needed\n"
672 <<
" by the INCL++ model" <<
G4endl;
674 }
676 G4String dataPathnbarp(dataPath0 + "/rawnbarpFS.dat");
677 G4String dataPathnbarn(dataPath0 + "/rawnbarnFS.dat");
678 G4String dataPathnbarnk(dataPath0 + "/rawppbarFSkaonic.dat");
679 G4String dataPathnbarpk(dataPath0 + "/rawnbarpFSkaonic.dat");
680#else
681 G4String path;
682 if (theConfig) path = theConfig->getINCLXXDataFilePath();
683 std::string dataPathnbarn(path + "/rawnbarnFS.dat");
684 INCL_DEBUG(
"Reading nbarn final states" << dataPathnbarn <<
'\n');
685 std::string dataPathnbarp(path + "/rawnbarpFS.dat");
686 INCL_DEBUG(
"Reading nbarp final states" << dataPathnbarp <<
'\n');
687 std::string dataPathnbarnk(path + "/rawppbarFSkaonic.dat");
688 INCL_DEBUG(
"Reading nbarn kaonic final states" << dataPathnbarnk <<
'\n');
689 std::string dataPathnbarpk(path + "/rawnbarpFSkaonic.dat");
690 INCL_DEBUG(
"Reading nbarp kaonic final states" << dataPathnbarpk <<
'\n');
691#endif
692
693 std::vector<double> probabilities;
694 std::vector<std::vector<G4String>> particle_types;
695 double sum = 0.0;
696 double kaonicFSprob=0.05;
697
699 ThreeVector mommy;
700
702 ThreeVector annihilationPosition(0.,0.,0.);
703 if (rdm < (1.-kaonicFSprob)) {
704 INCL_DEBUG(
"pionic nn final state chosen" <<
'\n');
705 if (targetA==1 || (targetA==2 && theEventInfo.annihilationP))
706 {sum = read_file(dataPathnbarp, probabilities, particle_types);}
707 else
708 {sum = read_file(dataPathnbarn, probabilities, particle_types);}
709 rdm = (rdm/(1.-kaonicFSprob))*sum;
710
711 G4int n = findStringNumber(rdm, probabilities)-1;
712 if ( n < 0 ) return theEventInfo;
713 for (
G4int j = 0; j < static_cast<int>(particle_types[n].size()); j++) {
714 if (particle_types[n][j] == "pi0") {
715 Particle *p =
new Particle(
PiZero, mommy, annihilationPosition);
716 starlist.push_back(p);
717 } else if (particle_types[n][j] == "pi-") {
718 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
719 starlist.push_back(p);
720 } else if (particle_types[n][j] == "pi+") {
721 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
722 starlist.push_back(p);
723 } else if (particle_types[n][j] == "omega") {
724 Particle *p =
new Particle(
Omega, mommy, annihilationPosition);
725 starlist.push_back(p);
726 } else if (particle_types[n][j] == "eta") {
727 Particle *p =
new Particle(
Eta, mommy, annihilationPosition);
728 starlist.push_back(p);
729 } else if (particle_types[n][j] == "rho-") {
730 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
731 starlist.push_back(p);
732 Particle *
pp =
new Particle(
PiZero, mommy, annihilationPosition);
733 starlist.push_back(pp);
734 } else if (particle_types[n][j] == "rho+") {
735 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
736 starlist.push_back(p);
737 Particle *
pp =
new Particle(
PiZero, mommy, annihilationPosition);
738 starlist.push_back(pp);
739 } else if (particle_types[n][j] == "rho0") {
740 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
741 starlist.push_back(p);
742 Particle *
pp =
new Particle(
PiPlus, mommy, annihilationPosition);
743 starlist.push_back(pp);
744 } else {
745 INCL_ERROR(
"Some non-existing FS particle detected when reading pbar FS files");
746 for (int jj = 0; jj < static_cast<int>(particle_types[n].size()); jj++) {
747#ifdef INCLXX_IN_GEANT4_MODE
749#else
750 std::cout <<
"gotcha! " << particle_types[
n][jj] << std::endl;
751#endif
752 }
753#ifdef INCLXX_IN_GEANT4_MODE
754 G4cout <<
"Some non-existing FS particle detected when reading pbar FS files" <<
G4endl;
755#else
756 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
757#endif
758 }
759 }
760 } else {
761 INCL_DEBUG(
"kaonic pp final state chosen" <<
'\n');
762 if (targetA==1 || (targetA==2 && theEventInfo.annihilationP))
763 {sum = read_file(dataPathnbarpk, probabilities, particle_types);}
764 else
765 {sum = read_file(dataPathnbarnk, probabilities, particle_types);}
766 rdm = ((1.-rdm)/kaonicFSprob)*sum;
767
768 G4int n = findStringNumber(rdm, probabilities)-1;
769 if ( n < 0 ) return theEventInfo;
770 for (
G4int j = 0; j < static_cast<int>(particle_types[n].size()); j++) {
771 if (particle_types[n][j] == "pi0") {
772 Particle *p =
new Particle(
PiZero, mommy, annihilationPosition);
773 starlist.push_back(p);
774 } else if (particle_types[n][j] == "pi-") {
775 Particle *p =
new Particle(
PiMinus, mommy, annihilationPosition);
776 starlist.push_back(p);
777 } else if (particle_types[n][j] == "pi+") {
778 Particle *p =
new Particle(
PiPlus, mommy, annihilationPosition);
779 starlist.push_back(p);
780 } else if (particle_types[n][j] == "omega") {
781 Particle *p =
new Particle(
Omega, mommy, annihilationPosition);
782 starlist.push_back(p);
783 } else if (particle_types[n][j] == "eta") {
784 Particle *p =
new Particle(
Eta, mommy, annihilationPosition);
785 starlist.push_back(p);
786 } else if (particle_types[n][j] == "K-") {
787 Particle *p =
new Particle(
KMinus, mommy, annihilationPosition);
788 starlist.push_back(p);
789 } else if (particle_types[n][j] == "K+") {
790 Particle *p =
new Particle(
KPlus, mommy, annihilationPosition);
791 starlist.push_back(p);
792 } else if (particle_types[n][j] == "K0") {
793 Particle *p =
new Particle(
KZero, mommy, annihilationPosition);
794 starlist.push_back(p);
795 } else if (particle_types[n][j] == "K0b") {
796 Particle *p =
new Particle(
KZeroBar, mommy, annihilationPosition);
797 starlist.push_back(p);
798 } else {
799 INCL_ERROR(
"Some non-existing FS particle detected when reading pbar FS files");
800 for (int jj = 0; jj < static_cast<int>(particle_types[n].size()); jj++) {
801#ifdef INCLXX_IN_GEANT4_MODE
803#else
804 std::cout <<
"gotcha! " << particle_types[
n][jj] << std::endl;
805#endif
806 }
807#ifdef INCLXX_IN_GEANT4_MODE
808 G4cout <<
"Some non-existing FS particle detected when reading pbar FS files" <<
G4endl;
809#else
810 std::cout << "Some non-existing FS particle detected when reading pbar FS files" << std::endl;
811#endif
812 }
813 }
814 }
815
816
818 if (starlist.size() < 2) {
819 INCL_ERROR(
"should never happen, at least 2 final state particles!" <<
'\n');
820 } else if (starlist.size() == 2) {
825 G4double s = energyOfMesonStar*energyOfMesonStar;
826 G4double mom1 = std::sqrt(s/4. - (std::pow(m1,2) + std::pow(m2,2))/2. - std::pow(m1,2)*std::pow(m2,2)/s + (std::pow(m1,4) + 2.*std::pow(m1*m2,2) + std::pow(m2,4))/(4.*s));
828 (*first)->setMomentum(momentello);
829 (*first)->adjustEnergyFromMomentum();
830 (*last)->setMomentum(-momentello);
831 (*last)->adjustEnergyFromMomentum();
832 } else {
834 }
835
836 if (targetA==1) postCascade_pbarH1(starlist);
837 else postCascade_pbarH2(starlist,starlistH2);
838
839 theGlobalInfo.nShots++;
840 return theEventInfo;
841 }
842
843
845
847
848
849 targetInitSuccess =
prepareReaction(projectileSpecies, kineticEnergy, targetA, targetZ, targetS);
850
851 if(!targetInitSuccess) {
852 INCL_WARN(
"Target initialisation failed for A=" << targetA <<
", Z=" << targetZ <<
", S=" << targetS <<
'\n');
853 theEventInfo.transparent=true;
854 return theEventInfo;
855 }
856
857 cascadeAction->beforeCascadeAction(propagationModel);
858
859 const G4bool canRunCascade = preCascade(projectileSpecies, kineticEnergy);
860 if(canRunCascade) {
861 cascade();
862 postCascade(projectileSpecies, kineticEnergy);
863 cascadeAction->afterCascadeAction(nucleus);
864 }
865 updateGlobalInfo();
866 return theEventInfo;
867 }
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z, const G4int S)
static std::vector< G4double > INCLBiasVector
Time ordered vector of all bias applied.
static G4ThreadLocal G4int nextBiasedCollisionID
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2).
void generate(const G4double sqrtS, ParticleList &particles)
Generate an event in the CM system.
ThreeVector normVector(G4double norm=1.)
ParticleList::const_iterator ParticleIter
std::vector< Base * > ParticleList