82 : verboseLevel(0), eex_rest(0), on_shell(false) {
84 G4cout <<
" >>> G4CollisionOutput::G4CollisionOutput" <<
G4endl;
133 particles.begin(), particles.end());
147 for (
unsigned i=0; i<cparticles.size(); i++)
154 if (!rproducts)
return;
157 G4cout <<
" >>> G4CollisionOutput::addOutgoingParticles(G4RPVector)"
161 G4ReactionProductVector::const_iterator j;
162 for (j=rproducts->begin(); j!=rproducts->end(); ++j) {
172 <<
"), momentum " << mom <<
" GeV" <<
G4endl;
231 G4cout <<
" >>> G4CollisionOutput::getTotalOutputMomentum" <<
G4endl;
250 G4cout <<
" >>> G4CollisionOutput::getTotalCharge" <<
G4endl;
269 G4cout <<
" >>> G4CollisionOutput::getTotalBaryonNumber" <<
G4endl;
288 G4cout <<
" >>> G4CollisionOutput::getTotalStrangeness" <<
G4endl;
301 os <<
" Output: " <<
G4endl
320 G4cout <<
" >>> G4CollisionOutput::boostToLabFrame" <<
G4endl;
339 fmom = ifrag->GetMomentum() /
GeV;
349 mom = convertor.
rotate(mom);
359 G4cout <<
" >>> G4CollisionOutput::rotateEvent" <<
G4endl;
363 ipart->setMomentum(ipart->getMomentum()*=rotate);
367 inuc->setMomentum(inuc->getMomentum()*=rotate);
372 ifrag->SetMomentum(mom*=rotate);
380 G4cout <<
" >>> G4CollisionOutput::trivialize" <<
G4endl;
384 if (
G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
392 if (
G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
405 G4cout <<
" >>> G4CollisionOutput::setOnShell" <<
G4endl;
415 G4cout <<
" bullet momentum = " << ini_mom.e() <<
", "<< ini_mom.x() <<
", "<< ini_mom.y()<<
", "<< ini_mom.z()<<
G4endl;
416 G4cout <<
" target momentum = " << momt.e()<<
", "<< momt.x()<<
", "<< momt.y()<<
", "<< momt.z()<<
G4endl;
417 G4cout <<
" Fstate momentum = " << out_mom.e()<<
", "<< out_mom.x()<<
", "<< out_mom.y()<<
", "<< out_mom.z()<<
G4endl;
430 G4cout <<
" momentum non conservation: " << G4endl
431 <<
" e " << enc <<
" p " << pnc << G4endl
435 if (std::fabs(enc) <= accuracy && pnc <= accuracy) {
452 for (
G4int ip=npart-1; ip>=0; ip--) {
455 last_mom += mom_non_cons;
460 }
else if (nnuc > 0) {
461 for (
G4int in=nnuc-1; in>=0; in--) {
464 last_mom += mom_non_cons;
469 }
else if (nfrag > 0) {
470 for (
G4int ifr=nfrag-1; ifr>=0; ifr--) {
473 if ((last_mom.e()-last_mom.m())+enc > 0.) {
474 last_mom += mom_non_cons;
483 mom_non_cons = ini_mom - out_mom;
484 pnc = mom_non_cons.rho();
485 enc = mom_non_cons.e();
489 G4cout <<
" momentum non conservation after (1): " << G4endl
490 <<
" e " << enc <<
" p " << pnc <<
G4endl;
494 G4bool need_hard_tuning =
true;
498 for (
G4int i=0; i < nfrag; i++) {
500 if (eex > 0.0 && eex + encMeV >= 0.0) {
505 G4double newMass = fragMom.m() + encMeV;
506 fragMom.setVectM(fragMom.vect(), newMass);
507 need_hard_tuning =
false;
511 }
else if (nnuc > 0) {
512 for (
G4int i=0; i < nnuc; i++) {
514 if (eex > 0.0 && eex + encMeV >= 0.0) {
516 need_hard_tuning =
false;
520 if (need_hard_tuning && encMeV > 0.) {
522 need_hard_tuning =
false;
526 if (!need_hard_tuning) {
533 G4cout <<
" trying hard (particle-pair) tuning" <<
G4endl;
536 std::pair<G4int, G4int> tune_particles = tune_par.first;
537 G4int mom_ind = tune_par.second;
540 G4cout <<
" p1 " << tune_particles.first <<
" p2 " << tune_particles.second
541 <<
" ind " << mom_ind <<
G4endl;
545 (tune_particles.first >= 0 && tune_particles.second >= 0 &&
546 mom_ind >= G4LorentzVector::X);
548 if (!tuning_possible) {
555 G4double newE12 = mom1.e() + mom2.e() + mom_non_cons.e();
556 G4double R = 0.5 * (newE12 * newE12 + mom2.e() * mom2.e() - mom1.e() * mom1.e()) / newE12;
557 G4double Q = -(mom1[mom_ind] + mom2[mom_ind]) / newE12;
559 G4double W = (R * Q + mom2[mom_ind]) * UDQ;
560 G4double V = (mom2.e() * mom2.e() - R * R) * UDQ;
569 G4double x1 = -(W + std::sqrt(DET));
570 G4double x2 = -(W - std::sqrt(DET));
576 if(mom_non_cons.e() > 0.0) {
578 if(R + Q * x1 >= 0.0) {
583 if(!xset && x2 > 0.0) {
584 if(R + Q * x2 >= 0.0) {
591 if(R + Q * x1 >= 0.) {
596 if(!xset && x2 < 0.0) {
597 if(R + Q * x2 >= 0.0) {
617 mom_non_cons = ini_mom - out_mom;
618 pnc = mom_non_cons.rho();
619 enc = mom_non_cons.e();
621 on_shell = (std::fabs(enc) < accuracy || pnc < accuracy);
624 G4cout <<
" momentum non conservation tuning: " << G4endl
625 <<
" e " << enc <<
" p " << pnc
626 << (
on_shell?
" success":
" FAILURE") << G4endl;
643 std::pair<std::pair<G4int, G4int>,
G4int>
646 G4cout <<
" >>> G4CollisionOutput::selectPairToTune" <<
G4endl;
648 std::pair<G4int, G4int> tup(-1, -1);
650 std::pair<std::pair<G4int, G4int>,
G4int> tuner(tup, i3);
657 G4double pcut = 0.3 * std::sqrt(1.88 * std::fabs(de));
666 for (
G4int l = G4LorentzVector::X; l<=G4LorentzVector::Z; l++) {
667 if (mom1[l]*mom2[l]<0.0) {
668 if (std::fabs(mom1[l])>pcut && std::fabs(mom2[l])>pcut) {
669 G4double psum = std::fabs(mom1[l]) + std::fabs(mom2[l]);
684 if (i3 < 0)
return tuner;
690 tuner.first.first = (p1>0.) ? ibest1 : ibest2;
691 tuner.first.second = (p1>0.) ? ibest2 : ibest1;
693 tuner.first.first = (p1<0.) ? ibest2 : ibest1;
694 tuner.first.second = (p1<0.) ? ibest1 : ibest2;
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
G4CollisionOutput & operator=(const G4CollisionOutput &right)
std::vector< G4InuclNuclei >::iterator nucleiIterator
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
std::vector< G4Fragment > recoilFragments
CLHEP::HepLorentzRotation G4LorentzRotation
G4LorentzVector getMomentum() const
void removeRecoilFragment(G4int index=-1)
void printCollisionOutput(std::ostream &os=G4cout) const
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
G4LorentzVector rotate(const G4LorentzVector &mom) const
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
G4LorentzVector getTotalOutputMomentum() const
const G4InuclElementaryParticle & getParticle() const
const G4String & GetParticleName() const
G4int GetAtomicNumber() const
std::vector< G4ReactionProduct * > G4ReactionProductVector
void add(const G4CollisionOutput &right)
G4GLOB_DLL std::ostream G4cout
G4int getTotalStrangeness() const
G4int numberOfOutgoingParticles() const
void boostToLabFrame(const G4LorentzConvertor &convertor)
void removeOutgoingParticle(G4int index)
std::pair< std::pair< G4int, G4int >, G4int > selectPairToTune(G4double de) const
void rotateEvent(const G4LorentzRotation &rotate)
G4int GetAtomicMass() const
std::vector< G4InuclElementaryParticle > outgoingParticles
G4int numberOfOutgoingNuclei() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
G4bool reflectionNeeded() const
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
G4int getTotalBaryonNumber() const
static const G4Fragment emptyFragment
std::vector< G4InuclNuclei >::const_iterator nucleiIterator
G4int getTotalCharge() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
void setRemainingExitationEnergy()
std::vector< G4Fragment >::iterator fragmentIterator
G4int numberOfFragments() const
void removeOutgoingNucleus(G4int index)
const G4Fragment & getRecoilFragment(G4int index=0) const
static const G4double pos
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
std::vector< G4InuclNuclei > outgoingNuclei
CLHEP::HepLorentzVector G4LorentzVector