94 if ( std::abs(mom1.
vect().
unit().
z() -1 ) < 1
e-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;
208 if ( totalCrossSection > 0 )
221 if (distance <= totalCrossSection /
pi)
223 time = collisionTime;
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");
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 G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
std::vector< G4VCollision * > G4CollisionVector
virtual G4double CrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
const G4LorentzVector & Get4Momentum() const
static const G4double pos
static constexpr double MeV
std::vector< G4CollisionInitialState * > theCollisions
const G4LorentzVector & GetTrackingMomentum() const
const G4String & GetParticleName() const
const G4ParticleDefinition * GetDefinition() const
G4double GetPDGCharge() const
static G4CollisionVector collisions
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
#define G4MUTEX_INITIALIZER
static constexpr double millibarn
G4int GetBaryonNumber() const
G4double GetActualMass() const
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static constexpr double c_light
static G4Neutron * Neutron()
G4GLOB_DLL std::ostream G4cout
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const
static constexpr double pi
const G4ThreeVector & GetPosition() const
virtual G4KineticTrackVector * FinalState(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
virtual G4bool IsInCharge(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const =0
static constexpr double GeV
const G4VCollision * FindCollision(const G4KineticTrack &trk1, const G4KineticTrack &trk2) const