79 if ( std::abs(mom1.vect().unit().z() -1 ) < 1e-6 )
83 G4double velocity = mom1.z()/mom1.e() * c_light;
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;
274 G4double energyBalance = pInitial.t();
275 G4double pxBalance = pInitial.vect().x();
276 G4double pyBalance = pInitial.vect().y();
277 G4double pzBalance = pInitial.vect().z();
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;
339 G4cout <<
"Scatterer costh= " << trk1.
Get4Momentum().vect().unit() *(products->operator[](0))->Get4Momentum().vect().unit()<<
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");
391 collisionInCharge = component;
404 return collisionInCharge;
418 return aCrossSection;
425 std::vector<G4KineticTrack *> & someCandidates,
429 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
430 for(; j != someCandidates.end(); ++j)
438 aTarget.push_back(*j);
449 std::vector<G4KineticTrack *> & theTargets)
452 return Scatter(*aProjectile, target_reloc);
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepLorentzRotation G4LorentzRotation
const G4ThreeVector & GetPosition() const
G4VCollision * FindCollision(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
G4CollisionVector collisions
G4double GetActualMass() const
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
const G4String & GetParticleName() const
std::vector< G4CollisionInitialState * > theCollisions
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
G4ParticleDefinition * GetDefinition() const
G4GLOB_DLL std::ostream G4cout
typedef GROUP2(G4CollisionNN, G4CollisionMesonBaryon) theChannels
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
static G4Neutron * Neutron()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4LorentzVector & GetTrackingMomentum() const
static const double millibarn
virtual G4KineticTrackVector * FinalState(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
virtual G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
G4double GetPDGCharge() const
const G4LorentzVector & Get4Momentum() const
static const G4double pos
G4int GetBaryonNumber() const
CLHEP::HepLorentzVector G4LorentzVector