138 using namespace G4InuclParticleNames;
149 maximumTries(20), numberOfTries(0),
177 outFile <<
"The Bertini-style cascade implements the inelastic scattering\n"
178 <<
"of hadrons by nuclei. Nucleons, pions, kaons and hyperons\n"
179 <<
"from 0 to 15 GeV may be used as projectiles in this model.\n"
180 <<
"Final state hadrons are produced by a classical cascade\n"
181 <<
"consisting of individual hadron-nucleon scatterings which use\n"
182 <<
"free-space partial cross sections, corrected for various\n"
183 <<
"nuclear medium effects. The target nucleus is modeled as a\n"
184 <<
"set of 1, 3 or 6 spherical shells, in which scattered hadrons\n"
185 <<
"travel in straight lines until they are reflected from or\n"
186 <<
"transmitted through shell boundaries.\n";
206 if (!ch || !pn || !nn || !pp)
return;
254 G4cout <<
" >>> G4CascadeInterface::ApplyYourself" <<
G4endl;
257 G4cerr <<
" >>> G4CascadeInterface got negative-energy track: "
262 #ifdef G4CASCADE_DEBUG_INTERFACE
263 static G4int counter(0);
265 G4cerr <<
"Reaction number "<< counter <<
" "
376 #ifdef G4CASCADE_DEBUG_INTERFACE
380 <<
"\n " << theSecondaries->size() <<
" secondaries:" <<
G4endl;
381 for (
size_t i=0; i<theSecondaries->size(); i++) {
450 G4cout <<
" >>> G4CascadeInterface::NoInteraction" <<
G4endl;
466 G4int bulletType = 0;
467 G4int bulletA = 0, bulletZ = 0;
476 if (0 == bulletType && 0 == bulletA*bulletZ) {
479 <<
" not usable as bullet." <<
G4endl;
497 projectileMomentum.
e());
545 G4cerr <<
" ERROR: G4CascadeInterface incompatible particle type "
546 << outgoingType <<
G4endl;
581 G4cout <<
" >>> G4CascadeInterface::copyOutputToHadronicResult" <<
G4endl;
590 if (!particles.empty()) {
592 for (; ipart != particles.end(); ipart++) {
598 if (!outgoingNuclei.empty()) {
600 for (; ifrag != outgoingNuclei.end(); ifrag++) {
608 G4cout <<
" >>> G4CascadeInterface::copyOutputToReactionProducts" <<
G4endl;
619 if (!particles.empty()) {
621 for (; ipart != particles.end(); ipart++) {
625 propResult->push_back(rp);
631 if (!fragments.empty()) {
633 for (; ifrag != fragments.end(); ifrag++) {
637 propResult->push_back(rp);
653 G4cerr <<
"ERROR: no baryon number conservation, sum of baryons = "
658 G4cerr <<
"ERROR: no charge conservation, sum of charges = "
663 G4cerr <<
"Kinetic energy conservation violated by "
670 G4cout <<
"Initial energy " << eInit <<
" final energy " << eFinal
671 <<
"\nTotal energy conservation at level "
675 G4cerr <<
"FATAL ERROR: kinetic energy created "
689 const std::vector<G4InuclElementaryParticle>&
p =
694 violated |= (
ipart->getKineticEnergy() < coulumbBarrier);
704 const std::vector<G4InuclElementaryParticle>& out =
707 #ifdef G4CASCADE_DEBUG_INTERFACE
709 G4cout <<
" retryInelasticProton: number of Tries "
711 <<
"\n retryInelasticProton: AND collision type ";
714 G4cout << (out.size() == 2 ?
"ELASTIC (t)" :
"INELASTIC (f)")
715 <<
"\n retryInelasticProton: AND Leading particles bullet "
716 << (out.size() >= 2 &&
719 ?
"YES (t)" :
"NO (f)")
743 #ifdef G4CASCADE_DEBUG_INTERFACE
745 G4cout <<
" retryInelasticNucleus: numberOfTries "
747 <<
"\n retryInelasticNucleus: AND outputParticles "
748 << ((npart != 0) ?
"NON-ZERO (t)" :
"EMPTY (f)")
749 #ifdef G4CASCADE_COULOMB_DEV
750 <<
"\n retryInelasticNucleus: AND coulombBarrier (COULOMB_DEV) "
752 <<
"\n retryInelasticNucleus: AND collision type (COULOMB_DEV) "
753 << ((npart+nfrag > 2) ?
"INELASTIC (t)" :
"ELASTIC (f)")
755 <<
"\n retryInelasticNucleus: AND collision type "
756 << ((npart+nfrag < 3) ?
"ELASTIC (t)" :
"INELASTIC (f)")
757 <<
"\n retryInelasticNucleus: AND Leading particle bullet "
760 <<
"\n retryInelasticNucleus: OR conservation "
761 << (!
balance->
okay() ?
"FAILED (t)" :
"PASSED (f)")
767 #ifdef G4CASCADE_COULOMB_DEV
770 (npart+nfrag < 3 && firstOut == bullet->getDefinition())
773 #ifndef G4CASCADE_SKIP_ECONS
787 std::ostream& errInfo =
G4cerr;
789 errInfo <<
" >>> G4CascadeInterface has non-conserving"
792 G4String throwMsg =
"G4CascadeInterface - ";
794 throwMsg +=
"Energy";
795 errInfo <<
" Energy conservation violated by " <<
balance->
deltaE()
800 throwMsg +=
"Momentum";
801 errInfo <<
" Momentum conservation violated by " <<
balance->
deltaP()
806 throwMsg +=
"Baryon number";
811 throwMsg +=
"Charge";
812 errInfo <<
" Charge conservation violated by " <<
balance->
deltaQ()
816 errInfo <<
" Final event output, for debugging:\n"
817 <<
" Bullet: \n" << *
bullet << G4endl
821 throwMsg +=
" non-conservation. More info in output.";