Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ReactionProduct.cc File Reference

Go to the source code of this file.

Functions

G4ReactionProduct operator+ (const G4ReactionProduct &p1, const G4ReactionProduct &p2)
 
G4ReactionProduct operator- (const G4ReactionProduct &p1, const G4ReactionProduct &p2)
 

Variables

G4Allocator< G4ReactionProductaRPAllocator
 

Function Documentation

◆ operator+()

Definition at line 236 of file G4ReactionProduct.cc.

238 {
239 G4double totEnergy = p1.totalEnergy + p2.totalEnergy;
240 G4double x = p1.momentum.x() + p2.momentum.x();
241 G4double y = p1.momentum.y() + p2.momentum.y();
242 G4double z = p1.momentum.z() + p2.momentum.z();
243 G4double newMass = totEnergy*totEnergy - ( x*x + y*y + z*z );
244 if( newMass < 0.0 )
245 newMass = -1. * std::sqrt( -newMass );
246 else
247 newMass = std::sqrt( newMass );
248 G4ReactionProduct result;
249 result.SetMass( newMass );
250 result.SetMomentum( x, y, z );
251 result.SetTotalEnergy( totEnergy );
252 result.SetPositionInNucleus( 0.0, 0.0, 0.0 );
253 result.SetFormationTime(0.0);
254 result.HasInitialStateParton(false);
255 return result;
256 }
double G4double
Definition: G4Types.hh:64
double z() const
double x() const
double y() const
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
void HasInitialStateParton(G4bool aFlag)
void SetPositionInNucleus(G4double x, G4double y, G4double z)
void SetFormationTime(G4double aTime)
void SetMass(const G4double mas)

◆ operator-()

Definition at line 258 of file G4ReactionProduct.cc.

260 {
261 G4double totEnergy = p1.totalEnergy - p2.totalEnergy;
262 G4double x = p1.momentum.x() - p2.momentum.x();
263 G4double y = p1.momentum.y() - p2.momentum.y();
264 G4double z = p1.momentum.z() - p2.momentum.z();
265 G4double newMass = totEnergy*totEnergy - ( x*x + y*y + z*z );
266 if( newMass < 0.0 )
267 newMass = -1. * std::sqrt( -newMass );
268 else
269 newMass = std::sqrt( newMass );
270 G4ReactionProduct result;
271 result.SetMass( newMass );
272 result.SetMomentum( x, y, z );
273 result.SetTotalEnergy( totEnergy );
274 result.SetPositionInNucleus( 0.0, 0.0, 0.0 );
275 result.SetFormationTime(0.0);
276 result.HasInitialStateParton(false);
277 return result;
278 }

Variable Documentation

◆ aRPAllocator