Import Geant4 11.0.0 source tree
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
|
||||
///\file "analysis/.README.txt"
|
||||
///\brief Examples analysis README page
|
||||
|
||||
/*! \page Examples_analysis Category "analysis"
|
||||
|
||||
Examples in this directory demonstrate how to make histograms and ntuples
|
||||
|
||||
\link ExampleAnaEx01 AnaEx01 \endlink
|
||||
|
||||
Simple example showing use of g4tools.
|
||||
|
||||
\link ExampleAnaEx02 AnaEx02 \endlink
|
||||
|
||||
As AnaEx01, but direct interface to ROOT.
|
||||
|
||||
\link ExampleB1Con B1Con \endlink
|
||||
|
||||
B1Con shows how to use the statistical tool G4ConvergenceTester.
|
||||
It does not make histograms.
|
||||
It has the same geometry as B1.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,145 @@
|
||||
|
||||
///\file "analysis/AnaEx01/.README.txt"
|
||||
///\brief Example AnaEx01 README page
|
||||
|
||||
/*! \page ExampleAnaEx01 Example AnaEx01
|
||||
|
||||
Examples AnaEx01 and AnaEx02 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis and ROOT compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
G4Analysis system.
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
|
||||
\section AnaEx01_s1 Detector description
|
||||
|
||||
The calorimeter is a box made of a given number of layers. A layer
|
||||
consists of an absorber plate and of a detection gap. The layer is
|
||||
replicated.
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
<pre>
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
</pre>
|
||||
|
||||
\section AnaEx01_s2 Physics list
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
\section AnaEx01_s3 Action Initialization
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
which are defined thread-local and a run action class
|
||||
which is defined both thread-local and global.
|
||||
|
||||
The thread-local action classes are defined in
|
||||
ActionInitialization::Build()
|
||||
and the global run action class is defined in
|
||||
ActionInitialization::BuildForMaster().
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
\section AnaEx01_s4 An event : PrimaryGeneratorAction
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
|
||||
\section AnaEx01_s5 Histograms
|
||||
|
||||
AnaEx01 can produce 4 histograms :
|
||||
|
||||
- EAbs : total energy deposit in absorber per event
|
||||
- EGap : total energy deposit in gap per event
|
||||
- LAbs : total track length of charged particles in absorber per event
|
||||
- LGap : total track length of charged particles in gap per event
|
||||
|
||||
And 2 Ntuples :
|
||||
- Ntuple1:
|
||||
- one row per event : EnergyAbs EnergyGap
|
||||
- Ntuple2:
|
||||
- one row per event : TrackLAbs TrackLGap
|
||||
|
||||
These histos and ntuples are booked in HistoManager and filled from
|
||||
EventAction.
|
||||
|
||||
One can control the name of the histograms file and its format:
|
||||
- default name : AnaEx01
|
||||
The format of the histogram file can be : root (default),
|
||||
xml, csv. Include correct g4nnn.hh in HistoManager.hh
|
||||
|
||||
\section AnaEx01_s7 How to build
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
\verbatim
|
||||
% cd path_to_AnaEx01/AnaEx01
|
||||
% gmake setup
|
||||
% gmake
|
||||
\endverbatim
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
\verbatim
|
||||
% gmake clean_setup
|
||||
\endverbatim
|
||||
|
||||
\section AnaEx01_s8 HOW TO RUN
|
||||
|
||||
- Execute AnaEx01 in the 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% ./AnaEx01
|
||||
and type in the commands from run.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
or
|
||||
\verbatim
|
||||
Idle> /control/execute run.mac
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
- Execute AnaEx01 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
\verbatim
|
||||
% ./AnaEx01 run.mac
|
||||
% ./AnaEx01 run.mac > run.out
|
||||
\endverbatim
|
||||
|
||||
The AnaEx01.in macro is used in Geant4 testing.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,140 @@
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
AnaEx01
|
||||
-------
|
||||
|
||||
Examples AnaEx01 and AnaEx02 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis and ROOT compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
G4Analysis system.
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
|
||||
1- Detector description
|
||||
-----------------------
|
||||
|
||||
The calorimeter is a box made of a given number of layers. A layer
|
||||
consists of an absorber plate and of a detection gap. The layer is
|
||||
replicated.
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
|
||||
2- Physics list
|
||||
---------------
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
3- Action Initialization
|
||||
------------------------
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
which are defined thread-local and a run action class
|
||||
which is defined both thread-local and global.
|
||||
|
||||
The thread-local action classes are defined in
|
||||
ActionInitialization::Build()
|
||||
and the global run action class is defined in
|
||||
ActionInitialization::BuildForMaster().
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
4- An event : PrimaryGeneratorAction
|
||||
------------------------------------
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
5- Histograms
|
||||
-------------
|
||||
|
||||
AnaEx01 can produce 4 histograms :
|
||||
|
||||
EAbs : total energy deposit in absorber per event
|
||||
EGap : total energy deposit in gap per event
|
||||
LAbs : total track length of charged particles in absorber per event
|
||||
LGap : total track length of charged particles in gap per event
|
||||
|
||||
And 2 Ntuples :
|
||||
- Ntuple1:
|
||||
- one row per event : EnergyAbs EnergyGap
|
||||
- Ntuple2:
|
||||
- one row per event : TrackLAbs TrackLGap
|
||||
|
||||
These histos and ntuples are booked in HistoManager and filled from
|
||||
EventAction.
|
||||
|
||||
One can control the name of the histograms file and its format:
|
||||
default name : AnaEx01
|
||||
The format of the histogram file can be : root (default),
|
||||
xml, csv. Include correct g4nnn.hh in HistoManager.hh
|
||||
|
||||
6- How to build
|
||||
---------------
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
% cd path_to_AnaEx01/AnaEx01
|
||||
% gmake setup
|
||||
% gmake
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
% gmake clean_setup
|
||||
|
||||
7- How to run
|
||||
--------------
|
||||
|
||||
- Execute AnaEx01 in the 'interactive mode' with visualization
|
||||
% ./AnaEx01
|
||||
and type in the commands from run.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
or
|
||||
Idle> /control/execute run.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
- Execute AnaEx01 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
% ./AnaEx01 run.mac
|
||||
% ./AnaEx01 run.mac > run.out
|
||||
|
||||
The AnaEx01.in macro is used in Geant4 testing.
|
||||
@@ -0,0 +1,149 @@
|
||||
|
||||
///\file "analysis/AnaEx02/.README.txt"
|
||||
///\brief Example AnaEx02 README page
|
||||
|
||||
/*! \page ExampleAnaEx02 Example AnaEx02
|
||||
|
||||
Examples AnaEx01 and AnaEx02 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis and ROOT compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
ROOT system. Please install ROOT before building this example:
|
||||
http://root.cern.ch
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
|
||||
\section AnaEx02_s1 Detector description
|
||||
|
||||
The calorimeter is a box made of a given number of layers. A layer
|
||||
consists of an absorber plate and of a detection gap. The layer is
|
||||
replicated.
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
<pre>
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
</pre>
|
||||
|
||||
\section AnaEx02_s2 Physics list
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
\section AnaEx02_s3 Action Initialization
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
which are defined thread-local and a run action class
|
||||
which is defined both thread-local and global.
|
||||
|
||||
The thread-local action classes are defined in
|
||||
ActionInitialization::Build()
|
||||
and the global run action class is defined in
|
||||
ActionInitialization::BuildForMaster().
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
\section AnaEx02_s4 An event : PrimaryGeneratorAction
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
|
||||
\section AnaEx02_s5 Histograms
|
||||
|
||||
To produce histograms, ROOT system must be installed
|
||||
|
||||
AnaEx02 can produce 4 histograms :
|
||||
|
||||
- EAbs : total energy deposit in absorber per event
|
||||
- EGap : total energy deposit in gap per event
|
||||
- LAbs : total track length of charged particles in absorber per event
|
||||
- LGap : total track length of charged particles in gap per event
|
||||
|
||||
And 2 Ntuples :
|
||||
- Ntuple1:
|
||||
- one row per event : EnergyAbs EnergyGap
|
||||
- Ntuple2:
|
||||
- one row per event : TrackLAbs TrackLGap
|
||||
|
||||
These histos and ntuples are booked in HistoManager and filled from
|
||||
EventAction.
|
||||
|
||||
One can control the name of the histograms file :
|
||||
- default name : AnaEx02
|
||||
Format : root
|
||||
|
||||
See HistoManager constructor
|
||||
|
||||
\section AnaEx02_s6 How to build
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
\verbatim
|
||||
% cd path_to_AnaEx02/AnaEx02
|
||||
% gmake setup
|
||||
% gmake
|
||||
\endverbatim
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
\verbatim
|
||||
% gmake clean_setup
|
||||
\endverbatim
|
||||
|
||||
\section AnaEx02_s8 HOW TO RUN
|
||||
|
||||
- Execute AnaEx02 in the 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% ./AnaEx02
|
||||
and type in the commands from run.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
or
|
||||
\verbatim
|
||||
Idle> /control/execute run.mac
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
- Execute AnaEx02 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
\verbatim
|
||||
% ./AnaEx02 run.mac
|
||||
% ./AnaEx02 run.mac > run.out
|
||||
\endverbatim
|
||||
|
||||
The AnaEx02.in macro is used in Geant4 testing.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,145 @@
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
AnaEx02
|
||||
-------
|
||||
Examples AnaEx01 and AnaEx02 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis and ROOT compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
ROOT system. Please install ROOT before building this example:
|
||||
http://root.cern.ch
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
|
||||
1- Detector description
|
||||
-----------------------
|
||||
|
||||
The calorimeter is a box made of a given number of layers. A layer
|
||||
consists of an absorber plate and of a detection gap. The layer is
|
||||
replicated.
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
2- Physics list
|
||||
---------------
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
3- Action Initialization
|
||||
------------------------
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
which are defined thread-local and a run action class
|
||||
which is defined both thread-local and global.
|
||||
|
||||
The thread-local action classes are defined in
|
||||
ActionInitialization::Build()
|
||||
and the global run action class is defined in
|
||||
ActionInitialization::BuildForMaster().
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
4- An event : PrimaryGeneratorAction
|
||||
------------------------------------
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
|
||||
5- Histograms
|
||||
-------------
|
||||
To produce histograms, ROOT system must be installed
|
||||
|
||||
AnaEx02 can produce 4 histograms :
|
||||
|
||||
EAbs : total energy deposit in absorber per event
|
||||
EGap : total energy deposit in gap per event
|
||||
LAbs : total track length of charged particles in absorber per event
|
||||
LGap : total track length of charged particles in gap per event
|
||||
|
||||
And 2 Ntuples :
|
||||
- Ntuple1:
|
||||
- one row per event : EnergyAbs EnergyGap
|
||||
- Ntuple2:
|
||||
- one row per event : TrackLAbs TrackLGap
|
||||
|
||||
These histos and ntuples are booked in HistoManager and filled from
|
||||
EventAction.
|
||||
|
||||
One can control the name of the histograms file :
|
||||
default name : AnaEx02
|
||||
format : root
|
||||
|
||||
See HistoManager constructor
|
||||
|
||||
6- How to build
|
||||
---------------
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
% cd path_to_AnaEx02/AnaEx02
|
||||
% gmake setup
|
||||
% gmake
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
% gmake clean_setup
|
||||
|
||||
7- How to run
|
||||
--------------
|
||||
|
||||
- Execute AnaEx02 in the 'interactive mode' with visualization:
|
||||
% ./AnaEx02
|
||||
and type in the commands from run.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
or
|
||||
Idle> /control/execute run.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
- Execute AnaEx02 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
% ./AnaEx02 run.mac
|
||||
% ./AnaEx02 run.mac > run.out
|
||||
|
||||
The AnaEx02.in macro is used in Geant4 testing.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
///\file "analysis/B1Con/.README.txt"
|
||||
///\brief Example B1Con README page
|
||||
|
||||
/*! \page ExampleB1Con Example B1Con
|
||||
|
||||
|
||||
Example of Convergence Tester
|
||||
|
||||
Koi, Tatsumi \n
|
||||
SLAC National Accelerator Laboratory / PPA \n
|
||||
tkoi@slac.stanford.eedu \n
|
||||
|
||||
This example shows how to use convergece tester in Geant4.
|
||||
The aim of Convergence Tester
|
||||
- After a Monte Carlo simulation, we get an answer. However how to estimate quality of the answer.
|
||||
The answer is usually given in a form of average value.
|
||||
But sometimes the value is strongly affected by single or a few events in the full calculation.
|
||||
In such case, we must concern about quality of the value.
|
||||
|
||||
What we must remember is
|
||||
- Large number of history does not valid result of simulation.
|
||||
- Small Relative Error does not valid result of simulation
|
||||
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.
|
||||
Note that in this example, the classes with the code added for
|
||||
the purpose of demonstration of the Convergence Tester start with a prefix
|
||||
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.
|
||||
|
||||
\verbatim
|
||||
***********************************************************************************************************************
|
||||
Output example
|
||||
|
||||
// Part I.A
|
||||
// Basic statistics values
|
||||
|
||||
G4ConvergenceTester Output Result of DOSE_TALLY
|
||||
EFFICIENCY = 0.601
|
||||
MEAN = 4.81721e-12
|
||||
VAR = 2.15334e-23
|
||||
SD = 4.64041e-12
|
||||
R = 0.0304622
|
||||
SHIFT = 2.22459e-13
|
||||
VOV = 0.000166754
|
||||
FOM = 1238.68
|
||||
|
||||
// Part I.B
|
||||
// If the largeset scored events happen at next to the last event,
|
||||
// then how much the event effects the statistics values of the calculation
|
||||
|
||||
THE LARGEST SCORE = 1.07301e-11 and it happend at 487th event
|
||||
Affected Mean = 4.82311e-12 and its ratio to orignal is 1.00123
|
||||
Affected VAR = 2.15468e-23 and its ratio to orignal is 1.00062
|
||||
Affected R = 0.0304192 and its ratio to orignal is 0.998587
|
||||
Affected SHIFT = 2.1804e-13 and its ratio to orignal is 0.980133
|
||||
Affected FOM = 1238.68 and its ratio to orignal is 1
|
||||
|
||||
// Part I.C
|
||||
// Convergence tests results
|
||||
|
||||
MEAN distribution is RANDOM
|
||||
r follows 1/std::sqrt(N)
|
||||
r is monotonically decrease
|
||||
r is less than 0.1. r = 0.0304622
|
||||
VOV follows 1/std::sqrt(N)
|
||||
VOV is monotonically decrease
|
||||
FOM distribution is not RANDOM
|
||||
SLOPE is not large enough
|
||||
This result passes 6 / 8 Convergence Test.
|
||||
|
||||
// Part II
|
||||
// Profile of statistics values in the history
|
||||
|
||||
G4ConvergenceTester Output History of DOSE_TALLY
|
||||
i/16 till_ith mean var sd r vov fom shift e r2eff r2int
|
||||
1 62 4.94618e-12 2.04631e-23 4.52362e-12 0.115225 0.00313634 86.5745 -1.73435e-14 0.619048 0.00976801 0.00329797
|
||||
2 124 4.69364e-12 2.10698e-23 4.59018e-12 0.0874712 0.001597 150.228 3.11143e-13 0.6 0.00533333 0.00225666
|
||||
3 187 4.72161e-12 2.14009e-23 4.62612e-12 0.0714575 0.00101852 225.105 3.1009e-13 0.590426 0.00368986 0.00138916
|
||||
4 249 4.95617e-12 2.13982e-23 4.62582e-12 0.0590299 0.000690138 329.865 9.71971e-14 0.62 0.00245161 0.00101898
|
||||
5 312 4.8529e-12 2.13482e-23 4.62041e-12 0.0538155 0.000573301 396.887 1.95662e-13 0.607029 0.00206827 0.000818582
|
||||
6 374 5.14255e-12 2.15736e-23 4.64474e-12 0.046641 0.000432121 528.379 -6.42963e-14 0.637333 0.00151743 0.000652145
|
||||
7 437 5.03849e-12 2.13484e-23 4.62043e-12 0.0438173 0.000379317 598.673 2.54207e-14 0.636986 0.00130112 0.000614447
|
||||
8 499 4.96962e-12 2.1429e-23 4.62914e-12 0.0416574 0.000329007 662.364 9.27708e-14 0.63 0.0011746 0.000557264
|
||||
9 562 4.91513e-12 2.14709e-23 4.63367e-12 0.0397316 0.000285324 728.13 1.33544e-13 0.623446 0.0010728 0.000502991
|
||||
10 624 4.82995e-12 2.13825e-23 4.62412e-12 0.0382954 0.000272664 783.766 2.19101e-13 0.616 0.000997403 0.000466792
|
||||
11 687 4.79197e-12 2.13975e-23 4.62574e-12 0.0368022 0.000251788 848.661 2.48547e-13 0.606105 0.000944593 0.000407838
|
||||
12 749 4.77183e-12 2.15116e-23 4.63807e-12 0.0354912 0.000227501 912.513 2.6728e-13 0.601333 0.000883962 0.000373986
|
||||
13 812 4.76087e-12 2.14479e-23 4.63119e-12 0.0341162 0.000212259 987.548 2.70437e-13 0.597786 0.000827601 0.000334885
|
||||
14 874 4.81359e-12 2.13296e-23 4.6184e-12 0.0324353 0.0001976 1092.56 2.14521e-13 0.603429 0.000751082 0.000299767
|
||||
15 937 4.82018e-12 2.14558e-23 4.63204e-12 0.0313767 0.000181379 1167.52 2.18545e-13 0.601279 0.000706952 0.000276498
|
||||
16 999 4.81721e-12 2.15334e-23 4.64041e-12 0.0304622 0.000166754 1238.68 2.22459e-13 0.601 0.000663894 0.000263125
|
||||
|
||||
|
||||
**************************************************************************************************************************
|
||||
\endverbatim
|
||||
|
||||
Reference of this Convergence tests: \n
|
||||
MCNP(TM) -A General Monte Carlo N-Particle Transport Code \n
|
||||
Version 4B \n
|
||||
Judith F. Briesmeister, Editor \n
|
||||
LA-12625-M, Issued: March 1997, UC 705 and UC 700 \n
|
||||
CHAPTER 2. GEOMETRY, DATA, PHYSICS, AND MATHEMATICS \n
|
||||
VI. ESTIMATION OF THE MONTE CARLO PRECISION \n
|
||||
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
Example of Convergence Tester
|
||||
|
||||
Koi, Tatsumi
|
||||
SLAC National Accelerator Laboratory / PPA
|
||||
tkoi@slac.stanford.eedu
|
||||
|
||||
This example shows how to use convergece tester in Geant4.
|
||||
The aim of Convergence Tester
|
||||
After a Monte Carlo simulation, we get an answer. However how to estimate quality of the answer.
|
||||
The answer is usually given in a form of average value.
|
||||
But sometimes the value is strongly affected by single or a few events in the full calculation.
|
||||
In such case, we must concern about quality of the value.
|
||||
What we must remember is
|
||||
Large number of history does not valid result of simulation.
|
||||
Small Relative Error does not valid result of simulation
|
||||
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
|
||||
Note that in this example, the classes with the code added for
|
||||
the purpose of demonstration of the Convergence Tester start with a prefix
|
||||
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.
|
||||
|
||||
***********************************************************************************************************************
|
||||
Output example
|
||||
|
||||
// Part I.A
|
||||
// Basic statistics values
|
||||
|
||||
G4ConvergenceTester Output Result of DOSE_TALLY
|
||||
EFFICIENCY = 0.601
|
||||
MEAN = 4.81721e-12
|
||||
VAR = 2.15334e-23
|
||||
SD = 4.64041e-12
|
||||
R = 0.0304622
|
||||
SHIFT = 2.22459e-13
|
||||
VOV = 0.000166754
|
||||
FOM = 1238.68
|
||||
|
||||
// Part I.B
|
||||
// If the largeset scored events happen at next to the last event,
|
||||
// then how much the event effects the statistics values of the calculation
|
||||
|
||||
THE LARGEST SCORE = 1.07301e-11 and it happend at 487th event
|
||||
Affected Mean = 4.82311e-12 and its ratio to orignal is 1.00123
|
||||
Affected VAR = 2.15468e-23 and its ratio to orignal is 1.00062
|
||||
Affected R = 0.0304192 and its ratio to orignal is 0.998587
|
||||
Affected SHIFT = 2.1804e-13 and its ratio to orignal is 0.980133
|
||||
Affected FOM = 1238.68 and its ratio to orignal is 1
|
||||
|
||||
// Part I.C
|
||||
// Convergence tests results
|
||||
|
||||
MEAN distribution is RANDOM
|
||||
r follows 1/std::sqrt(N)
|
||||
r is monotonically decrease
|
||||
r is less than 0.1. r = 0.0304622
|
||||
VOV follows 1/std::sqrt(N)
|
||||
VOV is monotonically decrease
|
||||
FOM distribution is not RANDOM
|
||||
SLOPE is not large enough
|
||||
This result passes 6 / 8 Convergence Test.
|
||||
|
||||
|
||||
// Part II
|
||||
// Profile of statistics values in the history
|
||||
|
||||
G4ConvergenceTester Output History of DOSE_TALLY
|
||||
i/16 till_ith mean var sd r vov fom shift e r2eff r2int
|
||||
1 62 4.94618e-12 2.04631e-23 4.52362e-12 0.115225 0.00313634 86.5745 -1.73435e-14 0.619048 0.00976801 0.00329797
|
||||
2 124 4.69364e-12 2.10698e-23 4.59018e-12 0.0874712 0.001597 150.228 3.11143e-13 0.6 0.00533333 0.00225666
|
||||
3 187 4.72161e-12 2.14009e-23 4.62612e-12 0.0714575 0.00101852 225.105 3.1009e-13 0.590426 0.00368986 0.00138916
|
||||
4 249 4.95617e-12 2.13982e-23 4.62582e-12 0.0590299 0.000690138 329.865 9.71971e-14 0.62 0.00245161 0.00101898
|
||||
5 312 4.8529e-12 2.13482e-23 4.62041e-12 0.0538155 0.000573301 396.887 1.95662e-13 0.607029 0.00206827 0.000818582
|
||||
6 374 5.14255e-12 2.15736e-23 4.64474e-12 0.046641 0.000432121 528.379 -6.42963e-14 0.637333 0.00151743 0.000652145
|
||||
7 437 5.03849e-12 2.13484e-23 4.62043e-12 0.0438173 0.000379317 598.673 2.54207e-14 0.636986 0.00130112 0.000614447
|
||||
8 499 4.96962e-12 2.1429e-23 4.62914e-12 0.0416574 0.000329007 662.364 9.27708e-14 0.63 0.0011746 0.000557264
|
||||
9 562 4.91513e-12 2.14709e-23 4.63367e-12 0.0397316 0.000285324 728.13 1.33544e-13 0.623446 0.0010728 0.000502991
|
||||
10 624 4.82995e-12 2.13825e-23 4.62412e-12 0.0382954 0.000272664 783.766 2.19101e-13 0.616 0.000997403 0.000466792
|
||||
11 687 4.79197e-12 2.13975e-23 4.62574e-12 0.0368022 0.000251788 848.661 2.48547e-13 0.606105 0.000944593 0.000407838
|
||||
12 749 4.77183e-12 2.15116e-23 4.63807e-12 0.0354912 0.000227501 912.513 2.6728e-13 0.601333 0.000883962 0.000373986
|
||||
13 812 4.76087e-12 2.14479e-23 4.63119e-12 0.0341162 0.000212259 987.548 2.70437e-13 0.597786 0.000827601 0.000334885
|
||||
14 874 4.81359e-12 2.13296e-23 4.6184e-12 0.0324353 0.0001976 1092.56 2.14521e-13 0.603429 0.000751082 0.000299767
|
||||
15 937 4.82018e-12 2.14558e-23 4.63204e-12 0.0313767 0.000181379 1167.52 2.18545e-13 0.601279 0.000706952 0.000276498
|
||||
16 999 4.81721e-12 2.15334e-23 4.64041e-12 0.0304622 0.000166754 1238.68 2.22459e-13 0.601 0.000663894 0.000263125
|
||||
|
||||
**************************************************************************************************************************
|
||||
|
||||
Reference of this Convergence tests
|
||||
MCNP(TM) -A General Monte Carlo N-Particle Transport Code
|
||||
Version 4B
|
||||
Judith F. Briesmeister, Editor
|
||||
LA-12625-M, Issued: March 1997, UC 705 and UC 700
|
||||
CHAPTER 2. GEOMETRY, DATA, PHYSICS, AND MATHEMATICS
|
||||
VI. ESTIMATION OF THE MONTE CARLO PRECISION
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example B1
|
||||
-----------
|
||||
|
||||
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.
|
||||
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The geometry is constructed in the B1DetectorConstruction 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.
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
to Geant4 kernel all user action classes.
|
||||
|
||||
While in sequential mode the action classes are instatiated just once,
|
||||
via invoking the method:
|
||||
B1ActionInitialization::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()
|
||||
which is invoked only in multi-threading mode.
|
||||
|
||||
4- PRIMARY GENERATOR
|
||||
|
||||
The primary generator is defined in the B1PrimaryGeneratorAction 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 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.
|
||||
|
||||
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(),
|
||||
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
|
||||
result is printed on the screen.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
|
||||
The user can change the initial viewer by commenting out this line
|
||||
and instead uncommenting one of the other /vis/open statements, such as
|
||||
HepRepFile or DAWNFILE (which produce files that can be viewed with the
|
||||
HepRApp and DAWN viewers, respectively). Note that one can always
|
||||
open new viewers at any time from the command line. For example, if
|
||||
you already have a view in, say, an OpenGL window with a name
|
||||
"viewer-0", then
|
||||
/vis/open DAWNFILE
|
||||
then to get the same view
|
||||
/vis/viewer/copyView viewer-0
|
||||
or to get the same view *plus* scene-modifications
|
||||
/vis/viewer/set/all viewer-0
|
||||
then to see the result
|
||||
/vis/viewer/flush
|
||||
|
||||
The DAWNFILE, HepRepFile drivers are always available
|
||||
(since they require no external libraries), but the OGL driver requires
|
||||
that the Geant4 libraries have been built with the OpenGL option.
|
||||
|
||||
From Release 9.6 the vis.mac macro in example B1 has additional commands
|
||||
that demonstrate additional functionality of the vis system, such as
|
||||
displaying text, axes, scales, date, logo and shows how to change
|
||||
viewpoint and style. Consider copying these to other examples or
|
||||
your application. To see even more commands use help or
|
||||
ls or browse the available UI commands in the Application
|
||||
Developers Guide, Section 7.1.
|
||||
|
||||
For more information on visualization, including information on how to
|
||||
install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
|
||||
for example,
|
||||
http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
|
||||
(where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
|
||||
|
||||
The tracks are automatically drawn at the end of each event, accumulated
|
||||
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).
|
||||
|
||||
C- HOW TO RUN
|
||||
|
||||
- Execute exampleB1 in the 'interactive mode' with visualization:
|
||||
% ./exampleB1
|
||||
and type in the commands from run1.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
or
|
||||
Idle> /control/execute run1.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
- Execute exampleB1 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
% ./exampleB1 run2.mac
|
||||
% ./exampleB1 exampleB1.in > exampleB1.out
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
Geant4 extended examples - analysis
|
||||
-----------------------------------
|
||||
|
||||
Examples in this directory demonstrate how to make histograms and ntuples
|
||||
|
||||
AnaEx01
|
||||
--------
|
||||
|
||||
Simple example showing use of g4tools.
|
||||
|
||||
AnaEx02
|
||||
--------
|
||||
|
||||
As AnaEx01, but direct interface to ROOT.
|
||||
|
||||
B1Con
|
||||
------
|
||||
|
||||
B1Con shows how to use the statistical tool G4ConvergenceTester.
|
||||
It does not make histograms.
|
||||
It has the same geometry as B1.
|
||||
Reference in New Issue
Block a user