Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,15 +23,11 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4DynamicParticle inline implementation
|
||||
//
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// History: first implementation, based on object model of
|
||||
// 17 AUg. 1999 H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
// 17.08.1999 - H.Kurashige
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
extern G4PART_DLL G4Allocator<G4DynamicParticle>*& pDynamicParticleAllocator();
|
||||
|
||||
// ------------------------
|
||||
@@ -40,26 +36,28 @@ extern G4PART_DLL G4Allocator<G4DynamicParticle>*& pDynamicParticleAllocator();
|
||||
|
||||
inline void * G4DynamicParticle::operator new(size_t)
|
||||
{
|
||||
if (!pDynamicParticleAllocator()) pDynamicParticleAllocator() =
|
||||
new G4Allocator<G4DynamicParticle>;
|
||||
if (pDynamicParticleAllocator() == nullptr)
|
||||
pDynamicParticleAllocator() = new G4Allocator<G4DynamicParticle>;
|
||||
return pDynamicParticleAllocator()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::operator delete(void * aDynamicParticle)
|
||||
{
|
||||
pDynamicParticleAllocator()->FreeSingle((G4DynamicParticle *) aDynamicParticle);
|
||||
pDynamicParticleAllocator()
|
||||
->FreeSingle((G4DynamicParticle *) aDynamicParticle);
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Inlined functions
|
||||
// ------------------------
|
||||
|
||||
inline const G4ElectronOccupancy* G4DynamicParticle::GetElectronOccupancy() const
|
||||
inline const G4ElectronOccupancy*
|
||||
G4DynamicParticle::GetElectronOccupancy() const
|
||||
{
|
||||
return theElectronOccupancy;
|
||||
}
|
||||
|
||||
inline G4int G4DynamicParticle::GetTotalOccupancy() const
|
||||
inline G4int G4DynamicParticle::GetTotalOccupancy() const
|
||||
{
|
||||
return (theElectronOccupancy) ? theElectronOccupancy->GetTotalOccupancy() : 0;
|
||||
}
|
||||
@@ -69,10 +67,11 @@ inline G4int G4DynamicParticle::GetOccupancy(G4int orbit) const
|
||||
return (theElectronOccupancy) ? theElectronOccupancy->GetOccupancy(orbit) : 0;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::AddElectron(G4int orbit, G4int number )
|
||||
inline void G4DynamicParticle::AddElectron(G4int orbit, G4int number)
|
||||
{
|
||||
if (!theElectronOccupancy) { AllocateElectronOccupancy(); }
|
||||
if ( theElectronOccupancy) {
|
||||
if (theElectronOccupancy == nullptr) { AllocateElectronOccupancy(); }
|
||||
if (theElectronOccupancy != nullptr)
|
||||
{
|
||||
G4int n = theElectronOccupancy->AddElectron(orbit, number);
|
||||
theDynamicalCharge -= CLHEP::eplus * n;
|
||||
theDynamicalMass += CLHEP::electron_mass_c2 * n;
|
||||
@@ -81,9 +80,10 @@ inline void G4DynamicParticle::AddElectron(G4int orbit, G4int number )
|
||||
|
||||
inline void G4DynamicParticle::RemoveElectron(G4int orbit, G4int number)
|
||||
{
|
||||
if (!theElectronOccupancy) AllocateElectronOccupancy();
|
||||
if ( theElectronOccupancy) {
|
||||
G4int n = theElectronOccupancy->RemoveElectron(orbit, number );
|
||||
if (theElectronOccupancy == nullptr) { AllocateElectronOccupancy(); }
|
||||
if (theElectronOccupancy != nullptr)
|
||||
{
|
||||
G4int n = theElectronOccupancy->RemoveElectron(orbit, number);
|
||||
theDynamicalCharge += CLHEP::eplus * n;
|
||||
theDynamicalMass -= CLHEP::electron_mass_c2 * n;
|
||||
}
|
||||
@@ -111,7 +111,11 @@ inline G4double G4DynamicParticle::GetMass() const
|
||||
|
||||
inline void G4DynamicParticle::SetMass(G4double newMass)
|
||||
{
|
||||
theDynamicalMass = std::max(newMass, 0.0);
|
||||
if(theDynamicalMass != newMass)
|
||||
{
|
||||
theDynamicalMass = std::max(newMass, 0.0);
|
||||
theBeta = -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
inline G4double G4DynamicParticle::GetSpin() const
|
||||
@@ -146,8 +150,8 @@ inline const G4ThreeVector& G4DynamicParticle::GetMomentumDirection() const
|
||||
|
||||
inline G4ThreeVector G4DynamicParticle::GetMomentum() const
|
||||
{
|
||||
G4double pModule = std::sqrt(theKineticEnergy*theKineticEnergy +
|
||||
2*theKineticEnergy*theDynamicalMass);
|
||||
G4double pModule = std::sqrt(theKineticEnergy*theKineticEnergy
|
||||
+ 2*theKineticEnergy*theDynamicalMass);
|
||||
G4ThreeVector pMomentum(theMomentumDirection.x()*pModule,
|
||||
theMomentumDirection.y()*pModule,
|
||||
theMomentumDirection.z()*pModule);
|
||||
@@ -156,19 +160,20 @@ inline G4ThreeVector G4DynamicParticle::GetMomentum() const
|
||||
|
||||
inline G4LorentzVector G4DynamicParticle::Get4Momentum() const
|
||||
{
|
||||
G4double mass = theDynamicalMass;
|
||||
G4double energy = theKineticEnergy;
|
||||
G4double momentum = std::sqrt(energy*energy+2.0*mass*energy);
|
||||
G4LorentzVector p4( theMomentumDirection.x()*momentum,
|
||||
theMomentumDirection.y()*momentum,
|
||||
theMomentumDirection.z()*momentum,
|
||||
energy+mass);
|
||||
const G4double mass = theDynamicalMass;
|
||||
const G4double energy = theKineticEnergy;
|
||||
const G4double momentum = std::sqrt(energy*energy+2.0*mass*energy);
|
||||
G4LorentzVector p4( theMomentumDirection.x()*momentum,
|
||||
theMomentumDirection.y()*momentum,
|
||||
theMomentumDirection.z()*momentum,
|
||||
energy+mass );
|
||||
return p4;
|
||||
}
|
||||
|
||||
inline G4double G4DynamicParticle::GetTotalMomentum() const
|
||||
{
|
||||
// The momentum is returned in energy equivalent.
|
||||
// The momentum is returned in energy equivalent
|
||||
//
|
||||
return std::sqrt((theKineticEnergy + 2.*theDynamicalMass)* theKineticEnergy);
|
||||
}
|
||||
|
||||
@@ -177,7 +182,8 @@ inline G4ParticleDefinition* G4DynamicParticle::GetDefinition() const
|
||||
return const_cast<G4ParticleDefinition*>(theParticleDefinition);
|
||||
}
|
||||
|
||||
inline const G4ParticleDefinition* G4DynamicParticle::GetParticleDefinition() const
|
||||
inline const G4ParticleDefinition*
|
||||
G4DynamicParticle::GetParticleDefinition() const
|
||||
{
|
||||
return theParticleDefinition;
|
||||
}
|
||||
@@ -204,30 +210,35 @@ inline G4double G4DynamicParticle::GetKineticEnergy() const
|
||||
|
||||
inline G4double G4DynamicParticle::GetLogKineticEnergy() const
|
||||
{
|
||||
if (theLogKineticEnergy == DBL_MAX) {
|
||||
theLogKineticEnergy = (theKineticEnergy > 0.) ? G4Log(theKineticEnergy) : LOG_EKIN_MIN;
|
||||
if (theLogKineticEnergy == DBL_MAX)
|
||||
{
|
||||
theLogKineticEnergy = (theKineticEnergy > 0.)
|
||||
? G4Log(theKineticEnergy) : LOG_EKIN_MIN;
|
||||
}
|
||||
return theLogKineticEnergy;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetMomentumDirection(const G4ThreeVector &aDirection)
|
||||
inline void
|
||||
G4DynamicParticle::SetMomentumDirection(const G4ThreeVector& aDirection)
|
||||
{
|
||||
theMomentumDirection = aDirection;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetMomentumDirection(G4double px, G4double py, G4double pz)
|
||||
inline void
|
||||
G4DynamicParticle::SetMomentumDirection(G4double px, G4double py, G4double pz)
|
||||
{
|
||||
theMomentumDirection.setX(px);
|
||||
theMomentumDirection.setY(py);
|
||||
theMomentumDirection.setZ(pz);
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetPolarization(const G4ThreeVector & vp)
|
||||
inline void G4DynamicParticle::SetPolarization(const G4ThreeVector& vp)
|
||||
{
|
||||
thePolarization = vp;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4double polZ)
|
||||
inline void
|
||||
G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4double polZ)
|
||||
{
|
||||
thePolarization.setX(polX);
|
||||
thePolarization.setY(polY);
|
||||
@@ -236,8 +247,11 @@ inline void G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4d
|
||||
|
||||
inline void G4DynamicParticle::SetKineticEnergy(G4double aEnergy)
|
||||
{
|
||||
theLogKineticEnergy = DBL_MAX;
|
||||
theKineticEnergy = aEnergy;
|
||||
if(aEnergy != theKineticEnergy) {
|
||||
theLogKineticEnergy = DBL_MAX;
|
||||
theKineticEnergy = aEnergy;
|
||||
theBeta = -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetProperTime(G4double atime)
|
||||
@@ -245,12 +259,14 @@ inline void G4DynamicParticle::SetProperTime(G4double atime)
|
||||
theProperTime = atime;
|
||||
}
|
||||
|
||||
inline const G4DecayProducts* G4DynamicParticle::GetPreAssignedDecayProducts() const
|
||||
inline const G4DecayProducts*
|
||||
G4DynamicParticle::GetPreAssignedDecayProducts() const
|
||||
{
|
||||
return thePreAssignedDecayProducts;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::SetPreAssignedDecayProducts(G4DecayProducts* aDecayProducts)
|
||||
inline void
|
||||
G4DynamicParticle::SetPreAssignedDecayProducts(G4DecayProducts* aDecayProducts)
|
||||
{
|
||||
thePreAssignedDecayProducts = aDecayProducts;
|
||||
}
|
||||
@@ -265,32 +281,27 @@ inline void G4DynamicParticle::SetPreAssignedDecayProperTime(G4double aTime)
|
||||
thePreAssignedDecayTime = aTime;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4DynamicParticle::SetVerboseLevel(G4int value)
|
||||
inline void G4DynamicParticle::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4DynamicParticle::GetVerboseLevel() const
|
||||
inline G4int G4DynamicParticle::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4DynamicParticle::SetPrimaryParticle(G4PrimaryParticle* p)
|
||||
inline void G4DynamicParticle::SetPrimaryParticle(G4PrimaryParticle* p)
|
||||
{
|
||||
primaryParticle = p;
|
||||
}
|
||||
|
||||
inline
|
||||
G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle() const
|
||||
inline G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle() const
|
||||
{
|
||||
return primaryParticle;
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4DynamicParticle::GetPDGcode() const
|
||||
inline G4int G4DynamicParticle::GetPDGcode() const
|
||||
{
|
||||
G4int code = theParticleDefinition->GetPDGEncoding();
|
||||
return (code == 0) ? thePDGcode : code;
|
||||
@@ -300,3 +311,22 @@ inline void G4DynamicParticle::SetPDGcode(G4int c)
|
||||
{
|
||||
thePDGcode = c;
|
||||
}
|
||||
|
||||
inline void G4DynamicParticle::ComputeBeta() const
|
||||
{
|
||||
// ultra relativistic particles and particles with mass zero
|
||||
theBeta = 1.0;
|
||||
|
||||
// other particles
|
||||
if(theDynamicalMass > 0.0 && theKineticEnergy < 1000*theDynamicalMass)
|
||||
{
|
||||
const G4double T = theKineticEnergy/theDynamicalMass;
|
||||
theBeta = std::sqrt(T*(T+2.))/(T+1.0);
|
||||
}
|
||||
}
|
||||
|
||||
inline G4double G4DynamicParticle::GetBeta() const
|
||||
{
|
||||
if(theBeta < 0.0) { ComputeBeta(); }
|
||||
return theBeta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user