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;
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;
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) {
471 for (
G4int in=nnuc-1; in>=0; in--) {
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;
607 on_shell = (std::fabs(enc) < accuracy || pnc < accuracy);
610 G4cout <<
" momentum non conservation tuning: " <<
G4endl
611 <<
" e " << enc <<
" p " << pnc
629std::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;
707 G4double x1 = -(W + std::sqrt(DET));
708 G4double x2 = -(W - std::sqrt(DET));
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) {
std::vector< G4InuclElementaryParticle >::iterator particleIterator
std::vector< G4InuclNuclei >::const_iterator nucleiIterator
std::vector< G4InuclNuclei >::iterator nucleiIterator
std::vector< G4Fragment >::iterator fragmentIterator
std::vector< G4InuclElementaryParticle >::iterator particleIterator
static const G4double pos
std::vector< G4ReactionProduct * > G4ReactionProductVector
static constexpr double GeV
G4GLOB_DLL std::ostream G4cout
void setVectM(const Hep3Vector &spatial, double mass)
const G4InuclElementaryParticle & getParticle() const
G4int numberOfOutgoingParticles() const
G4LorentzVector mom_non_cons
G4int getTotalStrangeness() const
void setRemainingExitationEnergy()
std::vector< G4InuclElementaryParticle > outgoingParticles
G4LorentzVector getTotalOutputMomentum() const
std::vector< G4InuclNuclei > outgoingNuclei
G4CollisionOutput & operator=(const G4CollisionOutput &right)
G4int getTotalBaryonNumber() const
std::pair< std::pair< G4int, G4int >, G4int > selectPairToTune(G4double de) const
void removeRecoilFragment(G4int index=-1)
void boostToLabFrame(const G4LorentzConvertor &convertor)
void rotateEvent(const G4LorentzRotation &rotate)
void removeOutgoingNucleus(G4int index)
void printCollisionOutput(std::ostream &os=G4cout) const
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
G4int getTotalCharge() const
const G4Fragment & getRecoilFragment(G4int index=0) const
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
G4int numberOfOutgoingNuclei() const
void add(const G4CollisionOutput &right)
G4bool tuneSelectedPair(G4LorentzVector &mom1, G4LorentzVector &mom2, G4int mom_index) const
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
G4int numberOfFragments() const
void removeOutgoingParticle(G4int index)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
static const G4Fragment emptyFragment
std::vector< G4Fragment > recoilFragments
static G4Electron * Electron()
G4LorentzVector getMomentum() const
G4bool reflectionNeeded() const
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
G4LorentzVector rotate(const G4LorentzVector &mom) const
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
const G4String & GetParticleName() const