Geant4 10.7.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

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 245 of file G4ReactionProduct.cc.

247 {
248 G4double totEnergy = p1.totalEnergy + p2.totalEnergy;
249 G4double x = p1.momentum.x() + p2.momentum.x();
250 G4double y = p1.momentum.y() + p2.momentum.y();
251 G4double z = p1.momentum.z() + p2.momentum.z();
252 G4double newMass = totEnergy*totEnergy - ( x*x + y*y + z*z );
253 if( newMass < 0.0 )
254 newMass = -1. * std::sqrt( -newMass );
255 else
256 newMass = std::sqrt( newMass );
257 G4ReactionProduct result;
258 result.SetMass( newMass );
259 result.SetMomentum( x, y, z );
260 result.SetTotalEnergy( totEnergy );
261 result.SetPositionInNucleus( 0.0, 0.0, 0.0 );
262 result.SetFormationTime(0.0);
263 result.HasInitialStateParton(false);
264 return result;
265 }
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 267 of file G4ReactionProduct.cc.

269 {
270 G4double totEnergy = p1.totalEnergy - p2.totalEnergy;
271 G4double x = p1.momentum.x() - p2.momentum.x();
272 G4double y = p1.momentum.y() - p2.momentum.y();
273 G4double z = p1.momentum.z() - p2.momentum.z();
274 G4double newMass = totEnergy*totEnergy - ( x*x + y*y + z*z );
275 if( newMass < 0.0 )
276 newMass = -1. * std::sqrt( -newMass );
277 else
278 newMass = std::sqrt( newMass );
279 G4ReactionProduct result;
280 result.SetMass( newMass );
281 result.SetMomentum( x, y, z );
282 result.SetTotalEnergy( totEnergy );
283 result.SetPositionInNucleus( 0.0, 0.0, 0.0 );
284 result.SetFormationTime(0.0);
285 result.HasInitialStateParton(false);
286 return result;
287 }