Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
+4 -1
View File
@@ -25,11 +25,14 @@ Convergence tester provides statistical information
to assist establishing valid confidence intervals for Monte Carlo results for users.
Geometry and Physics are same to exampleB1. Please see \ref ExampleB1.
Also run1.mac and run2.mac are like in exampleB1, with the only diffrence slightly
increased number of events in run1.mac.
Note that in this example, the classes with the code added for
the purpose of demonstration of the Convergence Tester start with a prefix
the purpose of demonstration of the Convergence Tester are defined in the namespace
B1Con instead of B1 and also the executable and the test macro names are changed
in exampleB1Con and exampleB1Con.in.
Known problem:
Computing time of T cannot be gotten properly in current MT migration of example of B1Con. Therefore
FOM (=1/(R^2T) where R is relative error and T is computing time) relates numbers are unusable.
@@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.21)
cmake_minimum_required(VERSION 3.16...3.27)
project(B1Con)
#----------------------------------------------------------------------------
@@ -45,7 +45,6 @@ target_link_libraries(exampleB1Con ${Geant4_LIBRARIES})
set(EXAMPLEB1_SCRIPTS
exampleB1Con.in
exampleB1Con.out
init.mac
init_vis.mac
run1.mac
run2.mac
+13
View File
@@ -5,6 +5,19 @@ which **must** added in reverse chronological order (newest at the top). It must
be used as a substitute for writing good git commit messages!
## 2023-11-14 I. Hrivnacova (B1Con-V11-01-02)
- Fixes for Doxygen:
Move class description comments after namespace
## 2023-09-12 I. Hrivnacova (B1Con-V11-01-01)
- Removed unused files: init.mac, B1Run.hh, B1ConRun.hh
- Added description of run*.mac in README's
## 2023-07-03 I. Hrivnacova (B1Con-V11-01-00)
- Updated for changes in example B1 since creation of this example
- Added accumulable class for a vector of Edep per event
(not present in B1 example but needed here)
## 2021-12-10 Ben Morgan (B1Con-V11-00-00)
- Change to new Markdown History format
+3 -1
View File
@@ -18,8 +18,10 @@ Convergence tester provides statistical information
to assist establishing valid confidence intervals for Monte Carlo results for users.
Geometry and Physics are same to exampleB1. Please see README.B1
Also run1.mac and run2.mac are like in exampleB1, with the only diffrence slightly
increased number of events in run1.mac.
Note that in this example, the classes with the code added for
the purpose of demonstration of the Convergence Tester start with a prefix
the purpose of demonstration of the Convergence Tester are defined in the namespace
B1Con instead of B1 and also the executable and the test macro names are changed
in exampleB1Con and exampleB1Con.in.
+53 -48
View File
@@ -9,92 +9,97 @@
This example demonstrates a very simple application where an energy
deposit is accounted in user actions and their associated objects
and a dose in a selected volume is calculated.
and a dose in a selected volume is calculated.
1- GEOMETRY DEFINITION
The geometry is constructed in the B1DetectorConstruction class.
The geometry is constructed in the B1::DetectorConstruction class.
The setup consists of a an envelope of box shape containing two
volumes: a spherical cone and a trapezoid.
In this example we use some common materials materials for medical
applications. The envelope is made of water and the two inner volumes
are made from tissue and bone materials.
are made from tissue and bone materials.
The materials are created with the help of the G4NistManager class,
which allows to build a material from the NIST database using their
names. All available materials can be found in the Geant4 User's Guide
for Application Developers, Appendix 10: Geant4 Materials Database.
2- PHYSICS LIST
The particle's type and the physic processes which will be available
in this example are set in the QBBC physics list. This physics list
in this example are set in the QBBC physics list. This physics list
requires data files for electromagnetic and hadronic processes.
See more on installation of the datasets in Geant4 Installation Guide,
Chapter 3.3: Note On Geant4 Datasets:
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
/InstallationGuide/html/ch03s03.html
The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA and
G4SAIDXSDATA are mandatory for this example.
The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA,
G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example.
In addition the build-in interactive command:
/process/(in)activate processName
allows to activate/inactivate the processes one by one.
3- ACTION INITALIZATION
A newly introduced class, B1ActionInitialization, instantiates and registers
A newly introduced class, B1::ActionInitialization, instantiates and registers
to Geant4 kernel all user action classes.
While in sequential mode the action classes are instatiated just once,
via invoking the method:
B1ActionInitialization::Build()
B1::ActionInitialization::Build()
in multi-threading mode the same method is invoked for each thread worker
and so all user action classes are defined thread-local.
A run action class is instantiated both thread-local
and global that's why its instance has is created also in the method
B1ActionInitialization::BuildForMaster()
A run action class is instantiated both thread-local
and global that's why its instance is created also in the method
B1::ActionInitialization::BuildForMaster()
which is invoked only in multi-threading mode.
4- PRIMARY GENERATOR
The primary generator is defined in the B1PrimaryGeneratorAction class.
The primary generator is defined in the B1::PrimaryGeneratorAction class.
The default kinematics is a 6 MeV gamma, randomly distributed in front
of the envelope across 80% of the transverse (X,Y) envelope size.
This default setting can be changed via the Geant4 built-in commands
of the envelope across 80% of the transverse (X,Y) envelope size.
This default setting can be changed via the Geant4 built-in commands
of the G4ParticleGun class.
5- DETECTOR RESPONSE
This example demonstrates a simple scoring implemented directly
in the user action classes and B1Run object.
Alternative ways of scoring via Geant4 classes can be found in the
other examples.
in the user action classes. Alternative ways of scoring via Geant4 classes
can be found in the other examples.
The energy deposited is collected step by step for a selected volume
in B1SteppingAction and accumulated event by event in B1EventAction.
At end of event, the value acummulated in B1EventAction is added in B1Run
and summed over the whole run (see B1EventAction::EndOfevent()).
Total dose deposited is computed at B1RunAction::EndOfRunAction(),
in B1::SteppingAction and accumulated event by event in B1::EventAction.
At end of event, the value acummulated in B1::EventAction is added in B1::RunAction
and summed over the whole run (see B1::EventAction::EndOfevent()).
Total dose deposited is computed at B1::RunAction::EndOfRunAction(),
and printed together with informations about the primary particle.
In multi-threading mode the energy accumulated in B1Run objects per
workers is merged to the master in B1Run::Merge() and the final
In multi-threading mode the energy accumulated in G4Accumulable objects per
workers is merged to the master in B1::RunAction::EndOfRunAction() and the final
result is printed on the screen.
An example of creating and computing new units (e.g., dose) is also shown
in the class constructor.
G4Parameter<G4double> type instead of G4double type is used for the B1::RunAction
data members in order to facilitate merging of the values accumulated on workers
to the master. Currently the accumulables have to be registered to G4AccumulablesManager
and G4AccumulablesManager::Merge() has to be called from the users code. This is planned
to be further simplified with a closer integration of G4Accumulable classes in
the Geant4 kernel next year.
An example of creating and computing new units (e.g., dose) is also shown
in the class constructor.
The following paragraphs are common to all basic examples
A- VISUALISATION
The visualization manager is set via the G4VisExecutive class
in the main() function in exampleB1.cc.
in the main() function in exampleB1.cc.
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main function when the example is used in interactive running mode.
@@ -137,21 +142,21 @@
for all events and erased at the beginning of the next run.
B- USER INTERFACES
The user command interface is set via the G4UIExecutive class
in the main() function in exampleB1.cc
The selection of the user command interface is then done automatically
according to the Geant4 configuration or it can be done explicitly via
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
in the main() function in exampleB1.cc
The selection of the user command interface is then done automatically
according to the Geant4 configuration or it can be done explicitly via
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
C- HOW TO RUN
- Execute exampleB1 in the 'interactive mode' with visualization:
% ./exampleB1
and type in the commands from run1.mac line by line:
and type in the commands from run1.mac line by line:
Idle> /control/verbose 2
Idle> /tracking/verbose 1
Idle> /run/beamOn 10
Idle> /run/beamOn 10
Idle> ...
Idle> exit
or
@@ -159,9 +164,9 @@
....
Idle> exit
- Execute exampleB1 in the 'batch' mode from macro files
- Execute exampleB1 in the 'batch' mode from macro files
(without visualization)
% ./exampleB1 run2.mac
% ./exampleB1 exampleB1.in > exampleB1.out
+105 -285
View File
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-01-ref-06 (30-June-2023)
Geant4 version Name: geant4-11-02-ref-00 (8-December-2023)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -20,13 +20,6 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
<<< Reference Physics List QBBC
Checking overlaps for volume Envelope:0 (G4Box) ... OK!
Checking overlaps for volume Shape1:0 (G4Cons) ... OK!
Checking overlaps for volume Shape2:0 (G4Trd) ... OK!
### HadronInelasticQBBC Construct Process:
Emin(FTFP)= 3 GeV Emax(FTFP)= 100000 GeV
Emin(BERT)= 1 GeV Emax(BERT)= 6 GeV Emax(BERTpions)= 12 GeV
Emin(BIC) = 0 GeV Emax(BIC)= 1.5 GeV.
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
@@ -54,6 +47,10 @@ Registered graphics systems are:
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
Default graphics system is: TSG_OFFSCREEN (based on batch session).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
Use "vis/open" without parameters to get these defaults.
Registering model factories...
@@ -86,6 +83,13 @@ End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
Checking overlaps for volume Envelope:0 (G4Box) ... OK!
Checking overlaps for volume Shape1:0 (G4Cons) ... OK!
Checking overlaps for volume Shape2:0 (G4Trd) ... OK!
### HadronInelasticQBBC Construct Process:
Emin(FTFP)= 3 GeV Emax(FTFP)= 100000 GeV
Emin(BERT)= 1 GeV Emax(BERT)= 6 GeV Emax(BERTpions)= 12 GeV
Emin(BIC) = 0 GeV Emax(BIC)= 1.5 GeV.
=======================================================================
====== Electromagnetic Physics Parameters ========
=======================================================================
@@ -523,391 +527,249 @@ CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
====================================================================
HADRONIC PROCESSES SUMMARY (verbose level 1)
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for B-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: B-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for D-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: D-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for GenericIon
Process: ionInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: ionElastic
Model: NNDiffuseElastic: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for He3
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: He3Inelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for alpha
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: alphaInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_He3
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_He3Inelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_alpha
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_alphaInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_deuteron
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_deuteronInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-------------------------------------------------------------------------
Hadronic Processes for anti_hypertriton
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: anti_lambdaInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_neutron
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
Model: AntiAElastic: 100 MeV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_neutronInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_proton
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
Model: AntiAElastic: 100 MeV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_protonInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for anti_triton
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_tritonInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for deuteron
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: dInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV
---------------------------------------------------
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for e+
Process: positronNuclear
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for e-
Process: electronNuclear
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for gamma
Process: photonNuclear
Model: GammaNPreco: 0 eV ---> 200 MeV
Model: BertiniCascade: 199 MeV ---> 6 GeV
Model: TheoFSGenerator: 3 GeV ---> 100 TeV
Cr_sctns: GammaNuclearXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for kaon+
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: kaon+Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for kaon-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: kaon-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: lambdaInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for mu+
Process: muonNuclear
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for mu-
Process: muonNuclear
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
Process: muMinusCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for neutron
Process: hadElastic
Model: hElasticCHIPS: 0 eV ---> 100 TeV
Cr_sctns: G4NeutronElasticXS: 0 eV ---> 100 TeV
Process: neutronInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 1 GeV ---> 6 GeV
Model: Binary Cascade: 0 eV ---> 1.5 GeV
Cr_sctns: G4NeutronInelasticXS: 0 eV ---> 100 TeV
Process: nCapture
Model: nRadCapture: 0 eV ---> 100 TeV
Cr_sctns: G4NeutronCaptureXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for pi+
Process: hadElastic
Model: hElasticGlauber: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: pi+Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 1 GeV ---> 12 GeV
Model: Binary Cascade: 0 eV ---> 1.5 GeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for pi-
Process: hadElastic
Model: hElasticGlauber: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: pi-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 1 GeV ---> 12 GeV
Model: Binary Cascade: 0 eV ---> 1.5 GeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for proton
Process: hadElastic
Model: hElasticCHIPS: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: protonInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 1 GeV ---> 6 GeV
Model: Binary Cascade: 0 eV ---> 1.5 GeV
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for sigma-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: sigma-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
---------------------------------------------------
-----------------------------------------------------------------------
Hadronic Processes for triton
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: tInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV
================================================================
=======================================================================
====== Geant4 Native Pre-compound Model Parameters ========
=======================================================================
@@ -942,47 +804,26 @@ Max 2J for sampling of angular correlations 10
=======================================================================
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
### Run 0 start.
---> Begin of event: 0
---> Begin of event: 100
---> Begin of event: 200
---> Begin of event: 300
---> Begin of event: 400
---> Begin of event: 500
---> Begin of event: 600
---> Begin of event: 700
---> Begin of event: 800
---> Begin of event: 900
G4ConvergenceTester Output Result of DOSE_TALLY
EFFICIENCY = 0.187
MEAN = 4.59908e-14
VAR = 1.60687e-26
SD = 1.26762e-13
R = 0.0871604
SHIFT = 1.78107e-13
VOV = 0.00865677
FOM = 6581.6
THE LARGEST SCORE = 5.43178e-13 and it happened at 566th event
Affected Mean = 4.64875e-14 and its ratio to original is 1.0108
Affected VAR = 1.62996e-26 and its ratio to original is 1.01437
Affected R = 0.086803 and its ratio to original is 0.9959
Affected SHIFT = 1.78431e-13 and its ratio to original is 1.00182
Affected FOM = 6581.6 and its ratio to original is 1
EFFICIENCY = 0.17
MEAN = 4.24413e-14
VAR = 1.51296e-26
SD = 1.23003e-13
R = 0.0916485
SHIFT = 1.833e-13
VOV = 0.00965561
FOM = 3968.52
THE LARGEST SCORE = 5.55155e-13 and it happened at 893th event
Affected Mean = 4.29535e-14 and its ratio to original is 1.01207
Affected VAR = 1.53771e-26 and its ratio to original is 1.01636
Affected R = 0.0912476 and its ratio to original is 0.995626
Affected SHIFT = 1.83781e-13 and its ratio to original is 1.00262
Affected FOM = 3968.52 and its ratio to original is 1
MEAN distribution is not RANDOM
r follows 1/std::sqrt(N)
r is monotonically decrease
r is less than 0.1. r = 0.0871604
r is less than 0.1. r = 0.0916485
VOV follows 1/std::sqrt(N)
VOV is monotonically decrease
FOM distribution is not RANDOM
@@ -992,69 +833,48 @@ This result passes 5 / 8 Convergence Test.
G4ConvergenceTester Output History of DOSE_TALLY
i/16 till_ith mean var sd r vov fom shift e r2eff r2int
1 62 6.0424e-14 2.12694e-26 1.4584e-13 0.304087 0.085229 540.722 1.58047e-13 0.253968 0.046627 0.0443743
2 124 4.34522e-14 1.48629e-26 1.21913e-13 0.250949 0.0715801 793.963 1.72666e-13 0.2 0.032 0.0304714
3 187 4.30264e-14 1.42936e-26 1.19556e-13 0.202655 0.0493 1217.46 1.71213e-13 0.191489 0.0224586 0.0183919
4 249 3.87796e-14 1.29331e-26 1.13724e-13 0.185471 0.0425375 1453.5 1.75121e-13 0.18 0.0182222 0.0160398
5 312 4.56897e-14 1.50775e-26 1.22791e-13 0.151906 0.0276474 2166.8 1.70399e-13 0.201278 0.0126781 0.0103236
6 374 4.42641e-14 1.49653e-26 1.22333e-13 0.142717 0.0239222 2454.83 1.73651e-13 0.189333 0.0114178 0.00889589
7 437 4.66551e-14 1.62359e-26 1.2742e-13 0.130498 0.019391 2936.06 1.76608e-13 0.189498 0.00976509 0.00722566
8 499 4.4408e-14 1.54392e-26 1.24254e-13 0.125131 0.0183329 3193.28 1.79065e-13 0.188 0.0086383 0.00698825
9 562 4.52784e-14 1.55386e-26 1.24654e-13 0.116027 0.0157509 3714.07 1.76339e-13 0.186501 0.00774761 0.0056908
10 624 4.44384e-14 1.55239e-26 1.24595e-13 0.112151 0.0146302 3975.26 1.79489e-13 0.184 0.00709565 0.00546203
11 687 4.50037e-14 1.5803e-26 1.2571e-13 0.106495 0.013151 4408.73 1.80261e-13 0.184593 0.00642053 0.00490412
12 749 4.56328e-14 1.59111e-26 1.26139e-13 0.100935 0.0118922 4907.79 1.79403e-13 0.186667 0.00580952 0.00436478
13 812 4.54608e-14 1.57597e-26 1.25538e-13 0.0968483 0.0109613 5330.72 1.78444e-13 0.186962 0.00534894 0.00401913
14 874 4.62163e-14 1.60542e-26 1.26705e-13 0.0926819 0.00992813 5820.77 1.77974e-13 0.187429 0.0049547 0.00362541
15 937 4.637e-14 1.62631e-26 1.27527e-13 0.0897973 0.00916043 6200.75 1.78559e-13 0.186567 0.00464819 0.00340676
16 999 4.59908e-14 1.60687e-26 1.26762e-13 0.0871604 0.00865677 6581.6 1.78107e-13 0.187 0.00434759 0.00324175
1 62 4.15089e-14 1.47669e-26 1.21519e-13 0.368836 0.150664 245.026 1.75351e-13 0.174603 0.0750361 0.0588445
2 124 3.93009e-14 1.4082e-26 1.18668e-13 0.270069 0.082913 457.014 1.81552e-13 0.176 0.0374545 0.0348991
3 187 3.87499e-14 1.31699e-26 1.1476e-13 0.215994 0.0578571 714.488 1.78683e-13 0.18617 0.0232523 0.023153
4 249 4.09837e-14 1.41212e-26 1.18833e-13 0.183381 0.041065 991.219 1.80656e-13 0.188 0.0172766 0.0162175
5 312 4.32645e-14 1.52396e-26 1.23449e-13 0.161281 0.0306769 1281.48 1.82098e-13 0.188498 0.0137543 0.0121741
6 374 4.11182e-14 1.42378e-26 1.19322e-13 0.149855 0.0274276 1484.35 1.81735e-13 0.186667 0.011619 0.0107776
7 437 4.21075e-14 1.46511e-26 1.21042e-13 0.137353 0.0225127 1766.86 1.80916e-13 0.182648 0.0102169 0.00860589
8 499 4.12978e-14 1.4143e-26 1.18924e-13 0.128783 0.0199466 2009.83 1.78628e-13 0.186 0.00875269 0.00779928
9 562 4.00473e-14 1.37636e-26 1.17319e-13 0.123464 0.0179062 2186.76 1.77608e-13 0.174067 0.00842788 0.00678832
10 624 3.94354e-14 1.35768e-26 1.16519e-13 0.118188 0.0164103 2386.35 1.78155e-13 0.1696 0.00783396 0.00611202
11 687 4.14442e-14 1.41886e-26 1.19116e-13 0.109575 0.014024 2776.22 1.76413e-13 0.174419 0.00687984 0.00510943
12 749 4.06709e-14 1.39931e-26 1.18292e-13 0.106204 0.0132954 2955.25 1.78255e-13 0.170667 0.00647917 0.00478516
13 812 4.08157e-14 1.40276e-26 1.18438e-13 0.10177 0.0121591 3218.4 1.77843e-13 0.169742 0.00601636 0.00432802
14 874 4.12957e-14 1.44e-26 1.2e-13 0.0982365 0.0112995 3454.09 1.80358e-13 0.170286 0.00556855 0.00407083
15 937 4.37242e-14 1.55491e-26 1.24696e-13 0.0931171 0.00983397 3844.32 1.81499e-13 0.173774 0.00506887 0.00359268
16 999 4.24413e-14 1.51296e-26 1.23003e-13 0.0916485 0.00965561 3968.52 1.833e-13 0.17 0.00488235 0.00350869
--------------------End of Global Run-----------------------
The run consists of 1000 gamma of 6 MeV
Dose in scoring volume : 45.9908 picoGy +- 4.00657 picoGy
Cumulated dose per run, in scoring volume : 42.4413 picoGy rms = 3.88774 picoGy
------------------------------------------------------------
### Run 1 start.
---> Begin of event: 0
---> Begin of event: 100
---> Begin of event: 200
---> Begin of event: 300
---> Begin of event: 400
---> Begin of event: 500
---> Begin of event: 600
---> Begin of event: 700
---> Begin of event: 800
---> Begin of event: 900
G4ConvergenceTester Output Result of DOSE_TALLY
EFFICIENCY = 0.619
MEAN = 4.93724e-12
VAR = 2.13442e-23
SD = 4.61998e-12
R = 0.0295908
SHIFT = 1.07914e-13
VOV = 0.000166371
FOM = 5191.16
THE LARGEST SCORE = 1.08323e-11 and it happened at 985th event
Affected Mean = 4.94312e-12 and its ratio to original is 1.00119
Affected VAR = 2.13576e-23 and its ratio to original is 1.00063
Affected R = 0.02955 and its ratio to original is 0.998622
Affected SHIFT = 1.03705e-13 and its ratio to original is 0.960996
Affected FOM = 5191.16 and its ratio to original is 1
EFFICIENCY = 0.634
MEAN = 5.06408e-12
VAR = 2.12533e-23
SD = 4.61013e-12
R = 0.0287881
SHIFT = -3.35491e-14
VOV = 0.000164871
FOM = 5027.63
THE LARGEST SCORE = 1.07532e-11 and it happened at 771th event
Affected Mean = 5.06976e-12 and its ratio to original is 1.00112
Affected VAR = 2.12644e-23 and its ratio to original is 1.00052
Affected R = 0.0287489 and its ratio to original is 0.99864
Affected SHIFT = -3.76895e-14 and its ratio to original is 1.12341
Affected FOM = 5027.63 and its ratio to original is 1
MEAN distribution is RANDOM
r follows 1/std::sqrt(N)
r is monotonically decrease
r is less than 0.1. r = 0.0295908
r is less than 0.1. r = 0.0287881
VOV follows 1/std::sqrt(N)
VOV is monotonically decrease
FOM distribution is not RANDOM
@@ -1064,26 +884,26 @@ This result passes 6 / 8 Convergence Test.
G4ConvergenceTester Output History of DOSE_TALLY
i/16 till_ith mean var sd r vov fom shift e r2eff r2int
1 62 4.38263e-12 2.21208e-23 4.70328e-12 0.135206 0.00334294 248.649 6.59571e-13 0.571429 0.0119048 0.00608568
2 124 4.33595e-12 2.11358e-23 4.59737e-12 0.0948353 0.00192038 505.402 6.5045e-13 0.552 0.00649275 0.00242903
3 187 4.61116e-12 2.11147e-23 4.59507e-12 0.072678 0.00104212 860.54 3.91328e-13 0.590426 0.00368986 0.00156414
4 249 4.7038e-12 2.10402e-23 4.58696e-12 0.0616745 0.000772654 1194.99 2.97843e-13 0.6 0.00266667 0.00112186
5 312 4.89922e-12 2.10031e-23 4.58291e-12 0.052874 0.00058943 1625.9 1.20592e-13 0.626198 0.00190715 0.000879575
6 374 4.90357e-12 2.10182e-23 4.58456e-12 0.0482802 0.000486749 1950.02 1.26468e-13 0.624 0.00160684 0.000717928
7 437 4.87756e-12 2.08961e-23 4.57123e-12 0.044781 0.000424288 2266.68 1.4648e-13 0.623288 0.0013799 0.000620858
8 499 4.98456e-12 2.093e-23 4.57493e-12 0.0410461 0.000367079 2697.95 5.24184e-14 0.632 0.00116456 0.000516856
9 562 4.96867e-12 2.11266e-23 4.59637e-12 0.0389871 0.00031331 2990.44 6.74759e-14 0.623446 0.0010728 0.000444489
10 624 4.97057e-12 2.11541e-23 4.59936e-12 0.0370127 0.000280293 3318 6.71146e-14 0.624 0.000964103 0.000403643
11 687 4.9675e-12 2.10852e-23 4.59187e-12 0.0352418 0.000256954 3659.84 6.92913e-14 0.626453 0.000866697 0.000373479
12 749 4.85957e-12 2.10558e-23 4.58866e-12 0.0344792 0.000238397 3823.51 1.65614e-13 0.618667 0.000821839 0.000365393
13 812 4.92694e-12 2.1194e-23 4.60369e-12 0.0327706 0.000210358 4232.62 1.10454e-13 0.622386 0.000746272 0.000326317
14 874 4.89643e-12 2.12847e-23 4.61354e-12 0.031853 0.000192674 4479.98 1.42237e-13 0.619429 0.000702161 0.000311294
15 937 4.95228e-12 2.12424e-23 4.60895e-12 0.0303875 0.000179785 4922.5 8.71702e-14 0.623667 0.000643304 0.000279115
16 999 4.93724e-12 2.13442e-23 4.61998e-12 0.0295908 0.000166371 5191.16 1.07914e-13 0.619 0.000615509 0.000259229
1 62 5.51905e-12 2.10641e-23 4.58956e-12 0.10477 0.00349254 379.591 -6.31268e-13 0.619048 0.00976801 0.00103449
2 124 5.61858e-12 2.18088e-23 4.66999e-12 0.074342 0.00153125 753.912 -5.93002e-13 0.664 0.00404819 0.00143432
3 187 5.47396e-12 2.16103e-23 4.64869e-12 0.0619369 0.000942672 1086.15 -4.12992e-13 0.664894 0.00268085 0.00113493
4 249 5.41604e-12 2.16453e-23 4.65245e-12 0.0543287 0.000684029 1411.66 -3.53246e-13 0.656 0.00209756 0.000842244
5 312 5.21136e-12 2.13731e-23 4.62311e-12 0.0501431 0.000536455 1657.17 -1.63731e-13 0.645367 0.00175561 0.00075069
6 374 5.08358e-12 2.13251e-23 4.61791e-12 0.0469095 0.00044534 1893.51 -4.54349e-14 0.637333 0.00151743 0.000677198
7 437 5.12087e-12 2.12018e-23 4.60454e-12 0.0429641 0.000387384 2257.24 -7.1508e-14 0.648402 0.00123802 0.000603677
8 499 5.16732e-12 2.12644e-23 4.61133e-12 0.0399095 0.000334221 2615.99 -1.28457e-13 0.652 0.00106748 0.000522095
9 562 5.14956e-12 2.12312e-23 4.60773e-12 0.0377106 0.000295912 2929.96 -1.10341e-13 0.648313 0.000963527 0.000456035
10 624 5.15941e-12 2.13414e-23 4.61967e-12 0.0358155 0.000257338 3248.23 -1.20809e-13 0.6432 0.000887562 0.000393136
11 687 5.14724e-12 2.12482e-23 4.60957e-12 0.0341423 0.000240653 3574.41 -1.13851e-13 0.642442 0.000808955 0.000355046
12 749 5.16986e-12 2.12561e-23 4.61044e-12 0.0325636 0.000221595 3929.38 -1.29951e-13 0.645333 0.000732782 0.000326192
13 812 5.06478e-12 2.12849e-23 4.61355e-12 0.031947 0.000200563 4082.53 -3.2786e-14 0.634686 0.000707972 0.00031138
14 874 5.08498e-12 2.12612e-23 4.61099e-12 0.030655 0.00018871 4433.91 -5.06988e-14 0.636571 0.000652475 0.000286178
15 937 5.05867e-12 2.12182e-23 4.60632e-12 0.0297315 0.000178037 4713.63 -2.19487e-14 0.635394 0.000611754 0.000271265
16 999 5.06408e-12 2.12533e-23 4.61013e-12 0.0287881 0.000164871 5027.63 -3.35491e-14 0.634 0.000577287 0.000250638
--------------------End of Global Run-----------------------
The run consists of 1000 proton of 210 MeV
Dose in scoring volume : 4.93724 nanoGy +- 146.024 picoGy
Cumulated dose per run, in scoring volume : 5.06408 nanoGy rms = 145.712 picoGy
------------------------------------------------------------
Graphics systems deleted.
@@ -27,11 +27,11 @@
/// \file exampleB1.cc
/// \brief Main program of the B1 example
#include "B1DetectorConstruction.hh"
#include "B1ConActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
@@ -40,29 +40,35 @@
#include "Randomize.hh"
using namespace B1;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
G4UIExecutive* ui = 0;
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
// Choose the Random engine
//
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Optionally: choose a different Random engine...
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
//use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
// Construct the default run manager
//
auto* runManager = G4RunManagerFactory::CreateRunManager();
auto* runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(8);
// Set mandatory initialization classes
//
// Detector construction
runManager->SetUserInitialization(new B1DetectorConstruction());
runManager->SetUserInitialization(new DetectorConstruction());
// Physics list
G4VModularPhysicsList* physicsList = new QBBC;
@@ -70,11 +76,7 @@ int main(int argc,char** argv)
runManager->SetUserInitialization(physicsList);
// User action initialization
runManager->SetUserInitialization(new B1ConActionInitialization());
// Initialize G4 kernel
//
runManager->Initialize();
runManager->SetUserInitialization(new B1Con::ActionInitialization());
// Initialize visualization
G4VisManager* visManager = new G4VisExecutive;
@@ -105,8 +107,6 @@ int main(int argc,char** argv)
delete visManager;
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -1,3 +1,4 @@
/run/initialize
# gamma 6 MeV
/gun/particle gamma
@@ -24,28 +24,31 @@
// ********************************************************************
//
//
/// \file B1ConActionInitialization.hh
/// \brief Definition of the B1ConActionInitialization class
/// \file ActionInitialization.hh
/// \brief Definition of the B1::ActionInitialization class
#ifndef B1ConActionInitialization_h
#define B1ConActionInitialization_h 1
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
/// Action initialization class.
///
namespace B1Con
{
class B1ConActionInitialization : public G4VUserActionInitialization
/// Action initialization class.
class ActionInitialization : public G4VUserActionInitialization
{
public:
B1ConActionInitialization();
virtual ~B1ConActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
ActionInitialization() = default;
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,62 +0,0 @@
//
// ********************************************************************
// * 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 B1ConRun.hh
/// \brief Definition of the B1ConRun class
#ifndef B1ConRun_h
#define B1ConRun_h 1
#include "B1Run.hh"
#include "globals.hh"
class G4Event;
/// Run class which extends B1Run
///
class B1ConRun : public B1Run
{
public:
B1ConRun();
virtual ~B1ConRun();
// method from the base class
virtual void Merge(const G4Run*);
virtual void AddEdep (G4double edep);
// get methods
G4int GetNumberOfEvent() const { return (G4int)fEdepEventVector.size(); }
G4double GetEdepPerEvent(G4int i) const { return fEdepEventVector[i]; }
private:
std::vector<G4double> fEdepEventVector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1DetectorConstruction.hh
/// \brief Definition of the B1DetectorConstruction class
/// \file B1/include/DetectorConstruction.hh
/// \brief Definition of the B1::DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
@@ -36,23 +36,27 @@
class G4VPhysicalVolume;
class G4LogicalVolume;
namespace B1
{
/// Detector construction class to define materials and geometry.
class B1DetectorConstruction : public G4VUserDetectorConstruction
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B1DetectorConstruction();
virtual ~B1DetectorConstruction();
DetectorConstruction() = default;
~DetectorConstruction() override = default;
virtual G4VPhysicalVolume* Construct();
G4VPhysicalVolume* Construct() override;
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
protected:
G4LogicalVolume* fScoringVolume;
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1EventAction.hh
/// \brief Definition of the B1EventAction class
/// \file B1/include/EventAction.hh
/// \brief Definition of the B1::EventAction class
#ifndef B1EventAction_h
#define B1EventAction_h 1
@@ -33,28 +33,34 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
/// Event action class
///
/// It instantiates B1EventInformation object at the beginning of
/// each event.
namespace B1Con
{
class RunAction;
}
class B1EventAction : public G4UserEventAction
namespace B1
{
/// Event action class
class EventAction : public G4UserEventAction
{
public:
B1EventAction();
virtual ~B1EventAction();
EventAction(B1Con::RunAction* runAction);
~EventAction() override = default;
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void AddEdep(G4double edep) { fEdep += edep; }
G4double GetEdep() const { return fEdep; }
private:
G4int fPrintModulo;
G4double fEdep;
B1Con::RunAction* fRunAction = nullptr;
G4double fEdep = 0.;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1PrimaryGeneratorAction.hh
/// \brief Definition of the B1PrimaryGeneratorAction class
/// \file B1/include/PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
@@ -38,30 +38,33 @@ class G4ParticleGun;
class G4Event;
class G4Box;
namespace B1
{
/// The primary generator action class with particle gun.
///
/// The default kinematic is a 6 MeV gamma, randomly distribued
/// in front of the phantom across 80% of the (X,Y) phantom size.
class B1PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B1PrimaryGeneratorAction();
virtual ~B1PrimaryGeneratorAction();
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
// method from the base class
virtual void GeneratePrimaries(G4Event*);
void GeneratePrimaries(G4Event*) override;
// method to access particle gun
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
private:
G4ParticleGun* fParticleGun; // pointer a to G4 gun class
G4Box* fEnvelopeBox;
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
G4Box* fEnvelopeBox = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,18 +24,25 @@
// ********************************************************************
//
//
/// \file B1ConRunAction.hh
/// \brief Definition of the B1ConRunAction class
/// \file B1/include/RunAction.hh
/// \brief Definition of the B1::RunAction class
#ifndef B1ConRunAction_h
#define B1ConRunAction_h 1
#ifndef B1RunAction_h
#define B1RunAction_h 1
#include "VectorAccummulable.hh"
#include "G4ConvergenceTester.hh"
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "globals.hh"
class G4ConvergenceTester;
class G4Run;
class G4LogicalVolume;
namespace B1Con
{
/// Run action class
///
@@ -43,20 +50,25 @@ class G4LogicalVolume;
/// from the energy deposit accumulated via stepping and event actions.
/// The computed dose is then printed on the screen.
class B1ConRunAction : public G4UserRunAction
class RunAction : public G4UserRunAction
{
public:
B1ConRunAction();
virtual ~B1ConRunAction();
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void AddEdep (G4double edep);
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
private:
G4ConvergenceTester* fdose_tally;
G4Accumulable<G4double> fEdep = 0.;
G4Accumulable<G4double> fEdep2 = 0.;
VectorAccumulable<G4double> fEdepPerEvent;
G4ConvergenceTester* fDoseTally = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1SteppingAction.hh
/// \brief Definition of the B1SteppingAction class
/// \file B1/include/SteppingAction.hh
/// \brief Definition of the B1::SteppingAction class
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
@@ -33,27 +33,31 @@
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class B1EventAction;
class G4LogicalVolume;
/// Stepping action class
///
namespace B1
{
class B1SteppingAction : public G4UserSteppingAction
class EventAction;
/// Stepping action class
class SteppingAction : public G4UserSteppingAction
{
public:
B1SteppingAction(B1EventAction* eventAction);
virtual ~B1SteppingAction();
SteppingAction(EventAction* eventAction);
~SteppingAction() override = default;
// method from the base class
virtual void UserSteppingAction(const G4Step*);
void UserSteppingAction(const G4Step*) override;
private:
B1EventAction* fEventAction;
G4LogicalVolume* fScoringVolume;
EventAction* fEventAction = nullptr;
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,41 +24,59 @@
// ********************************************************************
//
//
/// \file B1Run.hh
/// \brief Definition of the B1Run class
#ifndef B1Run_h
#define B1Run_h 1
#include "G4Run.hh"
#include "globals.hh"
class G4Event;
/// Run class
/// \file VectorAccummulable.hh
/// \brief Definition of the VectorAccummulable class
///
/// This class defines an accummulable of a vector<T> type
/// that merges the vectors filled on workers in a single vector.
class B1Run : public G4Run
#ifndef VectorAccumulable_h
#define VectorAccumulable_h 1
#include "G4VAccumulable.hh"
#include "globals.hh"
#include <vector>
template <typename T>
class VectorAccumulable : public G4VAccumulable
{
public:
B1Run();
virtual ~B1Run();
VectorAccumulable() = default;
~VectorAccumulable() override = default;
// method from the base class
virtual void Merge(const G4Run*);
void AddValue(T value);
const std::vector<T>& GetVector() const;
virtual void AddEdep (G4double edep);
// get methods
G4double GetEdep() const { return fEdep; }
G4double GetEdep2() const { return fEdep2; }
void Merge(const G4VAccumulable& other) override;
void Reset() override;
private:
G4double fEdep;
G4double fEdep2;
std::vector<T> fTVector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// inline functions
template <typename T>
inline void VectorAccumulable<T>::AddValue(T value) {
fTVector.push_back(value);
}
template <typename T>
inline const std::vector<T>& VectorAccumulable<T>::GetVector() const
{
return fTVector;
}
template <typename T>
inline void VectorAccumulable<T>::Merge(const G4VAccumulable& other) {
for (const auto& value : static_cast<const VectorAccumulable<T>&>(other).fTVector ) {
fTVector.push_back(value);
}
}
template <typename T>
inline void VectorAccumulable<T>::Reset() {
fTVector.clear();
}
#endif
@@ -1,7 +0,0 @@
# Macro file for the initialization phase of example B1
# when running in interactive mode without visualization
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
@@ -2,10 +2,15 @@
# when running in interactive mode with visualization
#
# Set some default verbose
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
#
# Visualization setting
/control/execute vis.mac
+6 -1
View File
@@ -3,8 +3,13 @@
# Can be run in batch, without graphic
# or interactively: Idle> /control/execute run1.mac
#
/control/verbose 2
# Change the default number of workers (in multi-threading mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
#
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 1
@@ -3,6 +3,9 @@
# To be run preferably in batch, without graphics:
# % exampleB1 run2.mac
#
#/run/numberOfThreads 4
/run/initialize
#
/control/verbose 2
/run/verbose 2
#
@@ -12,6 +15,7 @@
/gun/particle gamma
/gun/energy 6 MeV
#
/run/printProgress 100
/run/beamOn 1000
#
# proton 210 MeV to the direction (0.,0.,1.)
@@ -24,45 +24,41 @@
// ********************************************************************
//
//
/// \file B1ConRun.cc
/// \brief Implementation of the B1ConRun class
/// \file B1/src/ActionInitialization.cc
/// \brief Implementation of the B1::ActionInitialization class
#include "B1ConRun.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConRun::B1ConRun()
: B1Run(),
fEdepEventVector()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConRun::~B1ConRun()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConRun::Merge(const G4Run* aRun)
namespace B1Con
{
// Merge data in base class
B1Run::Merge(aRun);
const B1ConRun* localRun = static_cast<const B1ConRun*>(aRun);
for ( size_t i = 0 ; i != localRun->fEdepEventVector.size() ; i++ ) {
fEdepEventVector.push_back( localRun->fEdepEventVector[i] );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
auto runAction = new RunAction;
SetUserAction(runAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConRun::AddEdep (G4double edep)
void ActionInitialization::Build() const
{
// Update data in base class
B1Run::AddEdep(edep);
SetUserAction(new B1::PrimaryGeneratorAction);
fEdepEventVector.push_back(edep);
auto runAction = new RunAction;
SetUserAction(runAction);
auto eventAction = new B1::EventAction(runAction);
SetUserAction(eventAction);
SetUserAction(new B1::SteppingAction(eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -1,67 +0,0 @@
//
// ********************************************************************
// * 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 B1ConActionInitialization.cc
/// \brief Implementation of the B1ConActionInitialization class
#include "B1ConActionInitialization.hh"
#include "B1PrimaryGeneratorAction.hh"
#include "B1ConRunAction.hh"
#include "B1EventAction.hh"
#include "B1SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConActionInitialization::B1ConActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConActionInitialization::~B1ConActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConActionInitialization::BuildForMaster() const
{
SetUserAction(new B1ConRunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConActionInitialization::Build() const
{
SetUserAction(new B1PrimaryGeneratorAction);
SetUserAction(new B1ConRunAction);
B1EventAction* eventAction = new B1EventAction;
SetUserAction(eventAction);
SetUserAction(new B1SteppingAction(eventAction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,223 +0,0 @@
//
// ********************************************************************
// * 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 B1DetectorConstruction.cc
/// \brief Implementation of the B1DetectorConstruction class
#include "B1DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Orb.hh"
#include "G4Sphere.hh"
#include "G4Trd.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1DetectorConstruction::B1DetectorConstruction()
: G4VUserDetectorConstruction(),
fScoringVolume(0)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1DetectorConstruction::~B1DetectorConstruction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B1DetectorConstruction::Construct()
{
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
// Envelope parameters
//
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
// Option to switch on/off checking of volumes overlaps
//
G4bool checkOverlaps = true;
//
// World
//
G4double world_sizeXY = 1.2*env_sizeXY;
G4double world_sizeZ = 1.2*env_sizeZ;
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
G4Box* solidWorld =
new G4Box("World", //its name
0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ); //its size
G4LogicalVolume* logicWorld =
new G4LogicalVolume(solidWorld, //its solid
world_mat, //its material
"World"); //its name
G4VPhysicalVolume* physWorld =
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
//
// Envelope
//
G4Box* solidEnv =
new G4Box("Envelope", //its name
0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size
G4LogicalVolume* logicEnv =
new G4LogicalVolume(solidEnv, //its solid
env_mat, //its material
"Envelope"); //its name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicEnv, //its logical volume
"Envelope", //its name
logicWorld, //its mother volume
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
//
// Shape 1
//
G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
// Conical section shape
G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm;
G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm;
G4double shape1_hz = 3.*cm;
G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
G4Cons* solidShape1 =
new G4Cons("Shape1",
shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz,
shape1_phimin, shape1_phimax);
/*
// Full sphere shape
G4double shape1_rmax = 4*cm;
G4Orb* solidShape1 =
new G4Orb("Shape1", //its name
shape1_rmax); //its size
// Sphere shape
G4double shape1_rmin = 0*cm, shape1_rmax = 4*cm;
G4double shape1_thetamin = 0.*deg, shape1_thetamax = 180.*deg;
G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
G4Sphere* solidShape1 =
new G4Sphere("Shape1", //its name
shape1_rmin, shape1_rmax, //its size
shape1_phimin, shape1_phimax, //phi angle
shape1_thetamin, shape1_thetamax); //theta angle
// Box shape
G4double shape1_dx = 8*cm, shape1_dy = 8*cm, shape1_dz = 8*cm;
G4Box* solidShape1 =
new G4Box("Shape1", //its name
0.5*shape1_dx, 0.5*shape1_dy, 0.5*shape1_dz); //its size
*/
G4LogicalVolume* logicShape1 =
new G4LogicalVolume(solidShape1, //its solid
shape1_mat, //its material
"Shape1"); //its name
new G4PVPlacement(0, //no rotation
pos1, //at position
logicShape1, //its logical volume
"Shape1", //its name
logicEnv, //its mother volume
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
//
// Shape 2
//
G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
/*
// Shape 2 - conical section shape
G4double shape2_rmina = 0.*cm, shape2_rmaxa = 5.*cm;
G4double shape2_rminb = 0.*cm, shape2_rmaxb = 8.*cm;
G4double shape2_hz = 3.*cm;
G4double shape2_phimin = 0.*deg, shape2_phimax = 360.*deg;
G4Cons* solidShape2 =
new G4Cons("Shape2",
shape2_rmina, shape2_rmaxa, shape2_rminb, shape2_rmaxb, shape2_hz,
shape2_phimin, shape2_phimax);
*/
// Trapezoid shape
G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
G4double shape2_dz = 6*cm;
G4Trd* solidShape2 =
new G4Trd("Shape2", //its name
0.5*shape2_dxa, 0.5*shape2_dxb,
0.5*shape2_dya, 0.5*shape2_dyb, 0.5*shape2_dz); //its size
G4LogicalVolume* logicShape2 =
new G4LogicalVolume(solidShape2, //its solid
shape2_mat, //its material
"Shape2"); //its name
new G4PVPlacement(0, //no rotation
pos2, //at position
logicShape2, //its logical volume
"Shape2", //its name
logicEnv, //its mother volume
false, //no boolean operation
0, //copy number
checkOverlaps); //overlaps checking
// Set Shape2 as scoring volume
//
fScoringVolume = logicShape2;
//
//always return the physical World
//
return physWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,72 +0,0 @@
//
// ********************************************************************
// * 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 B1EventAction.cc
/// \brief Implementation of the B1EventAction class
#include "B1EventAction.hh"
#include "B1Run.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1EventAction::B1EventAction()
: G4UserEventAction(),
fPrintModulo(100),
fEdep(0.)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1EventAction::~B1EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1EventAction::BeginOfEventAction(const G4Event* event)
{
G4int eventNb = event->GetEventID();
if (eventNb%fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << eventNb << G4endl;
}
fEdep = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1EventAction::EndOfEventAction(const G4Event*)
{
// accumulate statistics in B1Run
B1Run* run
= static_cast<B1Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddEdep(fEdep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * 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 B1/src/DetectorConstruction.cc
/// \brief Implementation of the B1::DetectorConstruction class
#include "DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Orb.hh"
#include "G4Sphere.hh"
#include "G4Trd.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
namespace B1
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Get nist material manager
G4NistManager* nist = G4NistManager::Instance();
// Envelope parameters
//
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
// Option to switch on/off checking of volumes overlaps
//
G4bool checkOverlaps = true;
//
// World
//
G4double world_sizeXY = 1.2*env_sizeXY;
G4double world_sizeZ = 1.2*env_sizeZ;
G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
auto solidWorld = new G4Box("World", // its name
0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
world_mat, // its material
"World"); // its name
auto physWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
//
// Envelope
//
auto solidEnv = new G4Box("Envelope", // its name
0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size
auto logicEnv = new G4LogicalVolume(solidEnv, // its solid
env_mat, // its material
"Envelope"); // its name
new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
logicEnv, // its logical volume
"Envelope", // its name
logicWorld, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
//
// Shape 1
//
G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
// Conical section shape
G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm;
G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm;
G4double shape1_hz = 3.*cm;
G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
auto solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb,
shape1_hz, shape1_phimin, shape1_phimax);
auto logicShape1 = new G4LogicalVolume(solidShape1, // its solid
shape1_mat, // its material
"Shape1"); // its name
new G4PVPlacement(nullptr, // no rotation
pos1, // at position
logicShape1, // its logical volume
"Shape1", // its name
logicEnv, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
//
// Shape 2
//
G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
// Trapezoid shape
G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
G4double shape2_dz = 6*cm;
auto solidShape2 = new G4Trd("Shape2", // its name
0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb,
0.5 * shape2_dz); // its size
auto logicShape2 = new G4LogicalVolume(solidShape2, // its solid
shape2_mat, // its material
"Shape2"); // its name
new G4PVPlacement(nullptr, // no rotation
pos2, // at position
logicShape2, // its logical volume
"Shape2", // its name
logicEnv, // its mother volume
false, // no boolean operation
0, // copy number
checkOverlaps); // overlaps checking
// Set Shape2 as scoring volume
//
fScoringVolume = logicShape2;
//
//always return the physical World
//
return physWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,43 +24,39 @@
// ********************************************************************
//
//
/// \file B1Run.cc
/// \brief Implementation of the B1Run class
/// \file B1/src/EventAction.cc
/// \brief Implementation of the B1::EventAction class
#include "B1Run.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
namespace B1
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1Run::B1Run()
: G4Run(),
fEdep(0.),
fEdep2(0.)
EventAction::EventAction(B1Con::RunAction* runAction)
: fRunAction(runAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1Run::~B1Run()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1Run::Merge(const G4Run* run)
void EventAction::BeginOfEventAction(const G4Event*)
{
const B1Run* localRun = static_cast<const B1Run*>(run);
fEdep += localRun->fEdep;
fEdep2 += localRun->fEdep2;
G4Run::Merge(run);
fEdep = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1Run::AddEdep (G4double edep)
void EventAction::EndOfEventAction(const G4Event*)
{
fEdep += edep;
fEdep2 += edep*edep;
// accumulate statistics in run action
fRunAction->AddEdep(fEdep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B1PrimaryGeneratorAction.cc
/// \brief Implementation of the B1PrimaryGeneratorAction class
/// \file B1/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the B1::PrimaryGeneratorAction class
#include "B1PrimaryGeneratorAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
@@ -39,12 +39,12 @@
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
namespace B1
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1PrimaryGeneratorAction::B1PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fEnvelopeBox(0)
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
@@ -61,14 +61,14 @@ B1PrimaryGeneratorAction::B1PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1PrimaryGeneratorAction::~B1PrimaryGeneratorAction()
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of ecah event
//
@@ -96,7 +96,7 @@ void B1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
msg << "Envelope volume of box shape not found.\n";
msg << "Perhaps you have changed geometry.\n";
msg << "The gun will be place at the center.";
G4Exception("B1PrimaryGeneratorAction::GeneratePrimaries()",
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002",JustWarning,msg);
}
@@ -112,3 +112,6 @@ void B1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,24 +24,27 @@
// ********************************************************************
//
//
/// \file B1ConRunAction.cc
/// \brief Implementation of the B1ConRunAction class
/// \file B1/src/RunAction.cc
/// \brief Implementation of the B1::RunAction class
#include "B1ConRunAction.hh"
#include "B1PrimaryGeneratorAction.hh"
#include "B1DetectorConstruction.hh"
#include "B1ConRun.hh"
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4AccumulableManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
namespace B1Con
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConRunAction::B1ConRunAction()
: G4UserRunAction()
RunAction::RunAction()
{
// add new units for dose
//
@@ -55,65 +58,60 @@ B1ConRunAction::B1ConRunAction()
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->RegisterAccumulable(fEdep);
accumulableManager->RegisterAccumulable(fEdep2);
accumulableManager->RegisterAccumulable(&fEdepPerEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1ConRunAction::~B1ConRunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* B1ConRunAction::GenerateRun()
void RunAction::BeginOfRunAction(const G4Run*)
{
return new B1ConRun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConRunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
//inform the runManager to save random number seed
// inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
if (IsMaster()) {
fdose_tally = new G4ConvergenceTester("DOSE_TALLY");
//fdose_tally = new G4ConvergenceTester();
}
// reset accumulables to their initial values
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->Reset();
if (IsMaster()) {
fDoseTally = new G4ConvergenceTester("DOSE_TALLY");
//fDoseTally = new G4ConvergenceTester();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1ConRunAction::EndOfRunAction(const G4Run* aRun)
void RunAction::EndOfRunAction(const G4Run* run)
{
G4int nofEvents = aRun->GetNumberOfEvent();
G4int nofEvents = run->GetNumberOfEvent();
if (nofEvents == 0) return;
const B1ConRun* b1ConRun = static_cast<const B1ConRun*>(aRun);
// Merge accumulables
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
accumulableManager->Merge();
// Compute dose
// Compute dose = total energy deposit in a run and its variance
//
G4double edep = b1ConRun->GetEdep();
G4double edep2 = b1ConRun->GetEdep2();
G4double edep = fEdep.GetValue();
G4double edep2 = fEdep2.GetValue();
G4double rms = edep2 - edep*edep/nofEvents;
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
const B1DetectorConstruction* detectorConstruction
= static_cast<const B1DetectorConstruction*>
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4double mass = detectorConstruction->GetScoringVolume()->GetMass();
const auto detConstruction = static_cast<const B1::DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4double mass = detConstruction->GetScoringVolume()->GetMass();
G4double dose = edep/mass;
G4double rmsDose = rms/mass;
// Run conditions
// note: There is no primary generator action object for "master"
// run manager for multi-threaded mode.
const B1PrimaryGeneratorAction* generatorAction
= static_cast<const B1PrimaryGeneratorAction*>
(G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
const auto generatorAction = static_cast<const B1::PrimaryGeneratorAction*>(
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
G4String runCondition;
if (generatorAction)
{
@@ -126,33 +124,48 @@ void B1ConRunAction::EndOfRunAction(const G4Run* aRun)
// Print
//
if (IsMaster())
{
for ( G4int i = 0 ; i != b1ConRun->GetNumberOfEvent(); i++ ) {
G4double aDose = b1ConRun->GetEdepPerEvent(i)/mass/gray;
fdose_tally->AddScore( aDose );
if (IsMaster()) {
for (auto edepPerEvent : fEdepPerEvent.GetVector()) {
G4double dosePerEvent = edepPerEvent/mass/gray;
fDoseTally->AddScore(dosePerEvent);
}
fdose_tally->ShowResult();
fdose_tally->ShowHistory();
delete fdose_tally;
fDoseTally->ShowResult();
fDoseTally->ShowHistory();
delete fDoseTally;
fDoseTally = nullptr;
G4cout
<< "\n--------------------End of Global Run-----------------------";
<< G4endl
<< "--------------------End of Global Run-----------------------";
}
else
{
else {
G4cout
<< "\n--------------------End of Local Run------------------------";
<< G4endl
<< "--------------------End of Local Run------------------------";
}
G4cout
<< "\n The run consists of " << nofEvents << " "<< runCondition
<< "\n Dose in scoring volume : "
<< G4BestUnit(dose,"Dose") << " +- " << G4BestUnit(rmsDose,"Dose")
<< "\n------------------------------------------------------------\n"
<< G4endl
<< " The run consists of " << nofEvents << " "<< runCondition
<< G4endl
<< " Cumulated dose per run, in scoring volume : "
<< G4BestUnit(dose,"Dose") << " rms = " << G4BestUnit(rmsDose,"Dose")
<< G4endl
<< "------------------------------------------------------------"
<< G4endl
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::AddEdep(G4double edep)
{
fEdep += edep;
fEdep2 += edep*edep;
fEdepPerEvent.AddValue(edep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,40 +24,35 @@
// ********************************************************************
//
//
/// \file B1SteppingAction.cc
/// \brief Implementation of the B1SteppingAction class
/// \file B1/src/SteppingAction.cc
/// \brief Implementation of the B1::SteppingAction class
#include "B1SteppingAction.hh"
#include "B1EventAction.hh"
#include "B1DetectorConstruction.hh"
#include "SteppingAction.hh"
#include "EventAction.hh"
#include "DetectorConstruction.hh"
#include "G4Step.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
namespace B1
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1SteppingAction::B1SteppingAction(B1EventAction* eventAction)
: G4UserSteppingAction(),
fEventAction(eventAction),
fScoringVolume(0)
SteppingAction::SteppingAction(EventAction* eventAction)
: fEventAction(eventAction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1SteppingAction::~B1SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B1SteppingAction::UserSteppingAction(const G4Step* step)
void SteppingAction::UserSteppingAction(const G4Step* step)
{
if (!fScoringVolume) {
const B1DetectorConstruction* detectorConstruction
= static_cast<const B1DetectorConstruction*>
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
fScoringVolume = detectorConstruction->GetScoringVolume();
const auto detConstruction = static_cast<const DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
fScoringVolume = detConstruction->GetScoringVolume();
}
// get volume of the current step
@@ -75,3 +70,4 @@ void B1SteppingAction::UserSteppingAction(const G4Step* step)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
+11 -19
View File
@@ -2,25 +2,15 @@
# of the B1 example when running in interactive mode
#
# Use these open statements to open selected visualization
# Open a viewer
/vis/open
# This opens the default viewer - see examples/basic/B1/vis.mac for a
# more comprehensive overview of options. Also the documentation.
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create an OpenInventor view:
#/vis/open OI
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
# Use this open statement to create an offscreen file with TSG:
#/vis/open TSG_OFFSCREEN 1200x1200
# See the tsg_offscreen.mac file for more commands to change
# the file format, file name, picture size, etc.
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
@@ -100,8 +90,10 @@
/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2
#
# To get nice view
# Make the "World" box invisible
/vis/geometry/set/visibility World 0 false
/vis/geometry/set/visibility Envelope 0 false
# "Envelope" is transparent blue to represent water
/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 120 150