79 std::for_each(collisions.begin(), collisions.end(),
G4Delete());
94 if ( std::abs(mom1.
vect().
unit().
z() -1 ) < 1e-6 )
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;
200 const G4VCollision* collision = FindCollision(trk1,trk2);
208 if ( totalCrossSection > 0 )
221 if (distance <= totalCrossSection /
pi)
223 time = collisionTime;
298 const G4VCollision* collision = FindCollision(trk1,trk2);
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;
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");
401 for (i=0; i<collisions.size(); i++)
406 collisionInCharge = component;
419 return collisionInCharge;
427 const G4VCollision* collision = FindCollision(trk1,trk2);
433 return aCrossSection;
440 std::vector<G4KineticTrack *> & someCandidates,
443 theCollisions.clear();
444 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
445 for(; j != someCandidates.end(); ++j)
453 aTarget.push_back(*j);
454 theCollisions.push_back(
458 return theCollisions;
464 std::vector<G4KineticTrack *> & theTargets)
467 return Scatter(*aProjectile, target_reloc);
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
const G4ThreeVector & GetPosition() const
G4double GetActualMass() const
#define G4MUTEX_INITIALIZER
const G4String & GetParticleName() const
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
G4GLOB_DLL std::ostream G4cout
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 G4LorentzVector & GetTrackingMomentum() const
static constexpr double GeV
virtual G4KineticTrackVector * FinalState(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
static constexpr double MeV
static constexpr double pi
virtual G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
G4double GetPDGCharge() const
const G4LorentzVector & Get4Momentum() const
const G4ParticleDefinition * GetDefinition() const
static const G4double pos
static constexpr double millibarn
G4int GetBaryonNumber() const