74 finalBaryon(0), initialCharge(0), finalCharge(0), initialStrange(0),
81 absoluteLimit(absolute), initialBaryon(0), finalBaryon(0),
82 initialCharge(0), finalCharge(0), initialStrange(0),
92 G4cout <<
" >>> G4CascadeCheckBalance(" <<
theName <<
")::collide"
113 ((pbullet ? pbullet->
baryon() : nbullet ? nbullet->
getA() : 0) +
114 (ptarget ? ptarget->
baryon() : ntarget ? ntarget->
getA() : 0) );
123 std::vector<G4InuclElementaryParticle>& outParts =
127 elMass += outParts[i].getDefinition()->GetPDGMass();
133 initialCharge -= nelec;
144 G4cout <<
" initial px " << initial.
px() <<
" py " << initial.
py()
145 <<
" pz " << initial.
pz() <<
" E " << initial.
e()
146 <<
" baryon " << initialBaryon <<
" charge " << initialCharge
147 <<
" strange " << initialStrange <<
G4endl
148 <<
" final px " <<
final.px() <<
" py " <<
final.py()
149 <<
" pz " <<
final.pz() <<
" E " <<
final.e()
150 <<
" baryon " << finalBaryon <<
" charge " << finalCharge
151 <<
" strange " << finalStrange <<
G4endl;
159 G4cout <<
" >>> G4CascadeCheckBalance(" <<
theName <<
")::collide(<FRAG>)"
173 std::vector<G4InuclElementaryParticle>& outParts =
178 elMass += outParts[i].getDefinition()->GetPDGMass();
184 initialCharge -= nelec;
193 G4cout <<
" initial px " << initial.
px() <<
" py " << initial.
py()
194 <<
" pz " << initial.
pz() <<
" E " << initial.
e()
195 <<
" baryon " << initialBaryon <<
" charge " << initialCharge
196 <<
" strange " << initialStrange <<
G4endl
197 <<
" final px " <<
final.px() <<
" py " <<
final.py()
198 <<
" pz " <<
final.pz() <<
" E " <<
final.e()
199 <<
" baryon " << finalBaryon <<
" charge " << finalCharge
200 <<
" strange " << finalStrange <<
G4endl;
209 const std::vector<G4InuclElementaryParticle>& particles) {
211 G4cout <<
" >>> G4CascadeCheckBalance(" <<
theName <<
")::collide(<vector>)"
216 collide(bullet, target, tempOutput);
220 const std::vector<G4InuclElementaryParticle>& particles) {
223 <<
")::collide(<FRAG>,<vector>)" <<
G4endl;
233 const std::vector<G4InuclNuclei>& fragments) {
235 G4cout <<
" >>> G4CascadeCheckBalance(" <<
theName <<
")::collide(<vector>)"
247 const std::vector<G4CascadParticle>& particles) {
250 <<
")::collide(<cparticles>)" <<
G4endl;
254 collide(bullet, target, tempOutput);
262 const std::vector<G4CascadParticle>& cparticles) {
265 <<
")::collide(<EP>,<CP>)" <<
G4endl;
268 tempOutput.
add(output);
270 collide(bullet, target, tempOutput);
281 << (relokay ?
" conserved" :
" VIOLATED")
282 <<
" absolute " <<
deltaE()
283 << (absokay ?
" conserved" :
" VIOLATED") <<
G4endl;
286 <<
" conserved absolute " <<
deltaE() <<
" conserved" <<
G4endl;
289 return (relokay && absokay);
299 <<
relativeKE() << (relokay ?
" conserved" :
" VIOLATED")
301 << (absokay ?
" conserved" :
" VIOLATED") <<
G4endl;
305 <<
" conserved" <<
G4endl;
308 return (relokay && absokay);
314 G4bool absokay = (std::abs(
deltaP()) < 10.*absoluteLimit);
318 << (relokay ?
" conserved" :
" VIOLATED")
319 <<
" absolute " <<
deltaP()
320 << (absokay ?
" conserved" :
" VIOLATED") <<
G4endl;
323 <<
" conserved absolute " <<
deltaP() <<
" conserved" <<
G4endl;
326 return (relokay && absokay);
CLHEP::HepLorentzVector G4LorentzVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4bool baryonOkay() const
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4bool momentumOkay() const
G4double relativeP() const
G4bool chargeOkay() const
G4bool strangeOkay() const
static const G4double tolerance
G4double relativeKE() const
G4CascadeCheckBalance(const G4String &owner="G4CascadeCheckBalance")
G4double relativeE() const
G4bool energyOkay() const
G4int numberOfOutgoingParticles() const
G4int getTotalStrangeness() const
G4LorentzVector getTotalOutputMomentum() const
G4int getTotalBaryonNumber() const
G4int getTotalCharge() const
const std::vector< G4InuclElementaryParticle > & getOutgoingParticles() const
void add(const G4CollisionOutput &right)
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
static G4Electron * Electron()
const G4LorentzVector & GetMomentum() const
G4int getStrangeness() const
G4LorentzVector getMomentum() const
G4double getCharge() const