Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -42,6 +42,8 @@
// 17 AUg. 1999 H.Kurashige
// Add thePreAssignedDecayTime 18 Jan. 2001 H.Kurashige
// Added MagneticMoment Mar. 2007
// Added GetLogKineticEnergy: the log-kinetic energy value is computed only
// on demand if its stored value is not up-to-date. 15 March 2019 M. Novak
// ------------------------------------------------------------
#ifndef G4DynamicParticle_h
@@ -49,6 +51,7 @@
#include <cmath>
#include <CLHEP/Units/SystemOfUnits.h>
#include <CLHEP/Units/PhysicalConstants.h>
#include "globals.hh"
#include "G4ios.hh"
@@ -56,6 +59,7 @@
#include "G4ParticleDefinition.hh"
#include "G4Allocator.hh"
#include "G4LorentzVector.hh"
#include "G4Log.hh"
#include "G4ParticleMomentum.hh"
// G4ParticleMomentum is "momentum direction" not "momentum vector"
@@ -64,10 +68,8 @@
#include "G4ElectronOccupancy.hh"
class G4PrimaryParticle;
class G4VProcess;
class G4DecayProducts;
class G4DecayProducts;
class G4DynamicParticle
{
@@ -130,7 +132,6 @@ class G4DynamicParticle
void Set4Momentum( const G4LorentzVector &momentum);
// Set the current particle energy-momentum 4vector
G4double GetTotalMomentum() const;
// Returns the module of the momentum vector
G4double GetTotalEnergy() const;
@@ -138,27 +139,28 @@ class G4DynamicParticle
G4double GetKineticEnergy() const;
// Returns the kinetic energy of a particle
G4double GetLogKineticEnergy() const;
// Returns:
// - natural logarithm of the particle kinetic energy (E_k) if E_k > 0
// - LOG_EKIN_MIN otherwise
void SetKineticEnergy(G4double aEnergy);
// Sets the kinetic energy of a particle
G4double GetProperTime() const;
// Returns the current particle proper time
void SetProperTime( G4double );
// Set the current particle Proper Time
const G4ThreeVector& GetPolarization() const;
void SetPolarization(const G4ThreeVector&);
void SetPolarization(G4double polX, G4double polY, G4double polZ);
// Set/Get polarization vector
G4double GetMass() const;
void SetMass(G4double mass);
// set/get dynamical mass
// the dynamical mass is set to PDG mass in default
G4double GetCharge() const;
void SetCharge(G4double charge);
void SetCharge(G4int chargeInUnitOfEplus);
@@ -176,7 +178,6 @@ class G4DynamicParticle
// set/get dynamical MagneticMoment
// the dynamical mass is set to PDG MagneticMoment in default
const G4ElectronOccupancy* GetElectronOccupancy() const;
// Get electron occupancy
// ElectronOccupancy is valid only if the particle is ion
@@ -184,15 +185,13 @@ class G4DynamicParticle
G4int GetOccupancy(G4int orbit) const;
void AddElectron(G4int orbit, G4int number = 1);
void RemoveElectron(G4int orbit, G4int number = 1);
const G4ParticleDefinition* GetParticleDefinition() const;
void SetDefinition(const G4ParticleDefinition * aParticleDefinition);
// Set/Get particle definition
// following method of GetDefinition remains
// because of backward compatiblity. It will be removed in future
G4ParticleDefinition* GetDefinition() const;
const G4DecayProducts *GetPreAssignedDecayProducts() const;
void SetPreAssignedDecayProducts(G4DecayProducts *aDecayProducts);
@@ -203,45 +202,15 @@ class G4DynamicParticle
// Set/Get pre-assigned proper time when the particle will decay
//- print out information
//- print out information
void DumpInfo(G4int mode= 0) const;
// mode 0 : default )(minimum)
// mode 1 : 0 + electron occupancy
protected:
protected:
void AllocateElectronOccupancy();
G4double GetElectronMass() const;
protected:
G4ThreeVector theMomentumDirection;
// The normalized momentum vector
const G4ParticleDefinition *theParticleDefinition;
// Contains the static information of this particle.
G4ThreeVector thePolarization;
G4double theKineticEnergy;
G4double theProperTime;
G4double theDynamicalMass;
G4double theDynamicalCharge;
G4double theDynamicalSpin;
G4double theDynamicalMagneticMoment;
G4ElectronOccupancy* theElectronOccupancy;
G4DecayProducts *thePreAssignedDecayProducts;
G4double thePreAssignedDecayTime;
protected:
G4int verboseLevel;
public: // With Description
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
@@ -250,13 +219,6 @@ class G4DynamicParticle
// 1: Warning message
// 2: More
protected:
G4PrimaryParticle* primaryParticle;
// This void pointer is used by G4EventManager to maintain the
// link between pre-assigned decay products and corresponding
// primary particle.
public:
void SetPrimaryParticle(G4PrimaryParticle* p);
void SetPDGcode(G4int c);
@@ -273,7 +235,43 @@ class G4DynamicParticle
// corresponding primary particle or pre-assigned decay product will be
// returned if available. Otherwise (e.g. for geantino) returns 0.
protected:
private:
G4ThreeVector theMomentumDirection;
// The normalized momentum vector
G4ThreeVector thePolarization;
const G4ParticleDefinition *theParticleDefinition;
// Contains the static information of this particle.
G4ElectronOccupancy* theElectronOccupancy;
G4DecayProducts *thePreAssignedDecayProducts;
G4PrimaryParticle* primaryParticle;
// This void pointer is used by G4EventManager to maintain the
// link between pre-assigned decay products and corresponding
// primary particle.
G4double theKineticEnergy;
mutable G4double theLogKineticEnergy;
G4double theProperTime;
G4double theDynamicalMass;
G4double theDynamicalCharge;
G4double theDynamicalSpin;
G4double theDynamicalMagneticMoment;
G4double thePreAssignedDecayTime;
G4int verboseLevel;
G4int thePDGcode;
};
@@ -61,39 +61,31 @@ inline const G4ElectronOccupancy* G4DynamicParticle::GetElectronOccupancy() cons
inline G4int G4DynamicParticle::GetTotalOccupancy() const
{
G4int value = 0;
if ( theElectronOccupancy != 0) {
value = theElectronOccupancy->GetTotalOccupancy();
}
return value;
return (theElectronOccupancy) ? theElectronOccupancy->GetTotalOccupancy() : 0;
}
inline G4int G4DynamicParticle::GetOccupancy(G4int orbit) const
inline G4int G4DynamicParticle::GetOccupancy(G4int orbit) const
{
G4int value = 0;
if ( theElectronOccupancy != 0) {
value = theElectronOccupancy->GetOccupancy(orbit);
}
return value;
return (theElectronOccupancy) ? theElectronOccupancy->GetOccupancy(orbit) : 0;
}
inline void G4DynamicParticle::AddElectron(G4int orbit, G4int number )
{
if ( theElectronOccupancy == 0) AllocateElectronOccupancy();
if ( theElectronOccupancy != 0) {
G4int n = theElectronOccupancy->AddElectron(orbit, number );
if (!theElectronOccupancy) { AllocateElectronOccupancy(); }
if ( theElectronOccupancy) {
G4int n = theElectronOccupancy->AddElectron(orbit, number);
theDynamicalCharge -= CLHEP::eplus * n;
theDynamicalMass += GetElectronMass() * n;
theDynamicalMass += CLHEP::electron_mass_c2 * n;
}
}
inline void G4DynamicParticle::RemoveElectron(G4int orbit, G4int number)
inline void G4DynamicParticle::RemoveElectron(G4int orbit, G4int number)
{
if ( theElectronOccupancy == 0) AllocateElectronOccupancy();
if ( theElectronOccupancy != 0) {
if (!theElectronOccupancy) AllocateElectronOccupancy();
if ( theElectronOccupancy) {
G4int n = theElectronOccupancy->RemoveElectron(orbit, number );
theDynamicalCharge += CLHEP::eplus * n;
theDynamicalMass -= GetElectronMass() * n;
theDynamicalMass -= CLHEP::electron_mass_c2 * n;
}
}
@@ -128,7 +120,7 @@ inline void G4DynamicParticle::SetSpin(G4double spin)
theDynamicalSpin = spin;
}
inline void G4DynamicParticle::SetSpin(G4int spinInUnitOfHalfInteger)
inline void G4DynamicParticle::SetSpin(G4int spinInUnitOfHalfInteger)
{
theDynamicalSpin = spinInUnitOfHalfInteger * 0.5;
}
@@ -140,12 +132,12 @@ inline G4double G4DynamicParticle::GetMagneticMoment() const
inline void G4DynamicParticle::SetMagneticMoment(G4double magneticMoment)
{
theDynamicalMagneticMoment = magneticMoment;
theDynamicalMagneticMoment = magneticMoment;
}
inline const G4ThreeVector& G4DynamicParticle::GetMomentumDirection() const
{
return theMomentumDirection;
return theMomentumDirection;
}
inline G4ThreeVector G4DynamicParticle::GetMomentum() const
@@ -183,7 +175,7 @@ inline G4ParticleDefinition* G4DynamicParticle::GetDefinition() const
inline const G4ParticleDefinition* G4DynamicParticle::GetParticleDefinition() const
{
return const_cast<G4ParticleDefinition*>(theParticleDefinition);
return theParticleDefinition;
}
inline const G4ThreeVector& G4DynamicParticle::GetPolarization() const
@@ -206,6 +198,15 @@ inline G4double G4DynamicParticle::GetKineticEnergy() const
return theKineticEnergy;
}
inline G4double G4DynamicParticle::GetLogKineticEnergy() const
{
if (theLogKineticEnergy == DBL_MAX) {
theLogKineticEnergy = (theKineticEnergy > 0.) ?
G4Log(theKineticEnergy) : LOG_EKIN_MIN;
}
return theLogKineticEnergy;
}
inline void G4DynamicParticle::SetMomentumDirection(const G4ThreeVector &aDirection)
{
theMomentumDirection = aDirection;
@@ -218,6 +219,10 @@ inline void G4DynamicParticle::SetMomentumDirection(G4double px, G4double py, G4
theMomentumDirection.setZ(pz);
}
inline void G4DynamicParticle::SetPolarization(const G4ThreeVector & vp)
{
thePolarization = vp;
}
inline void G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4double polZ)
{
@@ -228,6 +233,7 @@ inline void G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4d
inline void G4DynamicParticle::SetKineticEnergy(G4double aEnergy)
{
theLogKineticEnergy = DBL_MAX;
theKineticEnergy = aEnergy;
}
@@ -259,33 +265,31 @@ inline void G4DynamicParticle::SetPreAssignedDecayProperTime(G4double aTime)
inline
void G4DynamicParticle::SetVerboseLevel(G4int value)
{
verboseLevel = value;
verboseLevel = value;
}
inline
G4int G4DynamicParticle::GetVerboseLevel() const
{
return verboseLevel;
return verboseLevel;
}
inline
void G4DynamicParticle::SetPrimaryParticle(G4PrimaryParticle* p)
{
primaryParticle=p;
primaryParticle=p;
}
inline
G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle() const
{
return primaryParticle;
return primaryParticle;
}
inline
G4int G4DynamicParticle::GetPDGcode() const
{
G4int code = theParticleDefinition->GetPDGEncoding();
if(code==0) code = thePDGcode;
return code;
return thePDGcode;
}
inline