Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Protected Member Functions
G4CascadeCheckBalance Class Reference

#include <G4CascadeCheckBalance.hh>

Inheritance diagram for G4CascadeCheckBalance:
G4VCascadeCollider

Public Member Functions

 G4CascadeCheckBalance (const char *owner="G4CascadeCheckBalance")
 
 G4CascadeCheckBalance (G4double relative, G4double absolute, const char *owner="G4CascadeCheckBalance")
 
virtual ~G4CascadeCheckBalance ()
 
void setOwner (const char *owner)
 
void setLimits (G4double relative, G4double absolute)
 
void setRelativeLimit (G4double limit)
 
void setAbsoluteLimit (G4double limit)
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
 
void collide (const G4Fragment &fragment, G4CollisionOutput &output)
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4InuclElementaryParticle > &particles)
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, const std::vector< G4CascadParticle > &particles)
 
void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output, const std::vector< G4CascadParticle > &cparticles)
 
void collide (const G4Fragment &target, const std::vector< G4InuclElementaryParticle > &particles)
 
void collide (const G4Fragment &target, const std::vector< G4InuclNuclei > &fragments)
 
G4bool energyOkay () const
 
G4bool ekinOkay () const
 
G4bool momentumOkay () const
 
G4bool baryonOkay () const
 
G4bool chargeOkay () const
 
G4bool strangeOkay () const
 
G4bool okay () const
 
G4double deltaE () const
 
G4double relativeE () const
 
G4double deltaKE () const
 
G4double relativeKE () const
 
G4double deltaP () const
 
G4double relativeP () const
 
G4LorentzVector deltaLV () const
 
G4int deltaB () const
 
G4int deltaQ () const
 
G4int deltaS () const
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const char *name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 
virtual void setVerboseLevel (G4int verbose=0)
 

Static Public Attributes

static const G4double tolerance = 1e-6
 

Protected Member Functions

G4double ekin (const G4LorentzVector &p) const
 
- Protected Member Functions inherited from G4VCascadeCollider
virtual void setName (const char *name)
 

Additional Inherited Members

- Protected Attributes inherited from G4VCascadeCollider
const char * theName
 
G4int verboseLevel
 

Detailed Description

Definition at line 64 of file G4CascadeCheckBalance.hh.

Constructor & Destructor Documentation

G4CascadeCheckBalance::G4CascadeCheckBalance ( const char *  owner = "G4CascadeCheckBalance")
explicit

Definition at line 68 of file G4CascadeCheckBalance.cc.

70  absoluteLimit(G4CascadeCheckBalance::tolerance), initialBaryon(0),
71  finalBaryon(0), initialCharge(0), finalCharge(0), initialStrange(0),
72  finalStrange(0) {}
static const G4double tolerance
G4VCascadeCollider(const char *name, G4int verbose=0)
G4CascadeCheckBalance::G4CascadeCheckBalance ( G4double  relative,
G4double  absolute,
const char *  owner = "G4CascadeCheckBalance" 
)

Definition at line 74 of file G4CascadeCheckBalance.cc.

77  : G4VCascadeCollider(owner), relativeLimit(relative),
78  absoluteLimit(absolute), initialBaryon(0), finalBaryon(0),
79  initialCharge(0), finalCharge(0), initialStrange(0),
80  finalStrange(0) {}
G4VCascadeCollider(const char *name, G4int verbose=0)
virtual G4CascadeCheckBalance::~G4CascadeCheckBalance ( )
inlinevirtual

Definition at line 72 of file G4CascadeCheckBalance.hh.

72 {};

Member Function Documentation

G4bool G4CascadeCheckBalance::baryonOkay ( ) const

Definition at line 296 of file G4CascadeCheckBalance.cc.

References deltaB(), G4cerr, G4endl, G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

Referenced by G4CascadeInterface::checkFinalResult(), okay(), and G4CascadeInterface::throwNonConservationFailure().

296  {
297  G4bool bokay = (deltaB() == 0); // Must be perfect!
298 
299  if (verboseLevel && !bokay)
300  G4cerr << theName << ": Baryon number VIOLATED " << deltaB() << G4endl;
301 
302  return bokay;
303 }
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4bool G4CascadeCheckBalance::chargeOkay ( ) const

Definition at line 305 of file G4CascadeCheckBalance.cc.

References deltaQ(), G4cerr, G4endl, G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

Referenced by G4CascadeInterface::checkFinalResult(), okay(), and G4CascadeInterface::throwNonConservationFailure().

305  {
306  G4bool qokay = (deltaQ() == 0); // Must be perfect!
307 
308  if (verboseLevel && !qokay)
309  G4cerr << theName << ": Charge conservation VIOLATED " << deltaQ()
310  << G4endl;
311 
312  return qokay;
313 }
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4CascadeCheckBalance::collide ( G4InuclParticle bullet,
G4InuclParticle target,
G4CollisionOutput output 
)
virtual

Implements G4VCascadeCollider.

Definition at line 85 of file G4CascadeCheckBalance.cc.

References G4InuclElementaryParticle::baryon(), CLHEP::HepLorentzVector::e(), G4cout, G4endl, G4InuclNuclei::getA(), G4InuclParticle::getCharge(), G4InuclParticle::getMomentum(), G4InuclElementaryParticle::getStrangeness(), G4CollisionOutput::getTotalBaryonNumber(), G4CollisionOutput::getTotalCharge(), G4CollisionOutput::getTotalOutputMomentum(), G4CollisionOutput::getTotalStrangeness(), CLHEP::HepLorentzVector::px(), CLHEP::HepLorentzVector::py(), CLHEP::HepLorentzVector::pz(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

Referenced by G4CascadeInterface::ApplyYourself(), G4CascadeInterface::checkFinalResult(), G4CascadeRecoilMaker::collide(), collide(), G4NucleiModel::generateParticleFate(), G4CascadeInterface::Propagate(), G4CascadeDeexciteBase::validateOutput(), and G4CascadeColliderBase::validateOutput().

87  {
88  if (verboseLevel)
89  G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide"
90  << G4endl;
91 
92  initial *= 0.; // Fast reset; some colliders only have one pointer
93  if (bullet) initial += bullet->getMomentum();
94  if (target) initial += target->getMomentum();
95 
96  // Baryon number, charge and strangeness must be computed "by hand"
97  initialCharge = 0;
98  if (bullet) initialCharge += G4int(bullet->getCharge());
99  if (target) initialCharge += G4int(target->getCharge());
100 
101  G4InuclElementaryParticle* pbullet =
102  dynamic_cast<G4InuclElementaryParticle*>(bullet);
103  G4InuclElementaryParticle* ptarget =
104  dynamic_cast<G4InuclElementaryParticle*>(target);
105 
106  G4InuclNuclei* nbullet = dynamic_cast<G4InuclNuclei*>(bullet);
107  G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
108 
109  initialBaryon =
110  ((pbullet ? pbullet->baryon() : nbullet ? nbullet->getA() : 0) +
111  (ptarget ? ptarget->baryon() : ntarget ? ntarget->getA() : 0) );
112 
113  // NOTE: Currently we ignore possibility of hypernucleus target
114  initialStrange = 0;
115  if (pbullet) initialStrange += pbullet->getStrangeness();
116  if (ptarget) initialStrange += ptarget->getStrangeness();
117 
118  // Final state totals are computed for us
119  final = output.getTotalOutputMomentum();
120  finalBaryon = output.getTotalBaryonNumber();
121  finalCharge = output.getTotalCharge();
122  finalStrange = output.getTotalStrangeness();
123 
124  // Report results
125  if (verboseLevel) {
126  G4cout << " initial px " << initial.px() << " py " << initial.py()
127  << " pz " << initial.pz() << " E " << initial.e()
128  << " baryon " << initialBaryon << " charge " << initialCharge
129  << " strange " << initialStrange << G4endl
130  << " final px " << final.px() << " py " << final.py()
131  << " pz " << final.pz() << " E " << final.e()
132  << " baryon " << finalBaryon << " charge " << finalCharge
133  << " strange " << finalStrange << G4endl;
134  }
135 }
G4LorentzVector getMomentum() const
const XML_Char * target
int G4int
Definition: G4Types.hh:78
G4LorentzVector getTotalOutputMomentum() const
G4GLOB_DLL std::ostream G4cout
G4int getA() const
double py() const
G4int getTotalStrangeness() const
double px() const
G4int getTotalBaryonNumber() const
G4int getTotalCharge() const
G4double getCharge() const
double pz() const
#define G4endl
Definition: G4ios.hh:61
void G4CascadeCheckBalance::collide ( const G4Fragment fragment,
G4CollisionOutput output 
)

Definition at line 138 of file G4CascadeCheckBalance.cc.

References CLHEP::HepLorentzVector::e(), G4cout, G4endl, G4Fragment::GetA(), G4Fragment::GetMomentum(), G4CollisionOutput::getTotalBaryonNumber(), G4CollisionOutput::getTotalCharge(), G4CollisionOutput::getTotalOutputMomentum(), G4CollisionOutput::getTotalStrangeness(), G4Fragment::GetZ(), CLHEP::HepLorentzVector::px(), CLHEP::HepLorentzVector::py(), CLHEP::HepLorentzVector::pz(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

139  {
140  if (verboseLevel)
141  G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide(<FRAG>)"
142  << G4endl;
143 
144  // Copy initial state directly from fragment (no bullet/target sums)
145  initial = fragment.GetMomentum();
146  initialCharge = G4int(fragment.GetZ());
147  initialBaryon = G4int(fragment.GetA());
148  initialStrange = 0; // No hypernuclei at present
149 
150  // Final state totals are computed for us
151  final = output.getTotalOutputMomentum();
152  finalBaryon = output.getTotalBaryonNumber();
153  finalCharge = output.getTotalCharge();
154  finalStrange = output.getTotalStrangeness();
155 
156  // Report results
157  if (verboseLevel) {
158  G4cout << " initial px " << initial.px() << " py " << initial.py()
159  << " pz " << initial.pz() << " E " << initial.e()
160  << " baryon " << initialBaryon << " charge " << initialCharge
161  << " strange " << initialStrange << G4endl
162  << " final px " << final.px() << " py " << final.py()
163  << " pz " << final.pz() << " E " << final.e()
164  << " baryon " << finalBaryon << " charge " << finalCharge
165  << " strange " << finalStrange << G4endl;
166  }
167 }
G4double GetA() const
Definition: G4Fragment.hh:303
int G4int
Definition: G4Types.hh:78
G4LorentzVector getTotalOutputMomentum() const
G4GLOB_DLL std::ostream G4cout
double py() const
G4int getTotalStrangeness() const
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:271
double px() const
G4int getTotalBaryonNumber() const
G4int getTotalCharge() const
double pz() const
#define G4endl
Definition: G4ios.hh:61
G4double GetZ() const
Definition: G4Fragment.hh:298
void G4CascadeCheckBalance::collide ( G4InuclParticle bullet,
G4InuclParticle target,
const std::vector< G4InuclElementaryParticle > &  particles 
)

Definition at line 172 of file G4CascadeCheckBalance.cc.

References G4CollisionOutput::addOutgoingParticles(), collide(), G4cout, G4endl, G4CollisionOutput::reset(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

174  {
175  if (verboseLevel)
176  G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide(<vector>)"
177  << G4endl;
178 
179  tempOutput.reset(); // Buffer for processing
180  tempOutput.addOutgoingParticles(particles);
181  collide(bullet, target, tempOutput);
182 }
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4GLOB_DLL std::ostream G4cout
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
#define G4endl
Definition: G4ios.hh:61
void G4CascadeCheckBalance::collide ( G4InuclParticle bullet,
G4InuclParticle target,
const std::vector< G4CascadParticle > &  particles 
)

Definition at line 212 of file G4CascadeCheckBalance.cc.

References G4CollisionOutput::addOutgoingParticles(), collide(), G4cout, G4endl, G4CollisionOutput::reset(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

214  {
215  if (verboseLevel)
216  G4cout << " >>> G4CascadeCheckBalance(" << theName
217  << ")::collide(<cparticles>)" << G4endl;
218 
219  tempOutput.reset(); // Buffer for processing
220  tempOutput.addOutgoingParticles(particles);
221  collide(bullet, target, tempOutput);
222 }
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4GLOB_DLL std::ostream G4cout
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
#define G4endl
Definition: G4ios.hh:61
void G4CascadeCheckBalance::collide ( G4InuclParticle bullet,
G4InuclParticle target,
G4CollisionOutput output,
const std::vector< G4CascadParticle > &  cparticles 
)

Definition at line 227 of file G4CascadeCheckBalance.cc.

References G4CollisionOutput::add(), G4CollisionOutput::addOutgoingParticles(), collide(), G4cout, G4endl, G4CollisionOutput::reset(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

230  {
231  if (verboseLevel)
232  G4cout << " >>> G4CascadeCheckBalance(" << theName
233  << ")::collide(<EP>,<CP>)" << G4endl;
234 
235  tempOutput.reset(); // Buffer for processing
236  tempOutput.add(output);
237  tempOutput.addOutgoingParticles(cparticles);
238  collide(bullet, target, tempOutput);
239 }
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
void add(const G4CollisionOutput &right)
G4GLOB_DLL std::ostream G4cout
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
#define G4endl
Definition: G4ios.hh:61
void G4CascadeCheckBalance::collide ( const G4Fragment target,
const std::vector< G4InuclElementaryParticle > &  particles 
)

Definition at line 184 of file G4CascadeCheckBalance.cc.

References G4CollisionOutput::addOutgoingParticles(), collide(), G4cout, G4endl, G4CollisionOutput::reset(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

185  {
186  if (verboseLevel)
187  G4cout << " >>> G4CascadeCheckBalance(" << theName
188  << ")::collide(<FRAG>,<vector>)" << G4endl;
189 
190  tempOutput.reset(); // Buffer for processing
191  tempOutput.addOutgoingParticles(particles);
192  collide(target, tempOutput);
193 }
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4GLOB_DLL std::ostream G4cout
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
#define G4endl
Definition: G4ios.hh:61
void G4CascadeCheckBalance::collide ( const G4Fragment target,
const std::vector< G4InuclNuclei > &  fragments 
)

Definition at line 198 of file G4CascadeCheckBalance.cc.

References G4CollisionOutput::addOutgoingNuclei(), collide(), G4cout, G4endl, G4CollisionOutput::reset(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

199  {
200  if (verboseLevel)
201  G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide(<vector>)"
202  << G4endl;
203 
204  tempOutput.reset(); // Buffer for processing
205  tempOutput.addOutgoingNuclei(fragments);
206  collide(target, tempOutput);
207 }
void addOutgoingNuclei(const std::vector< G4InuclNuclei > &nuclea)
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int G4CascadeCheckBalance::deltaB ( ) const
inline
G4double G4CascadeCheckBalance::deltaE ( ) const
inline

Definition at line 126 of file G4CascadeCheckBalance.hh.

References CLHEP::HepLorentzVector::e().

Referenced by G4CascadeInterface::checkFinalResult(), energyOkay(), relativeE(), and G4CascadeInterface::throwNonConservationFailure().

126 { return (final.e() - initial.e()); }
G4double G4CascadeCheckBalance::deltaKE ( ) const
inline

Definition at line 132 of file G4CascadeCheckBalance.hh.

References ekin().

Referenced by G4CascadeInterface::checkFinalResult(), ekinOkay(), and relativeKE().

132 { return (ekin(final) - ekin(initial)); }
G4double ekin(const G4LorentzVector &p) const
G4LorentzVector G4CascadeCheckBalance::deltaLV ( ) const
inline

Definition at line 144 of file G4CascadeCheckBalance.hh.

Referenced by deltaP(), and G4CascadeRecoilMaker::fillRecoil().

144 { return final - initial; }
G4double G4CascadeCheckBalance::deltaP ( ) const
inline

Definition at line 138 of file G4CascadeCheckBalance.hh.

References deltaLV(), and CLHEP::HepLorentzVector::rho().

Referenced by momentumOkay(), relativeP(), and G4CascadeInterface::throwNonConservationFailure().

138 { return deltaLV().rho(); }
G4LorentzVector deltaLV() const
double rho() const
G4int G4CascadeCheckBalance::deltaQ ( ) const
inline
G4int G4CascadeCheckBalance::deltaS ( ) const
inline

Definition at line 149 of file G4CascadeCheckBalance.hh.

Referenced by strangeOkay().

149 { return (finalStrange- initialStrange); }
G4double G4CascadeCheckBalance::ekin ( const G4LorentzVector p) const
inlineprotected

Definition at line 153 of file G4CascadeCheckBalance.hh.

References CLHEP::HepLorentzVector::e(), and CLHEP::HepLorentzVector::m().

Referenced by deltaKE(), dsihae(), elhain(), relativeKE(), scn4ba(), sihnab(), and tsamcs().

153 { return (p.e() - p.m()); }
G4bool G4CascadeCheckBalance::ekinOkay ( ) const

Definition at line 261 of file G4CascadeCheckBalance.cc.

References deltaKE(), G4cerr, G4cout, G4endl, relativeKE(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

261  {
262  G4bool relokay = (std::abs(relativeKE()) < relativeLimit);
263  G4bool absokay = (std::abs(deltaKE()) < absoluteLimit);
264 
265  if (verboseLevel && !(relokay || absokay)) {
266  G4cerr << theName << ": Kinetic energy balance: relative "
267  << relativeKE() << (relokay ? " conserved" : " VIOLATED")
268  << " absolute " << deltaKE()
269  << (absokay ? " conserved" : " VIOLATED") << G4endl;
270  } else if (verboseLevel > 1) {
271  G4cout << theName << ": Kinetic energy balance: relative "
272  << relativeKE() << " conserved absolute " << deltaKE()
273  << " conserved" << G4endl;
274  }
275 
276  return (relokay && absokay);
277 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4bool G4CascadeCheckBalance::energyOkay ( ) const

Definition at line 244 of file G4CascadeCheckBalance.cc.

References deltaE(), G4cerr, G4cout, G4endl, relativeE(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

Referenced by okay(), and G4CascadeInterface::throwNonConservationFailure().

244  {
245  G4bool relokay = (std::abs(relativeE()) < relativeLimit);
246  G4bool absokay = (std::abs(deltaE()) < absoluteLimit);
247 
248  if (verboseLevel && !(relokay || absokay)) {
249  G4cerr << theName << ": Energy conservation: relative " << relativeE()
250  << (relokay ? " conserved" : " VIOLATED")
251  << " absolute " << deltaE()
252  << (absokay ? " conserved" : " VIOLATED") << G4endl;
253  } else if (verboseLevel > 1) {
254  G4cout << theName << ": Energy conservation: relative " << relativeE()
255  << " conserved absolute " << deltaE() << " conserved" << G4endl;
256  }
257 
258  return (relokay && absokay);
259 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4bool G4CascadeCheckBalance::momentumOkay ( ) const

Definition at line 279 of file G4CascadeCheckBalance.cc.

References deltaP(), G4cerr, G4cout, G4endl, relativeP(), G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

Referenced by okay(), and G4CascadeInterface::throwNonConservationFailure().

279  {
280  G4bool relokay = (std::abs(relativeP()) < relativeLimit);
281  G4bool absokay = (std::abs(deltaP()) < absoluteLimit);
282 
283  if (verboseLevel && !(relokay || absokay)) {
284  G4cerr << theName << ": Momentum conservation: relative " << relativeP()
285  << (relokay ? " conserved" : " VIOLATED")
286  << " absolute " << deltaP()
287  << (absokay ? " conserved" : " VIOLATED") << G4endl;
288  } else if (verboseLevel > 1) {
289  G4cout << theName << ": Momentum conservation: relative " << relativeP()
290  << " conserved absolute " << deltaP() << " conserved" << G4endl;
291  }
292 
293  return (relokay && absokay);
294 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4bool G4CascadeCheckBalance::okay ( ) const
inline
G4double G4CascadeCheckBalance::relativeE ( ) const
inline

Definition at line 127 of file G4CascadeCheckBalance.hh.

References deltaE(), CLHEP::HepLorentzVector::e(), and tolerance.

Referenced by energyOkay(), and G4CascadeInterface::throwNonConservationFailure().

127  {
128  return ( (std::abs(deltaE())<tolerance) ? 0. :
129  (initial.e()<tolerance) ? 1. : deltaE()/initial.e() );
130  }
static const G4double tolerance
G4double G4CascadeCheckBalance::relativeKE ( ) const
inline

Definition at line 133 of file G4CascadeCheckBalance.hh.

References deltaKE(), ekin(), and tolerance.

Referenced by ekinOkay().

133  {
134  return ( (std::abs(deltaKE())<tolerance) ? 0. :
135  (ekin(initial)<tolerance) ? 1. : deltaKE()/ekin(initial) );
136  }
G4double ekin(const G4LorentzVector &p) const
static const G4double tolerance
G4double G4CascadeCheckBalance::relativeP ( ) const
inline

Definition at line 139 of file G4CascadeCheckBalance.hh.

References deltaP(), CLHEP::HepLorentzVector::rho(), and tolerance.

Referenced by momentumOkay(), and G4CascadeInterface::throwNonConservationFailure().

139  {
140  return ( (std::abs(deltaP())<tolerance) ? 0. :
141  (initial.rho()<tolerance) ? 1. : deltaP()/initial.rho() );
142  }
static const G4double tolerance
double rho() const
void G4CascadeCheckBalance::setAbsoluteLimit ( G4double  limit)
inline

Definition at line 82 of file G4CascadeCheckBalance.hh.

Referenced by setLimits().

82 { absoluteLimit = limit; }
void G4CascadeCheckBalance::setLimits ( G4double  relative,
G4double  absolute 
)
inline

Definition at line 76 of file G4CascadeCheckBalance.hh.

References setAbsoluteLimit(), and setRelativeLimit().

Referenced by G4CascadeInterface::G4CascadeInterface().

76  {
77  setRelativeLimit(relative);
78  setAbsoluteLimit(absolute);
79  }
void setAbsoluteLimit(G4double limit)
void setRelativeLimit(G4double limit)
void G4CascadeCheckBalance::setOwner ( const char *  owner)
inline

Definition at line 74 of file G4CascadeCheckBalance.hh.

References G4VCascadeCollider::setName().

74 { setName(owner); }
virtual void setName(const char *name)
void G4CascadeCheckBalance::setRelativeLimit ( G4double  limit)
inline

Definition at line 81 of file G4CascadeCheckBalance.hh.

Referenced by setLimits().

81 { relativeLimit = limit; }
G4bool G4CascadeCheckBalance::strangeOkay ( ) const

Definition at line 315 of file G4CascadeCheckBalance.cc.

References deltaS(), G4cerr, G4endl, G4VCascadeCollider::theName, and G4VCascadeCollider::verboseLevel.

315  {
316  G4bool sokay = (deltaS() == 0); // Must be perfect!
317 
318  if (verboseLevel && !sokay)
319  G4cerr << theName << ": Strangeness conservation VIOLATED " << deltaS()
320  << G4endl;
321 
322  return sokay;
323 }
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Field Documentation

const G4double G4CascadeCheckBalance::tolerance = 1e-6
static

Definition at line 66 of file G4CascadeCheckBalance.hh.

Referenced by relativeE(), relativeKE(), and relativeP().


The documentation for this class was generated from the following files: