85 : verboseLevel(0), eex_rest(0), on_shell(
false) {
87 G4cout <<
" >>> G4CollisionOutput::G4CollisionOutput" <<
G4endl;
136 particles.begin(), particles.end());
150 for (
unsigned i=0; i<cparticles.size(); i++)
157 if (!rproducts)
return;
160 G4cout <<
" >>> G4CollisionOutput::addOutgoingParticles(G4RPVector)"
164 G4ReactionProductVector::const_iterator j;
165 for (j=rproducts->begin(); j!=rproducts->end(); ++j) {
175 <<
"), momentum " <<
mom <<
" GeV" <<
G4endl;
234 G4cout <<
" >>> G4CollisionOutput::getTotalOutputMomentum" <<
G4endl;
253 G4cout <<
" >>> G4CollisionOutput::getTotalCharge" <<
G4endl;
273 G4cout <<
" >>> G4CollisionOutput::getTotalBaryonNumber" <<
G4endl;
292 G4cout <<
" >>> G4CollisionOutput::getTotalStrangeness" <<
G4endl;
305 os <<
" Output: " <<
G4endl
324 G4cout <<
" >>> G4CollisionOutput::boostToLabFrame" <<
G4endl;
343 fmom = ifrag->GetMomentum() /
GeV;
353 mom = convertor.
rotate(mom);
363 G4cout <<
" >>> G4CollisionOutput::rotateEvent" <<
G4endl;
367 ipart->setMomentum(ipart->getMomentum()*=rotate);
371 inuc->setMomentum(inuc->getMomentum()*=rotate);
376 ifrag->SetMomentum(mom*=rotate);
384 G4cout <<
" >>> G4CollisionOutput::trivialize" <<
G4endl;
388 if (
G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
396 if (
G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
409 G4cout <<
" >>> G4CollisionOutput::setOnShell" <<
G4endl;
419 G4cout <<
" bullet momentum = " << ini_mom.
e() <<
", "<< ini_mom.
x() <<
", "<< ini_mom.
y()<<
", "<< ini_mom.
z()<<
G4endl;
420 G4cout <<
" target momentum = " << momt.
e()<<
", "<< momt.
x()<<
", "<< momt.
y()<<
", "<< momt.
z()<<
G4endl;
421 G4cout <<
" Fstate momentum = " << out_mom.
e()<<
", "<< out_mom.
x()<<
", "<< out_mom.
y()<<
", "<< out_mom.
z()<<
G4endl;
440 G4cout <<
" momentum non conservation: " << G4endl
441 <<
" e " << enc <<
" p " << pnc << G4endl
445 if (std::fabs(enc) <= accuracy && pnc <= accuracy) {
462 for (
G4int ip=npart-1; ip>=0; ip--) {
470 }
else if (nnuc > 0) {
479 }
else if (nfrag > 0) {
480 for (
G4int ifr=nfrag-1; ifr>=0; ifr--) {
483 if ((last_mom.
e()-last_mom.
m())+enc > 0.) {
499 G4cout <<
" momentum non conservation after (1): " << G4endl
500 <<
" e " << enc <<
" p " << pnc <<
G4endl;
504 G4bool need_hard_tuning =
true;
508 for (
G4int i=0; i < nfrag; i++) {
510 if (eex > 0.0 && eex + encMeV >= 0.0) {
517 need_hard_tuning =
false;
521 }
else if (nnuc > 0) {
522 for (
G4int i=0; i < nnuc; i++) {
524 if (eex > 0.0 && eex + encMeV >= 0.0) {
526 need_hard_tuning =
false;
530 if (need_hard_tuning && encMeV > 0.) {
532 need_hard_tuning =
false;
536 if (!need_hard_tuning) {
543 G4cout <<
" trying hard (particle-pair) tuning" <<
G4endl;
574 std::pair<G4int, G4int> tune_particles = tune_par.first;
575 G4int mom_ind = tune_par.second;
578 (tune_particles.first >= 0 && tune_particles.second >= 0 &&
581 if (!tuning_possible) {
587 G4cout <<
" p1 " << tune_particles.first <<
" p2 " << tune_particles.second
588 <<
" ind " << mom_ind <<
G4endl;
604 pnc = mom_non_cons.
rho();
605 enc = mom_non_cons.e();
607 on_shell = (std::fabs(enc) < accuracy || pnc < accuracy);
610 G4cout <<
" momentum non conservation tuning: " << G4endl
611 <<
" e " << enc <<
" p " << pnc
612 << (
on_shell?
" success":
" FAILURE") << G4endl;
629 std::pair<std::pair<G4int, G4int>,
G4int>
632 G4cout <<
" >>> G4CollisionOutput::selectPairToTune" <<
G4endl;
634 std::pair<G4int, G4int> tup(-1, -1);
636 std::pair<std::pair<G4int, G4int>,
G4int> tuner(tup, i3);
643 G4double pcut = 0.3 * std::sqrt(1.88 * std::fabs(de));
653 if (mom1[l]*mom2[l]<0.0) {
654 if (std::fabs(mom1[l])>pcut && std::fabs(mom2[l])>pcut) {
655 G4double psum = std::fabs(mom1[l]) + std::fabs(mom2[l]);
670 if (i3 < 0)
return tuner;
676 tuner.first.first = (p1>0.) ? ibest1 : ibest2;
677 tuner.first.second = (p1>0.) ? ibest2 : ibest1;
679 tuner.first.first = (p1<0.) ? ibest2 : ibest1;
680 tuner.first.second = (p1<0.) ? ibest1 : ibest2;
689 G4int mom_ind)
const {
691 G4cout <<
" >>> G4CollisionOutput::tuneSelectedPair" <<
G4endl;
694 G4double R = 0.5 * (newE12*newE12 + mom2.
e()*mom2.
e() - mom1.
e()*mom1.
e()) / newE12;
695 G4double Q = -(mom1[mom_ind] + mom2[mom_ind]) / newE12;
697 G4double W = (R * Q + mom2[mom_ind]) * UDQ;
716 if (R + Q * x1 >= 0.0) {
721 if (!xset && x2 > 0.0) {
722 if (R + Q * x2 >= 0.0) {
729 if (R + Q * x1 >= 0.) {
734 if (!xset && x2 < 0.0) {
735 if (R + Q * x2 >= 0.0) {