78 std::for_each(collisions.begin(), collisions.end(),
G4Delete());
93 if ( std::abs(mom1.
vect().
unit().
z() -1 ) < 1e-6 )
97 G4double velocity = mom1.
z()/mom1.
e() * c_light;
99 collisionTime=deltaz/velocity;
108 collisionTime = (
position * velocity) / velocity.
mag2();
109 position -= velocity * collisionTime;
115 if (collisionTime > 0)
117 static const G4double maxCrossSection = 500*millibarn;
118 if(0.7*pi*distance_fast>maxCrossSection)
return time;
128 mom1 = toCMSFrame * mom1;
129 mom2 = toCMSFrame * mom2;
134 (toCMSFrame * coordinate2).vect());
140 G4double distance = pos * pos - (pos*mom) * (pos*mom) / (mom.
mag2());
148 if(pi*distance>maxCrossSection)
return time;
151 static const G4double maxChargedCrossSection = 200*millibarn;
154 pi*distance>maxChargedCrossSection)
return time;
160 sqrtS>1.91*GeV && pi*distance>maxChargedCrossSection)
return time;
199 const G4VCollision* collision = FindCollision(trk1,trk2);
207 if ( totalCrossSection > 0 )
220 if (distance <= totalCrossSection / pi)
222 time = collisionTime;
297 const G4VCollision* collision = FindCollision(trk1,trk2);
301 if (aCrossSection > 0.0)
305 #ifdef debug_G4Scatterer
306 G4cout <<
"be4 FinalState 1(p,e,m): "
317 if(!products || products->size() == 0)
return products;
319 #ifdef debug_G4Scatterer
326 #ifdef debug_G4Scatterer
327 G4cout <<
" FinalState 1: "
328 <<
final->Get4Momentum()<<
" "
329 <<
final->Get4Momentum().mag() ;
332 if(products->size() == 1)
return products;
333 final=products->operator[](1);
334 #ifdef debug_G4Scatterer
336 <<
final->Get4Momentum() <<
" "
337 <<
final->Get4Momentum().mag() <<
" " <<
G4endl;
340 final= products->operator[](0);
342 if(products->size()==2)
344 final=products->operator[](1);
345 pFinal +=
final->Get4Momentum();
348 #ifdef debug_G4Scatterer
349 if ( (pInitial-pFinal).mag() > 0.1*MeV )
351 G4cout <<
"G4Scatterer: momentum imbalance, pInitial= " <<pInitial <<
" pFinal= " <<pFinal<<
G4endl;
356 for(
size_t hpw=0; hpw<products->size(); hpw++)
358 energyBalance-=products->operator[](hpw)->Get4Momentum().t();
359 pxBalance-=products->operator[](hpw)->Get4Momentum().vect().x();
360 pyBalance-=products->operator[](hpw)->Get4Momentum().vect().y();
361 pzBalance-=products->operator[](hpw)->Get4Momentum().vect().z();
362 chargeBalance-=
G4lrint(products->operator[](hpw)->GetDefinition()->GetPDGCharge());
363 baryonBalance-=products->operator[](hpw)->GetDefinition()->GetBaryonNumber();
365 if(std::getenv(
"ScattererEnergyBalanceCheck"))
366 std::cout <<
"DEBUGGING energy balance A: "
374 if(chargeBalance !=0 )
378 for(
size_t hpw=0; hpw<products->size(); hpw++)
380 G4cout << products->operator[](hpw)->GetDefinition()->GetParticleName()<<
G4endl;
383 "Problem in ChargeBalance");
400 for (i=0; i<collisions.size(); i++)
405 collisionInCharge = component;
418 return collisionInCharge;
426 const G4VCollision* collision = FindCollision(trk1,trk2);
432 return aCrossSection;
439 std::vector<G4KineticTrack *> & someCandidates,
442 theCollisions.clear();
443 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
444 for(; j != someCandidates.end(); ++j)
452 aTarget.push_back(*j);
453 theCollisions.push_back(
457 return theCollisions;
463 std::vector<G4KineticTrack *> & theTargets)
466 return Scatter(*aProjectile, target_reloc);
std::vector< G4VCollision * > G4CollisionVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetPosition() const
const G4ParticleDefinition * GetDefinition() const
const G4LorentzVector & GetTrackingMomentum() const
const G4LorentzVector & Get4Momentum() const
G4double GetActualMass() const
static G4Neutron * Neutron()
G4double GetPDGCharge() const
G4int GetBaryonNumber() const
const G4String & GetParticleName() const
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4KineticTrackVector * FinalState(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0