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
+23 -9
View File
@@ -21,13 +21,27 @@ add_subdirectory(management)
# Geant4 global library
if(NOT GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GLOBAL_LIBRARY_TARGET(NAME G4global
COMPONENTS
HEPGeometry/sources.cmake
HEPNumerics/sources.cmake
HEPRandom/sources.cmake
management/sources.cmake
)
endif()
include(Geant4MacroLibraryTargets)
GEANT4_GLOBAL_LIBRARY_TARGET(NAME G4global
COMPONENTS
HEPGeometry/sources.cmake
HEPNumerics/sources.cmake
HEPRandom/sources.cmake
management/sources.cmake
)
# Temp hack to get "G4GlobalConfig.hh" generated header in include
# path for dependent targets
# TODO: Remove once migration to new module/library system in place.
# This will automatically set include paths
if(TARGET G4global)
target_include_directories(G4global PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
)
endif()
if(TARGET G4global-static)
target_include_directories(G4global-static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
)
endif()
endif()
@@ -50,6 +50,9 @@ class G4StatDouble
virtual ~G4StatDouble();
public:
G4StatDouble(const G4StatDouble&) = default;
G4StatDouble& operator=(const G4double &rhs)
{
reset();
+51 -5
View File
@@ -16,14 +16,60 @@ committal in the SVN repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
March 13, 2019 Gabriele Cosmo (global-V10-04-32)
June 17, 2019 Gabriele Cosmo (global-V10-05-10)
- Updated date and tag-ID for geant4-10-05-ref-06.
May 28, 2019 Gabriele Cosmo (global-V10-05-09)
- Updated date and tag-ID for geant4-10-05-ref-05.
May 20, 2019 Gabriele Cosmo (global-V10-05-08)
- Defined default move constructor and move assignment operator for G4String
and G4DataVector.
May 16, 2019 Gabriele Cosmo (global-V10-05-07)
- Defaulted copy constructor for G4StatDouble, to fix compilation warnings
on gcc-9.1.
April 27, 2019 Gabriele Cosmo (global-V10-05-06)
- Updated date and tag-ID for geant4-10-05-ref-04.
April 25, 2019 Ben Morgan (global-V10-05-05)
- DEV-250: Add G4GlobalConfig.hh generated header to hold global, always
required, preprocessor symbols instead of relying on -D flags.
- G4USE_STD11
- G4MULTITHREADED
- G4_STORE_TRAJECTORY
- G4VERBOSE
- GEANT4_USE_TIMEMORY
- Add inclusion of G4GlobalConfig.hh in G4Types.hh, tls.hh and
G4TiMemory.hh so that global and other categories pick up
the definitions transparently. Protect inclusion so that
only CMake builds use this header
- Update other headers/srcs to include G4Types/G4Threading if
they use G4MULTITHREADED
- Uses cmake-V10-05-02
March 29, 2019 Gabriele Cosmo (global-V10-05-04)
- Updated date and tag-ID for geant4-10-05-ref-03.
March 17, 2019 Mihaly Novak (global-V10-05-03)
- G4PhysicsVector: adding additional public Value() method option to propagate
down the known log-energy value (can avoid the log call in case of log-vector)
- templates: new LOG_EKIN_MIN constant as value taken incase of zero kin-energy.
March 13, 2019 Gabriele Cosmo (global-V10-05-02)
- Enable FPE detection on MacOS with clang.
Addressing problem report #2147.
- Changed ID for release 10.5.p01.
January 31, 2019 Ivana Hrivnacova
February 28, 2019 Gabriele Cosmo
- Updated date and tag-ID for geant4-10-05-ref-02.
January 31, 2019 Ivana Hrivnacova (global-V10-05-01)
- Merged GitHub PR #4: all Boolean operators now return G4bool.
January 30, 2019 Gabriele Cosmo (global-V10-05-00)
- Updated date and tag-ID for geant4-10-05-ref-01.
November 26, 2018 Gabriele Cosmo (global-V10-04-31)
- G4Cache, G4CacheDetails: minor code cleanup and formatting.
@@ -1729,8 +1775,8 @@ June 17, 2003 G.Cosmo (global-V05-02-00)
June 6, 2003 G.Cosmo (global-V05-01-01)
- Made g4std wrappers obsolete:
o modified wrappers to include standard std headers
o replaced all occurences of G4std:: with std::
o replaced all occurences of
o replaced all occurrences of G4std:: with std::
o replaced all occurrences of
#include "g4std/XXX"
with
#include <XXX>
@@ -54,6 +54,10 @@ class G4DataVector : public std::vector<G4double>
G4DataVector();
// Default constructor.
G4DataVector(const G4DataVector&) = default;
G4DataVector(G4DataVector&&) = default;
// Default copy&move constructors.
explicit G4DataVector(size_t cap);
// Constructor given a 'capacity' defining the initial number of elements.
@@ -64,6 +68,10 @@ class G4DataVector : public std::vector<G4double>
virtual ~G4DataVector();
// Empty destructor
G4DataVector& operator=(const G4DataVector &) = default;
G4DataVector& operator=(G4DataVector &&) = default;
// Default copy&move assignment operators.
inline void insertAt(size_t, const G4double&);
// Insert an element at given position
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//! \file G4GlobalConfig.hh
//! \brief Public global preprocessor defines
#ifndef G4GLOBALCONFIG_HH
#define G4GLOBALCONFIG_HH
//! \def G4MULTITHREADED
//! \brief Defined if Geant4 is built with Multithreading support
#cmakedefine G4MULTITHREADED
//! \def G4_STORE_TRAJECTORY
//! \brief Defined if Geant4 is built with trajectory storage
#cmakedefine G4_STORE_TRAJECTORY
//! \def G4VERBOSE
//! \brief Defined if Geant4 is built with additional verbosity in logging
#cmakedefine G4VERBOSE
//! \def G4USE_STD11
//! \brief Defined if the C++11 standard or newer is in use
//! \deprecated Geant4 requires C++11 or later, so this should no longer be used
#define G4USE_STD11
//! \def GEANT4_USE_TIMEMORY
//! \brief Defined if Geant4 built with TiMemory support
#cmakedefine GEANT4_USE_TIMEMORY
#endif // G4GLOBALCONFIG_HH
@@ -56,6 +56,8 @@
// 16 Aug. 2011 H.Kurashige : Add dBin, baseBin and verboseLevel
// 02 Oct. 2013 V.Ivanchenko : FindBinLocation method become inlined;
// instead of G4Pow G4Log is used
// 15 Mar. 2019 M.Novak : added Value method with the known log-energy value
// that can avoid the log call in case of log-vectors
//---------------------------------------------------------------
#ifndef G4PhysicsVector_h
@@ -91,6 +93,12 @@ class G4PhysicsVector
// the value. Consumer code got changed index and may reuse it
// for the next call to save CPU for bin location.
G4double Value(G4double theEnergy, G4double theLogEnergy,
size_t& lastidx) const;
// Same as Value() above, with the additional log-kinetic energy input
// argument that can be used for faster index computation in case of
// log-vectors.
inline G4double Value(G4double theEnergy) const;
// Get the cross-section/energy-loss value corresponding to the
// given energy. An appropriate interpolation is used to calculate
@@ -98,6 +106,11 @@ class G4PhysicsVector
// it should be used instead of the previous method if bin location
// cannot be kept thread safe
inline G4double Value(G4double theEnergy, G4double theLogEnergy) const;
// Same as Value() above with the additional log-kinetic energy input
// argument that can be used for faster index computation in case of
// log-vectors.
inline G4double GetValue(G4double theEnergy, G4bool& isOutRange) const;
// Obsolete method to get value, isOutRange is not used anymore.
// This method is kept for the compatibility reason.
@@ -150,6 +163,10 @@ class G4PhysicsVector
// min value 0, max value VectorLength-1
// idx is suggested bin number from user code
inline size_t FindBin(G4double energy, G4double logener, size_t idx) const;
// Same as FindBin() above with the additional logenergy input argument
// that can be used for faster index computation in case of log-vectors.
void FillSecondDerivatives();
// Initialise second derivatives for spline keeping
// 3d derivative continues - default algorithm
@@ -193,6 +210,8 @@ class G4PhysicsVector
inline void SetVerboseLevel(G4int value);
inline G4double Interpolation(size_t idx, G4double energy) const;
protected:
void DeleteData();
@@ -223,12 +242,16 @@ class G4PhysicsVector
inline G4double SplineInterpolation(size_t idx, G4double energy) const;
// Spline interpolation function
inline G4double Interpolation(size_t idx, G4double energy) const;
inline size_t FindBinLocation(G4double theEnergy) const;
// find low edge index of a bin for given energy
// min value 0, max value VectorLength-1
inline size_t FindBinLocation(G4double theEnergy,
G4double theLogEnergy) const;
// same as FindBinLocation() above with the additional log-energy input
// argument that can be used for faster index computations in case of
// log-vectors.
G4bool useSpline;
protected:
@@ -209,6 +209,27 @@ size_t G4PhysicsVector::FindBinLocation(G4double theEnergy) const
return std::min(bin, numberOfNodes-2);
}
//---------------------------------------------------------------
inline
size_t G4PhysicsVector::FindBinLocation(G4double theEnergy,
G4double theLogEnergy) const
{
size_t bin;
const G4double ex = (type==T_G4PhysicsLogVector) ? theLogEnergy : theEnergy;
if(type == T_G4PhysicsLogVector || type == T_G4PhysicsLinearVector) {
bin = size_t(ex/dBin - baseBin);
if(bin > 0 && theEnergy < binVector[bin]) { --bin; }
else if(theEnergy > binVector[bin+1]) { ++bin; }
} else {
// Bin location proposed by K.Genser (FNAL)
bin = std::lower_bound(binVector.begin(), binVector.end(), theEnergy)
- binVector.begin() - 1;
}
return std::min(bin, numberOfNodes-2);
}
//---------------------------------------------------------------
inline size_t G4PhysicsVector::FindBin(G4double e, size_t idx) const
@@ -227,6 +248,23 @@ inline size_t G4PhysicsVector::FindBin(G4double e, size_t idx) const
//---------------------------------------------------------------
inline
size_t G4PhysicsVector::FindBin(G4double e, G4double loge, size_t idx) const
{
size_t id = idx;
if(e < binVector[1]) {
id = 0;
} else if(e >= binVector[numberOfNodes-2]) {
id = numberOfNodes - 2;
} else if(idx >= numberOfNodes || e < binVector[idx]
|| e > binVector[idx+1]) {
id = FindBinLocation(e, loge);
}
return id;
}
//---------------------------------------------------------------
inline
G4double G4PhysicsVector::Value(G4double theEnergy) const
{
@@ -234,6 +272,14 @@ inline
return Value(theEnergy, idx);
}
//---------------------------------------------------------------
inline
G4double G4PhysicsVector::Value(G4double theEnergy, G4double theLogEnergy) const
{
size_t idx=0;
return Value(theEnergy, theLogEnergy, idx);
}
//---------------------------------------------------------------
inline
@@ -69,12 +69,11 @@ public: // with description
inline G4ReferenceCountedHandle( const G4ReferenceCountedHandle<X>& right );
// Copy constructor.
inline ~G4ReferenceCountedHandle();
// Destructor.
inline G4ReferenceCountedHandle<X>&
operator =( const G4ReferenceCountedHandle<X>& right );
inline G4ReferenceCountedHandle<X>& operator =( const G4ReferenceCountedHandle<X>& right );
// Assignment operator by reference.
inline G4ReferenceCountedHandle<X>& operator =( X* objPtr );
@@ -71,11 +71,13 @@ public:
inline G4String ( const char *, str_size );
inline G4String ( const G4String& );
inline G4String ( const std::string & );
inline G4String ( G4String&& ) = default;
~G4String () {}
inline G4String& operator=(const G4String&);
inline G4String& operator=(const std::string &);
inline G4String& operator=(const char*);
inline G4String& operator=(G4String&&) = default;
inline char operator () (str_size) const;
inline char& operator () (str_size);
@@ -35,6 +35,11 @@
#ifndef g4timemory_hh_
#define g4timemory_hh_
// Fundamental definitions
#ifndef G4GMAKE
#include "G4GlobalConfig.hh"
#endif
#include "globals.hh"
//----------------------------------------------------------------------------//
@@ -32,6 +32,11 @@
#ifndef G4TYPES_HH
#define G4TYPES_HH
// Fundamental definitions
#ifndef G4GMAKE
#include "G4GlobalConfig.hh"
#endif
#ifdef WIN32
// Disable warning C4786 on WIN32 architectures:
// identifier was truncated to '255' characters
@@ -39,27 +39,28 @@
// - The meaning of each digit is as follows;
//
// 711
// |--> major version number
// |--> major version number
// |--> minor version number
// |--> patch number
#ifndef G4VERSION_NUMBER
#define G4VERSION_NUMBER 1051
#define G4VERSION_NUMBER 1060
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-10-05-patch-01 $"
#define G4VERSION_TAG "$Name: geant4-10-06-beta-01 $"
#endif
// as variables
#include "G4Types.hh"
#include "G4String.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-10-05-patch-01 [MT]$";
static const G4String G4Version = "$Name: geant4-10-06-beta-01 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-10-05-patch-01 $";
static const G4String G4Version = "$Name: geant4-10-06-beta-01 $";
#endif
static const G4String G4Date = "(17-April-2019)";
static const G4String G4Date = "(28-June-2019)";
#endif
@@ -114,6 +114,10 @@ typedef float Float;
#define INT_MIN std::numeric_limits<int>::min() // -2147483648
#endif
#ifndef LOG_EKIN_MIN /* Min value of the natural logarithm of kin. energy. */
#define LOG_EKIN_MIN -30
#endif
//---------------------------------
template <class T>
+7 -2
View File
@@ -28,7 +28,12 @@
// History:
// 01.10.2012 G.Cosmo - Created
// Fundamental definitions
#ifndef G4GMAKE
#include "G4GlobalConfig.hh"
#endif
#ifndef G4_TLS
#define G4_TLS
@@ -65,7 +70,7 @@
#endif
#else
# define G4ThreadLocalStatic static
# define G4ThreadLocal
# define G4ThreadLocal
#endif
#endif
+21
View File
@@ -20,12 +20,33 @@ include_directories(${TiMemory_INCLUDE_DIRS})
# List internal includes needed.
# Configure header for preprocessor symbols
#
# Convert CMake variables -> #cmakedefine symbols here for now
# Could be done in cmake category as well, but it's here we control
# the actual names of the definitions
set(G4MULTITHREADED ${GEANT4_BUILD_MULTITHREADED})
set(G4_STORE_TRAJECTORY ${GEANT4_BUILD_STORE_TRAJECTORY})
set(G4VERBOSE ${GEANT4_BUILD_VERBOSE_CODE})
configure_file(${CMAKE_CURRENT_LIST_DIR}/include/G4GlobalConfig.hh.in
${CMAKE_CURRENT_BINARY_DIR}/include/G4GlobalConfig.hh
)
# WORKAROUND: When building/testing examples uing ROOT, ROOT's
# dictionary generation is not smart enough to handle target usage
# requirements for include paths. Explicitly add the path to the
# generated header into build time include paths...
set_property(GLOBAL APPEND
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include")
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4globman
HEADERS
${CMAKE_CURRENT_BINARY_DIR}/include/G4GlobalConfig.hh
globals.hh
templates.hh
tls.hh
@@ -28,17 +28,15 @@
#include "G4PhysicsModelCatalog.hh"
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#endif
modelCatalog* G4PhysicsModelCatalog::catalog = 0;
G4PhysicsModelCatalog::G4PhysicsModelCatalog()
{ if(!catalog) {
{ if(!catalog) {
static modelCatalog catal;
catalog = &catal;
}
catalog = &catal;
}
}
G4PhysicsModelCatalog::~G4PhysicsModelCatalog()
@@ -57,21 +55,21 @@ G4int G4PhysicsModelCatalog::Register(const G4String& name)
return catalog->size()-1;
}
const G4String& G4PhysicsModelCatalog::GetModelName(G4int idx)
const G4String& G4PhysicsModelCatalog::GetModelName(G4int idx)
{
static const G4String undef = "Undefined";
if(idx>=0 && idx<Entries()) return (*catalog)[idx];
return undef;
}
G4int G4PhysicsModelCatalog::GetIndex(const G4String& name)
G4int G4PhysicsModelCatalog::GetIndex(const G4String& name)
{
for(G4int idx=0;idx<Entries();++idx)
{ if((*catalog)[idx]==name) return idx; }
return -1;
}
G4int G4PhysicsModelCatalog::Entries()
G4int G4PhysicsModelCatalog::Entries()
{ return (catalog) ? G4int(catalog->size()) : -1; }
void G4PhysicsModelCatalog::Destroy()
@@ -512,6 +512,25 @@ G4double G4PhysicsVector::Value(G4double theEnergy, size_t& lastIdx) const
//---------------------------------------------------------------
G4double G4PhysicsVector::Value(G4double theEnergy, G4double theLogEnergy,
size_t& lastIdx) const
{
G4double y;
if(theEnergy <= edgeMin) {
lastIdx = 0;
y = dataVector[0];
} else if(theEnergy >= edgeMax) {
lastIdx = numberOfNodes-1;
y = dataVector[lastIdx];
} else {
lastIdx = FindBin(theEnergy, theLogEnergy, lastIdx);
y = Interpolation(lastIdx, theEnergy);
}
return y;
}
//---------------------------------------------------------------
G4double G4PhysicsVector::FindLinearEnergy(G4double rand) const
{
if(1 >= numberOfNodes) { return 0.0; }
+16 -18
View File
@@ -37,17 +37,15 @@
//
// Modifications:
// 08.01.2011 V.Ivanchenko extended maxZ from 256 to 512
// 02.05.2013 V.Ivanchenko added expA and logX methods,
// 02.05.2013 V.Ivanchenko added expA and logX methods,
// revised A13, logA, powZ, powA to improved accuracy
// 23.03.2018 M.Novak increased accuracy of A13 on the most critical
// [1/4,4] interval by introducing a denser(0.25) grid
// [1/4,4] interval by introducing a denser(0.25) grid
//
// -------------------------------------------------------------------
#include "G4Pow.hh"
#ifdef G4MULTITHREADED
#include "G4Threading.hh"
#endif
G4Pow* G4Pow::fpInstance = 0;
@@ -67,17 +65,17 @@ G4Pow* G4Pow::GetInstance()
G4Pow::G4Pow()
: onethird(1.0/3.0), max2(5)
{
{
#ifdef G4MULTITHREADED
if(G4Threading::IsWorkerThread())
{
G4Exception ("G4Pow::G4Pow()", "InvalidSetup", FatalException,
{
G4Exception ("G4Pow::G4Pow()", "InvalidSetup", FatalException,
"Attempt to instantiate G4Pow in worker thread!");
}
#endif
const G4int maxZ = 512;
const G4int maxZfact = 170;
const G4int numLowA = 17;
const G4int maxZ = 512;
const G4int maxZfact = 170;
const G4int numLowA = 17;
maxA = -0.6 + maxZ;
maxLowA = 4.0;
@@ -101,8 +99,8 @@ G4Pow::G4Pow()
for(G4int i=1; i<=max2; ++i)
{
ener[i] = powN(500.,i);
logen[i]= G4Log(ener[i]);
ener[i] = powN(500.,i);
logen[i]= G4Log(ener[i]);
lz2[i] = G4Log(1.0 + i*0.2);
}
@@ -112,8 +110,8 @@ G4Pow::G4Pow()
pz13[i] = std::pow(x,onethird);
lz[i] = G4Log(x);
if(i < maxZfact)
{
f *= x;
{
f *= x;
fact[i] = f;
fexp[i] = G4Exp(0.5*i);
}
@@ -138,8 +136,8 @@ G4double G4Pow::A13(G4double A) const {
G4double res = 0.;
if (A>0.) {
const bool invert = (A<1.);
const G4double a = invert ? 1./A : A;
res = (a<maxLowA) ? A13Low(a, invert) : A13High(a, invert);
const G4double a = invert ? 1./A : A;
res = (a<maxLowA) ? A13Low(a, invert) : A13High(a, invert);
}
return res;
}
@@ -151,7 +149,7 @@ G4double G4Pow::A13High(const G4double a, const bool invert) const {
if (a<maxA) {
const G4int i = static_cast<G4int>(a+0.5);
const G4double x = (a/i-1.)*onethird;
res = pz13[i]*(1.+x-x*x*(1.-1.666667*x));
res = pz13[i]*(1.+x-x*x*(1.-1.666667*x));
} else {
res = G4Exp(G4Log(a)*onethird);
}
@@ -163,7 +161,7 @@ G4double G4Pow::A13High(const G4double a, const bool invert) const {
G4double G4Pow::A13Low(const G4double a, const bool invert) const {
G4double res;
const G4int i = static_cast<G4int>(4.*(a+0.125));
const G4int i = static_cast<G4int>(4.*(a+0.125));
const G4double y = 0.25*i;
const G4double x = (a/y-1.)*onethird;
res = lowa13[i]*(1.+x-x*x*(1.-1.666667*x));