Import Geant4 11.2.2 source tree

This commit is contained in:
Gabriele Cosmo
2024-06-21 15:46:33 +02:00
parent dda54bbdcf
commit f7b23877ed
411 changed files with 22817 additions and 21317 deletions
@@ -29,12 +29,13 @@
#ifndef G4GMAKE
#include "G4FindDataDir.hh"
#include "G4Filesystem.hh"
#include "G4Exception.hh"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#if defined(_MSC_VER)
#if defined(_WIN32)
#define setenv(name, value, overwrite) _putenv_s(name, value)
#endif
@@ -91,7 +92,7 @@ static const char* G4FindDataDir(const char* name, const path& prefix, const pat
}
const char* G4FindDataDir(const char* name)
{
{
#if defined(G4MULTITHREADED)
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
@@ -104,8 +105,12 @@ const char* G4FindDataDir(const char* name)
/* If we know which directory/version to search for, try to find it */
if (const char *dataset = G4GetDataDir(name)) {
/* If GEANT4_DATA_DIR environment variable is set, use it and don't search further */
if (const char *basedir = std::getenv("GEANT4_DATA_DIR"))
return G4FindDataDir(name, basedir, dataset);
if (const char *basedir = std::getenv("GEANT4_DATA_DIR")) {
if (is_directory(basedir)) return G4FindDataDir(name, basedir, dataset);
G4Exception("G4FindDataDir", "Invalid GEANT4_DATA_DIR", JustWarning, "The GEANT4_DATA_DIR environment variable points to an invalid directory.\n"
"Will try fallback locations now. Correct the variable to disable this behaviour.");
}
/* If GEANT4_DATA_DIR environment variable is not set, search in default system paths */
for (const auto prefix : system_paths)
@@ -377,7 +377,7 @@ void G4PhysicsModelCatalog::Initialize() {
// --- Low-energy data-driven : 25'000 - 25'999 ---
// ------------------------------------------------
// - 25'000 - 25'199 : ParticleHP
// - 25'200 - 25'200 : LEND
// - 25'200 - 25'299 : LEND
// ...
// - 25'500 - 25'999 : RadioactiveDecay
@@ -585,7 +585,7 @@ void G4PhysicsModelCatalog::Initialize() {
// --- Others ... ---
// ======================================================================
// ================== 4th MODELS ADDED AFTER Geant4 11 ==================
// ================== 4th MODELS ADDED AFTER Geant4 11.0 ================
// ======================================================================
// PLEASE ADD MODELS ONLY BELOW HERE, WITH PROPER modelID .
// IF YOU ARE NOT SURE, PLEASE CONTACT ONE OF THE COORDINATORS OF THE
@@ -684,12 +684,14 @@ const G4String G4PhysicsModelCatalog::GetModelNameFromID( const G4int modelID )
// --------------------------------------------------------------------------
const G4String G4PhysicsModelCatalog::GetModelNameFromIndex( const G4int modelIndex ) {
return ( modelIndex >= 0 && modelIndex < Entries() ) ? (*theVectorOfModelNames)[ modelIndex ] : "Undefined";
return ( modelIndex >= 0 && modelIndex < Entries() )
? (*theVectorOfModelNames)[ modelIndex ] : G4String("Undefined");
}
// --------------------------------------------------------------------------
G4int G4PhysicsModelCatalog::GetModelID( const G4int modelIndex ) {
return ( modelIndex >= 0 && modelIndex < Entries() ) ? (*theVectorOfModelIDs)[ modelIndex ] : -1;
return ( modelIndex >= 0 && modelIndex < Entries() )
? (*theVectorOfModelIDs)[ modelIndex ] : -1;
}
// --------------------------------------------------------------------------
+2 -2
View File
@@ -34,8 +34,8 @@
#include "G4AutoLock.hh"
#include "globals.hh"
#if defined(WIN32) || defined(__MINGW32__)
# include <Windows.h>
#if defined(_WIN32)
# include <windows.h>
#else
# include <sys/syscall.h>
# include <sys/types.h>