Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
@@ -1,8 +1,13 @@
# Example molcounter-basic 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
=========================================================
-------------------------------------------------------------------------------
## 2025-11-10 G Cosmo (molcounter-basic-V11-03-03)
- Fixed coding conventions for tabs in MoleculeCounter source.
## 2025-05-28 H Tran (molcounter-basic-V11-03-02)
- Fixed warning in windows
@@ -1,103 +0,0 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
*** molcounters/basic example ***
Author: C. Velten \
Date: 7 April 2025 \
Email: cv2415@columbia.edu
(c) The Geant4-DNA collaboration.
This example shows how to use the new molecule counter manager
system and how to write custom molecule counters.
This example is provided by the Geant4-DNA collaboration.
The custom (spatially-aware) molecule counter used here
is further described in:
- Radiat. Phys. Chem. 212 (2023) 111194 \
doi:10.1016/j.radphyschem.2023.111194
Any report or published results obtained using the Geant4-DNA software shall
cite the following Geant4-DNA collaboration publications:
- Med. Phys. 51 (2024) 58735889
- Med. Phys. 45 (2018) e722-e739
- Phys. Med. 31 (2015) 861-874
- Med. Phys. 37 (2010) 4692-4708
- Int. J. Model. Simul. Sci. Comput. 1 (2010) 157178
### Description:
1. __Geometry__:
A box of liquid water with a 8 µm (radius) spherical cell placed at its center.
The cell contains a 4 µm (radius) nucleus and 100 mitochondria.
2. __Incident particles__:
Electrons with 1 keV energy, which can be changed in
the simple_sbs.ini macro file.
They are shot from the center of the box (inside the nucleus).
3. __Physics__:
The default Geant4-DNA physics constructor 2 is used in
the PhysicsList class with chemistry constructor 3.
4. __Molecule Counters__:
Counters are defined and registered in the ActionInitialization
class for master & workers using the BuildMoleculeCounters(), and
BuildMultipleAndCustomMoleculeCounters() methods.
To switch between either of these methods, change the
boolean value of fBuildMultipleAndCustomMoleculeCounters in
ActionInitialization.hh.
By default, the molecule counter manager will accumulate counts from
worker instances into the master instance. To facilitate this the user
__must__ create a `UserEventAction` and `UserRunAction` and override
the `(Begin|End)Of(Event|Run)Action` methods and call the corresponding
method on the `G4DNAChemistryManager::Instance()`. See the example's
`EventAction.hh` and `RunAction.(hh|cc)` on how to do this. \
__Default Method: `BuildMoleculeCounters()`:__
* Reset counters before each run but not keep counter values between events
* Register a default `G4MoleculeCounter` instance called "Molecules"
* Register a default `G4MoleculeReactionCounter` instance called "Reactions"
__Alternative Method: `BuildMultipleAndCustomMoleculeCounters()`:__
* Reset counters before each run but not keep counter values between events
* Register a `G4MoleculeCounter` instance called "BasicCounter":
* set its time precision to 25 ps
* Register a `G4MoleculeCounter` instance called "BasicCounter_Restricted":
* set its time precision to 25 ps
* activate the counter for global times in [500 ps, 10 ns]
* Register a `G4MoleculeCounter` instance called "BasicCounter_VariablePrecision":
* set its time precision to vary with global time:
```
<= 10 ps: 5 ps
<= 100 ps: 50 ps
<= 1 ns: 0.5 ns
<= 1 µs: 50 ns
```
* activate the counter for global times in [500 ps, 10 ns]
* Register a custom `MoleculeCounter` instance called "MoleculeCounter"
* set its time precision to vary with global time:
```
<= 10 ps: 5 ps
<= 100 ps: 50 ps
<= 1 ns: 0.5 ns
<= 1 µs: 50 ns
```
* __(important)__ `SetSensitiveToStepping(true)` to change molecule count when traversing geometry boundaries
* `SetIgnoreMoleculePosition(false)` if set to `true` the counter behaves like `G4MoleculeCounter`
* `SetNegativeCountsAreFatal(true)` to throw a FatalException if any molecule count drops below 0 through misregistration
* Register a `G4MoleculeReactionCounter` instance called "Reactions":
* set its time precision to 50 ps
* activate the counter for global times in [0 ps, 1 µs]
5. __Execute__ the code by running:
`./molcounters_basic [simple_sbs.in,simple_irt_syn_react.in]`
The `simple_sbs.in` macro __only__ includes molecule transport (diffusion)!
6. __Output__: Contents of the molecule counters are dumped to `stdout`
at the end of each run by the RunAction::EndOfRunAction()
@@ -1,10 +1,6 @@
\page Examplebasic Example basic
///\file "medical/dna/molcounters/basic/.README.txt"
///\brief Example molcounters basic README page
/*! \page Examplebasic Example basic
\ This example is provided by the Geant4-DNA collaboration
This molecule counter basic example is provided by the Geant4-DNA collaboration
(http://geant4-dna.org).
The custom (spatially-aware) molecule counter used here
@@ -23,32 +19,37 @@ doi:10.1016/j.radphyschem.2023.111194
\Description:
\section 1. __Geometry__:
## Geometry
A box of liquid water with a 8 µm (radius) spherical cell placed at its center.
The cell contains a 4 µm (radius) nucleus and 100 mitochondria.
\section2. __Incident particles__:
## Particles
Electrons with 1 keV energy, which can be changed in
the simple_sbs.ini macro file.
They are shot from the center of the box (inside the nucleus).
\section3. __Physics__:
## Physics
The default Geant4-DNA physics constructor 2 is used in
the PhysicsList class with chemistry constructor 3.
\section4. __Molecule Counters__:
## Counters
Counters are defined and registered in the ActionInitialization
class for master & workers using the BuildMoleculeCounters(), and
BuildMultipleAndCustomMoleculeCounters() methods.
To switch between either of these methods, change the
boolean value of fBuildMultipleAndCustomMoleculeCounters in
ActionInitialization.hh.
By default, the molecule counter manager will accumulate counts from
worker instances into the master instance. To facilitate this the user
__must__ create a `UserEventAction` and `UserRunAction` and override
the `(Begin|End)Of(Event|Run)Action` methods and call the corresponding
method on the `G4DNAChemistryManager::Instance()`. See the example's
`EventAction.hh` and `RunAction.(hh|cc)` on how to do this. \
`EventAction.hh` and `RunAction.(hh|cc)` on how to do this.
__Default Method: `BuildMoleculeCounters()`:__
* Reset counters before each run but not keep counter values between events
@@ -87,9 +88,13 @@ method on the `G4DNAChemistryManager::Instance()`. See the example's
* set its time precision to 50 ps
* activate the counter for global times in [0 ps, 1 µs]
\section5. __Execute__ the code by running:
`./molcounters_basic [simple_sbs.in,simple_irt_syn_react.in]`
## Execute the code by running:
```
./molcounters_basic [simple_sbs.in,simple_irt_syn_react.in]
```
The `simple_sbs.in` macro __only__ includes molecule transport (diffusion)!
\section6. __Output__: Contents of the molecule counters are dumped to `stdout`
Contents of the molecule counters are dumped to `stdout`
at the end of each run by the RunAction::EndOfRunAction()
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ChemistrySteppingAction.hh
/// \brief Definition of the ChemistrySteppingAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ChemistryTrackingManager.hh
/// \brief Definition of the ChemistryTrackingManager class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file EventAction.hh
/// \brief Definition of the EventAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file MoleculeCounter.hh
/// \brief Definition of the MoleculeCounter class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PhysicsList.hh
/// \brief Definition of the PhysicsList class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file StackingAction.hh
/// \brief Definition of the StackingAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file molcounters_basic.cc
/// \brief Main program of the molcounters/basic example
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
File diff suppressed because it is too large Load Diff
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -45,6 +48,7 @@
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "StackingAction.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAChemistryManager.hh"
#include "G4H2O.hh"
@@ -186,4 +190,4 @@ void ActionInitialization::BuildMultipleAndCustomMoleculeCounters() const
G4MoleculeCounterManager::Instance()->RegisterCounter(std::move(counter));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ChemistrySteppingAction.cc
/// \brief Implementation of the ChemistrySteppingAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ChemistryTrackingManager.cc
/// \brief Implementation of the ChemistryTrackingManager class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file MoleculeCounter.cc
/// \brief Implementation of the MoleculeCounter class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -80,8 +83,8 @@ std::unique_ptr<G4VMoleculeCounterIndex> MoleculeCounter::BuildIndex(const G4Tra
if (touchable == nullptr) touchable = aTrack->GetTouchable();
if (touchable == nullptr) {
auto touchableHandle = G4MoleculeLocator::Instance()->LocateMoleculeTrack(aTrack);
touchable = touchableHandle();
auto touchableHandle = G4MoleculeLocator::Instance()->LocateMoleculeTrack(aTrack);
touchable = touchableHandle();
}
if (touchable == nullptr) { // still not found -- should never fire
G4ExceptionDescription errMsg;
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PhysicsList.cc
/// \brief Implementation of the PhysicsList class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file StackingAction.cc
/// \brief Implementation of the StackingAction class
// The `molcounters` example(s) are provided as part of Geant4-DNA
// and any report or published result obtained using it shall cite
// the respective Geant4-DNA collaboration publications.