83 : verboseLevel(0), eex_rest(0), on_shell(false) {
85 G4cout <<
" >>> G4CollisionOutput::G4CollisionOutput" <<
G4endl;
134 particles.begin(), particles.end());
148 for (
unsigned i=0; i<cparticles.size(); i++)
155 if (!rproducts)
return;
158 G4cout <<
" >>> G4CollisionOutput::addOutgoingParticles(G4RPVector)"
162 G4ReactionProductVector::const_iterator j;
163 for (j=rproducts->begin(); j!=rproducts->end(); ++j) {
173 <<
"), momentum " << mom <<
" GeV" <<
G4endl;
232 G4cout <<
" >>> G4CollisionOutput::getTotalOutputMomentum" <<
G4endl;
251 G4cout <<
" >>> G4CollisionOutput::getTotalCharge" <<
G4endl;
270 G4cout <<
" >>> G4CollisionOutput::getTotalBaryonNumber" <<
G4endl;
289 G4cout <<
" >>> G4CollisionOutput::getTotalStrangeness" <<
G4endl;
302 os <<
" Output: " <<
G4endl
321 G4cout <<
" >>> G4CollisionOutput::boostToLabFrame" <<
G4endl;
340 fmom = ifrag->GetMomentum() /
GeV;
350 mom = convertor.
rotate(mom);
360 G4cout <<
" >>> G4CollisionOutput::rotateEvent" <<
G4endl;
364 ipart->setMomentum(ipart->getMomentum()*=rotate);
368 inuc->setMomentum(inuc->getMomentum()*=rotate);
373 ifrag->SetMomentum(mom*=rotate);
381 G4cout <<
" >>> G4CollisionOutput::trivialize" <<
G4endl;
385 if (
G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
393 if (
G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
406 G4cout <<
" >>> G4CollisionOutput::setOnShell" <<
G4endl;
416 G4cout <<
" bullet momentum = " << ini_mom.
e() <<
", "<< ini_mom.
x() <<
", "<< ini_mom.
y()<<
", "<< ini_mom.
z()<<
G4endl;
417 G4cout <<
" target momentum = " << momt.
e()<<
", "<< momt.
x()<<
", "<< momt.
y()<<
", "<< momt.
z()<<
G4endl;
418 G4cout <<
" Fstate momentum = " << out_mom.
e()<<
", "<< out_mom.
x()<<
", "<< out_mom.
y()<<
", "<< out_mom.
z()<<
G4endl;
431 G4cout <<
" momentum non conservation: " << G4endl
432 <<
" e " << enc <<
" p " << pnc << G4endl
436 if (std::fabs(enc) <= accuracy && pnc <= accuracy) {
453 for (
G4int ip=npart-1; ip>=0; ip--) {
461 }
else if (nnuc > 0) {
470 }
else if (nfrag > 0) {
471 for (
G4int ifr=nfrag-1; ifr>=0; ifr--) {
474 if ((last_mom.
e()-last_mom.
m())+enc > 0.) {
490 G4cout <<
" momentum non conservation after (1): " << G4endl
491 <<
" e " << enc <<
" p " << pnc <<
G4endl;
495 G4bool need_hard_tuning =
true;
499 for (
G4int i=0; i < nfrag; i++) {
501 if (eex > 0.0 && eex + encMeV >= 0.0) {
508 need_hard_tuning =
false;
512 }
else if (nnuc > 0) {
513 for (
G4int i=0; i < nnuc; i++) {
515 if (eex > 0.0 && eex + encMeV >= 0.0) {
517 need_hard_tuning =
false;
521 if (need_hard_tuning && encMeV > 0.) {
523 need_hard_tuning =
false;
527 if (!need_hard_tuning) {
534 G4cout <<
" trying hard (particle-pair) tuning" <<
G4endl;
565 std::pair<G4int, G4int> tune_particles = tune_par.first;
566 G4int mom_ind = tune_par.second;
569 (tune_particles.first >= 0 && tune_particles.second >= 0 &&
572 if (!tuning_possible) {
578 G4cout <<
" p1 " << tune_particles.first <<
" p2 " << tune_particles.second
579 <<
" ind " << mom_ind <<
G4endl;
595 pnc = mom_non_cons.
rho();
596 enc = mom_non_cons.e();
598 on_shell = (std::fabs(enc) < accuracy || pnc < accuracy);
601 G4cout <<
" momentum non conservation tuning: " << G4endl
602 <<
" e " << enc <<
" p " << pnc
603 << (
on_shell?
" success":
" FAILURE") << G4endl;
620 std::pair<std::pair<G4int, G4int>,
G4int>
623 G4cout <<
" >>> G4CollisionOutput::selectPairToTune" <<
G4endl;
625 std::pair<G4int, G4int> tup(-1, -1);
627 std::pair<std::pair<G4int, G4int>,
G4int> tuner(tup, i3);
634 G4double pcut = 0.3 * std::sqrt(1.88 * std::fabs(de));
644 if (mom1[l]*mom2[l]<0.0) {
645 if (std::fabs(mom1[l])>pcut && std::fabs(mom2[l])>pcut) {
646 G4double psum = std::fabs(mom1[l]) + std::fabs(mom2[l]);
661 if (i3 < 0)
return tuner;
667 tuner.first.first = (p1>0.) ? ibest1 : ibest2;
668 tuner.first.second = (p1>0.) ? ibest2 : ibest1;
670 tuner.first.first = (p1<0.) ? ibest2 : ibest1;
671 tuner.first.second = (p1<0.) ? ibest1 : ibest2;
680 G4int mom_ind)
const {
682 G4cout <<
" >>> G4CollisionOutput::tuneSelectedPair" <<
G4endl;
685 G4double R = 0.5 * (newE12*newE12 + mom2.
e()*mom2.
e() - mom1.
e()*mom1.
e()) / newE12;
686 G4double Q = -(mom1[mom_ind] + mom2[mom_ind]) / newE12;
688 G4double W = (R * Q + mom2[mom_ind]) * UDQ;
707 if (R + Q * x1 >= 0.0) {
712 if (!xset && x2 > 0.0) {
713 if (R + Q * x2 >= 0.0) {
720 if (R + Q * x1 >= 0.) {
725 if (!xset && x2 < 0.0) {
726 if (R + Q * x2 >= 0.0) {
std::vector< G4InuclNuclei >::const_iterator nucleiIterator
const G4InuclElementaryParticle & getParticle() const
G4int GetAtomicNumber() const
static const G4double pos
std::pair< std::pair< G4int, G4int >, G4int > selectPairToTune(G4double de) const
const G4Fragment & getRecoilFragment(G4int index=0) const
void rotateEvent(const G4LorentzRotation &rotate)
Float_t x1[n_points_granero]
G4LorentzVector mom_non_cons
const G4String & GetParticleName() const
std::vector< G4InuclElementaryParticle > outgoingParticles
G4int getTotalStrangeness() const
void boostToLabFrame(const G4LorentzConvertor &convertor)
void setOnShell(G4InuclParticle *bullet, G4InuclParticle *target)
G4LorentzVector rotate(const G4LorentzVector &mom) const
void add(const G4CollisionOutput &right)
G4bool tuneSelectedPair(G4LorentzVector &mom1, G4LorentzVector &mom2, G4int mom_index) const
G4CollisionOutput & operator=(const G4CollisionOutput &right)
G4LorentzVector backToTheLab(const G4LorentzVector &mom) const
std::vector< G4InuclNuclei > outgoingNuclei
void setRemainingExitationEnergy()
void removeOutgoingParticle(G4int index)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
G4int numberOfOutgoingNuclei() const
static const G4Fragment emptyFragment
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4int getTotalCharge() const
G4int numberOfOutgoingParticles() const
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
void removeRecoilFragment(G4int index=-1)
std::vector< G4Fragment > recoilFragments
G4int numberOfFragments() const
G4bool reflectionNeeded() const
G4int GetAtomicMass() const
G4LorentzVector getMomentum() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
std::vector< G4Fragment >::iterator fragmentIterator
G4GLOB_DLL std::ostream G4cout
void removeOutgoingNucleus(G4int index)
G4int getTotalBaryonNumber() const
void printCollisionOutput(std::ostream &os=G4cout) const
Float_t x2[n_points_geant4]
static constexpr double GeV
G4LorentzVector getTotalOutputMomentum() const
void trivialise(G4InuclParticle *bullet, G4InuclParticle *target)
void setVectM(const Hep3Vector &spatial, double mass)