Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
@@ -1,36 +0,0 @@
# ------------------------------------------------------------
# GNUmakefile for transportation library. G.Folger 10-Dec-97.
# ------------------------------------------------------------
name := G4transportation
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/biasing/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/intercoms/include
ifdef G4DEBUG_TRANSPORT
CPPFLAGS += -DG4DEBUG_TRANSPORT
endif
ifdef G4DEBUG_POSTSTEP_TRANSPORT
CPPFLAGS += -DG4DEBUG_POSTSTEP_TRANSPORT
endif
include $(G4INSTALL)/config/common.gmk
+7 -2
View File
@@ -5,13 +5,18 @@ 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!
-------------------------------------------------------------------------------
## 2023-01-26 John Apostolakis (transport-V11-01-02)
- Added a method to set both warning & important energies in G4TransporationParameters
Added method to report lock errors.
Improve reporting of inconsistent changes of 'warning' & 'important' energies
(not only enforce warning_E < important_E but also warn about violations.)
## 2023-01-25 John Apostolakis (transport-V11-00-11)
## 2023-01-25 John Apostolakis (transport-V11-01-01)
- Fix unwanted change of default looper parameters.
( Reversed inadvertent creation of G4TransportationParameters in
calls to G4Transportation constructor.)
## 2023-01-09 Jonas Hahnfeld
## 2023-01-09 Jonas Hahnfeld (transport-V11-01-00)
- Fix compilation warning about unused variable without `G4VERBOSE`.
## 2022-11-25 Gabriele Cosmo (transport-V11-00-10)
@@ -22,21 +22,32 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Class Description:
//
// A utility static class, responsable for keeping common parameters
// for all transportation processes. These parameters can be relevant only
// to some types of particles, e.g. only charged particles.
// to some types of particles, e.g. only stable charged particles.
//
// It must initialized only by the master thread.
// It can be updated before the transportation processes have been instantiated or
// after their instantiation.
// Constraints (creation/update):
// - It must initialized only by the master thread.
// - It should be updated before the transportation processes have been instantiated.
// Note: It can be updated only if the state of the simulation is PreInit, Init or Idle.
// Parameters may be used in run time or at initialisation
//
// Author: J. Apostolakis Nov 2022
//
// Only those instances of G4Transportation (and derived classes) that are created
// *after* G4TransportationParameters will be aware of it and will copy
// the values of its parameters.
// (So in a multithreaded application, runs that start after this is created will obtain them.)
//
// Use: Parameters may be used in run time or at initialisation
//
// Meaning of parameters:
// - Warning energy: below this, looping tracks can be killed without any message
// - Important energy: between warning E and this, looping tracks will complain and die
// - Number of Trials: above 'important energy' looping tracks get this number of chances.
// Author: J. Apostolakis Nov 2022
// Inspired by G4EmParameters by V. Ivanchenko
// -------------------------------------------------------------------
//
@@ -53,8 +64,15 @@ public:
~G4TransportationParameters() = default;
G4bool SetNumberOfTrials( G4int val );
// All three methods below enforce the relation WarningE <= ImportantE
G4bool SetWarningEnergy( G4double val );
G4bool SetImportantEnergy( G4double val );
// If the relation fails, the methods above warn and use the new value for both.
G4bool SetWarningAndImportantEnergies( G4double warnE, G4double imprtE );
// If the relation does *not* hold, it warns and
// uses the smaller as the 'warning Energy'
// and the larger as the 'important energy'
G4int GetNumberOfTrials() const { return fNumberOfTrials; }
G4double GetWarningEnergy() const { return fWarningEnergy; }
@@ -72,6 +90,9 @@ public:
G4bool GetSilenceAllLooperWarnings(){ return fSilenceLooperWarnings; }
void ReportLockError(G4String methodName, G4bool verbose= false) const;
// Report error - in case the state of G4 is incorrect, and update methods fail
// Probe whether the 'default' instance exists, without creating it
static G4bool Exists() { return theInstance != nullptr; }
@@ -69,9 +69,9 @@ G4TransportationParameters* G4TransportationParameters::Instance()
G4bool G4TransportationParameters::IsLocked() const
{
auto fStateManager = G4StateManager::GetStateManager();
auto stateManager = G4StateManager::GetStateManager();
auto state = fStateManager->GetCurrentState();
auto state = stateManager->GetCurrentState();
bool goodState = state == G4State_PreInit
|| state == G4State_Init
|| state == G4State_Idle ;
@@ -82,7 +82,7 @@ G4bool G4TransportationParameters::IsLocked() const
G4bool G4TransportationParameters::SetNumberOfTrials( G4int val )
{
if(IsLocked()) { return false; }
if(IsLocked()) { ReportLockError(__func__); return false; }
fNumberOfTrials = val;
return true;
}
@@ -91,13 +91,17 @@ G4bool G4TransportationParameters::SetNumberOfTrials( G4int val )
G4bool G4TransportationParameters::SetWarningEnergy( double val )
{
if(IsLocked()) { return false; }
if(IsLocked()) { ReportLockError(__func__); return false; }
fWarningEnergy = val;
// Consistency check -- and trial fix
if( fWarningEnergy > fImportantEnergy )
if( fWarningEnergy > fImportantEnergy ) {
G4cerr << "G4TransportationParameters::GetWarningEnergy enforcing warning-E <= important-E "
<< " resetting important energy from " << fImportantEnergy
<< " to " << val << G4endl;
// "Enforcing Important Energy >= Warning Energy"
fImportantEnergy = fWarningEnergy;
}
return true;
}
@@ -105,16 +109,77 @@ G4bool G4TransportationParameters::SetWarningEnergy( double val )
G4bool G4TransportationParameters::SetImportantEnergy( double val )
{
if(IsLocked()) { return false; }
if(IsLocked()) { ReportLockError(__func__); return false; }
fImportantEnergy = val;
// Consistency check -- and trial fix
if( fImportantEnergy < fWarningEnergy )
if( fImportantEnergy < fWarningEnergy ) {
G4String mthd= G4String("G4TransportationParameters")+G4String(__func__);
G4ExceptionDescription ed;
ed<<"enforcing hierarchy (warning-E <= important-E): resetting important"
<<" energy from " << fImportantEnergy << " to " << val << G4endl;
G4Exception( mthd, "Enforcing Warning Energy <= Important Energy",
JustWarning, ed );
fWarningEnergy = fImportantEnergy;
}
return true;
}
//------------------------------------------------------------------------------
G4bool G4TransportationParameters::SetWarningAndImportantEnergies( G4double warnE,
G4double importE )
{
if(IsLocked()) {
ReportLockError(__func__);
return false;
}
if( warnE <= importE )
{
fWarningEnergy = warnE;
fImportantEnergy = importE;
}
else
{
fWarningEnergy = importE;
fImportantEnergy = warnE;
G4String mthd= G4String("G4TransportationParameters")+G4String(__func__);
G4ExceptionDescription ed;
ed << "To enforce hierarchy (warning-E <= important-E): "
<< " using smaller value= " << importE << " as Warning Energy "
<< " and larger value= " << warnE << " as Important Energy." << G4endl;
G4Exception( mthd, "Enforcing Warning Energy <= Important Energy",
JustWarning, ed );
}
return true;
}
//------------------------------------------------------------------------------
void G4TransportationParameters::ReportLockError(G4String methodName, G4bool verbose) const
{
// Report Incompatible States: GeomClosed , EventProc, (also Quit, Abort)
G4String namesMethodClass= G4String("G4TransportationParameters") + methodName;
auto stateManager = G4StateManager::GetStateManager();
auto state = stateManager->GetCurrentState();
G4ExceptionDescription ed;
ed << "Cannot change values of G4TransportationParameters when G4State is "
<< stateManager->GetStateString(state) << G4endl;
ed << "Only the following Geant4 state are compatible: Pre_Init, Init and Idle." << G4endl;
if( verbose ) {
ed << G4endl << "Values remain as follows:" << G4endl;
StreamInfo( ed );
}
G4Exception( namesMethodClass,
"Locked, due to incompatible G4state: it not possible to change its parameters.",
JustWarning, ed );
}
//------------------------------------------------------------------------------
void G4TransportationParameters::StreamInfo(std::ostream& os) const
@@ -188,7 +253,7 @@ G4bool G4TransportationParameters::SetLowLooperThresholds() // Values for low-E
G4bool G4TransportationParameters::EnableUseOfMagneticMoment(G4bool useMoment)
{
if(IsLocked()) { return false; }
if(IsLocked()) { return false; }
fUseMagneticMoment= useMoment;
return true;
}