Skip to content

Commit

Permalink
Import Geant4 11.2.1 source tree
Browse files Browse the repository at this point in the history
  • Loading branch information
gcosmo committed Feb 16, 2024
1 parent 860a2b9 commit 57dce1b
Show file tree
Hide file tree
Showing 331 changed files with 41,997 additions and 44,239 deletions.
108 changes: 108 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# requires clang-format version 13.0+
---
AlignAfterOpenBracket: Align
# Instead ContinuationIndentWidth is used
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# Aligns \ symbols on the left; other options DontAlign, Left
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
# When declaring a function, parameters continue on the same line
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
# while (true) {} allowed
# if (a) return; is allowed
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: MultiLine
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBraces: Custom
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakInheritanceList: BeforeColon
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 100
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
FixNamespaceComments: true
IncludeBlocks: Regroup
# Priority is:
# 1. Geant4 headers in ""
# 1. Geant4 headers in "" that don't start with 'G4'
# 2. External package headers with extension in "" or <> (but _should_ be <>)
# 3. System headers (not exhaustive)
# Note order of regexes is important as they are matched in order
IncludeCategories:
- Regex: '^"G4.*\.hh"'
Priority: 1
- Regex: '^"(Randomize|globals)\.hh"'
Priority: 1
- Regex: '^"[[:alnum:]\/\-_.]+"'
Priority: 2
- Regex: '^<[a-z_]+>'
Priority: 3
- Regex: '^<[[:alnum:]\/.]+>'
Priority: 2
# Provides an extra indent level for public/protected/private sections
# without requiring excess indention and use of AccessModifierOffset
IndentAccessModifiers: true
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...
31 changes: 31 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# Minimal set of checks for Geant4
# - See CODING_GUIDELINES.rst for guidelines and instructions for use
# - Full list at https://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks: "-*, \
modernize-deprecated-headers, \
modernize-make-shared, \
modernize-make-unique, \
modernize-redundant-void-arg, \
modernize-use-auto, \
modernize-use-equals-default, \
modernize-use-nullptr, \
modernize-use-override, \
modernize-use-using, \
performance-faster-string-find, \
performance-for-range-copy, \
performance-inefficient-string-concatenation, \
performance-trivially-destructible, \
readability-delete-null-pointer, \
readability-duplicate-include, \
readability-string-compare"
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
- key: modernize-use-auto.RemoveStars
value: 'true'
- key: performance-faster-string-find.StringLikeClasses
value: 'G4String;::std::basic_string;::std::basic_string_view'
...
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ project(Geant4
HOMEPAGE_URL "https://geant4.cern.ch")
set(${PROJECT_NAME}_VERSION_MAJOR 11)
set(${PROJECT_NAME}_VERSION_MINOR 2)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")

# - Prepend our own CMake Modules to the search path
Expand Down
154 changes: 154 additions & 0 deletions ReleaseNotes/Patch.11.2-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@

Geant4 11.2 - patch-01 Release Notes
------------------------------------

16 February 2024

List of fixes included in this public patch since the public release 11.2.0:

o Configuration
-------------
+ CMake:
o Added -F flag on macOS with a framework build of Qt.
Addressing problem report #2589.
o Fixed detection of SoQt/Xt packages, by manually checking versions of
found packages. Geant4 only requires a minimum version.

o Geometry:
--------
+ solids/CSG:
o In wrapper G4UTrap, use GetThetaCosPhi() and GetThetaSinPhi() in
method GetVertices(); this overcomes a problem with trapezoid reported
in CMSSW after migration to VecGeom 1.2.6.
Also fixed typo in method SetAllParameters(), setter used in
parameterisation of shape dimensions.

o Global:
------
+ G4PhysicsModelCatalog: added ID for the Light-Ion QMD model.
+ Updated date and version for 11.2.1.

o Physics Lists:
-------------
+ constructors/electromagnetic
o G4GammaGeneralProcess: fixed sampling of muon pair production.
Addressing problem report #2543.
o G4EmStandardPhysics_option3: restore step limit type to use
'fUseDistanceToBoundary' and set default RangeFactor from 0.03 to 0.04,
fixing inaccuracy in medical benchmarks.
+ constructors/gamma_lepto_nuclear
o G4NeutrinoPhysics: fixed neutrino physics instantiation.
Addressing problem report #2594.

o Processes - Electromagnetic:
---------------------------
+ dna
o G4DNABornAngle: fixed numerical problem; added protection for cosTheta;
use relativistic formula for maximum energy transfer to delta-electrons.
+ loweneegy
o G4MicroElecInelasticModel_new: fixed Coverity report for memory leak at
exit. Minor code cleanup.
o G4MicroElecLOPhononModel: minor code cleanup.
+ standard
o G4IonICRU73Data: fix for the case when target material has an element
with Z>92; improved debug printouts. In the Lindhard-Sorensen model to
compute dEdx the first try is to take it from ICRU73 or ICRU90 data,
if this class returns zero, then dEdx is computed from G4GenericIon
and effective charge. Addressing problem report #2586.
+ utils
o G4VEmProcess, G4VEnergyLossProcess: minor CPU optimisation with
reduction of number of calls for log() of kinetic energy.
+ xrays
o G4GaussXTRadiator, G4VXTRenergyLoss: flexible summation in SpectralXTRdEdx;
clean-up in GetStackFactor() based on std::complex methods.
o In G4Scintillation::sample_time(), refactored the scintillation time
sampling.

o Processes - Hadronic:
--------------------
+ cross_sections
o G4KokoulinMuonNuclearXS: use faster interface to G4PhysicsVector.
o G4ElectroNuclearCrossSection: added low-energy limit of 100 MeV for
cross-section.
+ management
o G4HadronicProcess: explicitly define cross-section type per particle
type, this might provide some CPU speedup.
+ models/de_excitation
o G4FermiBreakUpVI, G4FermiFragmentsPoolVI: fix in production of fake
excited isomeres, by moving the check on lifetime limit to the Initialise()
method of the model, allowing to change this limit in an application;
do not consider decay chains with no final state.
Addressing problem report #2584.
o G4StatMFChannel: replaced use of C-arrays with std::vector, clearing
compilation warnings on gcc compiler when LTO settings are enabled.
+ models/lend
o Fixed compilation error on recent Windows VC++ compiler 17.8.3 for use
of std::isfinite(). Addressing problem report #2582.
o Fixed compilation warnings on gcc compiler when LTO settings are
enabled.
+ models/particle_hp
o G4ParticleHPFissionFS, G4ParticleHPFFFissionFS: added extra protections
against cases when fission data are not available for some isotopes.
Addressing problem #2590.
o G4ParticleHPFSFissionFS, G4ParticleHPFissionBaseFS: replaced use of
C-arrays with std::vector, clearing compilation warnings on gcc
compiler when LTO settings are enabled.
+ qmd
o Fixed model ID (model_LightIonQMDModel) in G4LightIonQMDReaction.
+ radioactive_decay
o G4Radioactivation: added DBL_EPSILON check on transition energy for
metastables to prevent creation of zero energy levels which have no
decay products.
o G4BetaPlusDecay, G4BetaMinusDecay: fixed sampling algorithm.
Addressing problem report #2588.

o Run:
---
+ Correctly report number of threads from G4TaskRunManager.

o Tracking:
--------
+ G4TrackingMessenger: fixed Coverity report for memory leak at exit,
by moving static thread-local variable to become class member, as
G4TrackingManager and its messenger are thread-local by nature.

o Examples:
--------
+ basic/B2
o Updated PrimaryGeneratorAction::GeneratePrimaries() in B2a and B2b
examples to avoid placing of the initial position on the world
boundary. Updated READMEs.
+ extended/electromagnetic/TestEm1
o Updated initial gun position in PrimaryGeneratorAction to not lay on
the world volume surface.
+ extended/electromagnetic/TestEm5
o Updated initial gun position in PrimaryGeneratorAction to not lay on
the world volume surface.
o In TrackingAction, added a protection against potential wrong argument
to std::acos(), rarely happening for very high energy projectile
particles.
+ extended/electromagnetic/TestEm11
o Updated initial gun position in PrimaryGeneratorAction to not lay on
the world volume surface.
+ extended/electromagnetic/TestEm16
o Updated READMEs to document all macros.
+ extended/medical/dna/neuron
o Cleanup to reduce number of Valgrind warnings; applied coding style
recommendations; removed commented lines, removed unused methods;
substituted C-arrays with vectors; improved algorithm of reading of
data file.

----------------------------------------------------------------------------

Technical Notes
---------------

o This patch should be applied on top of release 11.2 series.
o Technical notes distributed for release 11.2 are also applicable and
valid for this patch.

The code and rebuilt binary libraries for release 11.2.1 are available
through the Geant4 "Download" Web page.

Please refer to the Geant4 User Documentation for further information about
using Geant4.
9 changes: 9 additions & 0 deletions cmake/History
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!

-------------------------------------------------------------------------------

## 2024-01-29 Ben Morgan (cmake-V11-01-32)
- Manually check versions of found SoXX packages to workaround their use of
the `ExactVersionOnly` version checking strategy in find_package. Geant4
only requires a minimum version.

## 2024-01-26 Ben Morgan (cmake-V11-01-31)
- Add -F flag for Qt when on macOS and with a framework build of Qt
- Addresses [Bugzilla 2589](https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2589)

## 2023-11-28 Ben Morgan (cmake-V11-01-30)
- Bump minimum VecGeom version to 1.2.6

Expand Down
3 changes: 3 additions & 0 deletions cmake/Modules/G4ConfigurePkgConfigHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ if(NOT GEANT4_BUILD_GRANULAR_LIBS)
set(G4_QT_CFLAGS "${G4_QT_CFLAGS} -I${_dir}")
endforeach()

if(APPLE AND G4_QT_CFLAGS MATCHES "QtCore\.framework")
set(G4_QT_CFLAGS "${G4_QT_CFLAGS} -F${G4QTLIBPATH}")
endif()
else()
set(G4_BUILTWITH_QT "no")
endif()
Expand Down
14 changes: 13 additions & 1 deletion cmake/Modules/G4InterfaceOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,28 @@ if(GEANT4_USE_INVENTOR)
find_package(Coin 4.0.0 REQUIRED)
geant4_save_package_variables(Inventor Coin_DIR)

# Helper to hand-check version because SoXXX use an exact version strategy
# in their CMake config files
function(check_sobind_version _binding _minversion)
if(${_binding}_VERSION VERSION_LESS "${_minversion}")
message(FATAL_ERROR "Found ${_binding}, version: ${${_binding}_VERSION}, but Geant4 requires versions >= ${_minversion}\n"
"${_binding} found at:\n ${${_binding}_DIR}\n")
endif()
endfunction()

if(GEANT4_USE_INVENTOR_QT)
find_package(SoQt 1.6.0 REQUIRED)
find_package(SoQt REQUIRED)
check_sobind_version(SoQt 1.6.0)
geant4_save_package_variables(Inventor SoQt_DIR)
else()
if(UNIX)
find_package(SoXt 1.4.0 REQUIRED)
check_sobind_version(SoXt 1.4.0)
geant4_save_package_variables(Inventor SoXt_DIR)
set(GEANT4_USE_INVENTOR_XT ON)
elseif(WIN32)
find_package(SoWin 1.4.0 REQUIRED)
check_sobind_version(SoWin 1.4.0)
geant4_save_package_variables(Inventor SoWin_DIR)
set(GEANT4_USE_INVENTOR_WIN ON)
endif()
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced/CaTS/CaTS.out
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo


**************************************************************
Geant4 version Name: geant4-11-02-ref-00 (8-December-2023)
Geant4 version Name: geant4-11-02-patch-01 (16-February-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
Expand Down Expand Up @@ -778,4 +778,4 @@ Correlated gamma emission flag 0
Max 2J for sampling of angular correlations 10
=======================================================================
writing Event: 0
TimeTotal> 25.213 2.830
TimeTotal> 16.268 2.600
Loading

0 comments on commit 57dce1b

Please sign in to comment.