94 if ( std::abs(mom1.vect().unit().z() -1 ) < 1e-6 )
98 G4double velocity = mom1.z()/mom1.e() * c_light;
100 collisionTime=deltaz/velocity;
101 distance_fast=position.x()*position.x() + position.y()*position.y();
109 collisionTime = (position * velocity) / velocity.mag2();
110 position -= velocity * collisionTime;
111 distance_fast=position.mag2();
116 if (collisionTime > 0)
119 if(0.7*
pi*distance_fast>maxCrossSection)
return time;
129 mom1 = toCMSFrame * mom1;
130 mom2 = toCMSFrame * mom2;
135 (toCMSFrame * coordinate2).vect());
141 G4double distance = pos * pos - (pos*mom) * (pos*mom) / (mom.mag2());
149 if(
pi*distance>maxCrossSection)
return time;
155 pi*distance>maxChargedCrossSection)
return time;
161 sqrtS>1.91*
GeV &&
pi*distance>maxChargedCrossSection)
return time;
208 if ( totalCrossSection > 0 )
221 if (distance <= totalCrossSection /
pi)
223 time = collisionTime;
289 G4double energyBalance = pInitial.t();
290 G4double pxBalance = pInitial.vect().x();
291 G4double pyBalance = pInitial.vect().y();
292 G4double pzBalance = pInitial.vect().z();
302 if (aCrossSection > 0.0)
306 #ifdef debug_G4Scatterer
307 G4cout <<
"be4 FinalState 1(p,e,m): "
318 if(!products || products->size() == 0)
return products;
320 #ifdef debug_G4Scatterer
327 #ifdef debug_G4Scatterer
328 G4cout <<
" FinalState 1: "
329 <<
final->Get4Momentum()<<
" "
330 <<
final->Get4Momentum().mag() ;
333 if(products->size() == 1)
return products;
334 final=products->operator[](1);
335 #ifdef debug_G4Scatterer
337 <<
final->Get4Momentum() <<
" "
338 <<
final->Get4Momentum().mag() <<
" " <<
G4endl;
341 final= products->operator[](0);
343 if(products->size()==2)
345 final=products->operator[](1);
346 pFinal +=
final->Get4Momentum();
349 #ifdef debug_G4Scatterer
350 if ( (pInitial-pFinal).mag() > 0.1*
MeV )
352 G4cout <<
"G4Scatterer: momentum imbalance, pInitial= " <<pInitial <<
" pFinal= " <<pFinal<<
G4endl;
354 G4cout <<
"Scatterer costh= " << trk1.
Get4Momentum().vect().unit() *(products->operator[](0))->Get4Momentum().vect().unit()<<
G4endl;
357 for(
size_t hpw=0; hpw<products->size(); hpw++)
359 energyBalance-=products->operator[](hpw)->Get4Momentum().t();
360 pxBalance-=products->operator[](hpw)->Get4Momentum().vect().x();
361 pyBalance-=products->operator[](hpw)->Get4Momentum().vect().y();
362 pzBalance-=products->operator[](hpw)->Get4Momentum().vect().z();
363 chargeBalance-=
G4lrint(products->operator[](hpw)->GetDefinition()->GetPDGCharge());
364 baryonBalance-=products->operator[](hpw)->GetDefinition()->GetBaryonNumber();
366 if(getenv(
"ScattererEnergyBalanceCheck"))
367 std::cout <<
"DEBUGGING energy balance A: "
375 if(chargeBalance !=0 )
379 for(
size_t hpw=0; hpw<products->size(); hpw++)
381 G4cout << products->operator[](hpw)->GetDefinition()->GetParticleName()<<
G4endl;
384 "Problem in ChargeBalance");
406 collisionInCharge = component;
419 return collisionInCharge;
433 return aCrossSection;
440 std::vector<G4KineticTrack *> & someCandidates,
444 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
445 for(; j != someCandidates.end(); ++j)
453 aTarget.push_back(*j);
464 std::vector<G4KineticTrack *> & theTargets)
467 return Scatter(*aProjectile, target_reloc);
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepLorentzRotation G4LorentzRotation
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
const G4ThreeVector & GetPosition() const
static G4CollisionVector collisions
G4double GetActualMass() const
#define G4MUTEX_INITIALIZER
const G4String & GetParticleName() const
std::vector< G4CollisionInitialState * > theCollisions
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
G4GLOB_DLL std::ostream G4cout
typedef GROUP2(G4CollisionNN, G4CollisionMesonBaryon) theChannels
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
std::vector< G4VCollision * > G4CollisionVector
static G4Neutron * Neutron()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
const G4VCollision * FindCollision(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
const G4LorentzVector & GetTrackingMomentum() const
static const double millibarn
virtual G4KineticTrackVector * FinalState(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
G4double GetPDGCharge() const
const G4LorentzVector & Get4Momentum() const
const G4ParticleDefinition * GetDefinition() const
static const G4double pos
G4int GetBaryonNumber() const
CLHEP::HepLorentzVector G4LorentzVector