62 std::for_each(collisions.begin(), collisions.end(),
G4Delete());
75 if ( std::abs(mom1.
vect().
unit().
z() -1 ) < 1e-6 )
79 G4double velocity = mom1.
z()/mom1.
e() * c_light;
81 collisionTime=deltaz/velocity;
91 position -= velocity * collisionTime;
97 if (collisionTime > 0)
99 static const G4double maxCrossSection = 500*millibarn;
100 if(0.7*pi*distance_fast>maxCrossSection)
return time;
110 mom1 = toCMSFrame * mom1;
111 mom2 = toCMSFrame * mom2;
116 (toCMSFrame * coordinate2).vect());
122 G4double distance = pos * pos - (pos*mom) * (pos*mom) / (mom.
mag2());
130 if(pi*distance>maxCrossSection)
return time;
133 static const G4double maxChargedCrossSection = 200*millibarn;
136 pi*distance>maxChargedCrossSection)
return time;
142 sqrtS>1.91*GeV && pi*distance>maxChargedCrossSection)
return time;
189 if ( totalCrossSection > 0 )
202 if (distance <= totalCrossSection / pi)
204 time = collisionTime;
281 if (aCrossSection > 0.0)
285 #ifdef debug_G4Scatterer
286 G4cout <<
"be4 FinalState 1(p,e,m): "
297 if(!products || products->size() == 0)
return products;
299 #ifdef debug_G4Scatterer
306 #ifdef debug_G4Scatterer
307 G4cout <<
" FinalState 1: "
308 <<
final->Get4Momentum()<<
" "
309 <<
final->Get4Momentum().mag() ;
312 if(products->size() == 1)
return products;
313 final=products->operator[](1);
314 #ifdef debug_G4Scatterer
316 <<
final->Get4Momentum() <<
" "
317 <<
final->Get4Momentum().mag() <<
" " <<
G4endl;
320 final= products->operator[](0);
322 if(products->size()==2)
324 final=products->operator[](1);
325 pFinal +=
final->Get4Momentum();
328 #ifdef debug_G4Scatterer
329 if ( (pInitial-pFinal).mag() > 0.1*MeV )
331 G4cout <<
"G4Scatterer: momentum imbalance, pInitial= " <<pInitial <<
" pFinal= " <<pFinal<<
G4endl;
336 for(
size_t hpw=0; hpw<products->size(); hpw++)
338 energyBalance-=products->operator[](hpw)->Get4Momentum().t();
339 pxBalance-=products->operator[](hpw)->Get4Momentum().vect().x();
340 pyBalance-=products->operator[](hpw)->Get4Momentum().vect().y();
341 pzBalance-=products->operator[](hpw)->Get4Momentum().vect().z();
342 chargeBalance-=
G4lrint(products->operator[](hpw)->GetDefinition()->GetPDGCharge());
343 baryonBalance-=products->operator[](hpw)->GetDefinition()->GetBaryonNumber();
345 if(getenv(
"ScattererEnergyBalanceCheck"))
346 std::cout <<
"DEBUGGING energy balance A: "
354 if(chargeBalance !=0 )
358 for(
size_t hpw=0; hpw<products->size(); hpw++)
360 G4cout << products->operator[](hpw)->GetDefinition()->GetParticleName()<<
G4endl;
363 "Problem in ChargeBalance");
379 for (i=0; i<collisions.size(); i++)
384 collisionInCharge = component;
397 return collisionInCharge;
409 return aCrossSection;
415 std::vector<G4KineticTrack *> & someCandidates,
418 theCollisions.clear();
419 std::vector<G4KineticTrack *>::iterator j=someCandidates.begin();
420 for(; j != someCandidates.end(); ++j)
428 aTarget.push_back(*j);
429 theCollisions.push_back(
433 return theCollisions;
439 std::vector<G4KineticTrack *> & theTargets)
442 return Scatter(*aProjectile, target_reloc);
G4DLLIMPORT std::ostream G4cout
const G4ThreeVector & GetPosition() 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
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &someCandidates, G4double aCurrentTime)
virtual G4double GetTimeToInteraction(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
virtual G4KineticTrackVector * GetFinalState(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &theTargets)
G4double GetCrossSection(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)