Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
+2 -5
View File
@@ -1,6 +1,3 @@
# - G4track category build
# Add (private) allocation export symbol
add_definitions(-DG4TRACK_ALLOC_EXPORT)
geant4_global_library_target(COMPONENTS sources.cmake)
include(sources.cmake)
geant4_add_category(G4track MODULES G4track)
+27 -14
View File
@@ -1,21 +1,34 @@
-------------------------------------------------------------------
# Category track History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
## 2022-05-25 Alberto Ribon (track-V11-00-04)
- `G4Track`: add methods to get/set information on (short-lived) parent resonance
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
## 2022-04-19 Jonas Hahnfeld (track-V11-00-03)
- `G4ParticleChangeForTransport`:
* Apply proposed step length
* Further simplify `UpdateStepForAlongStep` method, assuming that
transportation is always the first process
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
## 2022-01-28 Ben Morgan (track-V11-00-02)
- Replace `geant4_global_library_target` with direct file inclusion and
call to `geant4_add_category` to define library build from source modules.
- Make DLL export symbol a CMake module-level compile definition to aid
future modularization
## 2021-12-13 Jonas Hahnfeld (track-V11-00-01)
- Simplify `G4ParticleChangeForTransport::UpdateStepForAlongStep`, assuming
that transportation is always the first process
## 2021-12-10 Ben Morgan (track-V11-00-00)
- Change to new Markdown History format
---
# History entries prior to 11.0
- September 28, 2021 J. Hahnfeld (track-V10-07-06)
- G4ParticleChangeForMSC, G4ParticleChangeForTransport: Disable debugFlag
+31
View File
@@ -235,6 +235,29 @@ class G4Track
// (the model ID and its name are supposed to be used in Geant4
// code, whereas the index is meant for plotting in user code)
inline const G4ParticleDefinition* GetParentResonanceDef() const;
inline void SetParentResonanceDef(const G4ParticleDefinition* parent);
inline G4int GetParentResonanceID() const;
inline void SetParentResonanceID(const G4int parentID );
inline G4bool HasParentResonance() const;
inline G4int GetParentResonancePDGEncoding() const;
inline G4String GetParentResonanceName() const;
inline G4double GetParentResonanceMass() const;
// Because short-lived resonances (e.g. omega, phi, rho, delta, etc.)
// do not have corresponding track objects, if the track is produced
// by a resonance parent, these methods allow to get/set information
// regarding this short-lived parent.
// The ID is a unique (integer) identifier for each resonance (which
// corresponds to the rounded integer of the mass of the resonance
// in keV), which allows to know if two (or more) tracks originated
// from the same parent resonance: this should not be confused with
// the parent-track-ID (fParentID) which corresponds to its closest
// ancestor which is not a short-lived resonance (and therefore has
// a corresponding track object).
// In the case of a track non originating from a resonance parent,
// the above "Get" methods return, respectively: nullptr, 0, false,
// 0, "", 0.
G4double GetWeight() const;
void SetWeight(G4double aValue);
// Track weight; methods for manipulating a weight for this track
@@ -317,6 +340,14 @@ class G4Track
G4int fCreatorModelID = -1;
// ID of the physics model which created the track
const G4ParticleDefinition* fParentResonanceDef = nullptr;
// Pointer to the particle definition of a short-lived resonance,
// in the case that the track is produced by a resonance parent
// (which does not have a corresponding track object)
G4int fParentResonanceID = 0;
// Unique ID for the parent resonance, in the case that the track
// is produced by a resonance parent, else 0
G4int fParentID = 0;
G4int fTrackID = 0;
+36
View File
@@ -418,6 +418,42 @@ inline const G4String G4Track::GetCreatorModelName() const
return G4PhysicsModelCatalog::GetModelNameFromID(fCreatorModelID);
}
inline const G4ParticleDefinition* G4Track::GetParentResonanceDef() const
{
return fParentResonanceDef;
}
inline void G4Track::SetParentResonanceDef(const G4ParticleDefinition* parentDef)
{
fParentResonanceDef = parentDef;
}
inline G4int G4Track::GetParentResonanceID() const
{
return fParentResonanceID;
}
inline void G4Track::SetParentResonanceID(const G4int parentID)
{
fParentResonanceID = parentID;
}
inline G4bool G4Track::HasParentResonance() const {
return ( fParentResonanceDef == nullptr ? false : true );
}
inline G4int G4Track::GetParentResonancePDGEncoding() const {
return ( fParentResonanceDef == nullptr ? 0 : fParentResonanceDef->GetPDGEncoding() );
}
inline G4String G4Track::GetParentResonanceName() const {
return ( fParentResonanceDef == nullptr ? G4String() : fParentResonanceDef->GetParticleName() );
}
inline G4double G4Track::GetParentResonanceMass() const {
return fParentResonanceID * CLHEP::keV; // the ID is the mass of the resonance in eV
}
// flag for "Below Threshold"
inline G4bool G4Track::IsBelowThreshold() const
{
+2
View File
@@ -49,6 +49,8 @@ geant4_add_module(G4track
G4VAuxiliaryTrackInformation.cc
G4VUserTrackInformation.cc)
geant4_module_compile_definitions(G4track PRIVATE G4TRACK_ALLOC_EXPORT)
geant4_module_link_libraries(G4track
PUBLIC
G4geometrymng
@@ -101,75 +101,36 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
// the auxiliary trajectory points (jacek 30/10/2002)
pStep->SetPointerToVectorOfAuxiliaryPoints(fpVectorOfAuxiliaryPointsPointer);
// copy of G4ParticleChange::UpdateStepForAlongStep
// i.e. no effect for touchable
// A physics process always calculates the final state of the
// particle relative to the initial state at the beginning
// of the Step, i.e., based on information of G4Track (or
// equivalently the PreStepPoint).
// So, the differences (delta) between these two states have to be
// calculated and be accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// pointer to G4ThreeVector. Also it is a normalized
// momentum vector.
// Most of the code assumes that transportation is always the first process,
// so the pre- and post-step point are still equal.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// update kinetic energy
// now assume that no energy change in transportation
// However it is not true in electric fields
// Case for changing energy will be implemented in future
// update momentum direction and energy
if(isMomentumChanged)
{
G4double energy;
energy = pPostStepPoint->GetKineticEnergy() +
(theEnergyChange - pPreStepPoint->GetKineticEnergy());
// calculate new momentum
G4ThreeVector pMomentum =
pPostStepPoint->GetMomentum() +
(CalcMomentum(theEnergyChange, theMomentumDirectionChange, mass) -
pPreStepPoint->GetMomentum());
G4double tMomentum = pMomentum.mag();
G4ThreeVector direction(1.0, 0.0, 0.0);
if(tMomentum > 0.)
{
G4double inv_Momentum = 1.0 / tMomentum;
direction = pMomentum * inv_Momentum;
}
pPostStepPoint->SetMomentumDirection(direction);
pPostStepPoint->SetKineticEnergy(energy);
pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange);
pPostStepPoint->SetKineticEnergy(theEnergyChange);
}
if(isVelocityChanged)
pPostStepPoint->SetVelocity(theVelocityChange);
// stop case should not occur
// pPostStepPoint->SetMomentumDirection(G4ThreeVector(1., 0., 0.));
// update polarization
pPostStepPoint->AddPolarization(thePolarizationChange -
pPreStepPoint->GetPolarization());
pPostStepPoint->SetPolarization(thePolarizationChange);
// update position and time
pPostStepPoint->AddPosition(thePositionChange - pPreStepPoint->GetPosition());
pPostStepPoint->SetPosition(thePositionChange);
pPostStepPoint->AddGlobalTime(theTimeChange - pPreStepPoint->GetLocalTime());
pPostStepPoint->AddLocalTime(theTimeChange - pPreStepPoint->GetLocalTime());
pPostStepPoint->AddProperTime(theProperTimeChange -
pPreStepPoint->GetProperTime());
pPostStepPoint->SetProperTime(theProperTimeChange);
#ifdef G4VERBOSE
G4Track* aTrack = pStep->GetTrack();
if(debugFlag) { CheckIt(*aTrack); }
#endif
// Update the G4Step specific attributes
// pStep->SetStepLength( theTrueStepLength );
pStep->SetStepLength( theTrueStepLength );
// pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
pStep->SetControlFlag(theSteppingControlFlag);
+4
View File
@@ -106,6 +106,10 @@ G4Track& G4Track::operator=(const G4Track& right)
// Creator model ID
fCreatorModelID = right.fCreatorModelID;
// Parent resonance
fParentResonanceDef = right.fParentResonanceDef;
fParentResonanceID = right.fParentResonanceID;
// velocity information
fVelocity = right.fVelocity;