Geant4 11.2.2
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

G4Allocator< G4ReactionProduct > *& aRPAllocator ()
 
G4ReactionProduct operator+ (const G4ReactionProduct &p1, const G4ReactionProduct &p2)
 
G4ReactionProduct operator- (const G4ReactionProduct &p1, const G4ReactionProduct &p2)
 

Function Documentation

◆ aRPAllocator()

G4Allocator< G4ReactionProduct > *& aRPAllocator ( )

Definition at line 33 of file G4ReactionProduct.cc.

34{
36 return _instance;
37}
#define G4ThreadLocalStatic
Definition tls.hh:76

Referenced by G4ReactionProduct::operator delete(), and G4ReactionProduct::operator new().

◆ operator+()

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

Definition at line 259 of file G4ReactionProduct.cc.

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

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

Definition at line 281 of file G4ReactionProduct.cc.

283 {
284 G4double totEnergy = p1.totalEnergy - p2.totalEnergy;
285 G4double x = p1.momentum.x() - p2.momentum.x();
286 G4double y = p1.momentum.y() - p2.momentum.y();
287 G4double z = p1.momentum.z() - p2.momentum.z();
288 G4double newMass = totEnergy*totEnergy - ( x*x + y*y + z*z );
289 if( newMass < 0.0 )
290 newMass = -1. * std::sqrt( -newMass );
291 else
292 newMass = std::sqrt( newMass );
293 G4ReactionProduct result;
294 result.SetMass( newMass );
295 result.SetMomentum( x, y, z );
296 result.SetTotalEnergy( totEnergy );
297 result.SetPositionInNucleus( 0.0, 0.0, 0.0 );
298 result.SetFormationTime(0.0);
299 result.HasInitialStateParton(false);
300 return result;
301 }