64 std::for_each(collisions.begin(), collisions.end(),
G4Delete());
79 if ( std::abs(mom1.
vect().
unit().
z() -1 ) < 1
e-6 )
85 collisionTime=deltaz/velocity;
86 distance_fast=position.
x()*position.
x() + position.
y()*position.
y();
94 collisionTime = (position * velocity) / velocity.
mag2();
95 position -= velocity * collisionTime;
96 distance_fast=position.
mag2();
101 if (collisionTime > 0)
104 if(0.7*
pi*distance_fast>maxCrossSection)
return time;
114 mom1 = toCMSFrame * mom1;
115 mom2 = toCMSFrame * mom2;
120 (toCMSFrame * coordinate2).vect());
126 G4double distance = pos * pos - (pos*mom) * (pos*mom) / (mom.mag2());
134 if(
pi*distance>maxCrossSection)
return time;
140 pi*distance>maxChargedCrossSection)
return time;
146 sqrtS>1.91*
GeV &&
pi*distance>maxChargedCrossSection)
return time;
193 if ( totalCrossSection > 0 )
206 if (distance <= totalCrossSection /
pi)
208 time = collisionTime;
287 if (aCrossSection > 0.0)
291 #ifdef debug_G4Scatterer
292 G4cout <<
"be4 FinalState 1(p,e,m): "
303 if(!products || products->size() == 0)
return products;
305 #ifdef debug_G4Scatterer
312 #ifdef debug_G4Scatterer
313 G4cout <<
" FinalState 1: "
314 <<
final->Get4Momentum()<<
" "
315 <<
final->Get4Momentum().mag() ;
318 if(products->size() == 1)
return products;
319 final=products->operator[](1);
320 #ifdef debug_G4Scatterer
322 <<
final->Get4Momentum() <<
" "
323 <<
final->Get4Momentum().mag() <<
" " <<
G4endl;
326 final= products->operator[](0);
328 if(products->size()==2)
330 final=products->operator[](1);
331 pFinal +=
final->Get4Momentum();
334 #ifdef debug_G4Scatterer
335 if ( (pInitial-pFinal).mag() > 0.1*
MeV )
337 G4cout <<
"G4Scatterer: momentum imbalance, pInitial= " <<pInitial <<
" pFinal= " <<pFinal<<
G4endl;
342 for(
size_t hpw=0; hpw<products->size(); hpw++)
344 energyBalance-=products->operator[](hpw)->Get4Momentum().t();
345 pxBalance-=products->operator[](hpw)->Get4Momentum().vect().x();
346 pyBalance-=products->operator[](hpw)->Get4Momentum().vect().y();
347 pzBalance-=products->operator[](hpw)->Get4Momentum().vect().z();
348 chargeBalance-=
G4lrint(products->operator[](hpw)->GetDefinition()->GetPDGCharge());
349 baryonBalance-=products->operator[](hpw)->GetDefinition()->GetBaryonNumber();
351 if(getenv(
"ScattererEnergyBalanceCheck"))
352 std::cout <<
"DEBUGGING energy balance A: "
360 if(chargeBalance !=0 )
364 for(
size_t hpw=0; hpw<products->size(); hpw++)
366 G4cout << products->operator[](hpw)->GetDefinition()->GetParticleName()<<
G4endl;
369 "Problem in ChargeBalance");
386 for (i=0; i<collisions.size(); i++)
391 collisionInCharge = component;
404 return collisionInCharge;
418 return aCrossSection;
425 std::vector<G4KineticTrack *> & someCandidates,
428 theCollisions.clear();
429 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
430 for(; j != someCandidates.end(); ++j)
438 aTarget.push_back(*j);
439 theCollisions.push_back(
443 return theCollisions;
449 std::vector<G4KineticTrack *> & theTargets)
452 return Scatter(*aProjectile, target_reloc);