Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
+1 -14
View File
@@ -1,22 +1,9 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4track
# Package: Geant4.src.G4track
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
#
#------------------------------------------------------------------------------
# Add allocation export symbol for the track category
add_definitions(-DG4TRACK_ALLOC_EXPORT)
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
geant4_global_library_target(COMPONENTS sources.cmake)
+17
View File
@@ -16,6 +16,23 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
- March 11, 2020 V.Ivanchenko (track-V10-06-03)
G4Track - do not use Velocity table, instead use GetBeta() method
from G4DynamicParticle; expected minor speed-up
- February 10, 2020 V.Ivanchenko (track-V10-06-02)
G4Track - use G4OpticalPhoton pdg code; removed static thread local
variables; slightly simplified velocity computation; removed
commented code left from previous tag
- January 29, 2020 V.Ivanchenko (track-V10-06-01)
G4Track - fixed Coverity reports connected with unnecessary checks
for valid pointers to G4Step and G4DynamicParticle
- December 9, 2019 B. Morgan (track-V10-06-00)
- Cleanup CMake build, removing obsolete granular library option and
explicit include_directories.
- November 15, 2019 G.Cosmo (track-V10-05-01)
- Fixed implicit type conversions from size_t to G4int in G4Step.
+2 -9
View File
@@ -49,6 +49,7 @@
#define G4Track_h 1
#include <cmath> // Include from 'system'
#include <CLHEP/Units/PhysicalConstants.h>
#include "globals.hh" // Include from 'global'
#include "trkdefs.hh" // Include DLL defs...
@@ -66,7 +67,6 @@
class G4Step; // Forward declaration
class G4MaterialCutsCouple;
class G4VelocityTable;
class G4VAuxiliaryTrackInformation;
class G4VProcess;
@@ -96,7 +96,7 @@ private:
//--------
public: // With description
// Destrcutor
// Destructor
~G4Track();
// Operators
@@ -260,12 +260,6 @@ public: // With description
G4VUserTrackInformation* GetUserInformation() const;
void SetUserInformation(G4VUserTrackInformation* aValue) const;
// Velocity table
static void SetVelocityTableProperties(G4double t_max, G4double t_min, G4int nbin);
static G4double GetMaxTOfVelocityTable();
static G4double GetMinTOfVelocityTable();
static G4int GetNbinOfVelocityTable();
//---------
private:
//---------
@@ -321,7 +315,6 @@ public: // With description
mutable G4double prev_momentum;
G4bool is_OpticalPhoton;
static G4VelocityTable*& velTable();
G4bool useGivenVelocity;
// do not calclulate velocity and just use current fVelocity
+32 -77
View File
@@ -109,18 +109,23 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
// proper time
inline G4double G4Track::GetProperTime() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetProperTime();}
else {return 0.0;}
}
{ return fpDynamicParticle->GetProperTime(); }
inline void G4Track::SetProperTime(const G4double aValue)
{ if (fpDynamicParticle != nullptr) fpDynamicParticle->SetProperTime(aValue); }
{ fpDynamicParticle->SetProperTime(aValue); }
// Proper time of the current track
// velocity
inline G4double G4Track::GetVelocity() const
{ return fVelocity; }
{ return (useGivenVelocity) ? fVelocity :
((!is_OpticalPhoton) ? CLHEP::c_light*fpDynamicParticle->GetBeta() :
CalculateVelocityForOpticalPhoton());
}
inline G4double G4Track::CalculateVelocity() const
{
return GetVelocity();
}
inline void G4Track::SetVelocity(G4double val)
{ fVelocity = val; }
@@ -131,48 +136,25 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
inline void G4Track::UseGivenVelocity(G4bool val)
{ useGivenVelocity = val;}
// volume
inline G4VPhysicalVolume* G4Track::GetVolume() const
{
if ( fpTouchable == 0 ) {return nullptr;}
else {return fpTouchable->GetVolume(); }
}
{ return (fpTouchable) ? fpTouchable->GetVolume() : nullptr; }
inline G4VPhysicalVolume* G4Track::GetNextVolume() const
{
if ( fpNextTouchable == 0 ) {return nullptr;}
else { return fpNextTouchable->GetVolume(); }
}
{ return (fpNextTouchable) ? fpNextTouchable->GetVolume() : nullptr; }
// material
inline
const G4MaterialCutsCouple* G4Track::GetMaterialCutsCouple() const
{
if ( fpStep==nullptr ) {return nullptr;}
else {return fpStep->GetPreStepPoint()->GetMaterialCutsCouple(); }
}
// material - assuming that the pointer to G4Step is defined
inline const G4MaterialCutsCouple* G4Track::GetMaterialCutsCouple() const
{ return fpStep->GetPreStepPoint()->GetMaterialCutsCouple(); }
inline
const G4MaterialCutsCouple* G4Track::GetNextMaterialCutsCouple() const
{
if ( fpStep==nullptr ) {return nullptr;}
else {return fpStep->GetPostStepPoint()->GetMaterialCutsCouple(); }
}
inline const G4MaterialCutsCouple* G4Track::GetNextMaterialCutsCouple() const
{ return fpStep->GetPostStepPoint()->GetMaterialCutsCouple(); }
// material
inline G4Material* G4Track::GetMaterial() const
{
if ( fpStep==nullptr ) {return nullptr;}
else { return fpStep->GetPreStepPoint()->GetMaterial(); }
}
inline G4Material* G4Track::GetMaterial() const
{ return fpStep->GetPreStepPoint()->GetMaterial(); }
inline G4Material* G4Track::GetNextMaterial() const
{
if ( fpStep==nullptr ) {return nullptr;}
else { return fpStep->GetPostStepPoint()->GetMaterial(); }
}
{ return fpStep->GetPostStepPoint()->GetMaterial(); }
// touchable
inline const G4VTouchable* G4Track::GetTouchable() const
@@ -204,60 +186,32 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
// kinetic energy
inline G4double G4Track::GetKineticEnergy() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetKineticEnergy();}
else { return 0.0; }
}
{ return fpDynamicParticle->GetKineticEnergy(); }
inline void G4Track::SetKineticEnergy(const G4double aValue)
{
if (fpDynamicParticle != nullptr) { fpDynamicParticle->SetKineticEnergy(aValue); }
}
{ fpDynamicParticle->SetKineticEnergy(aValue); }
// total energy
inline G4double G4Track::GetTotalEnergy() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetTotalEnergy();}
else { return 0.0; }
}
{ return fpDynamicParticle->GetTotalEnergy(); }
// momentum
inline G4ThreeVector G4Track::GetMomentum() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetMomentum();}
const G4ThreeVector zerovector;
return zerovector;
}
{ return fpDynamicParticle->GetMomentum(); }
// momentum (direction)
inline const G4ThreeVector& G4Track::GetMomentumDirection() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetMomentumDirection();}
static const G4ThreeVector zerovector;
return zerovector;
}
{ return fpDynamicParticle->GetMomentumDirection(); }
inline void G4Track::SetMomentumDirection(const G4ThreeVector& aValue)
{
if (fpDynamicParticle != nullptr) {fpDynamicParticle->SetMomentumDirection(aValue);}
}
{ fpDynamicParticle->SetMomentumDirection(aValue); }
// polarization
inline const G4ThreeVector& G4Track::GetPolarization() const
{
if (fpDynamicParticle != nullptr) {return fpDynamicParticle->GetPolarization();}
static const G4ThreeVector zerovector;
return zerovector;
}
{ return fpDynamicParticle->GetPolarization(); }
inline void G4Track::SetPolarization(const G4ThreeVector& aValue)
{
if (fpDynamicParticle != nullptr) {
fpDynamicParticle->SetPolarization(aValue.x(),
aValue.y(),
aValue.z());
}
}
{ fpDynamicParticle->SetPolarization(aValue); }
// track status
inline G4TrackStatus G4Track::GetTrackStatus() const
@@ -279,7 +233,7 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
{ return fCurrentStepNumber; }
inline void G4Track::IncrementCurrentStepNumber()
{ fCurrentStepNumber++; }
{ ++fCurrentStepNumber; }
// step length
inline G4double G4Track::GetStepLength() const
@@ -298,7 +252,7 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
inline const G4ThreeVector& G4Track::GetVertexMomentumDirection() const
{ return fVtxMomentumDirection; }
inline void G4Track::SetVertexMomentumDirection(const G4ThreeVector& aValue)
{ fVtxMomentumDirection = aValue ;}
{ fVtxMomentumDirection = aValue; }
inline G4double G4Track::GetVertexKineticEnergy() const
{ return fVtxKineticEnergy; }
@@ -354,6 +308,7 @@ extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
// user information
inline G4VUserTrackInformation* G4Track::GetUserInformation() const
{ return fpUserInformation; }
inline void G4Track::SetUserInformation(G4VUserTrackInformation* aValue) const
{ fpUserInformation = aValue; }
+61 -87
View File
@@ -1,98 +1,72 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4track
# Package: Geant4.src.G4track
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4track
HEADERS
G4FieldTrackUpdator.hh
G4ForceCondition.hh
G4GPILSelection.hh
G4ParticleChange.hh
G4ParticleChange.icc
G4ParticleChangeForDecay.hh
G4ParticleChangeForGamma.hh
G4ParticleChangeForLoss.hh
G4ParticleChangeForMSC.hh
G4ParticleChangeForMSC.icc
G4ParticleChangeForRadDecay.hh
G4ParticleChangeForTransport.hh
G4ParticleChangeForTransport.icc
G4Step.hh
G4Step.icc
G4StepPoint.hh
G4StepPoint.icc
G4StepStatus.hh
G4SteppingControl.hh
G4Track.hh
G4Track.icc
G4TrackFastVector.hh
G4TrackStatus.hh
G4TrackVector.hh
G4VParticleChange.hh
G4VParticleChange.icc
G4VelocityTable.hh
G4VAuxiliaryTrackInformation.hh
G4VUserTrackInformation.hh
trkdefs.hh
SOURCES
G4FieldTrackUpdator.cc
G4ParticleChange.cc
G4ParticleChangeForDecay.cc
G4ParticleChangeForGamma.cc
G4ParticleChangeForLoss.cc
G4ParticleChangeForMSC.cc
G4ParticleChangeForTransport.cc
G4Step.cc
G4StepPoint.cc
G4Track.cc
G4VParticleChange.cc
G4VelocityTable.cc
G4VAuxiliaryTrackInformation.cc
G4VUserTrackInformation.cc
GRANULAR_DEPENDENCIES
G4geometrymng
G4globman
G4intercoms
G4magneticfield
G4materials
G4partman
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4intercoms
G4materials
G4particles
LINK_LIBRARIES
geant4_define_module(NAME G4track
HEADERS
G4FieldTrackUpdator.hh
G4ForceCondition.hh
G4GPILSelection.hh
G4ParticleChange.hh
G4ParticleChange.icc
G4ParticleChangeForDecay.hh
G4ParticleChangeForGamma.hh
G4ParticleChangeForLoss.hh
G4ParticleChangeForMSC.hh
G4ParticleChangeForMSC.icc
G4ParticleChangeForRadDecay.hh
G4ParticleChangeForTransport.hh
G4ParticleChangeForTransport.icc
G4Step.hh
G4Step.icc
G4StepPoint.hh
G4StepPoint.icc
G4StepStatus.hh
G4SteppingControl.hh
G4Track.hh
G4Track.icc
G4TrackFastVector.hh
G4TrackStatus.hh
G4TrackVector.hh
G4VParticleChange.hh
G4VParticleChange.icc
G4VelocityTable.hh
G4VAuxiliaryTrackInformation.hh
G4VUserTrackInformation.hh
trkdefs.hh
SOURCES
G4FieldTrackUpdator.cc
G4ParticleChange.cc
G4ParticleChangeForDecay.cc
G4ParticleChangeForGamma.cc
G4ParticleChangeForLoss.cc
G4ParticleChangeForMSC.cc
G4ParticleChangeForTransport.cc
G4Step.cc
G4StepPoint.cc
G4Track.cc
G4VParticleChange.cc
G4VelocityTable.cc
G4VAuxiliaryTrackInformation.cc
G4VUserTrackInformation.cc
GRANULAR_DEPENDENCIES
G4geometrymng
G4globman
G4intercoms
G4magneticfield
G4materials
G4partman
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4intercoms
G4materials
G4particles
LINK_LIBRARIES
)
# List any source specific properties here
+4 -84
View File
@@ -40,8 +40,6 @@
#include "G4Track.hh"
#include "G4PhysicalConstants.hh"
#include "G4ParticleTable.hh"
#include "G4VelocityTable.hh"
#include "G4VAuxiliaryTrackInformation.hh"
#include "G4PhysicsModelCatalog.hh"
@@ -54,12 +52,6 @@ G4Allocator<G4Track>*& aTrackAllocator()
return _instance;
}
G4VelocityTable*& G4Track::velTable()
{
G4ThreadLocalStatic G4VelocityTable* _instance = nullptr;
return _instance;
}
///////////////////////////////////////////////////////////
G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
G4double aValueTime,
@@ -70,7 +62,6 @@ G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
fTrackLength(0.),
fParentID(0), fTrackID(0),
fVelocity(c_light),
fpDynamicParticle(apValueDynamicParticle),
fTrackStatus(fAlive),
fBelowThreshold(false), fGoodForTracking(false),
fStepLength(0.0), fWeight(1.0),
@@ -85,20 +76,9 @@ G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
useGivenVelocity(false),
fpAuxiliaryTrackInformationMap(nullptr)
{
static G4ThreadLocal G4bool isFirstTime = true;
static G4ThreadLocal G4ParticleDefinition* fOpticalPhoton = nullptr;
if ( isFirstTime ) {
isFirstTime = false;
// set fOpticalPhoton
fOpticalPhoton = G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
}
fpDynamicParticle = (apValueDynamicParticle) ? apValueDynamicParticle : new G4DynamicParticle();
// check if the particle type is Optical Photon
is_OpticalPhoton = (fpDynamicParticle->GetDefinition() == fOpticalPhoton);
if (velTable() == nullptr ) velTable() = G4VelocityTable::GetVelocityTable();
fVelocity = CalculateVelocity();
is_OpticalPhoton = (fpDynamicParticle->GetDefinition()->GetPDGEncoding() == -22);
}
//////////////////
@@ -109,7 +89,7 @@ G4Track::G4Track()
fTrackLength(0.),
fParentID(0), fTrackID(0),
fVelocity(c_light),
fpDynamicParticle(nullptr),
fpDynamicParticle(new G4DynamicParticle()),
fTrackStatus(fAlive),
fBelowThreshold(false), fGoodForTracking(false),
fStepLength(0.0), fWeight(1.0),
@@ -157,9 +137,7 @@ G4Track::~G4Track()
///////////////////
{
delete fpDynamicParticle;
fpDynamicParticle = nullptr;
delete fpUserInformation;
fpUserInformation = nullptr;
ClearAuxiliaryTrackInformation();
}
@@ -230,47 +208,12 @@ void G4Track::CopyTrackInfo(const G4Track& right)
*this = right;
}
///////////////////
G4double G4Track::CalculateVelocity() const
///////////////////
{
if (useGivenVelocity) return fVelocity;
G4double velocity = c_light ;
G4double mass = fpDynamicParticle->GetMass();
// special case for photons
if ( is_OpticalPhoton ) return CalculateVelocityForOpticalPhoton();
// particles other than optical photon
if (mass<DBL_MIN) {
// Zero Mass
velocity = c_light;
} else {
G4double T = (fpDynamicParticle->GetKineticEnergy())/mass;
if (T > GetMaxTOfVelocityTable()) {
velocity = c_light;
} else if (T<DBL_MIN) {
velocity =0.;
} else if (T<GetMinTOfVelocityTable()) {
velocity = c_light*std::sqrt(T*(T+2.))/(T+1.0);
} else {
velocity = velTable()->Value(T);
}
}
return velocity ;
}
///////////////////
G4double G4Track::CalculateVelocityForOpticalPhoton() const
///////////////////
{
{
G4double velocity = c_light ;
G4Material* mat = nullptr;
G4bool update_groupvel = false;
if ( fpStep !=0 ){
@@ -309,29 +252,6 @@ G4double G4Track::CalculateVelocityForOpticalPhoton() const
return velocity ;
}
///////////////////
void G4Track::SetVelocityTableProperties(G4double t_max, G4double t_min, G4int nbin)
///////////////////
{
G4VelocityTable::SetVelocityTableProperties(t_max, t_min, nbin);
velTable() = G4VelocityTable::GetVelocityTable();
}
///////////////////
G4double G4Track::GetMaxTOfVelocityTable()
///////////////////
{ return G4VelocityTable::GetMaxTOfVelocityTable(); }
///////////////////
G4double G4Track::GetMinTOfVelocityTable()
///////////////////
{ return G4VelocityTable::GetMinTOfVelocityTable(); }
///////////////////
G4int G4Track::GetNbinOfVelocityTable()
///////////////////
{ return G4VelocityTable::GetNbinOfVelocityTable(); }
///////////////////
void G4Track::SetAuxiliaryTrackInformation(G4int idx, G4VAuxiliaryTrackInformation* info) const
///////////////////