Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
+17
View File
@@ -0,0 +1,17 @@
# Example extended History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-06-10 Gabriele Cosmo (exextended-V11-02-01)
- Updated GDML files to use short URL for schema validation.
## 2024-06-04 Ben Morgan (exextended-V11-02-00)
- Initial overall History file for extended examples.
Used for global changes affecting all examples under here.
- Apply clang-format to all extended examples.
- Address coding style warnings.
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -290,7 +297,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -845,7 +852,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -866,20 +873,20 @@ See commands in /vis/modeling/trajectories/ for other options.
--------------------End of Run------------------------------
mean Energy in Absorber : 281.112 MeV +- 0 eV
mean Energy in Gap : 74.1401 MeV +- 0 eV
mean Energy in Absorber : 245.231 MeV +- 0 eV
mean Energy in Gap : 64.6941 MeV +- 0 eV
mean trackLength in Absorber : 69.2721 cm +- 0 fm
mean trackLength in Gap : 37.7451 cm +- 0 fm
mean trackLength in Absorber : 60.8807 cm +- 0 fm
mean trackLength in Gap : 32.6255 cm +- 0 fm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 281.112 MeV rms = 0 eV
EGap: mean = 74.1401 MeV rms = 0 eV
LAbs: mean = 69.2721 cm rms = 0 fm
LGap: mean = 37.7451 cm rms = 0 fm
EAbs: mean = 245.231 MeV rms = 0 eV
EGap: mean = 64.6941 MeV rms = 0 eV
LAbs: mean = 60.8807 cm rms = 0 fm
LGap: mean = 32.6255 cm rms = 0 fm
... create file : ./histo/AnaEx01_h1_EAbs.csv - done
... create file : ./histo/AnaEx01_h1_EGap.csv - done
... create file : ./histo/AnaEx01_h1_LAbs.csv - done
@@ -939,20 +946,20 @@ There are histograms that can be viewed with visualization:
--------------------End of Run------------------------------
mean Energy in Absorber : 190.633 MeV +- 48.8718 MeV
mean Energy in Gap : 46.5146 MeV +- 13.3975 MeV
mean Energy in Absorber : 186.264 MeV +- 50.8208 MeV
mean Energy in Gap : 45.8735 MeV +- 13.843 MeV
mean trackLength in Absorber : 47.0418 cm +- 12.1398 cm
mean trackLength in Gap : 23.5952 cm +- 6.83896 cm
mean trackLength in Absorber : 46.0323 cm +- 12.6521 cm
mean trackLength in Gap : 23.2729 cm +- 7.04724 cm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 190.633 MeV rms = 48.8718 MeV
EGap: mean = 46.5146 MeV rms = 13.3975 MeV
LAbs: mean = 47.0418 cm rms = 12.1398 cm
LGap: mean = 23.5952 cm rms = 6.83896 cm
EAbs: mean = 186.264 MeV rms = 50.8208 MeV
EGap: mean = 45.8735 MeV rms = 13.843 MeV
LAbs: mean = 46.0323 cm rms = 12.6521 cm
LGap: mean = 23.246 cm rms = 6.99942 cm
... create file : ./histo/AnaEx01_h1_EAbs.csv - done
... create file : ./histo/AnaEx01_h1_EGap.csv - done
... create file : ./histo/AnaEx01_h1_LAbs.csv - done
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -290,7 +297,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -845,7 +852,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -865,20 +872,20 @@ See commands in /vis/modeling/trajectories/ for other options.
--------------------End of Run------------------------------
mean Energy in Absorber : 281.112 MeV +- 0 eV
mean Energy in Gap : 74.1401 MeV +- 0 eV
mean Energy in Absorber : 245.231 MeV +- 0 eV
mean Energy in Gap : 64.6941 MeV +- 0 eV
mean trackLength in Absorber : 69.2721 cm +- 0 fm
mean trackLength in Gap : 37.7451 cm +- 0 fm
mean trackLength in Absorber : 60.8807 cm +- 0 fm
mean trackLength in Gap : 32.6255 cm +- 0 fm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 281.112 MeV rms = 0 eV
EGap: mean = 74.1401 MeV rms = 0 eV
LAbs: mean = 69.2721 cm rms = 0 fm
LGap: mean = 37.7451 cm rms = 0 fm
EAbs: mean = 245.231 MeV rms = 0 eV
EGap: mean = 64.6941 MeV rms = 0 eV
LAbs: mean = 60.8807 cm rms = 0 fm
LGap: mean = 32.6255 cm rms = 0 fm
... write file : AnaEx01.hdf5 - done
... close file : AnaEx01.hdf5 - done
@@ -923,20 +930,20 @@ There are histograms that can be viewed with visualization:
--------------------End of Run------------------------------
mean Energy in Absorber : 190.633 MeV +- 48.8718 MeV
mean Energy in Gap : 46.5146 MeV +- 13.3975 MeV
mean Energy in Absorber : 186.264 MeV +- 50.8208 MeV
mean Energy in Gap : 45.8735 MeV +- 13.843 MeV
mean trackLength in Absorber : 47.0418 cm +- 12.1398 cm
mean trackLength in Gap : 23.5952 cm +- 6.83896 cm
mean trackLength in Absorber : 46.0323 cm +- 12.6521 cm
mean trackLength in Gap : 23.2729 cm +- 7.04724 cm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 190.633 MeV rms = 48.8718 MeV
EGap: mean = 46.5146 MeV rms = 13.3975 MeV
LAbs: mean = 47.0418 cm rms = 12.1398 cm
LGap: mean = 23.5952 cm rms = 6.83896 cm
EAbs: mean = 186.264 MeV rms = 50.8208 MeV
EGap: mean = 45.8735 MeV rms = 13.843 MeV
LAbs: mean = 46.0323 cm rms = 12.6521 cm
LGap: mean = 23.246 cm rms = 6.99942 cm
... write file : AnaEx01.hdf5 - done
... close file : AnaEx01.hdf5 - done
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -290,7 +297,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -845,7 +852,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -867,20 +874,20 @@ See commands in /vis/modeling/trajectories/ for other options.
--------------------End of Run------------------------------
mean Energy in Absorber : 281.112 MeV +- 0 eV
mean Energy in Gap : 74.1401 MeV +- 0 eV
mean Energy in Absorber : 245.231 MeV +- 0 eV
mean Energy in Gap : 64.6941 MeV +- 0 eV
mean trackLength in Absorber : 69.2721 cm +- 0 fm
mean trackLength in Gap : 37.7451 cm +- 0 fm
mean trackLength in Absorber : 60.8807 cm +- 0 fm
mean trackLength in Gap : 32.6255 cm +- 0 fm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 281.112 MeV rms = 0 eV
EGap: mean = 74.1401 MeV rms = 0 eV
LAbs: mean = 69.2721 cm rms = 0 fm
LGap: mean = 37.7451 cm rms = 0 fm
EAbs: mean = 245.231 MeV rms = 0 eV
EGap: mean = 64.6941 MeV rms = 0 eV
LAbs: mean = 60.8807 cm rms = 0 fm
LGap: mean = 32.6255 cm rms = 0 fm
... write file : AnaEx01.root - done
... close file : AnaEx01.root - done
@@ -926,20 +933,20 @@ There are histograms that can be viewed with visualization:
--------------------End of Run------------------------------
mean Energy in Absorber : 190.633 MeV +- 48.8718 MeV
mean Energy in Gap : 46.5146 MeV +- 13.3975 MeV
mean Energy in Absorber : 186.264 MeV +- 50.8208 MeV
mean Energy in Gap : 45.8735 MeV +- 13.843 MeV
mean trackLength in Absorber : 47.0418 cm +- 12.1398 cm
mean trackLength in Gap : 23.5952 cm +- 6.83896 cm
mean trackLength in Absorber : 46.0323 cm +- 12.6521 cm
mean trackLength in Gap : 23.2729 cm +- 7.04724 cm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 190.633 MeV rms = 48.8718 MeV
EGap: mean = 46.5146 MeV rms = 13.3975 MeV
LAbs: mean = 47.0418 cm rms = 12.1398 cm
LGap: mean = 23.5952 cm rms = 6.83896 cm
EAbs: mean = 186.264 MeV rms = 50.8208 MeV
EGap: mean = 45.8735 MeV rms = 13.843 MeV
LAbs: mean = 46.0323 cm rms = 12.6521 cm
LGap: mean = 23.246 cm rms = 6.99942 cm
... write file : AnaEx01.root - done
... close file : AnaEx01.root - done
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -290,7 +297,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -845,7 +852,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -867,20 +874,20 @@ See commands in /vis/modeling/trajectories/ for other options.
--------------------End of Run------------------------------
mean Energy in Absorber : 281.112 MeV +- 0 eV
mean Energy in Gap : 74.1401 MeV +- 0 eV
mean Energy in Absorber : 245.231 MeV +- 0 eV
mean Energy in Gap : 64.6941 MeV +- 0 eV
mean trackLength in Absorber : 69.2721 cm +- 0 fm
mean trackLength in Gap : 37.7451 cm +- 0 fm
mean trackLength in Absorber : 60.8807 cm +- 0 fm
mean trackLength in Gap : 32.6255 cm +- 0 fm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 281.112 MeV rms = 0 eV
EGap: mean = 74.1401 MeV rms = 0 eV
LAbs: mean = 69.2721 cm rms = 0 fm
LGap: mean = 37.7451 cm rms = 0 fm
EAbs: mean = 245.231 MeV rms = 0 eV
EGap: mean = 64.6941 MeV rms = 0 eV
LAbs: mean = 60.8807 cm rms = 0 fm
LGap: mean = 32.6255 cm rms = 0 fm
... write file : AnaEx01.xml - done
... write file : AnaEx01_nt_Ntuple1.xml - done
... write file : AnaEx01_nt_Ntuple2.xml - done
@@ -931,20 +938,20 @@ There are histograms that can be viewed with visualization:
--------------------End of Run------------------------------
mean Energy in Absorber : 190.633 MeV +- 48.8718 MeV
mean Energy in Gap : 46.5146 MeV +- 13.3975 MeV
mean Energy in Absorber : 186.264 MeV +- 50.8208 MeV
mean Energy in Gap : 45.8735 MeV +- 13.843 MeV
mean trackLength in Absorber : 47.0418 cm +- 12.1398 cm
mean trackLength in Gap : 23.5952 cm +- 6.83896 cm
mean trackLength in Absorber : 46.0323 cm +- 12.6521 cm
mean trackLength in Gap : 23.2729 cm +- 7.04724 cm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 190.633 MeV rms = 48.8718 MeV
EGap: mean = 46.5146 MeV rms = 13.3975 MeV
LAbs: mean = 47.0418 cm rms = 12.1398 cm
LGap: mean = 23.5952 cm rms = 6.83896 cm
EAbs: mean = 186.264 MeV rms = 50.8208 MeV
EGap: mean = 45.8735 MeV rms = 13.843 MeV
LAbs: mean = 46.0323 cm rms = 12.6521 cm
LGap: mean = 23.246 cm rms = 6.99942 cm
... write file : AnaEx01.xml - done
... write file : AnaEx01_nt_Ntuple1.xml - done
... write file : AnaEx01_nt_Ntuple2.xml - done
+10 -12
View File
@@ -32,25 +32,23 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4VisExecutive.hh"
#include "G4RunManagerFactory.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
@@ -62,7 +60,7 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
auto detector = new DetectorConstruction;
auto detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new FTFP_BERT);
runManager->SetUserInitialization(new ActionInitialization(detector));
@@ -76,13 +74,13 @@ int main(int argc,char** argv)
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if ( ui == nullptr ) {
if (ui == nullptr) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand("/control/alias defaultFileType root");
// define the default value for alias used in AnaEx01.in
UImanager->ApplyCommand(command+fileName);
// define the default value for alias used in AnaEx01.in
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
@@ -43,7 +43,7 @@ class HistoManager
{
public:
HistoManager();
~HistoManager() = default;
~HistoManager() = default;
void Book();
void Save();
@@ -51,8 +51,7 @@ class HistoManager
void FillHisto(G4int id, G4double e, G4double weight = 1.0);
void Normalize(G4int id, G4double fac);
void FillNtuple(G4double EnergyAbs, G4double EnergyGap,
G4double TrackLAbs, G4double TrackLGap);
void FillNtuple(G4double EnergyAbs, G4double EnergyGap, G4double TrackLAbs, G4double TrackLGap);
void PrintStatistic();
@@ -63,4 +62,3 @@ class HistoManager
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -51,5 +51,3 @@ class ActionInitialization : public G4VUserActionInitialization
};
#endif
@@ -32,11 +32,11 @@
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -48,41 +48,40 @@ class DetectorMessenger;
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction() override;
DetectorConstruction();
~DetectorConstruction() override;
public:
G4VPhysicalVolume* Construct() override;
void SetAbsorberMaterial (const G4String&);
void SetAbsorberMaterial(const G4String&);
void SetAbsorberThickness(G4double);
void SetGapMaterial (const G4String&);
void SetGapMaterial(const G4String&);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetNbOfLayers(G4int);
void PrintCalorParameters();
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeYZ() { return fWorldSizeYZ; }
G4double GetCalorThickness() { return fCalorThickness; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4int GetNbOfLayers() { return fNbOfLayers; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
const G4VPhysicalVolume* GetphysiWorld() { return fPhysiWorld; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
private:
void DefineMaterials();
@@ -93,37 +92,37 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4Material* fGapMaterial = nullptr;
G4Material* fDefaultMaterial = nullptr;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10.*CLHEP::mm;
G4double fGapThickness = 5.*CLHEP::mm;
G4double fCalorSizeYZ = 10.*CLHEP::cm;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10. * CLHEP::mm;
G4double fGapThickness = 5. * CLHEP::mm;
G4double fCalorSizeYZ = 10. * CLHEP::cm;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness= 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness = 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4Box* fSolidWorld = nullptr; //pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; //pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; //pointer to the physical World
G4Box* fSolidWorld = nullptr; // pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; // pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; // pointer to the physical World
G4Box* fSolidCalor = nullptr; //pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; //pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; //pointer to the physical Calor
G4Box* fSolidCalor = nullptr; // pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; // pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; // pointer to the physical Calor
G4Box* fSolidLayer = nullptr; //pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; //pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; //pointer to the physical Layer
G4Box* fSolidLayer = nullptr; // pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; // pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; // pointer to the physical Layer
G4Box* fSolidAbsorber = nullptr; //pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; //pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; //pointer to the physical Absorber
G4Box* fSolidAbsorber = nullptr; // pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; // pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; // pointer to the physical Absorber
G4Box* fSolidGap = nullptr; //pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; //pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; //pointer to the physical Gap
G4Box* fSolidGap = nullptr; // pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; // pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; // pointer to the physical Gap
DetectorMessenger* fDetectorMessenger = nullptr; //pointer to the Messenger
DetectorMessenger* fDetectorMessenger = nullptr; // pointer to the Messenger
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -131,13 +130,13 @@ class DetectorConstruction : public G4VUserDetectorConstruction
inline void DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers*fLayerThickness;
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers * fLayerThickness;
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
fWorldSizeX = 1.2 * fCalorThickness;
fWorldSizeYZ = 1.2 * fCalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -32,8 +32,8 @@
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
@@ -43,10 +43,10 @@ class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
class DetectorMessenger : public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
@@ -54,13 +54,13 @@ class DetectorMessenger: public G4UImessenger
private:
DetectorConstruction* fDetector = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fAbsThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fGapThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fSizeYZCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,30 +46,36 @@ class HistoManager;
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction*, HistoManager*);
~EventAction() override;
public:
EventAction(RunAction*, HistoManager*);
~EventAction() override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
void AddAbs(G4double de, G4double dl)
{
fEnergyAbs += de;
fTrackLAbs += dl;
};
void AddGap(G4double de, G4double dl)
{
fEnergyGap += de;
fTrackLGap += dl;
};
private:
RunAction* fRunAct = nullptr;
HistoManager* fHistoManager = nullptr;
private:
RunAction* fRunAct = nullptr;
HistoManager* fHistoManager = nullptr;
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
G4int fPrintModulo = 100;
G4int fPrintModulo = 100;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -43,19 +43,17 @@ class DetectorConstruction;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
void GeneratePrimaries(G4Event*) override;
private:
G4ParticleGun* fParticleGun = nullptr; //pointer a to G4 class
DetectorConstruction* fDetector = nullptr; //pointer to the geometry
private:
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 class
DetectorConstruction* fDetector = nullptr; // pointer to the geometry
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -36,8 +36,8 @@
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,30 +47,29 @@ class HistoManager;
class RunAction : public G4UserRunAction
{
public:
RunAction(HistoManager*);
~RunAction() override;
public:
RunAction(HistoManager*);
~RunAction() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void FillPerEvent(G4double, G4double, G4double, G4double);
void FillPerEvent(G4double, G4double, G4double, G4double);
private:
HistoManager* fHistoManager = nullptr;
private:
HistoManager* fHistoManager = nullptr;
G4Accumulable<G4double> fSumEAbs = 0.;
G4Accumulable<G4double> fSum2EAbs = 0.;
G4Accumulable<G4double> fSumEGap = 0.;
G4Accumulable<G4double> fSum2EGap = 0.;
G4Accumulable<G4double> fSumEAbs = 0.;
G4Accumulable<G4double> fSum2EAbs = 0.;
G4Accumulable<G4double> fSumEGap = 0.;
G4Accumulable<G4double> fSum2EGap = 0.;
G4Accumulable<G4double> fSumLAbs = 0.;
G4Accumulable<G4double> fSum2LAbs = 0.;
G4Accumulable<G4double> fSumLGap = 0.;
G4Accumulable<G4double> fSum2LGap = 0.;
G4Accumulable<G4double> fSumLAbs = 0.;
G4Accumulable<G4double> fSum2LAbs = 0.;
G4Accumulable<G4double> fSumLGap = 0.;
G4Accumulable<G4double> fSum2LGap = 0.;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -41,15 +41,15 @@ class EventAction;
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
void UserSteppingAction(const G4Step*) override;
void UserSteppingAction(const G4Step*) override;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,17 +28,16 @@
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
: fDetector(detector)
{}
ActionInitialization::ActionInitialization(DetectorConstruction* detector) : fDetector(detector) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +48,7 @@ ActionInitialization::~ActionInitialization() = default;
void ActionInitialization::BuildForMaster() const
{
// Histo manager
auto histo = new HistoManager();
auto histo = new HistoManager();
// Actions
SetUserAction(new RunAction(histo));
@@ -60,19 +59,19 @@ void ActionInitialization::BuildForMaster() const
void ActionInitialization::Build() const
{
// Histo manager
auto histo = new HistoManager();
auto histo = new HistoManager();
// Actions
//
SetUserAction(new PrimaryGeneratorAction(fDetector));
auto runAction = new RunAction(histo);
auto runAction = new RunAction(histo);
SetUserAction(runAction);
auto eventAction = new EventAction(runAction, histo);
auto eventAction = new EventAction(runAction, histo);
SetUserAction(eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
SetUserAction(steppingAction);
}
@@ -30,26 +30,24 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GeometryManager.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4StateManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
#include "G4SolidStore.hh"
#include "G4StateManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -113,114 +111,118 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// World
//
fSolidWorld = new G4Box("World", //its name
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
fSolidWorld = new G4Box("World", // its name
fWorldSizeX / 2, fWorldSizeYZ / 2, fWorldSizeYZ / 2); // its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fDefaultMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its logical volume
"World", //its name
nullptr, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicWorld, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0); // copy number
//
// Calorimeter
//
fSolidCalor = nullptr; fLogicCalor = nullptr; fPhysiCalor = nullptr;
fSolidLayer = nullptr; fLogicLayer = nullptr; fPhysiLayer = nullptr;
fSolidCalor = nullptr;
fLogicCalor = nullptr;
fPhysiCalor = nullptr;
fSolidLayer = nullptr;
fLogicLayer = nullptr;
fPhysiLayer = nullptr;
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", //its name
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", // its name
fCalorThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
fDefaultMaterial, //its material
"Calorimeter"); //its name
fLogicCalor = new G4LogicalVolume(fSolidCalor, // its solid
fDefaultMaterial, // its material
"Calorimeter"); // its name
fPhysiCalor = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicCalor, //its logical volume
"Calorimeter", //its name
fLogicWorld, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiCalor = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicCalor, // its logical volume
"Calorimeter", // its name
fLogicWorld, // its mother volume
false, // no boolean operation
0); // copy number
//
// Layer
//
fSolidLayer = new G4Box("Layer", //its name
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidLayer = new G4Box("Layer", // its name
fLayerThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicLayer = new G4LogicalVolume(fSolidLayer, //its solid
fDefaultMaterial, //its material
"Layer"); //its name
fLogicLayer = new G4LogicalVolume(fSolidLayer, // its solid
fDefaultMaterial, // its material
"Layer"); // its name
if (fNbOfLayers > 1) {
fPhysiLayer = new G4PVReplica("Layer", //its name
fLogicLayer, //its logical volume
fLogicCalor, //its mother
kXAxis, //axis of replication
fNbOfLayers, //number of replica
fLayerThickness); //witdth of replica
fPhysiLayer = new G4PVReplica("Layer", // its name
fLogicLayer, // its logical volume
fLogicCalor, // its mother
kXAxis, // axis of replication
fNbOfLayers, // number of replica
fLayerThickness); // witdth of replica
}
else {
fPhysiLayer = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicLayer, //its logical volume
"Layer", //its name
fLogicCalor, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiLayer = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicLayer, // its logical volume
"Layer", // its name
fLogicCalor, // its mother volume
false, // no boolean operation
0); // copy number
}
}
//
// Absorber
//
fSolidAbsorber = nullptr; fLogicAbsorber = nullptr; fPhysiAbsorber = nullptr;
fSolidAbsorber = nullptr;
fLogicAbsorber = nullptr;
fPhysiAbsorber = nullptr;
if (fAbsorberThickness > 0.) {
fSolidAbsorber = new G4Box("Absorber", //its name
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidAbsorber = new G4Box("Absorber", // its name
fAbsorberThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
fAbsorberMaterial, //its material
fAbsorberMaterial->GetName()); //name
fPhysiAbsorber = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
fLogicAbsorber, //its logical volume
fAbsorberMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, // its solid
fAbsorberMaterial, // its material
fAbsorberMaterial->GetName()); // name
fPhysiAbsorber = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(-fGapThickness / 2, 0., 0.), // its position
fLogicAbsorber, // its logical volume
fAbsorberMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
//
// Gap
//
fSolidGap = nullptr; fLogicGap = nullptr; fPhysiGap = nullptr;
fSolidGap = nullptr;
fLogicGap = nullptr;
fPhysiGap = nullptr;
if (fGapThickness > 0.) {
fSolidGap = new G4Box("Gap",
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fSolidGap = new G4Box("Gap", fGapThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2);
fLogicGap = new G4LogicalVolume(fSolidGap,
fGapMaterial,
fGapMaterial->GetName());
fLogicGap = new G4LogicalVolume(fSolidGap, fGapMaterial, fGapMaterial->GetName());
fPhysiGap = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
fLogicGap, //its logical volume
fGapMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fPhysiGap = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(fAbsorberThickness / 2, 0., 0.), // its position
fLogicGap, // its logical volume
fGapMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
PrintCalorParameters();
@@ -228,14 +230,14 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// Visualization attributes
//
fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
auto simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
simpleBoxVisAtt->SetVisibility(true);
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
//
//always return the physical World
// always return the physical World
//
return fPhysiWorld;
}
@@ -246,9 +248,8 @@ void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
<< " + "
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
<< fAbsorberThickness / mm << "mm of " << fAbsorberMaterial->GetName() << " + "
<< fGapThickness / mm << "mm of " << fGapMaterial->GetName() << " ] "
<< "\n------------------------------------------------------------\n";
}
@@ -274,7 +275,7 @@ void DetectorConstruction::SetGapMaterial(const G4String& materialChoice)
auto material = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (material != nullptr) {
fGapMaterial = material;
if ( fLogicGap != nullptr) {
if (fLogicGap != nullptr) {
fLogicGap->SetMaterial(fGapMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
@@ -287,7 +288,7 @@ void DetectorConstruction::SetAbsorberThickness(G4double value)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -298,7 +299,7 @@ void DetectorConstruction::SetGapThickness(G4double value)
{
// change Gap thickness and recompute the calorimeter parameters
fGapThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -309,7 +310,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
{
// change the transverse size and recompute the calorimeter parameters
fCalorSizeYZ = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -319,7 +320,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
void DetectorConstruction::SetNbOfLayers(G4int value)
{
fNbOfLayers = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -32,57 +32,57 @@
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIdirectory.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
: fDetector(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction* Det) : fDetector(Det)
{
G4bool broadcast = false;
fDetDir = new G4UIdirectory("/det/",broadcast);
fDetDir = new G4UIdirectory("/det/", broadcast);
fDetDir->SetGuidance("Detector control");
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat",this);
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat", this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("AbsMat",false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsMaterCmd->SetParameterName("AbsMat", false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat",this);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat", this);
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
fGapMaterCmd->SetParameterName("GapMat",false);
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapMaterCmd->SetParameterName("GapMat", false);
fGapMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick",this);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick", this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("AbsThick",false);
fAbsThickCmd->SetParameterName("AbsThick", false);
fAbsThickCmd->SetRange("AbsThick>=0.");
fAbsThickCmd->SetUnitCategory("Length");
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick",this);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick", this);
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
fGapThickCmd->SetParameterName("GapThick",false);
fGapThickCmd->SetParameterName("GapThick", false);
fGapThickCmd->SetRange("GapThick>=0.");
fGapThickCmd->SetUnitCategory("Length");
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ",this);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ", this);
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
fSizeYZCmd->SetParameterName("SizeYZ",false);
fSizeYZCmd->SetParameterName("SizeYZ", false);
fSizeYZCmd->SetRange("SizeYZ>0.");
fSizeYZCmd->SetUnitCategory("Length");
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeYZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers",this);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers", this);
fNbLayersCmd->SetGuidance("Set number of layers.");
fNbLayersCmd->SetParameterName("NbLayers",false);
fNbLayersCmd->SetParameterName("NbLayers", false);
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -102,32 +102,32 @@ DetectorMessenger::~DetectorMessenger()
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fAbsMaterCmd ) {
if (command == fAbsMaterCmd) {
fDetector->SetAbsorberMaterial(newValue);
return;
}
if( command == fGapMaterCmd ) {
if (command == fGapMaterCmd) {
fDetector->SetGapMaterial(newValue);
return;
}
if( command == fAbsThickCmd ) {
if (command == fAbsThickCmd) {
fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fGapThickCmd ) {
if (command == fGapThickCmd) {
fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fSizeYZCmd ) {
if (command == fSizeYZCmd) {
fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fNbLayersCmd ) {
if (command == fNbLayersCmd) {
fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));
return;
}
@@ -35,15 +35,14 @@
#include "EventAction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "RunAction.hh"
#include "G4Event.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(RunAction* run, HistoManager* histo)
: fRunAct(run),fHistoManager(histo)
EventAction::EventAction(RunAction* run, HistoManager* histo) : fRunAct(run), fHistoManager(histo)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,7 +54,7 @@ EventAction::~EventAction() = default;
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0) {
if (evtNb % fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
}
@@ -68,18 +67,18 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
void EventAction::EndOfEventAction(const G4Event*)
{
//accumulates statistic
// accumulates statistic
//
fRunAct->FillPerEvent(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
//fill histograms
// fill histograms
//
fHistoManager->FillHisto(0, fEnergyAbs);
fHistoManager->FillHisto(1, fEnergyGap);
fHistoManager->FillHisto(2, fTrackLAbs);
fHistoManager->FillHisto(3, fTrackLGap);
//fill ntuple
// fill ntuple
//
fHistoManager->FillNtuple(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
}
@@ -34,30 +34,28 @@
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc)
: fDetector(dc)
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc) : fDetector(dc)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "e-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
fParticleGun->SetParticleEnergy(500.*MeV);
G4double position = -0.5*(fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
fParticleGun->SetParticleEnergy(500. * MeV);
G4double position = -0.5 * (fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position, 0. * cm, 0. * cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,10 +69,9 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
// this function is called at the begining of event
//
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,17 +32,17 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4AccumulableManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4AccumulableManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(HistoManager* histo)
: fHistoManager(histo)
RunAction::RunAction(HistoManager* histo) : fHistoManager(histo)
{
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
@@ -69,23 +69,26 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
// reset accumulables to their initial values
G4AccumulableManager::Instance()->Reset();
//histograms
// histograms
//
fHistoManager->Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::FillPerEvent(G4double EAbs, G4double EGap,
G4double LAbs, G4double LGap)
void RunAction::FillPerEvent(G4double EAbs, G4double EGap, G4double LAbs, G4double LGap)
{
//accumulate statistic
// accumulate statistic
//
fSumEAbs += EAbs; fSum2EAbs += EAbs*EAbs;
fSumEGap += EGap; fSum2EGap += EGap*EGap;
fSumEAbs += EAbs;
fSum2EAbs += EAbs * EAbs;
fSumEGap += EGap;
fSum2EGap += EGap * EGap;
fSumLAbs += LAbs; fSum2LAbs += LAbs*LAbs;
fSumLGap += LGap; fSum2LGap += LGap*LGap;
fSumLAbs += LAbs;
fSum2LAbs += LAbs * LAbs;
fSumLGap += LGap;
fSum2LGap += LGap * LGap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -102,67 +105,72 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
return;
}
//compute statistics: mean and rms
// compute statistics: mean and rms
//
auto sumEAbs = fSumEAbs.GetValue();
auto sum2EAbs = fSum2EAbs.GetValue();
sumEAbs /= nofEvents; sum2EAbs /= nofEvents;
auto rmsEAbs = sum2EAbs - sumEAbs*sumEAbs;
if (rmsEAbs >0.) {
sumEAbs /= nofEvents;
sum2EAbs /= nofEvents;
auto rmsEAbs = sum2EAbs - sumEAbs * sumEAbs;
if (rmsEAbs > 0.) {
rmsEAbs = std::sqrt(rmsEAbs);
} else {
}
else {
rmsEAbs = 0.;
}
auto sumEGap = fSumEGap.GetValue();
auto sum2EGap = fSum2EGap.GetValue();
sumEGap /= nofEvents; sum2EGap /= nofEvents;
auto rmsEGap = sum2EGap - sumEGap*sumEGap;
if (rmsEGap >0.) {
sumEGap /= nofEvents;
sum2EGap /= nofEvents;
auto rmsEGap = sum2EGap - sumEGap * sumEGap;
if (rmsEGap > 0.) {
rmsEGap = std::sqrt(rmsEGap);
} else {
}
else {
rmsEGap = 0.;
}
auto sumLAbs = fSumLAbs.GetValue();
auto sum2LAbs = fSum2LAbs.GetValue();
sumLAbs /= nofEvents; sum2LAbs /= nofEvents;
auto rmsLAbs = sum2LAbs - sumLAbs*sumLAbs;
if (rmsLAbs >0.) {
sumLAbs /= nofEvents;
sum2LAbs /= nofEvents;
auto rmsLAbs = sum2LAbs - sumLAbs * sumLAbs;
if (rmsLAbs > 0.) {
rmsLAbs = std::sqrt(rmsLAbs);
} else {
}
else {
rmsLAbs = 0.;
}
auto sumLGap = fSumLGap.GetValue();
auto sum2LGap = fSum2LGap.GetValue();
sumLGap /= nofEvents; sum2LGap /= nofEvents;
G4double rmsLGap = sum2LGap - sumLGap*sumLGap;
if (rmsLGap >0.) {
sumLGap /= nofEvents;
sum2LGap /= nofEvents;
G4double rmsLGap = sum2LGap - sumLGap * sumLGap;
if (rmsLGap > 0.) {
rmsLGap = std::sqrt(rmsLGap);
} else {
}
else {
rmsLGap = 0.;
}
//print
// print
//
G4cout
<< "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs,"Energy")
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap,"Energy")
<< " +- " << G4BestUnit(rmsEGap,"Energy")
<< G4endl;
G4cout << "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs, "Energy") << " +- "
<< G4BestUnit(rmsEAbs, "Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap, "Energy") << " +- "
<< G4BestUnit(rmsEGap, "Energy") << G4endl;
G4cout
<< "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs,"Length")
<< " +- " << G4BestUnit(rmsLAbs,"Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap,"Length")
<< " +- " << G4BestUnit(rmsLGap,"Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
G4cout << "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs, "Length") << " +- "
<< G4BestUnit(rmsLAbs, "Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap, "Length") << " +- "
<< G4BestUnit(rmsLGap, "Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
//save histograms
// save histograms
//
fHistoManager->PrintStatistic();
fHistoManager->Save();
@@ -39,7 +39,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
: fDetector(det), fEventAction(evt)
: fDetector(det), fEventAction(evt)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,8 +51,7 @@ SteppingAction::~SteppingAction() = default;
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// get volume of the current step
G4VPhysicalVolume* volume =
aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
G4VPhysicalVolume* volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
// collect energy and track length step by step
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -62,8 +61,12 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
stepl = aStep->GetStepLength();
}
if (volume == fDetector->GetAbsorber()) { fEventAction->AddAbs(edep,stepl); }
if (volume == fDetector->GetGap()) { fEventAction->AddGap(edep,stepl); }
if (volume == fDetector->GetAbsorber()) {
fEventAction->AddAbs(edep, stepl);
}
if (volume == fDetector->GetGap()) {
fEventAction->AddGap(edep, stepl);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,8 +32,9 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,7 +43,7 @@ HistoManager::HistoManager()
// Create or get analysis manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetDefaultFileType("root");
// the default file type can be overriden in run macro
// the default file type can be overriden in run macro
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,13 +53,13 @@ void HistoManager::Book()
// Create or get analysis manager
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( ! fFactoryOn ) {
if (!fFactoryOn) {
//
analysisManager->SetVerboseLevel(1);
// Only merge in MT mode to avoid warning when running in Sequential mode
#ifdef G4MULTITHREADED
#ifdef G4MULTITHREADED
analysisManager->SetNtupleMerging(true);
#endif
#endif
// Create directories
analysisManager->SetHistoDirectoryName("histo");
@@ -68,26 +69,26 @@ void HistoManager::Book()
// Open an output file
//
G4bool fileOpen = analysisManager->OpenFile("AnaEx01");
if (! fileOpen) {
G4cerr << "\n---> HistoManager::Book(): cannot open "
<< analysisManager->GetFileName() << G4endl;
if (!fileOpen) {
G4cerr << "\n---> HistoManager::Book(): cannot open " << analysisManager->GetFileName()
<< G4endl;
return;
}
if ( ! fFactoryOn ) {
if (!fFactoryOn) {
// Create histograms.
// Histogram ids are generated automatically starting from 0.
// The start value can be changed by:
// analysisManager->SetFirstHistoId(1);
// id = 0
analysisManager->CreateH1("EAbs","Edep in absorber (MeV)", 100, 0., 800*MeV);
analysisManager->CreateH1("EAbs", "Edep in absorber (MeV)", 100, 0., 800 * MeV);
// id = 1
analysisManager->CreateH1("EGap","Edep in gap (MeV)", 100, 0., 100*MeV);
analysisManager->CreateH1("EGap", "Edep in gap (MeV)", 100, 0., 100 * MeV);
// id = 2
analysisManager->CreateH1("LAbs","trackL in absorber (mm)", 100, 0., 1*m);
analysisManager->CreateH1("LAbs", "trackL in absorber (mm)", 100, 0., 1 * m);
// id = 3
analysisManager->CreateH1("LGap","trackL in gap (mm)", 100, 0., 50*cm);
analysisManager->CreateH1("LGap", "trackL in gap (mm)", 100, 0., 50 * cm);
// Create ntuples.
// Ntuples ids are generated automatically starting from 0.
@@ -96,22 +97,21 @@ void HistoManager::Book()
// Create 1st ntuple (id = 0)
analysisManager->CreateNtuple("Ntuple1", "Edep");
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
analysisManager->FinishNtuple();
// Create 2nd ntuple (id = 1)
//
analysisManager->CreateNtuple("Ntuple2", "TrackL");
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
analysisManager->FinishNtuple();
fFactoryOn = true;
}
G4cout << "\n----> Output file is open in "
<< analysisManager->GetFileName() << "."
G4cout << "\n----> Output file is open in " << analysisManager->GetFileName() << "."
<< analysisManager->GetFileType() << G4endl;
}
@@ -119,7 +119,9 @@ void HistoManager::Book()
void HistoManager::Save()
{
if (! fFactoryOn) { return; }
if (!fFactoryOn) {
return;
}
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
@@ -142,14 +144,15 @@ void HistoManager::Normalize(G4int ih, G4double fac)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
auto h1 = analysisManager->GetH1(ih);
if (h1 != nullptr) { h1->scale(fac);
}
if (h1 != nullptr) {
h1->scale(fac);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
G4double trackLAbs, G4double trackLGap)
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap, G4double trackLAbs,
G4double trackLGap)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
// Fill 1st ntuple ( id = 0)
@@ -166,25 +169,29 @@ void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
void HistoManager::PrintStatistic()
{
if (! fFactoryOn) { return; }
if (!fFactoryOn) {
return;
}
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4cout << "\n ----> print histograms statistic \n" << G4endl;
for ( G4int i=0; i<analysisManager->GetNofH1s(); ++i ) {
for (G4int i = 0; i < analysisManager->GetNofH1s(); ++i) {
G4String name = analysisManager->GetH1Name(i);
auto h1 = analysisManager->GetH1(i);
G4String unitCategory;
if (name[0U] == 'E' ) { unitCategory = "Energy"; }
if (name[0U] == 'L' ) { unitCategory = "Length"; }
// we use an explicit unsigned int type for operator [] argument
// to avoid problems with windows compiler
if (name[0U] == 'E') {
unitCategory = "Energy";
}
if (name[0U] == 'L') {
unitCategory = "Length";
}
// we use an explicit unsigned int type for operator [] argument
// to avoid problems with windows compiler
G4cout << name
<< ": mean = " << G4BestUnit(h1->mean(), unitCategory)
<< " rms = " << G4BestUnit(h1->rms(), unitCategory )
<< G4endl;
G4cout << name << ": mean = " << G4BestUnit(h1->mean(), unitCategory)
<< " rms = " << G4BestUnit(h1->rms(), unitCategory) << G4endl;
}
}
+10 -11
View File
@@ -34,27 +34,26 @@
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "FTFP_BERT.hh"
#include "HistoManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "HistoManager.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
@@ -64,7 +63,7 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
auto detector = new DetectorConstruction;
auto detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new FTFP_BERT);
runManager->SetUserInitialization(new ActionInitialization(detector));
@@ -82,11 +81,11 @@ int main(int argc,char** argv)
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if ( ui == nullptr ) {
if (ui == nullptr) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
+30 -23
View File
@@ -10,7 +10,7 @@
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -77,14 +77,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -289,7 +296,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -844,7 +851,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -862,20 +869,20 @@ See commands in /vis/modeling/trajectories/ for other options.
--------------------End of Run------------------------------
mean Energy in Absorber : 281.112 MeV +- 0 eV
mean Energy in Gap : 74.1401 MeV +- 0 eV
mean Energy in Absorber : 245.231 MeV +- 0 eV
mean Energy in Gap : 64.6941 MeV +- 0 eV
mean trackLength in Absorber : 69.2721 cm +- 0 fm
mean trackLength in Gap : 37.7451 cm +- 0 fm
mean trackLength in Absorber : 60.8807 cm +- 0 fm
mean trackLength in Gap : 32.6255 cm +- 0 fm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 281.112 MeV rms = 0 eV
EGap: mean = 74.1401 MeV rms = 0 eV
LAbs: mean = 69.2721 cm rms = 0 fm
LGap: mean = 37.7451 cm rms = 0 fm
EAbs: mean = 245.231 MeV rms = 0 eV
EGap: mean = 64.6941 MeV rms = 0 eV
LAbs: mean = 60.8807 cm rms = 0 fm
LGap: mean = 32.6255 cm rms = 0 fm
----> Histograms and ntuples are saved
@@ -909,20 +916,20 @@ LGap: mean = 37.7451 cm rms = 0 fm
--------------------End of Run------------------------------
mean Energy in Absorber : 190.633 MeV +- 48.8718 MeV
mean Energy in Gap : 46.5146 MeV +- 13.3975 MeV
mean Energy in Absorber : 186.264 MeV +- 50.8208 MeV
mean Energy in Gap : 45.8735 MeV +- 13.843 MeV
mean trackLength in Absorber : 47.0418 cm +- 12.1398 cm
mean trackLength in Gap : 23.5952 cm +- 6.83896 cm
mean trackLength in Absorber : 46.0323 cm +- 12.6521 cm
mean trackLength in Gap : 23.2729 cm +- 7.04724 cm
------------------------------------------------------------
----> print histograms statistic
EAbs: mean = 190.633 MeV rms = 48.8718 MeV
EGap: mean = 46.5146 MeV rms = 13.3975 MeV
LAbs: mean = 47.0418 cm rms = 12.1398 cm
LGap: mean = 23.5952 cm rms = 6.83896 cm
EAbs: mean = 186.264 MeV rms = 50.8208 MeV
EGap: mean = 45.8735 MeV rms = 13.843 MeV
LAbs: mean = 46.0323 cm rms = 12.6521 cm
LGap: mean = 23.246 cm rms = 6.99942 cm
----> Histograms and ntuples are saved
@@ -51,7 +51,7 @@ class HistoManager
{
public:
HistoManager() = default;
~HistoManager();
~HistoManager();
void Book();
void Save();
@@ -59,8 +59,7 @@ class HistoManager
void FillHisto(G4int id, G4double bin, G4double weight = 1.0);
void Normalize(G4int id, G4double fac);
void FillNtuple(G4double energyAbs, G4double energyGap,
G4double trackLAbs, G4double trackLGap);
void FillNtuple(G4double energyAbs, G4double energyGap, G4double trackLAbs, G4double trackLGap);
void PrintStatistic();
@@ -79,4 +78,3 @@ class HistoManager
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -51,5 +51,3 @@ class ActionInitialization : public G4VUserActionInitialization
};
#endif
@@ -32,11 +32,11 @@
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -48,41 +48,40 @@ class DetectorMessenger;
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction() override;
DetectorConstruction();
~DetectorConstruction() override;
public:
G4VPhysicalVolume* Construct() override;
void SetAbsorberMaterial (const G4String&);
void SetAbsorberMaterial(const G4String&);
void SetAbsorberThickness(G4double);
void SetGapMaterial (const G4String&);
void SetGapMaterial(const G4String&);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetNbOfLayers(G4int);
void PrintCalorParameters();
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeYZ() { return fWorldSizeYZ; }
G4double GetCalorThickness() { return fCalorThickness; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4int GetNbOfLayers() { return fNbOfLayers; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
const G4VPhysicalVolume* GetphysiWorld() { return fPhysiWorld; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
private:
void DefineMaterials();
@@ -93,37 +92,37 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4Material* fGapMaterial = nullptr;
G4Material* fDefaultMaterial = nullptr;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10.*CLHEP::mm;
G4double fGapThickness = 5.*CLHEP::mm;
G4double fCalorSizeYZ = 10.*CLHEP::cm;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10. * CLHEP::mm;
G4double fGapThickness = 5. * CLHEP::mm;
G4double fCalorSizeYZ = 10. * CLHEP::cm;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness= 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness = 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4Box* fSolidWorld = nullptr; //pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; //pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; //pointer to the physical World
G4Box* fSolidWorld = nullptr; // pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; // pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; // pointer to the physical World
G4Box* fSolidCalor = nullptr; //pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; //pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; //pointer to the physical Calor
G4Box* fSolidCalor = nullptr; // pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; // pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; // pointer to the physical Calor
G4Box* fSolidLayer = nullptr; //pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; //pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; //pointer to the physical Layer
G4Box* fSolidLayer = nullptr; // pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; // pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; // pointer to the physical Layer
G4Box* fSolidAbsorber = nullptr; //pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; //pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; //pointer to the physical Absorber
G4Box* fSolidAbsorber = nullptr; // pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; // pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; // pointer to the physical Absorber
G4Box* fSolidGap = nullptr; //pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; //pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; //pointer to the physical Gap
G4Box* fSolidGap = nullptr; // pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; // pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; // pointer to the physical Gap
DetectorMessenger* fDetectorMessenger = nullptr; //pointer to the Messenger
DetectorMessenger* fDetectorMessenger = nullptr; // pointer to the Messenger
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -131,13 +130,13 @@ class DetectorConstruction : public G4VUserDetectorConstruction
inline void DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers*fLayerThickness;
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers * fLayerThickness;
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
fWorldSizeX = 1.2 * fCalorThickness;
fWorldSizeYZ = 1.2 * fCalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -32,8 +32,8 @@
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
@@ -43,10 +43,10 @@ class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
class DetectorMessenger : public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
@@ -54,13 +54,13 @@ class DetectorMessenger: public G4UImessenger
private:
DetectorConstruction* fDetector = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fAbsThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fGapThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fSizeYZCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,30 +46,36 @@ class HistoManager;
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction*, HistoManager*);
~EventAction() override;
public:
EventAction(RunAction*, HistoManager*);
~EventAction() override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
void AddAbs(G4double de, G4double dl)
{
fEnergyAbs += de;
fTrackLAbs += dl;
};
void AddGap(G4double de, G4double dl)
{
fEnergyGap += de;
fTrackLGap += dl;
};
private:
RunAction* fRunAct = nullptr;
HistoManager* fHistoManager = nullptr;
private:
RunAction* fRunAct = nullptr;
HistoManager* fHistoManager = nullptr;
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
G4double fEnergyAbs = 0.;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
G4int fPrintModulo = 100;
G4int fPrintModulo = 100;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -43,19 +43,17 @@ class DetectorConstruction;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
void GeneratePrimaries(G4Event*) override;
private:
G4ParticleGun* fParticleGun = nullptr; //pointer a to G4 class
DetectorConstruction* fDetector = nullptr; //pointer to the geometry
private:
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 class
DetectorConstruction* fDetector = nullptr; // pointer to the geometry
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -36,8 +36,8 @@
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,30 +47,29 @@ class HistoManager;
class RunAction : public G4UserRunAction
{
public:
RunAction(HistoManager*);
~RunAction() override;
public:
RunAction(HistoManager*);
~RunAction() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void FillPerEvent(G4double, G4double, G4double, G4double);
void FillPerEvent(G4double, G4double, G4double, G4double);
private:
HistoManager* fHistoManager = nullptr;
private:
HistoManager* fHistoManager = nullptr;
G4Accumulable<G4double> fSumEAbs = 0.;
G4Accumulable<G4double> fSum2EAbs = 0.;
G4Accumulable<G4double> fSumEGap = 0.;
G4Accumulable<G4double> fSum2EGap = 0.;
G4Accumulable<G4double> fSumEAbs = 0.;
G4Accumulable<G4double> fSum2EAbs = 0.;
G4Accumulable<G4double> fSumEGap = 0.;
G4Accumulable<G4double> fSum2EGap = 0.;
G4Accumulable<G4double> fSumLAbs = 0.;
G4Accumulable<G4double> fSum2LAbs = 0.;
G4Accumulable<G4double> fSumLGap = 0.;
G4Accumulable<G4double> fSum2LGap = 0.;
G4Accumulable<G4double> fSumLAbs = 0.;
G4Accumulable<G4double> fSum2LAbs = 0.;
G4Accumulable<G4double> fSumLGap = 0.;
G4Accumulable<G4double> fSum2LGap = 0.;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -41,15 +41,15 @@ class EventAction;
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
void UserSteppingAction(const G4Step*) override;
void UserSteppingAction(const G4Step*) override;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,17 +28,16 @@
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
: fDetector(detector)
{}
ActionInitialization::ActionInitialization(DetectorConstruction* detector) : fDetector(detector) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +48,7 @@ ActionInitialization::~ActionInitialization() = default;
void ActionInitialization::BuildForMaster() const
{
// Histo manager
auto histo = new HistoManager();
auto histo = new HistoManager();
// Actions
SetUserAction(new RunAction(histo));
@@ -60,19 +59,19 @@ void ActionInitialization::BuildForMaster() const
void ActionInitialization::Build() const
{
// Histo manager
auto histo = new HistoManager();
auto histo = new HistoManager();
// Actions
//
SetUserAction(new PrimaryGeneratorAction(fDetector));
auto runAction = new RunAction(histo);
auto runAction = new RunAction(histo);
SetUserAction(runAction);
auto eventAction = new EventAction(runAction, histo);
auto eventAction = new EventAction(runAction, histo);
SetUserAction(eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
SetUserAction(steppingAction);
}
@@ -30,26 +30,24 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GeometryManager.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4StateManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
#include "G4SolidStore.hh"
#include "G4StateManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -113,114 +111,118 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// World
//
fSolidWorld = new G4Box("World", //its name
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
fSolidWorld = new G4Box("World", // its name
fWorldSizeX / 2, fWorldSizeYZ / 2, fWorldSizeYZ / 2); // its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fDefaultMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its logical volume
"World", //its name
nullptr, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicWorld, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0); // copy number
//
// Calorimeter
//
fSolidCalor = nullptr; fLogicCalor = nullptr; fPhysiCalor = nullptr;
fSolidLayer = nullptr; fLogicLayer = nullptr; fPhysiLayer = nullptr;
fSolidCalor = nullptr;
fLogicCalor = nullptr;
fPhysiCalor = nullptr;
fSolidLayer = nullptr;
fLogicLayer = nullptr;
fPhysiLayer = nullptr;
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", //its name
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", // its name
fCalorThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
fDefaultMaterial, //its material
"Calorimeter"); //its name
fLogicCalor = new G4LogicalVolume(fSolidCalor, // its solid
fDefaultMaterial, // its material
"Calorimeter"); // its name
fPhysiCalor = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicCalor, //its logical volume
"Calorimeter", //its name
fLogicWorld, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiCalor = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicCalor, // its logical volume
"Calorimeter", // its name
fLogicWorld, // its mother volume
false, // no boolean operation
0); // copy number
//
// Layer
//
fSolidLayer = new G4Box("Layer", //its name
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidLayer = new G4Box("Layer", // its name
fLayerThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicLayer = new G4LogicalVolume(fSolidLayer, //its solid
fDefaultMaterial, //its material
"Layer"); //its name
fLogicLayer = new G4LogicalVolume(fSolidLayer, // its solid
fDefaultMaterial, // its material
"Layer"); // its name
if (fNbOfLayers > 1) {
fPhysiLayer = new G4PVReplica("Layer", //its name
fLogicLayer, //its logical volume
fLogicCalor, //its mother
kXAxis, //axis of replication
fNbOfLayers, //number of replica
fLayerThickness); //witdth of replica
fPhysiLayer = new G4PVReplica("Layer", // its name
fLogicLayer, // its logical volume
fLogicCalor, // its mother
kXAxis, // axis of replication
fNbOfLayers, // number of replica
fLayerThickness); // witdth of replica
}
else {
fPhysiLayer = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicLayer, //its logical volume
"Layer", //its name
fLogicCalor, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiLayer = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicLayer, // its logical volume
"Layer", // its name
fLogicCalor, // its mother volume
false, // no boolean operation
0); // copy number
}
}
//
// Absorber
//
fSolidAbsorber = nullptr; fLogicAbsorber = nullptr; fPhysiAbsorber = nullptr;
fSolidAbsorber = nullptr;
fLogicAbsorber = nullptr;
fPhysiAbsorber = nullptr;
if (fAbsorberThickness > 0.) {
fSolidAbsorber = new G4Box("Absorber", //its name
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidAbsorber = new G4Box("Absorber", // its name
fAbsorberThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
fAbsorberMaterial, //its material
fAbsorberMaterial->GetName()); //name
fPhysiAbsorber = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
fLogicAbsorber, //its logical volume
fAbsorberMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, // its solid
fAbsorberMaterial, // its material
fAbsorberMaterial->GetName()); // name
fPhysiAbsorber = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(-fGapThickness / 2, 0., 0.), // its position
fLogicAbsorber, // its logical volume
fAbsorberMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
//
// Gap
//
fSolidGap = nullptr; fLogicGap = nullptr; fPhysiGap = nullptr;
fSolidGap = nullptr;
fLogicGap = nullptr;
fPhysiGap = nullptr;
if (fGapThickness > 0.) {
fSolidGap = new G4Box("Gap",
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fSolidGap = new G4Box("Gap", fGapThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2);
fLogicGap = new G4LogicalVolume(fSolidGap,
fGapMaterial,
fGapMaterial->GetName());
fLogicGap = new G4LogicalVolume(fSolidGap, fGapMaterial, fGapMaterial->GetName());
fPhysiGap = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
fLogicGap, //its logical volume
fGapMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fPhysiGap = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(fAbsorberThickness / 2, 0., 0.), // its position
fLogicGap, // its logical volume
fGapMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
PrintCalorParameters();
@@ -228,14 +230,14 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// Visualization attributes
//
fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
auto simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
simpleBoxVisAtt->SetVisibility(true);
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
//
//always return the physical World
// always return the physical World
//
return fPhysiWorld;
}
@@ -246,9 +248,8 @@ void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
<< " + "
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
<< fAbsorberThickness / mm << "mm of " << fAbsorberMaterial->GetName() << " + "
<< fGapThickness / mm << "mm of " << fGapMaterial->GetName() << " ] "
<< "\n------------------------------------------------------------\n";
}
@@ -274,7 +275,7 @@ void DetectorConstruction::SetGapMaterial(const G4String& materialChoice)
auto material = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (material != nullptr) {
fGapMaterial = material;
if ( fLogicGap != nullptr) {
if (fLogicGap != nullptr) {
fLogicGap->SetMaterial(fGapMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
@@ -287,7 +288,7 @@ void DetectorConstruction::SetAbsorberThickness(G4double value)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -298,7 +299,7 @@ void DetectorConstruction::SetGapThickness(G4double value)
{
// change Gap thickness and recompute the calorimeter parameters
fGapThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -309,7 +310,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
{
// change the transverse size and recompute the calorimeter parameters
fCalorSizeYZ = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -319,7 +320,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
void DetectorConstruction::SetNbOfLayers(G4int value)
{
fNbOfLayers = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -32,57 +32,57 @@
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIdirectory.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
: fDetector(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction* Det) : fDetector(Det)
{
G4bool broadcast = false;
fDetDir = new G4UIdirectory("/det/",broadcast);
fDetDir = new G4UIdirectory("/det/", broadcast);
fDetDir->SetGuidance("Detector control");
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat",this);
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat", this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("AbsMat",false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsMaterCmd->SetParameterName("AbsMat", false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat",this);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat", this);
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
fGapMaterCmd->SetParameterName("GapMat",false);
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapMaterCmd->SetParameterName("GapMat", false);
fGapMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick",this);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick", this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("AbsThick",false);
fAbsThickCmd->SetParameterName("AbsThick", false);
fAbsThickCmd->SetRange("AbsThick>=0.");
fAbsThickCmd->SetUnitCategory("Length");
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick",this);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick", this);
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
fGapThickCmd->SetParameterName("GapThick",false);
fGapThickCmd->SetParameterName("GapThick", false);
fGapThickCmd->SetRange("GapThick>=0.");
fGapThickCmd->SetUnitCategory("Length");
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ",this);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ", this);
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
fSizeYZCmd->SetParameterName("SizeYZ",false);
fSizeYZCmd->SetParameterName("SizeYZ", false);
fSizeYZCmd->SetRange("SizeYZ>0.");
fSizeYZCmd->SetUnitCategory("Length");
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeYZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers",this);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers", this);
fNbLayersCmd->SetGuidance("Set number of layers.");
fNbLayersCmd->SetParameterName("NbLayers",false);
fNbLayersCmd->SetParameterName("NbLayers", false);
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -102,32 +102,32 @@ DetectorMessenger::~DetectorMessenger()
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fAbsMaterCmd ) {
if (command == fAbsMaterCmd) {
fDetector->SetAbsorberMaterial(newValue);
return;
}
if( command == fGapMaterCmd ) {
if (command == fGapMaterCmd) {
fDetector->SetGapMaterial(newValue);
return;
}
if( command == fAbsThickCmd ) {
if (command == fAbsThickCmd) {
fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fGapThickCmd ) {
if (command == fGapThickCmd) {
fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fSizeYZCmd ) {
if (command == fSizeYZCmd) {
fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fNbLayersCmd ) {
if (command == fNbLayersCmd) {
fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));
return;
}
@@ -35,15 +35,14 @@
#include "EventAction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "RunAction.hh"
#include "G4Event.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(RunAction* run, HistoManager* histo)
: fRunAct(run),fHistoManager(histo)
EventAction::EventAction(RunAction* run, HistoManager* histo) : fRunAct(run), fHistoManager(histo)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,7 +54,7 @@ EventAction::~EventAction() = default;
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0) {
if (evtNb % fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
}
@@ -68,18 +67,18 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
void EventAction::EndOfEventAction(const G4Event*)
{
//accumulates statistic
// accumulates statistic
//
fRunAct->FillPerEvent(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
//fill histograms
// fill histograms
//
fHistoManager->FillHisto(0, fEnergyAbs);
fHistoManager->FillHisto(1, fEnergyGap);
fHistoManager->FillHisto(2, fTrackLAbs);
fHistoManager->FillHisto(3, fTrackLGap);
//fill ntuple
// fill ntuple
//
fHistoManager->FillNtuple(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
}
@@ -34,30 +34,28 @@
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc)
: fDetector(dc)
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc) : fDetector(dc)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "e-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
fParticleGun->SetParticleEnergy(500.*MeV);
G4double position = -0.5*(fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
fParticleGun->SetParticleEnergy(500. * MeV);
G4double position = -0.5 * (fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position, 0. * cm, 0. * cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,10 +69,9 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
// this function is called at the begining of event
//
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,17 +32,17 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4AccumulableManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4AccumulableManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(HistoManager* histo)
: fHistoManager(histo)
RunAction::RunAction(HistoManager* histo) : fHistoManager(histo)
{
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
@@ -69,23 +69,26 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
// reset accumulables to their initial values
G4AccumulableManager::Instance()->Reset();
//histograms
// histograms
//
fHistoManager->Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::FillPerEvent(G4double EAbs, G4double EGap,
G4double LAbs, G4double LGap)
void RunAction::FillPerEvent(G4double EAbs, G4double EGap, G4double LAbs, G4double LGap)
{
//accumulate statistic
// accumulate statistic
//
fSumEAbs += EAbs; fSum2EAbs += EAbs*EAbs;
fSumEGap += EGap; fSum2EGap += EGap*EGap;
fSumEAbs += EAbs;
fSum2EAbs += EAbs * EAbs;
fSumEGap += EGap;
fSum2EGap += EGap * EGap;
fSumLAbs += LAbs; fSum2LAbs += LAbs*LAbs;
fSumLGap += LGap; fSum2LGap += LGap*LGap;
fSumLAbs += LAbs;
fSum2LAbs += LAbs * LAbs;
fSumLGap += LGap;
fSum2LGap += LGap * LGap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -102,67 +105,72 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
return;
}
//compute statistics: mean and rms
// compute statistics: mean and rms
//
auto sumEAbs = fSumEAbs.GetValue();
auto sum2EAbs = fSum2EAbs.GetValue();
sumEAbs /= nofEvents; sum2EAbs /= nofEvents;
auto rmsEAbs = sum2EAbs - sumEAbs*sumEAbs;
if (rmsEAbs >0.) {
sumEAbs /= nofEvents;
sum2EAbs /= nofEvents;
auto rmsEAbs = sum2EAbs - sumEAbs * sumEAbs;
if (rmsEAbs > 0.) {
rmsEAbs = std::sqrt(rmsEAbs);
} else {
}
else {
rmsEAbs = 0.;
}
auto sumEGap = fSumEGap.GetValue();
auto sum2EGap = fSum2EGap.GetValue();
sumEGap /= nofEvents; sum2EGap /= nofEvents;
auto rmsEGap = sum2EGap - sumEGap*sumEGap;
if (rmsEGap >0.) {
sumEGap /= nofEvents;
sum2EGap /= nofEvents;
auto rmsEGap = sum2EGap - sumEGap * sumEGap;
if (rmsEGap > 0.) {
rmsEGap = std::sqrt(rmsEGap);
} else {
}
else {
rmsEGap = 0.;
}
auto sumLAbs = fSumLAbs.GetValue();
auto sum2LAbs = fSum2LAbs.GetValue();
sumLAbs /= nofEvents; sum2LAbs /= nofEvents;
auto rmsLAbs = sum2LAbs - sumLAbs*sumLAbs;
if (rmsLAbs >0.) {
sumLAbs /= nofEvents;
sum2LAbs /= nofEvents;
auto rmsLAbs = sum2LAbs - sumLAbs * sumLAbs;
if (rmsLAbs > 0.) {
rmsLAbs = std::sqrt(rmsLAbs);
} else {
}
else {
rmsLAbs = 0.;
}
auto sumLGap = fSumLGap.GetValue();
auto sum2LGap = fSum2LGap.GetValue();
sumLGap /= nofEvents; sum2LGap /= nofEvents;
G4double rmsLGap = sum2LGap - sumLGap*sumLGap;
if (rmsLGap >0.) {
sumLGap /= nofEvents;
sum2LGap /= nofEvents;
G4double rmsLGap = sum2LGap - sumLGap * sumLGap;
if (rmsLGap > 0.) {
rmsLGap = std::sqrt(rmsLGap);
} else {
}
else {
rmsLGap = 0.;
}
//print
// print
//
G4cout
<< "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs,"Energy")
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap,"Energy")
<< " +- " << G4BestUnit(rmsEGap,"Energy")
<< G4endl;
G4cout << "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs, "Energy") << " +- "
<< G4BestUnit(rmsEAbs, "Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap, "Energy") << " +- "
<< G4BestUnit(rmsEGap, "Energy") << G4endl;
G4cout
<< "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs,"Length")
<< " +- " << G4BestUnit(rmsLAbs,"Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap,"Length")
<< " +- " << G4BestUnit(rmsLGap,"Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
G4cout << "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs, "Length") << " +- "
<< G4BestUnit(rmsLAbs, "Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap, "Length") << " +- "
<< G4BestUnit(rmsLGap, "Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
//save histograms
// save histograms
//
fHistoManager->PrintStatistic();
fHistoManager->Save();
@@ -39,7 +39,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
: fDetector(det), fEventAction(evt)
: fDetector(det), fEventAction(evt)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,8 +51,7 @@ SteppingAction::~SteppingAction() = default;
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// get volume of the current step
G4VPhysicalVolume* volume =
aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
G4VPhysicalVolume* volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
// collect energy and track length step by step
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -62,8 +61,12 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
stepl = aStep->GetStepLength();
}
if (volume == fDetector->GetAbsorber()) { fEventAction->AddAbs(edep,stepl); }
if (volume == fDetector->GetGap()) { fEventAction->AddGap(edep,stepl); }
if (volume == fDetector->GetAbsorber()) {
fEventAction->AddAbs(edep, stepl);
}
if (volume == fDetector->GetGap()) {
fEventAction->AddGap(edep, stepl);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,14 +30,15 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <TH1D.h>
#include <TFile.h>
#include <TTree.h>
#include <CLHEP/Units/SystemOfUnits.h>
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include <CLHEP/Units/SystemOfUnits.h>
#include <TFile.h>
#include <TH1D.h>
#include <TTree.h>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
@@ -53,24 +54,23 @@ void HistoManager::Book()
// This tree is associated to an output file.
//
G4String fileName = "AnaEx02.root";
fRootFile = new TFile(fileName,"RECREATE");
fRootFile = new TFile(fileName, "RECREATE");
if (fRootFile == nullptr) {
G4cout << " HistoManager::Book :"
<< " problem creating the ROOT TFile "
<< G4endl;
<< " problem creating the ROOT TFile " << G4endl;
return;
}
// id = 0
fHisto[0] = new TH1D("EAbs", "Edep in absorber (MeV)", 100, 0., 800*CLHEP::MeV);
fHisto[0] = new TH1D("EAbs", "Edep in absorber (MeV)", 100, 0., 800 * CLHEP::MeV);
// id = 1
fHisto[1] = new TH1D("EGap", "Edep in gap (MeV)", 100, 0., 100*CLHEP::MeV);
fHisto[1] = new TH1D("EGap", "Edep in gap (MeV)", 100, 0., 100 * CLHEP::MeV);
// id = 2
fHisto[2] = new TH1D("LAbs", "trackL in absorber (mm)", 100, 0., 1*CLHEP::m);
fHisto[2] = new TH1D("LAbs", "trackL in absorber (mm)", 100, 0., 1 * CLHEP::m);
// id = 3
fHisto[3] = new TH1D("LGap", "trackL in gap (mm)", 100, 0., 50*CLHEP::cm);
fHisto[3] = new TH1D("LGap", "trackL in gap (mm)", 100, 0., 50 * CLHEP::cm);
for ( G4int i=0; i<kMaxHisto; ++i ) {
for (G4int i = 0; i < kMaxHisto; ++i) {
if (fHisto[i] == nullptr) {
G4cout << "\n can't create histo " << i << G4endl;
}
@@ -93,11 +93,12 @@ void HistoManager::Book()
void HistoManager::Save()
{
if (fRootFile == nullptr) { return;
}
if (fRootFile == nullptr) {
return;
}
fRootFile->Write(); // Writing the histograms to the file
fRootFile->Close(); // and closing the tree (and the file)
fRootFile->Write(); // Writing the histograms to the file
fRootFile->Close(); // and closing the tree (and the file)
G4cout << "\n----> Histograms and ntuples are saved\n" << G4endl;
}
@@ -108,11 +109,12 @@ void HistoManager::FillHisto(G4int ih, G4double xbin, G4double weight)
{
if (ih >= kMaxHisto) {
G4cerr << "---> warning from HistoManager::FillHisto() : histo " << ih
<< " does not exist. (xbin=" << xbin << " weight=" << weight << ")"
<< G4endl;
<< " does not exist. (xbin=" << xbin << " weight=" << weight << ")" << G4endl;
return;
}
if (fHisto[ih] != nullptr) { fHisto[ih]->Fill(xbin, weight); }
if (fHisto[ih] != nullptr) {
fHisto[ih]->Fill(xbin, weight);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -131,16 +133,20 @@ void HistoManager::Normalize(G4int ih, G4double fac)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
G4double trackLAbs , G4double trackLGap )
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap, G4double trackLAbs,
G4double trackLGap)
{
fEabs = energyAbs;
fEgap = energyGap;
fLabs = trackLAbs;
fLgap = trackLGap;
if (fNtuple1 != nullptr) { fNtuple1->Fill(); }
if (fNtuple2 != nullptr) { fNtuple2->Fill(); }
if (fNtuple1 != nullptr) {
fNtuple1->Fill();
}
if (fNtuple2 != nullptr) {
fNtuple2->Fill();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -152,13 +158,15 @@ void HistoManager::PrintStatistic()
const G4String name = h1->GetName();
G4String unitCategory;
if (name[0] == 'E' ) { unitCategory = "Energy"; }
if (name[0] == 'L' ) { unitCategory = "Length"; }
if (name[0] == 'E') {
unitCategory = "Energy";
}
if (name[0] == 'L') {
unitCategory = "Length";
}
G4cout << name
<< ": mean = " << G4BestUnit(h1->GetMean(), unitCategory)
<< " rms = " << G4BestUnit(h1->GetRMS(), unitCategory )
<< G4endl;
G4cout << name << ": mean = " << G4BestUnit(h1->GetMean(), unitCategory)
<< " rms = " << G4BestUnit(h1->GetRMS(), unitCategory) << G4endl;
}
}
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -276,7 +283,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -831,7 +838,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -861,10 +868,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 86.7754 MeV rms = 6.06128 MeV
EGap: mean = 6.22737 MeV rms = 4.05788 MeV
LAbs: mean = 6.36212 cm rms = 5.45277 mm
LGap: mean = 3.22513 cm rms = 2.15538 cm
EAbs: mean = 92.3063 MeV rms = 4.14219 MeV
EGap: mean = 4.85878 MeV rms = 2.0183 MeV
LAbs: mean = 6.63777 cm rms = 2.92186 mm
LGap: mean = 2.3872 cm rms = 9.61394 mm
### Run 1 start.
---> Begin of event: 0
@@ -889,8 +896,8 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 182.084 MeV rms = 6.77419 MeV
LAbs: mean = 13.0969 cm rms = 5.39518 mm
EAbs: mean = 181.847 MeV rms = 4.68046 MeV
LAbs: mean = 13.1175 cm rms = 4.04973 mm
### Run 2 start.
---> Begin of event: 0
@@ -923,10 +930,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 271.702 MeV rms = 14.4701 MeV
EGap2: mean = 13.0056 MeV rms = 4.70044 MeV
LAbs: mean = 19.609 cm rms = 1.07761 cm
LGap2: mean = 6.42871 cm rms = 2.46679 cm
EAbs: mean = 274.942 MeV rms = 8.96651 MeV
EGap2: mean = 13.9939 MeV rms = 6.14487 MeV
LAbs: mean = 19.7961 cm rms = 7.49951 mm
LGap2: mean = 6.91332 cm rms = 3.1357 cm
... close file : ./histo/e-_h1_EAbs.csv - done
... close file : ./histo/e-_h1_EAbs_v1.csv - done
... close file : ./histo/e-_h1_EAbs_v2.csv - done
@@ -966,10 +973,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 197.13 MeV rms = 59.1173 MeV
EGap2: mean = 20.0031 MeV rms = 11.0171 MeV
LAbs: mean = 8.42208 cm rms = 2.68317 cm
LGap2: mean = 4.32901 cm rms = 1.4735 cm
EAbs: mean = 220.52 MeV rms = 42.6585 MeV
EGap2: mean = 21.0932 MeV rms = 14.424 MeV
LAbs: mean = 8.44493 cm rms = 2.11558 cm
LGap2: mean = 4.29837 cm rms = 1.2912 cm
### Run 4 start.
---> Begin of event: 0
@@ -998,10 +1005,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 201.326 MeV rms = 52.7717 MeV
EGap2: mean = 19.8641 MeV rms = 13.0272 MeV
LAbs: mean = 9.43807 cm rms = 2.2901 cm
LGap2: mean = 4.98845 cm rms = 1.36532 cm
EAbs: mean = 183.744 MeV rms = 43.5113 MeV
EGap2: mean = 15.4705 MeV rms = 6.10516 MeV
LAbs: mean = 9.21143 cm rms = 2.16642 cm
LGap2: mean = 4.86717 cm rms = 1.60599 cm
... close file : ./histo/proton_h1_EAbs.csv - done
... close file : ./histo/proton_h1_EAbs_v1.csv - done
... close file : ./histo/proton_h1_EGap2.csv - done
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -275,7 +282,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -830,7 +837,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -851,10 +858,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 86.7754 MeV rms = 6.06128 MeV
EGap: mean = 6.22737 MeV rms = 4.05788 MeV
LAbs: mean = 6.36212 cm rms = 5.45277 mm
LGap: mean = 3.22513 cm rms = 2.15538 cm
EAbs: mean = 92.3063 MeV rms = 4.14219 MeV
EGap: mean = 4.85878 MeV rms = 2.0183 MeV
LAbs: mean = 6.63777 cm rms = 2.92186 mm
LGap: mean = 2.3872 cm rms = 9.61394 mm
### Run 1 start.
---> Begin of event: 0
@@ -866,8 +873,8 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 182.084 MeV rms = 6.77419 MeV
LAbs: mean = 13.0969 cm rms = 5.39518 mm
EAbs: mean = 181.847 MeV rms = 4.68046 MeV
LAbs: mean = 13.1175 cm rms = 4.04973 mm
### Run 2 start.
---> Begin of event: 0
@@ -879,10 +886,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 271.702 MeV rms = 14.4701 MeV
EGap2: mean = 13.0056 MeV rms = 4.70044 MeV
LAbs: mean = 19.609 cm rms = 1.07761 cm
LGap2: mean = 6.42871 cm rms = 2.46679 cm
EAbs: mean = 274.942 MeV rms = 8.96651 MeV
EGap2: mean = 13.9939 MeV rms = 6.14487 MeV
LAbs: mean = 19.7961 cm rms = 7.49951 mm
LGap2: mean = 6.91332 cm rms = 3.1357 cm
... close file : e-.hdf5 - done
... create file : proton.hdf5 - done
... open analysis file : proton.hdf5 - done
@@ -897,10 +904,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 197.13 MeV rms = 59.1173 MeV
EGap2: mean = 20.0031 MeV rms = 11.0171 MeV
LAbs: mean = 8.42208 cm rms = 2.68317 cm
LGap2: mean = 4.32901 cm rms = 1.4735 cm
EAbs: mean = 220.52 MeV rms = 42.6585 MeV
EGap2: mean = 21.0932 MeV rms = 14.424 MeV
LAbs: mean = 8.44493 cm rms = 2.11558 cm
LGap2: mean = 4.29837 cm rms = 1.2912 cm
### Run 4 start.
---> Begin of event: 0
@@ -912,10 +919,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 201.326 MeV rms = 52.7717 MeV
EGap2: mean = 19.8641 MeV rms = 13.0272 MeV
LAbs: mean = 9.43807 cm rms = 2.2901 cm
LGap2: mean = 4.98845 cm rms = 1.36532 cm
EAbs: mean = 183.744 MeV rms = 43.5113 MeV
EGap2: mean = 15.4705 MeV rms = 6.10516 MeV
LAbs: mean = 9.21143 cm rms = 2.16642 cm
LGap2: mean = 4.86717 cm rms = 1.60599 cm
... close file : proton.hdf5 - done
Graphics systems deleted.
Visualization Manager deleting...
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -277,7 +284,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -832,7 +839,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -853,10 +860,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 86.7754 MeV rms = 6.06128 MeV
EGap: mean = 6.22737 MeV rms = 4.05788 MeV
LAbs: mean = 6.36212 cm rms = 5.45277 mm
LGap: mean = 3.22513 cm rms = 2.15538 cm
EAbs: mean = 92.3063 MeV rms = 4.14219 MeV
EGap: mean = 4.85878 MeV rms = 2.0183 MeV
LAbs: mean = 6.63777 cm rms = 2.92186 mm
LGap: mean = 2.3872 cm rms = 9.61394 mm
### Run 1 start.
---> Begin of event: 0
@@ -868,8 +875,8 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 182.084 MeV rms = 6.77419 MeV
LAbs: mean = 13.0969 cm rms = 5.39518 mm
EAbs: mean = 181.847 MeV rms = 4.68046 MeV
LAbs: mean = 13.1175 cm rms = 4.04973 mm
### Run 2 start.
---> Begin of event: 0
@@ -881,10 +888,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 271.702 MeV rms = 14.4701 MeV
EGap2: mean = 13.0056 MeV rms = 4.70044 MeV
LAbs: mean = 19.609 cm rms = 1.07761 cm
LGap2: mean = 6.42871 cm rms = 2.46679 cm
EAbs: mean = 274.942 MeV rms = 8.96651 MeV
EGap2: mean = 13.9939 MeV rms = 6.14487 MeV
LAbs: mean = 19.7961 cm rms = 7.49951 mm
LGap2: mean = 6.91332 cm rms = 3.1357 cm
... close file : e-.root - done
... create file : proton.root - done
... open analysis file : proton.root - done
@@ -900,10 +907,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 197.13 MeV rms = 59.1173 MeV
EGap2: mean = 20.0031 MeV rms = 11.0171 MeV
LAbs: mean = 8.42208 cm rms = 2.68317 cm
LGap2: mean = 4.32901 cm rms = 1.4735 cm
EAbs: mean = 220.52 MeV rms = 42.6585 MeV
EGap2: mean = 21.0932 MeV rms = 14.424 MeV
LAbs: mean = 8.44493 cm rms = 2.11558 cm
LGap2: mean = 4.29837 cm rms = 1.2912 cm
### Run 4 start.
---> Begin of event: 0
@@ -915,10 +922,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 201.326 MeV rms = 52.7717 MeV
EGap2: mean = 19.8641 MeV rms = 13.0272 MeV
LAbs: mean = 9.43807 cm rms = 2.2901 cm
LGap2: mean = 4.98845 cm rms = 1.36532 cm
EAbs: mean = 183.744 MeV rms = 43.5113 MeV
EGap2: mean = 15.4705 MeV rms = 6.10516 MeV
LAbs: mean = 9.21143 cm rms = 2.16642 cm
LGap2: mean = 4.86717 cm rms = 1.60599 cm
... close file : proton.root - done
Graphics systems deleted.
Visualization Manager deleting...
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -78,14 +78,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -277,7 +284,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -832,7 +839,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -855,10 +862,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 86.7754 MeV rms = 6.06128 MeV
EGap: mean = 6.22737 MeV rms = 4.05788 MeV
LAbs: mean = 6.36212 cm rms = 5.45277 mm
LGap: mean = 3.22513 cm rms = 2.15538 cm
EAbs: mean = 92.3063 MeV rms = 4.14219 MeV
EGap: mean = 4.85878 MeV rms = 2.0183 MeV
LAbs: mean = 6.63777 cm rms = 2.92186 mm
LGap: mean = 2.3872 cm rms = 9.61394 mm
### Run 1 start.
---> Begin of event: 0
@@ -872,8 +879,8 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 182.084 MeV rms = 6.77419 MeV
LAbs: mean = 13.0969 cm rms = 5.39518 mm
EAbs: mean = 181.847 MeV rms = 4.68046 MeV
LAbs: mean = 13.1175 cm rms = 4.04973 mm
### Run 2 start.
---> Begin of event: 0
@@ -887,10 +894,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 271.702 MeV rms = 14.4701 MeV
EGap2: mean = 13.0056 MeV rms = 4.70044 MeV
LAbs: mean = 19.609 cm rms = 1.07761 cm
LGap2: mean = 6.42871 cm rms = 2.46679 cm
EAbs: mean = 274.942 MeV rms = 8.96651 MeV
EGap2: mean = 13.9939 MeV rms = 6.14487 MeV
LAbs: mean = 19.7961 cm rms = 7.49951 mm
LGap2: mean = 6.91332 cm rms = 3.1357 cm
... close file : e-.xml - done
... close file : e-_nt_Ntuple1.xml - done
... close file : e-_nt_Ntuple2.xml - done
@@ -911,10 +918,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 197.13 MeV rms = 59.1173 MeV
EGap2: mean = 20.0031 MeV rms = 11.0171 MeV
LAbs: mean = 8.42208 cm rms = 2.68317 cm
LGap2: mean = 4.32901 cm rms = 1.4735 cm
EAbs: mean = 220.52 MeV rms = 42.6585 MeV
EGap2: mean = 21.0932 MeV rms = 14.424 MeV
LAbs: mean = 8.44493 cm rms = 2.11558 cm
LGap2: mean = 4.29837 cm rms = 1.2912 cm
### Run 4 start.
---> Begin of event: 0
@@ -928,10 +935,10 @@ There are histograms that can be viewed with visualization:
----> print histograms statistic
EAbs: mean = 201.326 MeV rms = 52.7717 MeV
EGap2: mean = 19.8641 MeV rms = 13.0272 MeV
LAbs: mean = 9.43807 cm rms = 2.2901 cm
LGap2: mean = 4.98845 cm rms = 1.36532 cm
EAbs: mean = 183.744 MeV rms = 43.5113 MeV
EGap2: mean = 15.4705 MeV rms = 6.10516 MeV
LAbs: mean = 9.21143 cm rms = 2.16642 cm
LGap2: mean = 4.86717 cm rms = 1.60599 cm
... close file : proton.xml - done
... close file : proton_nt_Ntuple1.xml - done
... close file : proton_nt_Ntuple2.xml - done
+10 -12
View File
@@ -32,25 +32,23 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4VisExecutive.hh"
#include "G4RunManagerFactory.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
@@ -62,7 +60,7 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
auto detector = new DetectorConstruction;
auto detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new FTFP_BERT);
runManager->SetUserInitialization(new ActionInitialization(detector));
@@ -76,13 +74,13 @@ int main(int argc,char** argv)
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if ( ui == nullptr ) {
if (ui == nullptr) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand("/control/alias defaultFileType root");
// define the default value for alias used in AnaEx03.in
UImanager->ApplyCommand(command+fileName);
// define the default value for alias used in AnaEx03.in
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
@@ -51,5 +51,3 @@ class ActionInitialization : public G4VUserActionInitialization
};
#endif
@@ -46,27 +46,33 @@ class HistoManager;
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction() override;
public:
EventAction();
~EventAction() override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
void AddAbs(G4double de, G4double dl)
{
fEnergyAbs += de;
fTrackLAbs += dl;
};
void AddGap(G4double de, G4double dl)
{
fEnergyGap += de;
fTrackLGap += dl;
};
private:
G4double fEnergyAbs = 0;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
private:
G4double fEnergyAbs = 0;
G4double fEnergyGap = 0;
G4double fTrackLAbs = 0;
G4double fTrackLGap = 0;
G4int fPrintModulo = 100;
G4int fPrintModulo = 100;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -46,19 +46,19 @@ class G4Run;
class RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction() override;
public:
RunAction();
~RunAction() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void PrintStatistic();
void PrintStatistic();
private:
void DefineCommands();
private:
void DefineCommands();
G4GenericMessenger* fMessenger = nullptr;
G4GenericMessenger* fMessenger = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,11 +32,11 @@
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -48,41 +48,40 @@ class DetectorMessenger;
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction() override;
DetectorConstruction();
~DetectorConstruction() override;
public:
G4VPhysicalVolume* Construct() override;
void SetAbsorberMaterial (const G4String&);
void SetAbsorberMaterial(const G4String&);
void SetAbsorberThickness(G4double);
void SetGapMaterial (const G4String&);
void SetGapMaterial(const G4String&);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetNbOfLayers(G4int);
void PrintCalorParameters();
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeX() { return fWorldSizeX; }
G4double GetWorldSizeYZ() { return fWorldSizeYZ; }
G4double GetCalorThickness() { return fCalorThickness; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4double GetCalorSizeYZ() { return fCalorSizeYZ; }
G4int GetNbOfLayers() { return fNbOfLayers; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetAbsorberMaterial() { return fAbsorberMaterial; }
G4double GetAbsorberThickness() { return fAbsorberThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
G4Material* GetGapMaterial() { return fGapMaterial; }
G4double GetGapThickness() { return fGapThickness; }
const G4VPhysicalVolume* GetphysiWorld() { return fPhysiWorld; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
const G4VPhysicalVolume* GetAbsorber() { return fPhysiAbsorber; }
const G4VPhysicalVolume* GetGap() { return fPhysiGap; }
private:
void DefineMaterials();
@@ -93,37 +92,37 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4Material* fGapMaterial = nullptr;
G4Material* fDefaultMaterial = nullptr;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10.*CLHEP::mm;
G4double fGapThickness = 5.*CLHEP::mm;
G4double fCalorSizeYZ = 10.*CLHEP::cm;
G4int fNbOfLayers = 10;
G4double fAbsorberThickness = 10. * CLHEP::mm;
G4double fGapThickness = 5. * CLHEP::mm;
G4double fCalorSizeYZ = 10. * CLHEP::cm;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness= 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4double fCalorThickness = 0.; // will be computed
G4double fLayerThickness = 0.; // will be computed
G4double fWorldSizeYZ = 0.; // will be computed;
G4double fWorldSizeX = 0.; // will be computed;
G4Box* fSolidWorld = nullptr; //pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; //pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; //pointer to the physical World
G4Box* fSolidWorld = nullptr; // pointer to the solid World
G4LogicalVolume* fLogicWorld = nullptr; // pointer to the logical World
G4VPhysicalVolume* fPhysiWorld = nullptr; // pointer to the physical World
G4Box* fSolidCalor = nullptr; //pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; //pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; //pointer to the physical Calor
G4Box* fSolidCalor = nullptr; // pointer to the solid Calor
G4LogicalVolume* fLogicCalor = nullptr; // pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor = nullptr; // pointer to the physical Calor
G4Box* fSolidLayer = nullptr; //pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; //pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; //pointer to the physical Layer
G4Box* fSolidLayer = nullptr; // pointer to the solid Layer
G4LogicalVolume* fLogicLayer = nullptr; // pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer = nullptr; // pointer to the physical Layer
G4Box* fSolidAbsorber = nullptr; //pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; //pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; //pointer to the physical Absorber
G4Box* fSolidAbsorber = nullptr; // pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber = nullptr; // pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber = nullptr; // pointer to the physical Absorber
G4Box* fSolidGap = nullptr; //pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; //pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; //pointer to the physical Gap
G4Box* fSolidGap = nullptr; // pointer to the solid Gap
G4LogicalVolume* fLogicGap = nullptr; // pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap = nullptr; // pointer to the physical Gap
DetectorMessenger* fDetectorMessenger = nullptr; //pointer to the Messenger
DetectorMessenger* fDetectorMessenger = nullptr; // pointer to the Messenger
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -131,13 +130,13 @@ class DetectorConstruction : public G4VUserDetectorConstruction
inline void DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers*fLayerThickness;
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers * fLayerThickness;
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
fWorldSizeX = 1.2 * fCalorThickness;
fWorldSizeYZ = 1.2 * fCalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -32,8 +32,8 @@
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
@@ -43,10 +43,10 @@ class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
class DetectorMessenger : public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
@@ -54,13 +54,13 @@ class DetectorMessenger: public G4UImessenger
private:
DetectorConstruction* fDetector = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIdirectory* fDetDir = nullptr;
G4UIcmdWithAString* fAbsMaterCmd = nullptr;
G4UIcmdWithAString* fGapMaterCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fAbsThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fGapThickCmd = nullptr;
G4UIcmdWithADoubleAndUnit* fSizeYZCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,19 +43,17 @@ class DetectorConstruction;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
void GeneratePrimaries(G4Event*) override;
private:
G4ParticleGun* fParticleGun = nullptr; //pointer a to G4 class
DetectorConstruction* fDetector = nullptr; //pointer to the geometry
private:
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 class
DetectorConstruction* fDetector = nullptr; // pointer to the geometry
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -41,15 +41,15 @@ class EventAction;
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction() override;
void UserSteppingAction(const G4Step*) override;
void UserSteppingAction(const G4Step*) override;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
private:
DetectorConstruction* fDetector = nullptr;
EventAction* fEventAction = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,26 +30,24 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4GeometryManager.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4StateManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
#include "G4SolidStore.hh"
#include "G4StateManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -113,114 +111,118 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// World
//
fSolidWorld = new G4Box("World", //its name
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
fSolidWorld = new G4Box("World", // its name
fWorldSizeX / 2, fWorldSizeYZ / 2, fWorldSizeYZ / 2); // its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fDefaultMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its logical volume
"World", //its name
nullptr, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiWorld = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicWorld, // its logical volume
"World", // its name
nullptr, // its mother volume
false, // no boolean operation
0); // copy number
//
// Calorimeter
//
fSolidCalor = nullptr; fLogicCalor = nullptr; fPhysiCalor = nullptr;
fSolidLayer = nullptr; fLogicLayer = nullptr; fPhysiLayer = nullptr;
fSolidCalor = nullptr;
fLogicCalor = nullptr;
fPhysiCalor = nullptr;
fSolidLayer = nullptr;
fLogicLayer = nullptr;
fPhysiLayer = nullptr;
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", //its name
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
if (fCalorThickness > 0.) {
fSolidCalor = new G4Box("Calorimeter", // its name
fCalorThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
fDefaultMaterial, //its material
"Calorimeter"); //its name
fLogicCalor = new G4LogicalVolume(fSolidCalor, // its solid
fDefaultMaterial, // its material
"Calorimeter"); // its name
fPhysiCalor = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicCalor, //its logical volume
"Calorimeter", //its name
fLogicWorld, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiCalor = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicCalor, // its logical volume
"Calorimeter", // its name
fLogicWorld, // its mother volume
false, // no boolean operation
0); // copy number
//
// Layer
//
fSolidLayer = new G4Box("Layer", //its name
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidLayer = new G4Box("Layer", // its name
fLayerThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicLayer = new G4LogicalVolume(fSolidLayer, //its solid
fDefaultMaterial, //its material
"Layer"); //its name
fLogicLayer = new G4LogicalVolume(fSolidLayer, // its solid
fDefaultMaterial, // its material
"Layer"); // its name
if (fNbOfLayers > 1) {
fPhysiLayer = new G4PVReplica("Layer", //its name
fLogicLayer, //its logical volume
fLogicCalor, //its mother
kXAxis, //axis of replication
fNbOfLayers, //number of replica
fLayerThickness); //witdth of replica
fPhysiLayer = new G4PVReplica("Layer", // its name
fLogicLayer, // its logical volume
fLogicCalor, // its mother
kXAxis, // axis of replication
fNbOfLayers, // number of replica
fLayerThickness); // witdth of replica
}
else {
fPhysiLayer = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicLayer, //its logical volume
"Layer", //its name
fLogicCalor, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiLayer = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicLayer, // its logical volume
"Layer", // its name
fLogicCalor, // its mother volume
false, // no boolean operation
0); // copy number
}
}
//
// Absorber
//
fSolidAbsorber = nullptr; fLogicAbsorber = nullptr; fPhysiAbsorber = nullptr;
fSolidAbsorber = nullptr;
fLogicAbsorber = nullptr;
fPhysiAbsorber = nullptr;
if (fAbsorberThickness > 0.) {
fSolidAbsorber = new G4Box("Absorber", //its name
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fSolidAbsorber = new G4Box("Absorber", // its name
fAbsorberThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2); // size
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
fAbsorberMaterial, //its material
fAbsorberMaterial->GetName()); //name
fPhysiAbsorber = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
fLogicAbsorber, //its logical volume
fAbsorberMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, // its solid
fAbsorberMaterial, // its material
fAbsorberMaterial->GetName()); // name
fPhysiAbsorber = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(-fGapThickness / 2, 0., 0.), // its position
fLogicAbsorber, // its logical volume
fAbsorberMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
//
// Gap
//
fSolidGap = nullptr; fLogicGap = nullptr; fPhysiGap = nullptr;
fSolidGap = nullptr;
fLogicGap = nullptr;
fPhysiGap = nullptr;
if (fGapThickness > 0.) {
fSolidGap = new G4Box("Gap",
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fSolidGap = new G4Box("Gap", fGapThickness / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2);
fLogicGap = new G4LogicalVolume(fSolidGap,
fGapMaterial,
fGapMaterial->GetName());
fLogicGap = new G4LogicalVolume(fSolidGap, fGapMaterial, fGapMaterial->GetName());
fPhysiGap = new G4PVPlacement(nullptr, //no rotation
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
fLogicGap, //its logical volume
fGapMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
fPhysiGap = new G4PVPlacement(nullptr, // no rotation
G4ThreeVector(fAbsorberThickness / 2, 0., 0.), // its position
fLogicGap, // its logical volume
fGapMaterial->GetName(), // its name
fLogicLayer, // its mother
false, // no boulean operat
0); // copy number
}
PrintCalorParameters();
@@ -228,14 +230,14 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
// Visualization attributes
//
fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
auto simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
simpleBoxVisAtt->SetVisibility(true);
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
//
//always return the physical World
// always return the physical World
//
return fPhysiWorld;
}
@@ -246,9 +248,8 @@ void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
<< " + "
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
<< fAbsorberThickness / mm << "mm of " << fAbsorberMaterial->GetName() << " + "
<< fGapThickness / mm << "mm of " << fGapMaterial->GetName() << " ] "
<< "\n------------------------------------------------------------\n";
}
@@ -274,7 +275,7 @@ void DetectorConstruction::SetGapMaterial(const G4String& materialChoice)
auto material = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (material != nullptr) {
fGapMaterial = material;
if ( fLogicGap != nullptr) {
if (fLogicGap != nullptr) {
fLogicGap->SetMaterial(fGapMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
@@ -287,7 +288,7 @@ void DetectorConstruction::SetAbsorberThickness(G4double value)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -298,7 +299,7 @@ void DetectorConstruction::SetGapThickness(G4double value)
{
// change Gap thickness and recompute the calorimeter parameters
fGapThickness = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -309,7 +310,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
{
// change the transverse size and recompute the calorimeter parameters
fCalorSizeYZ = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -319,7 +320,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double value)
void DetectorConstruction::SetNbOfLayers(G4int value)
{
fNbOfLayers = value;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
if (G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -32,57 +32,57 @@
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIdirectory.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
: fDetector(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction* Det) : fDetector(Det)
{
G4bool broadcast = false;
fDetDir = new G4UIdirectory("/det/",broadcast);
fDetDir = new G4UIdirectory("/det/", broadcast);
fDetDir->SetGuidance("Detector control");
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat",this);
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat", this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("AbsMat",false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsMaterCmd->SetParameterName("AbsMat", false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat",this);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat", this);
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
fGapMaterCmd->SetParameterName("GapMat",false);
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapMaterCmd->SetParameterName("GapMat", false);
fGapMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick",this);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick", this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("AbsThick",false);
fAbsThickCmd->SetParameterName("AbsThick", false);
fAbsThickCmd->SetRange("AbsThick>=0.");
fAbsThickCmd->SetUnitCategory("Length");
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick",this);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick", this);
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
fGapThickCmd->SetParameterName("GapThick",false);
fGapThickCmd->SetParameterName("GapThick", false);
fGapThickCmd->SetRange("GapThick>=0.");
fGapThickCmd->SetUnitCategory("Length");
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ",this);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ", this);
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
fSizeYZCmd->SetParameterName("SizeYZ",false);
fSizeYZCmd->SetParameterName("SizeYZ", false);
fSizeYZCmd->SetRange("SizeYZ>0.");
fSizeYZCmd->SetUnitCategory("Length");
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeYZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers",this);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers", this);
fNbLayersCmd->SetGuidance("Set number of layers.");
fNbLayersCmd->SetParameterName("NbLayers",false);
fNbLayersCmd->SetParameterName("NbLayers", false);
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -102,32 +102,32 @@ DetectorMessenger::~DetectorMessenger()
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fAbsMaterCmd ) {
if (command == fAbsMaterCmd) {
fDetector->SetAbsorberMaterial(newValue);
return;
}
if( command == fGapMaterCmd ) {
if (command == fGapMaterCmd) {
fDetector->SetGapMaterial(newValue);
return;
}
if( command == fAbsThickCmd ) {
if (command == fAbsThickCmd) {
fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fGapThickCmd ) {
if (command == fGapThickCmd) {
fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fSizeYZCmd ) {
if (command == fSizeYZCmd) {
fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));
return;
}
if( command == fNbLayersCmd ) {
if (command == fNbLayersCmd) {
fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));
return;
}
@@ -34,30 +34,28 @@
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc)
: fDetector(dc)
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* dc) : fDetector(dc)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "e-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
fParticleGun->SetParticleEnergy(500.*MeV);
G4double position = -0.5*(fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
fParticleGun->SetParticleEnergy(500. * MeV);
G4double position = -0.5 * (fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position, 0. * cm, 0. * cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -71,10 +69,9 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
// this function is called at the begining of event
//
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -39,7 +39,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
: fDetector(det), fEventAction(evt)
: fDetector(det), fEventAction(evt)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,8 +51,7 @@ SteppingAction::~SteppingAction() = default;
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// get volume of the current step
G4VPhysicalVolume* volume =
aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
G4VPhysicalVolume* volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
// collect energy and track length step by step
G4double edep = aStep->GetTotalEnergyDeposit();
@@ -62,8 +61,12 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
stepl = aStep->GetStepLength();
}
if (volume == fDetector->GetAbsorber()) { fEventAction->AddAbs(edep,stepl); }
if (volume == fDetector->GetGap()) { fEventAction->AddGap(edep,stepl); }
if (volume == fDetector->GetAbsorber()) {
fEventAction->AddAbs(edep, stepl);
}
if (volume == fDetector->GetGap()) {
fEventAction->AddGap(edep, stepl);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,16 +28,15 @@
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
: fDetector(detector)
{}
ActionInitialization::ActionInitialization(DetectorConstruction* detector) : fDetector(detector) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -61,10 +60,10 @@ void ActionInitialization::Build() const
SetUserAction(new RunAction());
auto eventAction = new EventAction();
auto eventAction = new EventAction();
SetUserAction(eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
auto steppingAction = new SteppingAction(fDetector, eventAction);
SetUserAction(steppingAction);
}
@@ -34,6 +34,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
@@ -52,7 +53,7 @@ EventAction::~EventAction() = default;
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0) {
if (evtNb % fPrintModulo == 0) {
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
}
@@ -78,9 +79,9 @@ void EventAction::EndOfEventAction(const G4Event*)
analysisManager->FillH1(3, fTrackLGap);
}
//fill ntuple
// fill ntuple
//
// Fill 1st ntuple ( id = 0)
// Fill 1st ntuple ( id = 0)
analysisManager->FillNtupleDColumn(0, 0, fEnergyAbs);
analysisManager->FillNtupleDColumn(0, 1, fEnergyGap);
analysisManager->AddNtupleRow(0);
@@ -37,8 +37,8 @@
#include "G4GenericMessenger.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -50,10 +50,10 @@ RunAction::RunAction()
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetDefaultFileType("root");
analysisManager->SetVerboseLevel(1);
// Only merge in MT mode to avoid warning when running in Sequential mode
#ifdef G4MULTITHREADED
analysisManager->SetNtupleMerging(true);
#endif
// Only merge in MT mode to avoid warning when running in Sequential mode
#ifdef G4MULTITHREADED
analysisManager->SetNtupleMerging(true);
#endif
// Create directories
analysisManager->SetHistoDirectoryName("histo");
@@ -65,13 +65,13 @@ RunAction::RunAction()
// analysisManager->SetFirstHistoId(1);
// id = 0
analysisManager->CreateH1("EAbs","Edep in absorber (MeV)", 100, 0., 800*MeV);
analysisManager->CreateH1("EAbs", "Edep in absorber (MeV)", 100, 0., 800 * MeV);
// id = 1
analysisManager->CreateH1("EGap","Edep in gap (MeV)", 100, 0., 100*MeV);
analysisManager->CreateH1("EGap", "Edep in gap (MeV)", 100, 0., 100 * MeV);
// id = 2
analysisManager->CreateH1("LAbs","trackL in absorber (mm)", 100, 0., 1*m);
analysisManager->CreateH1("LAbs", "trackL in absorber (mm)", 100, 0., 1 * m);
// id = 3
analysisManager->CreateH1("LGap","trackL in gap (mm)", 100, 0., 50*cm);
analysisManager->CreateH1("LGap", "trackL in gap (mm)", 100, 0., 50 * cm);
// Create ntuples.
// Ntuples ids are generated automatically starting from 0.
@@ -80,15 +80,15 @@ RunAction::RunAction()
// Create 1st ntuple (id = 0)
analysisManager->CreateNtuple("Ntuple1", "Edep");
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
analysisManager->CreateNtupleDColumn("Eabs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Egap"); // column Id = 1
analysisManager->FinishNtuple();
// Create 2nd ntuple (id = 1)
//
analysisManager->CreateNtuple("Ntuple2", "TrackL");
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
analysisManager->CreateNtupleDColumn("Labs"); // column Id = 0
analysisManager->CreateNtupleDColumn("Lgap"); // column Id = 1
analysisManager->FinishNtuple();
DefineCommands();
@@ -107,8 +107,7 @@ void RunAction::BeginOfRunAction(const G4Run* run)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* /*run*/)
{}
void RunAction::EndOfRunAction(const G4Run* /*run*/) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -117,22 +116,24 @@ void RunAction::PrintStatistic()
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4cout << "\n ----> print histograms statistic \n" << G4endl;
for ( G4int i=0; i<analysisManager->GetNofH1s(); ++i ) {
for (G4int i = 0; i < analysisManager->GetNofH1s(); ++i) {
auto h1 = analysisManager->GetH1(i);
// skip if histogram was deleted
if (h1 == nullptr) continue;
G4String name = analysisManager->GetH1Name(i);
G4String unitCategory;
if (name[0U] == 'E' ) { unitCategory = "Energy"; }
if (name[0U] == 'L' ) { unitCategory = "Length"; }
// we use an explicit unsigned int type for operator [] argument
// to avoid problems with windows compiler
if (name[0U] == 'E') {
unitCategory = "Energy";
}
if (name[0U] == 'L') {
unitCategory = "Length";
}
// we use an explicit unsigned int type for operator [] argument
// to avoid problems with windows compiler
G4cout << name
<< ": mean = " << G4BestUnit(h1->mean(), unitCategory)
<< " rms = " << G4BestUnit(h1->rms(), unitCategory )
<< G4endl;
G4cout << name << ": mean = " << G4BestUnit(h1->mean(), unitCategory)
<< " rms = " << G4BestUnit(h1->rms(), unitCategory) << G4endl;
}
}
@@ -141,18 +142,12 @@ void RunAction::PrintStatistic()
void RunAction::DefineCommands()
{
// Define /AnaEx03/runAction command directory using generic messenger class
fMessenger
= new G4GenericMessenger(this,
"/AnaEx03/runAction/",
"Run action commands");
fMessenger = new G4GenericMessenger(this, "/AnaEx03/runAction/", "Run action commands");
// printStatistic command
auto& printStatisticCmd
= fMessenger->DeclareMethod("printStatistic",
&RunAction::PrintStatistic,
"Print statistic at the end of Run.");
auto& printStatisticCmd = fMessenger->DeclareMethod("printStatistic", &RunAction::PrintStatistic,
"Print statistic at the end of Run.");
printStatisticCmd.SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -43,14 +43,21 @@ Registered graphics systems are:
RayTracerX (RayTracerX)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
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.
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
- by argument in the construction of G4VisExecutive
- by environment variable "G4VIS_DEFAULT_DRIVER"
- by entry in "~/.g4session"
- by build flags.
- Note: This feature is not allowed in batch mode.
For further information see "examples/basic/B1/exampleB1.cc"
and "vis.mac".
Registering model factories...
@@ -233,7 +240,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -794,7 +801,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -806,24 +813,24 @@ G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
G4ConvergenceTester Output Result of DOSE_TALLY
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
EFFICIENCY = 0.198
MEAN = 4.55475e-14
VAR = 1.54263e-26
SD = 1.24203e-13
R = 0.0862315
SHIFT = 1.72861e-13
VOV = 0.00854466
FOM = 4482.77
THE LARGEST SCORE = 5.54337e-13 and it happened at 366th event
Affected Mean = 4.60558e-14 and its ratio to original is 1.01116
Affected VAR = 1.56695e-26 and its ratio to original is 1.01576
Affected R = 0.0859065 and its ratio to original is 0.99623
Affected SHIFT = 1.73445e-13 and its ratio to original is 1.00338
Affected FOM = 4482.77 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.0916485
r is less than 0.1. r = 0.0862315
VOV follows 1/std::sqrt(N)
VOV is monotonically decrease
FOM distribution is not RANDOM
@@ -833,48 +840,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 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
1 62 3.17379e-14 1.29473e-26 1.13786e-13 0.451691 0.226367 163.379 2.0412e-13 0.142857 0.0952381 0.105548
2 124 3.30804e-14 1.06384e-26 1.03143e-13 0.278877 0.105732 428.601 1.73258e-13 0.168 0.039619 0.0375311
3 187 3.94836e-14 1.26526e-26 1.12484e-13 0.207776 0.0559014 772.128 1.69917e-13 0.191489 0.0224586 0.0204825
4 249 3.97276e-14 1.30204e-26 1.14107e-13 0.181656 0.0405982 1010.14 1.71002e-13 0.184 0.0177391 0.0151277
5 312 3.82407e-14 1.22829e-26 1.10828e-13 0.163814 0.0339478 1242.15 1.69776e-13 0.185304 0.0140465 0.0127029
6 374 3.89136e-14 1.2719e-26 1.12778e-13 0.149661 0.0287795 1488.2 1.742e-13 0.184 0.0118261 0.0105126
7 437 3.80559e-14 1.25301e-26 1.11938e-13 0.140546 0.0252541 1687.5 1.75552e-13 0.191781 0.00962166 0.0100864
8 499 4.16767e-14 1.38768e-26 1.178e-13 0.126406 0.019678 2086.14 1.74791e-13 0.202 0.00790099 0.00804549
9 562 4.17944e-14 1.4095e-26 1.18722e-13 0.119718 0.0172617 2325.73 1.75728e-13 0.198934 0.00715237 0.00715461
10 624 4.33469e-14 1.47176e-26 1.21316e-13 0.111949 0.0146904 2659.74 1.74757e-13 0.1968 0.00653008 0.00598243
11 687 4.40834e-14 1.50155e-26 1.22538e-13 0.105974 0.0130273 2968.1 1.74616e-13 0.196221 0.00595392 0.00526027
12 749 4.57566e-14 1.56694e-26 1.25178e-13 0.0998947 0.0112546 3340.36 1.73389e-13 0.198667 0.00537808 0.00458757
13 812 4.50245e-14 1.54897e-26 1.24458e-13 0.0969456 0.0105987 3546.68 1.74374e-13 0.195572 0.0050593 0.0043276
14 874 4.57357e-14 1.56286e-26 1.25015e-13 0.0924063 0.00966482 3903.69 1.7349e-13 0.2 0.00457143 0.00395773
15 937 4.56765e-14 1.55286e-26 1.24614e-13 0.0890783 0.0090895 4200.83 1.73294e-13 0.198294 0.00431025 0.00361624
16 999 4.55475e-14 1.54263e-26 1.24203e-13 0.0862315 0.00854466 4482.77 1.72861e-13 0.198 0.00405051 0.00337794
--------------------End of Global Run-----------------------
The run consists of 1000 gamma of 6 MeV
Cumulated dose per run, in scoring volume : 42.4413 picoGy rms = 3.88774 picoGy
Cumulated dose per run, in scoring volume : 45.5475 picoGy rms = 3.92567 picoGy
------------------------------------------------------------
G4ConvergenceTester Output Result of DOSE_TALLY
EFFICIENCY = 0.638
MEAN = 5.05669e-12
VAR = 2.16333e-23
SD = 4.65116e-12
R = 0.0290868
SHIFT = 2.0878e-15
VOV = 0.000156804
FOM = 4727.91
THE LARGEST SCORE = 1.0851e-11 and it happened at 802th event
Affected Mean = 5.06247e-12 and its ratio to original is 1.00114
Affected VAR = 2.16452e-23 and its ratio to original is 1.00055
Affected R = 0.029047 and its ratio to original is 0.998632
Affected SHIFT = -2.10021e-15 and its ratio to original is -1.00595
Affected FOM = 4727.91 and its ratio to original is 1
EFFICIENCY = 0.612
MEAN = 4.70767e-12
VAR = 2.09414e-23
SD = 4.57618e-12
R = 0.0307395
SHIFT = 3.36726e-13
VOV = 0.000199175
FOM = 4601.27
THE LARGEST SCORE = 1.07575e-11 and it happened at 607th event
Affected Mean = 4.71372e-12 and its ratio to original is 1.00128
Affected VAR = 2.09571e-23 and its ratio to original is 1.00075
Affected R = 0.0306962 and its ratio to original is 0.998591
Affected SHIFT = 3.3236e-13 and its ratio to original is 0.987033
Affected FOM = 4601.27 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.0290868
r is less than 0.1. r = 0.0307395
VOV follows 1/std::sqrt(N)
VOV is monotonically decrease
FOM distribution is not RANDOM
@@ -884,26 +891,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 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.24443e-12 2.19131e-23 4.68114e-12 0.079836 0.00119948 627.571 -2.32561e-13 0.632 0.00465823 0.00166456
3 187 5.19533e-12 2.17828e-23 4.6672e-12 0.0655187 0.000810324 931.816 -1.46253e-13 0.638298 0.00301418 0.00125568
4 249 5.24762e-12 2.17577e-23 4.66451e-12 0.0562178 0.000628242 1265.64 -1.88828e-13 0.64 0.00225 0.000897804
5 312 5.05818e-12 2.13264e-23 4.61805e-12 0.0516051 0.000543135 1502.01 -1.61673e-14 0.632588 0.00185562 0.000798965
6 374 4.94544e-12 2.13069e-23 4.61595e-12 0.0481992 0.000456237 1721.79 8.7396e-14 0.626667 0.00158865 0.000728316
7 437 5.00127e-12 2.121e-23 4.60543e-12 0.044 0.000391269 2066.11 4.18245e-14 0.636986 0.00130112 0.000630458
8 499 5.08953e-12 2.13598e-23 4.62167e-12 0.0406103 0.000326214 2425.43 -4.35334e-14 0.646 0.00109598 0.000549919
9 562 5.16829e-12 2.14152e-23 4.62765e-12 0.0377363 0.000291332 2808.93 -1.0866e-13 0.653641 0.000941192 0.000480309
10 624 5.18124e-12 2.14591e-23 4.63239e-12 0.0357628 0.000258743 3127.5 -1.18512e-13 0.6544 0.000844988 0.000431944
11 687 5.17908e-12 2.13659e-23 4.62233e-12 0.0340262 0.000239275 3454.87 -1.19679e-13 0.655523 0.000763807 0.000392296
12 749 5.17742e-12 2.13375e-23 4.61926e-12 0.0325783 0.00022047 3768.8 -1.13831e-13 0.658667 0.000690958 0.000368972
13 812 5.18358e-12 2.12092e-23 4.60534e-12 0.0311592 0.000212735 4119.89 -1.23029e-13 0.661747 0.000628724 0.000340981
14 874 5.13529e-12 2.13621e-23 4.62192e-12 0.0304266 0.000190414 4320.69 -7.65616e-14 0.651429 0.000611529 0.00031319
15 937 5.10108e-12 2.15153e-23 4.63846e-12 0.02969 0.000170897 4537.73 -4.15281e-14 0.646055 0.000584067 0.000296492
16 999 5.05669e-12 2.16333e-23 4.65116e-12 0.0290868 0.000156804 4727.91 2.0878e-15 0.638 0.000567398 0.000277796
1 62 5.19299e-12 2.1284e-23 4.61346e-12 0.111928 0.00320878 347.051 -2.2379e-14 0.666667 0.00793651 0.00439255
2 124 5.36134e-12 2.12529e-23 4.61009e-12 0.0769096 0.001509 735.041 -2.4295e-13 0.656 0.00419512 0.00167264
3 187 5.1933e-12 2.16596e-23 4.65399e-12 0.0653586 0.000877776 1017.81 -8.33545e-14 0.632979 0.00308421 0.00116482
4 249 4.95489e-12 2.15601e-23 4.64329e-12 0.0592682 0.000688672 1237.74 1.1844e-13 0.612 0.00253595 0.000962715
5 312 4.91856e-12 2.14292e-23 4.62917e-12 0.0531977 0.000567319 1536.34 1.6347e-13 0.616613 0.00198646 0.000834496
6 374 4.90622e-12 2.0871e-23 4.56847e-12 0.0480849 0.000528341 1880.42 1.48974e-13 0.624 0.00160684 0.000699154
7 437 4.77642e-12 2.08916e-23 4.57073e-12 0.0457243 0.000449474 2079.59 2.55796e-13 0.609589 0.00146221 0.000623722
8 499 4.77164e-12 2.09932e-23 4.58183e-12 0.0429424 0.000382828 2357.76 2.67344e-13 0.612 0.00126797 0.00057239
9 562 4.71852e-12 2.09737e-23 4.5797e-12 0.0409051 0.000346315 2598.47 3.11738e-13 0.605684 0.00115635 0.0005139
10 624 4.70478e-12 2.10471e-23 4.58771e-12 0.0390047 0.00030795 2857.84 3.22915e-13 0.6016 0.00105957 0.00045936
11 687 4.72405e-12 2.09644e-23 4.5787e-12 0.0369516 0.000283309 3184.24 3.08893e-13 0.607558 0.000938856 0.000424579
12 749 4.72705e-12 2.11366e-23 4.59746e-12 0.0355138 0.000252487 3447.29 3.11107e-13 0.602667 0.000879056 0.000380491
13 812 4.76222e-12 2.10716e-23 4.59039e-12 0.0338061 0.000231611 3804.37 2.76281e-13 0.608856 0.00079019 0.000351255
14 874 4.76977e-12 2.10183e-23 4.58457e-12 0.0324935 0.000216617 4117.92 2.72184e-13 0.612571 0.000722814 0.000331808
15 937 4.70589e-12 2.09145e-23 4.57323e-12 0.0317308 0.000213362 4318.29 3.35765e-13 0.610874 0.000679103 0.000326665
16 999 4.70767e-12 2.09414e-23 4.57618e-12 0.0307395 0.000199175 4601.27 3.36726e-13 0.612 0.000633987 0.000309986
--------------------End of Global Run-----------------------
The run consists of 1000 proton of 210 MeV
Cumulated dose per run, in scoring volume : 5.05669 nanoGy rms = 147.009 picoGy
Cumulated dose per run, in scoring volume : 4.70767 nanoGy rms = 144.639 picoGy
------------------------------------------------------------
Graphics systems deleted.
@@ -27,42 +27,39 @@
/// \file exampleB1.cc
/// \brief Main program of the B1 example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "QBBC.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "Randomize.hh"
using namespace B1;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
int main(int argc, char** argv)
{
// Instantiate G4UIExecutive if there are no arguments (interactive mode)
G4UIExecutive* ui = nullptr;
if ( argc == 1 ) {
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
// Optionally: choose a different Random engine...
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
//use G4SteppingVerboseWithUnits
// use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
// Construct the default run manager
//
auto* runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(8);
// Set mandatory initialization classes
@@ -91,7 +88,7 @@ int main(int argc,char** argv)
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode : define UI session
@@ -47,7 +47,7 @@ class ActionInitialization : public G4VUserActionInitialization
void Build() const override;
};
}
} // namespace B1Con
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,7 +55,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4LogicalVolume* fScoringVolume = nullptr;
};
}
} // namespace B1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -56,13 +56,11 @@ class EventAction : public G4UserEventAction
private:
B1Con::RunAction* fRunAction = nullptr;
G4double fEdep = 0.;
G4double fEdep = 0.;
};
}
} // namespace B1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -30,8 +30,8 @@
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
@@ -59,11 +59,11 @@ class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
private:
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
G4Box* fEnvelopeBox = nullptr;
};
}
} // namespace B1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,15 +32,14 @@
#include "VectorAccummulable.hh"
#include "G4Accumulable.hh"
#include "G4ConvergenceTester.hh"
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "globals.hh"
class G4ConvergenceTester;
class G4Run;
namespace B1Con
{
@@ -56,19 +55,18 @@ class RunAction : public G4UserRunAction
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void AddEdep (G4double edep);
void AddEdep(G4double edep);
private:
G4Accumulable<G4double> fEdep = 0.;
G4Accumulable<G4double> fEdep2 = 0.;
VectorAccumulable<G4double> fEdepPerEvent;
VectorAccumulable<G4double> fEdepPerEvent;
G4ConvergenceTester* fDoseTally = nullptr;
};
}
} // namespace B1Con
#endif
@@ -56,7 +56,7 @@ class SteppingAction : public G4UserSteppingAction
G4LogicalVolume* fScoringVolume = nullptr;
};
}
} // namespace B1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,9 +35,10 @@
#include "G4VAccumulable.hh"
#include "globals.hh"
#include <vector>
template <typename T>
template<typename T>
class VectorAccumulable : public G4VAccumulable
{
public:
@@ -56,26 +57,29 @@ class VectorAccumulable : public G4VAccumulable
// inline functions
template <typename T>
inline void VectorAccumulable<T>::AddValue(T value) {
fTVector.push_back(value);
template<typename T>
inline void VectorAccumulable<T>::AddValue(T value)
{
fTVector.push_back(value);
}
template <typename T>
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 ) {
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() {
template<typename T>
inline void VectorAccumulable<T>::Reset()
{
fTVector.clear();
}
@@ -28,9 +28,10 @@
/// \brief Implementation of the B1::ActionInitialization class
#include "ActionInitialization.hh"
#include "EventAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
namespace B1Con
@@ -61,4 +62,4 @@ void ActionInitialization::Build() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1Con
@@ -29,16 +29,16 @@
#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 "G4NistManager.hh"
#include "G4Orb.hh"
#include "G4PVPlacement.hh"
#include "G4RunManager.hh"
#include "G4Sphere.hh"
#include "G4SystemOfUnits.hh"
#include "G4Trd.hh"
namespace B1
{
@@ -52,7 +52,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// Envelope parameters
//
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
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
@@ -62,109 +62,111 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
//
// World
//
G4double world_sizeXY = 1.2*env_sizeXY;
G4double world_sizeZ = 1.2*env_sizeZ;
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 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
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
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 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
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
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);
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;
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);
shape1_hz, shape1_phimin, shape1_phimax);
auto logicShape1 = new G4LogicalVolume(solidShape1, // its solid
shape1_mat, // its material
"Shape1"); // its name
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
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);
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
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
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
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
// always return the physical World
//
return physWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1
@@ -28,6 +28,7 @@
/// \brief Implementation of the B1::EventAction class
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4Event.hh"
@@ -38,9 +39,7 @@ namespace B1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(B1Con::RunAction* runAction)
: fRunAction(runAction)
{}
EventAction::EventAction(B1Con::RunAction* runAction) : fRunAction(runAction) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -59,4 +58,4 @@ void EventAction::EndOfEventAction(const G4Event*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1
@@ -29,13 +29,13 @@
#include "PrimaryGeneratorAction.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4RunManager.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
@@ -47,16 +47,15 @@ namespace B1
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="gamma");
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "gamma");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(6.*MeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
fParticleGun->SetParticleEnergy(6. * MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -70,7 +69,7 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of ecah event
// this function is called at the begining of ecah event
//
// In order to avoid dependence of PrimaryGeneratorAction
@@ -80,38 +79,33 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
G4double envSizeXY = 0;
G4double envSizeZ = 0;
if (!fEnvelopeBox)
{
G4LogicalVolume* envLV
= G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope");
if ( envLV ) fEnvelopeBox = dynamic_cast<G4Box*>(envLV->GetSolid());
if (!fEnvelopeBox) {
G4LogicalVolume* envLV = G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope");
if (envLV) fEnvelopeBox = dynamic_cast<G4Box*>(envLV->GetSolid());
}
if ( fEnvelopeBox ) {
envSizeXY = fEnvelopeBox->GetXHalfLength()*2.;
envSizeZ = fEnvelopeBox->GetZHalfLength()*2.;
if (fEnvelopeBox) {
envSizeXY = fEnvelopeBox->GetXHalfLength() * 2.;
envSizeZ = fEnvelopeBox->GetZHalfLength() * 2.;
}
else {
else {
G4ExceptionDescription msg;
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("PrimaryGeneratorAction::GeneratePrimaries()",
"MyCode0002",JustWarning,msg);
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
}
G4double size = 0.8;
G4double x0 = size * envSizeXY * (G4UniformRand()-0.5);
G4double y0 = size * envSizeXY * (G4UniformRand()-0.5);
G4double x0 = size * envSizeXY * (G4UniformRand() - 0.5);
G4double y0 = size * envSizeXY * (G4UniformRand() - 0.5);
G4double z0 = -0.5 * envSizeZ;
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
fParticleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1
@@ -28,16 +28,17 @@
/// \brief Implementation of the B1::RunAction class
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4AccumulableManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4UnitsTable.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
namespace B1Con
{
@@ -48,15 +49,15 @@ RunAction::RunAction()
{
// add new units for dose
//
const G4double milligray = 1.e-3*gray;
const G4double microgray = 1.e-6*gray;
const G4double nanogray = 1.e-9*gray;
const G4double picogray = 1.e-12*gray;
const G4double milligray = 1.e-3 * gray;
const G4double microgray = 1.e-6 * gray;
const G4double nanogray = 1.e-9 * gray;
const G4double picogray = 1.e-12 * gray;
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
new G4UnitDefinition("milligray", "milliGy", "Dose", milligray);
new G4UnitDefinition("microgray", "microGy", "Dose", microgray);
new G4UnitDefinition("nanogray", "nanoGy", "Dose", nanogray);
new G4UnitDefinition("picogray", "picoGy", "Dose", picogray);
// Register accumulable to the accumulable manager
G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance();
@@ -77,8 +78,8 @@ void RunAction::BeginOfRunAction(const G4Run*)
accumulableManager->Reset();
if (IsMaster()) {
fDoseTally = new G4ConvergenceTester("DOSE_TALLY");
//fDoseTally = new G4ConvergenceTester();
fDoseTally = new G4ConvergenceTester("DOSE_TALLY");
// fDoseTally = new G4ConvergenceTester();
}
}
@@ -95,17 +96,20 @@ void RunAction::EndOfRunAction(const G4Run* run)
// Compute dose = total energy deposit in a run and its variance
//
G4double edep = fEdep.GetValue();
G4double edep = fEdep.GetValue();
G4double edep2 = fEdep2.GetValue();
G4double rms = edep2 - edep*edep/nofEvents;
if (rms > 0.) rms = std::sqrt(rms); else rms = 0.;
G4double rms = edep2 - edep * edep / nofEvents;
if (rms > 0.)
rms = std::sqrt(rms);
else
rms = 0.;
const auto detConstruction = static_cast<const B1::DetectorConstruction*>(
G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4double mass = detConstruction->GetScoringVolume()->GetMass();
G4double dose = edep/mass;
G4double rmsDose = rms/mass;
G4double dose = edep / mass;
G4double rmsDose = rms / mass;
// Run conditions
// note: There is no primary generator action object for "master"
@@ -113,59 +117,48 @@ void RunAction::EndOfRunAction(const G4Run* run)
const auto generatorAction = static_cast<const B1::PrimaryGeneratorAction*>(
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
G4String runCondition;
if (generatorAction)
{
if (generatorAction) {
const G4ParticleGun* particleGun = generatorAction->GetParticleGun();
runCondition += particleGun->GetParticleDefinition()->GetParticleName();
runCondition += " of ";
G4double particleEnergy = particleGun->GetParticleEnergy();
runCondition += G4BestUnit(particleEnergy,"Energy");
runCondition += G4BestUnit(particleEnergy, "Energy");
}
// Print
//
if (IsMaster()) {
for (auto edepPerEvent : fEdepPerEvent.GetVector()) {
G4double dosePerEvent = edepPerEvent/mass/gray;
fDoseTally->AddScore(dosePerEvent);
}
for (auto edepPerEvent : fEdepPerEvent.GetVector()) {
G4double dosePerEvent = edepPerEvent / mass / gray;
fDoseTally->AddScore(dosePerEvent);
}
fDoseTally->ShowResult();
fDoseTally->ShowHistory();
delete fDoseTally;
fDoseTally = nullptr;
fDoseTally->ShowResult();
fDoseTally->ShowHistory();
delete fDoseTally;
fDoseTally = nullptr;
G4cout
<< G4endl
<< "--------------------End of Global Run-----------------------";
G4cout << G4endl << "--------------------End of Global Run-----------------------";
}
else {
G4cout
<< G4endl
<< "--------------------End of Local Run------------------------";
G4cout << G4endl << "--------------------End of Local Run------------------------";
}
G4cout
<< 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;
G4cout << 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;
fEdep += edep;
fEdep2 += edep * edep;
fEdepPerEvent.AddValue(edep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1Con
@@ -28,22 +28,21 @@
/// \brief Implementation of the B1::SteppingAction class
#include "SteppingAction.hh"
#include "EventAction.hh"
#include "DetectorConstruction.hh"
#include "G4Step.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
#include "G4RunManager.hh"
#include "G4Step.hh"
namespace B1
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(EventAction* eventAction)
: fEventAction(eventAction)
{}
SteppingAction::SteppingAction(EventAction* eventAction) : fEventAction(eventAction) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -56,9 +55,8 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
}
// get volume of the current step
G4LogicalVolume* volume
= step->GetPreStepPoint()->GetTouchableHandle()
->GetVolume()->GetLogicalVolume();
G4LogicalVolume* volume =
step->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume();
// check if we are in scoring volume
if (volume != fScoringVolume) return;
@@ -70,4 +68,4 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
} // namespace B1
+33 -41
View File
@@ -55,25 +55,22 @@
// --------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <iostream>
#include "G4GeometryManager.hh"
#include "G4RunManagerFactory.hh"
#include "G4Types.hh"
#include "G4UImanager.hh"
#include "G4VPhysicalVolume.hh"
#include <iostream>
#include <stdlib.h>
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UImanager.hh"
#include "G4GeometryManager.hh"
// user classes
#include "B01ActionInitialization.hh"
#include "B01DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ImportanceBiasing.hh"
#include "G4WeightWindowBiasing.hh"
#include "B01ActionInitialization.hh"
// #include "B01PrimaryGeneratorAction.hh"
// #include "B01RunAction.hh"
@@ -85,10 +82,10 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc, char **argv)
int main(int argc, char** argv)
{
G4int mode = 0;
if (argc>1) mode = atoi(argv[1]);
if (argc > 1) mode = atoi(argv[1]);
G4int numberOfEvents = 100;
G4long myseed = 345354;
@@ -98,54 +95,49 @@ int main(int argc, char **argv)
G4Random::setTheSeed(myseed);
G4VWeightWindowAlgorithm *wwAlg = 0; // pointer for WeightWindow (mode>0)
G4VWeightWindowAlgorithm* wwAlg = 0; // pointer for WeightWindow (mode>0)
// create the detector ---------------------------
B01DetectorConstruction* detector = new B01DetectorConstruction();
runManager->SetUserInitialization(detector);
G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron");
G4GeometrySampler mgs(detector->GetWorldVolume(), "neutron");
G4VModularPhysicsList* physicsList = new FTFP_BERT;
if(mode == 0)
{
physicsList->RegisterPhysics(new G4ImportanceBiasing(&mgs));
}
else
{
wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor
1, // survival factor
100); // max. number of splitting
if (mode == 0) {
physicsList->RegisterPhysics(new G4ImportanceBiasing(&mgs));
}
else {
wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor
1, // survival factor
100); // max. number of splitting
physicsList->RegisterPhysics(new G4WeightWindowBiasing
(&mgs, wwAlg, onBoundary));
// place of action
}
physicsList->RegisterPhysics(new G4WeightWindowBiasing(&mgs, wwAlg, onBoundary));
// place of action
}
runManager->SetUserInitialization(physicsList);
// Set user action classes through Worker Initialization
//
// Set user action classes through Worker Initialization
//
B01ActionInitialization* actions = new B01ActionInitialization;
runManager->SetUserInitialization(actions);
runManager->Initialize();
if (mode == 0)
{
detector->CreateImportanceStore();
}
else
{
detector->CreateWeightWindowStore();
}
if (mode == 0) {
detector->CreateImportanceStore();
}
else {
detector->CreateWeightWindowStore();
}
// runManager->BeamOn(numberOfEvents);
//temporary fix before runManager->BeamOn works...
// temporary fix before runManager->BeamOn works...
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4String command1 = "/control/cout/setCoutFile threadOut";
UImanager->ApplyCommand(command1);
G4String command2 = "/run/beamOn " +
G4UIcommand::ConvertToString(numberOfEvents);;
G4String command2 = "/run/beamOn " + G4UIcommand::ConvertToString(numberOfEvents);
;
UImanager->ApplyCommand(command2);
// open geometry for clean biasing stores clean-up
+23 -23
View File
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -246,7 +246,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -801,7 +801,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -826,24 +826,24 @@ Max 2J for sampling of angular correlations 10
=============================================================
=============================================================
Volume | Tr.Entering | Population | Collisions | Coll*WGT | NumWGTedE | FluxWGTedE | Av.Tr.WGT | SL | SLW | SLW_v | SLWE | SLWE_v |
cell_00 | 38 | 131 | 38 | 38 | 0.127734 | 3.3177 | 1 | 7208.92 | 7208.92 | 6356.16 | 23917 | 811.897 |
cell_01 | 155 | 182 | 614 | 614 | 0.0210531 | 4.36408 | 1 | 25941.3 | 25941.3 | 148122 | 113210 | 3118.42 |
cell_02 | 166 | 271 | 1544 | 772 | 0.00766938 | 2.49197 | 0.5 | 50099.9 | 25049.9 | 252061 | 62423.7 | 1933.15 |
cell_03 | 204 | 329 | 1927 | 481.75 | 0.00734615 | 2.21468 | 0.25 | 62002 | 15500.5 | 155611 | 34328.6 | 1143.14 |
cell_04 | 255 | 401 | 2219 | 277.375 | 0.00404447 | 1.96357 | 0.125 | 68326.1 | 8540.76 | 134997 | 16770.3 | 545.99 |
cell_05 | 294 | 437 | 2710 | 169.375 | 0.00491922 | 1.76999 | 0.0625 | 83766.5 | 5235.41 | 65027.8 | 9266.61 | 319.886 |
cell_06 | 298 | 467 | 2571 | 80.3438 | 0.00383013 | 1.68586 | 0.03125 | 80907.8 | 2528.37 | 40894.2 | 4262.48 | 156.63 |
cell_07 | 280 | 431 | 2782 | 43.4688 | 0.00369089 | 1.36923 | 0.015625 | 82344.7 | 1286.64 | 18702.1 | 1761.7 | 69.0276 |
cell_08 | 289 | 441 | 2837 | 22.1641 | 0.00356832 | 1.25859 | 0.0078125 | 82266.5 | 642.707 | 9137.9 | 808.904 | 32.6069 |
cell_09 | 279 | 430 | 2748 | 10.7344 | 0.00256272 | 1.27376 | 0.00390625 | 80110.7 | 312.932 | 6259.92 | 398.601 | 16.0424 |
cell_10 | 274 | 409 | 2539 | 4.95898 | 0.00384701 | 1.32321 | 0.00195312 | 75706.6 | 147.864 | 2044.36 | 195.656 | 7.86469 |
cell_11 | 280 | 409 | 2704 | 2.64062 | 0.00374931 | 1.38624 | 0.000976562 | 80288.5 | 78.4068 | 1140.78 | 108.691 | 4.27712 |
cell_12 | 248 | 387 | 2587 | 1.26318 | 0.00262015 | 1.18621 | 0.000488281 | 73089.3 | 35.6881 | 656.374 | 42.3337 | 1.7198 |
cell_13 | 228 | 343 | 2078 | 0.507324 | 0.00308891 | 1.30833 | 0.000244141 | 62666.1 | 15.2993 | 264.72 | 20.0166 | 0.817695 |
cell_14 | 238 | 341 | 2383 | 0.290894 | 0.00310663 | 1.03811 | 0.00012207 | 68552.6 | 8.36824 | 121.564 | 8.68718 | 0.377655 |
cell_15 | 252 | 344 | 2505 | 0.152893 | 0.00228662 | 0.712841 | 6.10352e-05 | 68347.2 | 4.17158 | 66.4738 | 2.97367 | 0.152001 |
cell_16 | 192 | 294 | 2170 | 0.0662231 | 0.00179967 | 0.719758 | 3.05176e-05 | 57876.2 | 1.76624 | 32.9559 | 1.27127 | 0.0593098 |
cell_17 | 143 | 217 | 1423 | 0.0217133 | 0.00133862 | 0.657133 | 1.52588e-05 | 38452.2 | 0.586734 | 13.6664 | 0.385563 | 0.0182941 |
cell_18 | 72 | 137 | 844 | 0.00643921 | 0.00163629 | 0.67332 | 7.62939e-06 | 22786.8 | 0.173849 | 3.67902 | 0.117056 | 0.00601994 |
cell_19 | 30 | 30 | 30 | 0.000228882 | 0.0116028 | 0.701981 | 7.62939e-06 | 4524.62 | 0.0345201 | 0.11948 | 0.0242324 | 0.00138631 |
cell_00 | 37 | 129 | 37 | 37 | 0.0141346 | 2.50151 | 1 | 6319.8 | 6319.8 | 39047.3 | 15809 | 551.919 |
cell_01 | 143 | 169 | 494 | 494 | 0.0284315 | 4.65384 | 1 | 24724.4 | 24724.4 | 113620 | 115063 | 3230.37 |
cell_02 | 175 | 273 | 1284 | 642 | 0.0152999 | 2.96694 | 0.5 | 48728.8 | 24364.4 | 147533 | 72287.7 | 2257.25 |
cell_03 | 245 | 390 | 2277 | 569.25 | 0.00750143 | 2.12762 | 0.25 | 75105.4 | 18776.4 | 185373 | 39949 | 1390.56 |
cell_04 | 302 | 438 | 2519 | 314.875 | 0.0041225 | 1.6376 | 0.125 | 80385.9 | 10048.2 | 145806 | 16455 | 601.084 |
cell_05 | 326 | 467 | 2832 | 177 | 0.0036518 | 1.40627 | 0.0625 | 84488.1 | 5280.51 | 78543.5 | 7425.81 | 286.825 |
cell_06 | 335 | 485 | 3167 | 98.9688 | 0.00353905 | 1.5158 | 0.03125 | 93844.7 | 2932.65 | 46028.3 | 4445.3 | 162.897 |
cell_07 | 374 | 533 | 3379 | 52.7969 | 0.00409635 | 1.31248 | 0.015625 | 102335 | 1598.98 | 20363.8 | 2098.63 | 83.4172 |
cell_08 | 391 | 583 | 3759 | 29.3672 | 0.0034061 | 1.22557 | 0.0078125 | 108832 | 850.248 | 12654.7 | 1042.04 | 43.1032 |
cell_09 | 319 | 481 | 3047 | 11.9023 | 0.00274063 | 1.23986 | 0.00390625 | 87875.5 | 343.263 | 6205.24 | 425.6 | 17.0063 |
cell_10 | 291 | 425 | 2704 | 5.28125 | 0.00300906 | 1.23975 | 0.00195312 | 80305.1 | 156.846 | 2582.61 | 194.449 | 7.77122 |
cell_11 | 245 | 359 | 2335 | 2.28027 | 0.00329516 | 1.15499 | 0.000976562 | 68810.5 | 67.1978 | 961.111 | 77.6125 | 3.16702 |
cell_12 | 226 | 346 | 2012 | 0.982422 | 0.00307834 | 1.24728 | 0.000488281 | 61466.5 | 30.013 | 494.403 | 37.4344 | 1.52194 |
cell_13 | 204 | 297 | 1735 | 0.423584 | 0.00291361 | 1.08037 | 0.000244141 | 50828.1 | 12.4092 | 198.84 | 13.4065 | 0.579341 |
cell_14 | 173 | 252 | 1736 | 0.211914 | 0.00294957 | 0.817106 | 0.00012207 | 50721.3 | 6.19156 | 88.5095 | 5.05916 | 0.261065 |
cell_15 | 156 | 214 | 1675 | 0.102234 | 0.00183409 | 0.65141 | 6.10352e-05 | 45319.5 | 2.76608 | 52.9189 | 1.80185 | 0.097058 |
cell_16 | 139 | 198 | 1365 | 0.0416565 | 0.00168723 | 0.691558 | 3.05176e-05 | 35823.4 | 1.09324 | 22.6412 | 0.756041 | 0.038201 |
cell_17 | 111 | 158 | 1089 | 0.0166168 | 0.00208178 | 0.792333 | 1.52588e-05 | 30677.1 | 0.468096 | 8.91184 | 0.370888 | 0.0185525 |
cell_18 | 62 | 121 | 663 | 0.00505829 | 0.00367138 | 0.897193 | 7.62939e-06 | 20687.4 | 0.157832 | 1.95084 | 0.141606 | 0.00716227 |
cell_19 | 39 | 39 | 39 | 0.000297546 | 0.023012 | 1.60163 | 7.62939e-06 | 6364.5 | 0.0485573 | 0.148025 | 0.077771 | 0.00340635 |
=============================================
@@ -37,13 +37,12 @@
class B01ActionInitialization : public G4VUserActionInitialization
{
public:
B01ActionInitialization();
B01ActionInitialization();
virtual ~B01ActionInitialization();
public:
virtual void BuildForMaster() const;
virtual void Build() const;
};
#endif
@@ -32,8 +32,9 @@
#ifndef B01DetectorConstruction_hh
#define B01DetectorConstruction_hh B01DetectorConstruction_hh
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -42,33 +43,32 @@ class G4VWeightWindowStore;
class B01DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B01DetectorConstruction();
~B01DetectorConstruction();
virtual G4VPhysicalVolume* Construct();
public:
B01DetectorConstruction();
~B01DetectorConstruction();
G4VIStore* CreateImportanceStore();
virtual G4VPhysicalVolume* Construct();
G4VIStore* CreateImportanceStore();
// create an importance store, caller is responsible for deleting it
G4VWeightWindowStore *CreateWeightWindowStore();
// create an weight window store, caller is responsible for
G4VWeightWindowStore* CreateWeightWindowStore();
// create an weight window store, caller is responsible for
// deleting it
G4String GetCellName(G4int i);
G4String GetCellName(G4int i);
G4VPhysicalVolume* GetWorldVolume();
G4VPhysicalVolume* GetWorldVolume();
void SetSensitive();
void SetSensitive();
virtual void ConstructSDandField();
virtual void ConstructSDandField();
private:
std::vector< G4LogicalVolume * > fLogicalVolumeVector;
std::vector< G4VPhysicalVolume * > fPhysicalVolumeVector;
G4VPhysicalVolume* fWorldVolume;
private:
std::vector<G4LogicalVolume*> fLogicalVolumeVector;
std::vector<G4VPhysicalVolume*> fPhysicalVolumeVector;
G4VPhysicalVolume* fWorldVolume;
};
#endif
@@ -29,7 +29,7 @@
//
#ifndef B01PrimaryGeneratorAction_hh
#define B01PrimaryGeneratorAction_hh B01PrimaryGeneratorAction_hh
#define B01PrimaryGeneratorAction_hh B01PrimaryGeneratorAction_hh
#include "G4VUserPrimaryGeneratorAction.hh"
@@ -50,4 +50,3 @@ class B01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
};
#endif
+34 -35
View File
@@ -27,10 +27,10 @@
/// \brief Definition of the B01Run class
//
//
//
//
//---------------------------------------------------------------------
// (Purpose)
// Example implementation for multi-functional-detector and
// (Purpose)
// Example implementation for multi-functional-detector and
// primitive scorer.
// This B01Run class has collections which accumulate
// a event information into a run information.
@@ -40,46 +40,45 @@
#ifndef B01Run_h
#define B01Run_h 1
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Run.hh"
#include "G4THitsMap.hh"
#include <vector>
//
class B01Run : public G4Run {
class B01Run : public G4Run
{
public:
// constructor and destructor.
// vector of multifunctionaldetector name has to given to constructor.
B01Run(const std::vector<G4String> mfdName);
virtual ~B01Run();
public:
// constructor and destructor.
// vector of multifunctionaldetector name has to given to constructor.
B01Run(const std::vector<G4String> mfdName);
virtual ~B01Run();
public:
// virtual method from G4Run.
// The method is overriden in this class for scoring.
virtual void RecordEvent(const G4Event*);
public:
// virtual method from G4Run.
// The method is overriden in this class for scoring.
virtual void RecordEvent(const G4Event*);
// Access methods for scoring information.
// - Number of HitsMap for this RUN.
// This is equal to number of collections.
G4int GetNumberOfHitsMap() const { return fRunMap.size(); }
// - Get HitsMap of this RUN.
// by sequential number, by multifucntional name and collection name,
// and by collection name with full path.
G4THitsMap<G4double>* GetHitsMap(G4int i) { return fRunMap[i]; }
G4THitsMap<G4double>* GetHitsMap(const G4String& detName, const G4String& colName);
G4THitsMap<G4double>* GetHitsMap(const G4String& fullName);
// - Dump All HitsMap of this RUN.
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void DumpAllScorer();
// Access methods for scoring information.
// - Number of HitsMap for this RUN.
// This is equal to number of collections.
G4int GetNumberOfHitsMap() const {return fRunMap.size();}
// - Get HitsMap of this RUN.
// by sequential number, by multifucntional name and collection name,
// and by collection name with full path.
G4THitsMap<G4double>* GetHitsMap(G4int i){return fRunMap[i];}
G4THitsMap<G4double>* GetHitsMap(const G4String& detName,
const G4String& colName);
G4THitsMap<G4double>* GetHitsMap(const G4String& fullName);
// - Dump All HitsMap of this RUN.
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void DumpAllScorer();
virtual void Merge(const G4Run*);
virtual void Merge(const G4Run*);
private:
std::vector<G4String> fCollName;
std::vector<G4int> fCollID;
std::vector<G4THitsMap<G4double>*> fRunMap;
private:
std::vector<G4String> fCollName;
std::vector<G4int> fCollID;
std::vector<G4THitsMap<G4double>*> fRunMap;
};
//
@@ -27,49 +27,48 @@
/// \brief Definition of the B01RunAction class
//
//
//
//
#ifndef B01RunAction_h
#define B01RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#include <vector>
class G4Run;
//=======================================================================
// B01RunAction
//
//
//
//
//=======================================================================
//
class B01RunAction : public G4UserRunAction
{
public:
// constructor and destructor
B01RunAction();
virtual ~B01RunAction();
public:
// constructor and destructor
B01RunAction();
virtual ~B01RunAction();
public:
// virtual method from G4UserRunAction.
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
public:
// virtual method from G4UserRunAction.
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
public:
void PrintHeader(std::ostream *out);
std::string FillString(const std::string &name, char c, G4int n
, G4bool back=true);
private:
// Data member
// - vector of MultiFunctionalDetector names.
std::vector<G4String> fSDName;
// G4int fFieldName;
G4int fFieldValue;
public:
void PrintHeader(std::ostream* out);
std::string FillString(const std::string& name, char c, G4int n, G4bool back = true);
private:
// Data member
// - vector of MultiFunctionalDetector names.
std::vector<G4String> fSDName;
// G4int fFieldName;
G4int fFieldValue;
};
//
@@ -30,18 +30,23 @@
//
#include "B01ActionInitialization.hh"
#include "B01PrimaryGeneratorAction.hh"
#include "B01RunAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B01ActionInitialization::B01ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B01ActionInitialization::~B01ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -54,11 +59,8 @@ void B01ActionInitialization::BuildForMaster() const
void B01ActionInitialization::Build() const
{
SetUserAction(new B01PrimaryGeneratorAction);
SetUserAction(new B01RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,32 +29,32 @@
//
//
#include "G4Types.hh"
#include <sstream>
#include <set>
#include "globals.hh"
#include "B01DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4Types.hh"
#include "G4VisAttributes.hh"
#include "globals.hh"
#include <set>
#include <sstream>
// For Primitive Scorers
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDParticleFilter.hh"
#include "G4PSNofCollision.hh"
#include "G4PSPopulation.hh"
#include "G4PSTrackCounter.hh"
#include "G4PSTrackLength.hh"
#include "G4SDManager.hh"
#include "G4SDParticleFilter.hh"
// for importance biasing
#include "G4IStore.hh"
@@ -64,10 +64,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B01DetectorConstruction::B01DetectorConstruction() :
G4VUserDetectorConstruction(),
fLogicalVolumeVector(),fPhysicalVolumeVector()
{;}
B01DetectorConstruction::B01DetectorConstruction()
: G4VUserDetectorConstruction(), fLogicalVolumeVector(), fPhysicalVolumeVector()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -83,7 +84,7 @@ G4VPhysicalVolume* B01DetectorConstruction::Construct()
{
G4double pos_x;
G4double pos_y;
G4double pos_z;
G4double pos_z;
G4double density, pressure, temperature;
G4double A;
@@ -93,55 +94,54 @@ G4VPhysicalVolume* B01DetectorConstruction::Construct()
G4double z;
G4double fractionmass;
A = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , Z= 1, A);
A = 1.01 * g / mole;
G4Element* elH = new G4Element(name = "Hydrogen", symbol = "H", Z = 1, A);
A = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , Z = 6, A);
A = 12.01 * g / mole;
G4Element* elC = new G4Element(name = "Carbon", symbol = "C", Z = 6, A);
A = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , Z= 8, A);
A = 16.00 * g / mole;
G4Element* elO = new G4Element(name = "Oxygen", symbol = "O", Z = 8, A);
A = 22.99*g/mole;
G4Element* elNa = new G4Element(name="Natrium" ,symbol="Na" , Z=11 , A);
A = 22.99 * g / mole;
G4Element* elNa = new G4Element(name = "Natrium", symbol = "Na", Z = 11, A);
A = 200.59*g/mole;
G4Element* elHg = new G4Element(name="Hg" ,symbol="Hg" , Z=80, A);
A = 200.59 * g / mole;
G4Element* elHg = new G4Element(name = "Hg", symbol = "Hg", Z = 80, A);
A = 26.98*g/mole;
G4Element* elAl = new G4Element(name="Aluminium" ,symbol="Al" , Z=13, A);
A = 26.98 * g / mole;
G4Element* elAl = new G4Element(name = "Aluminium", symbol = "Al", Z = 13, A);
A = 28.09*g/mole;
G4Element* elSi = new G4Element(name="Silicon", symbol="Si", Z=14, A);
A = 28.09 * g / mole;
G4Element* elSi = new G4Element(name = "Silicon", symbol = "Si", Z = 14, A);
A = 39.1*g/mole;
G4Element* elK = new G4Element(name="K" ,symbol="K" , Z=19 , A);
A = 39.1 * g / mole;
G4Element* elK = new G4Element(name = "K", symbol = "K", Z = 19, A);
A = 69.72*g/mole;
G4Element* elCa = new G4Element(name="Calzium" ,symbol="Ca" , Z=31 , A);
A = 69.72 * g / mole;
G4Element* elCa = new G4Element(name = "Calzium", symbol = "Ca", Z = 31, A);
A = 55.85*g/mole;
G4Element* elFe = new G4Element(name="Iron" ,symbol="Fe", Z=26, A);
A = 55.85 * g / mole;
G4Element* elFe = new G4Element(name = "Iron", symbol = "Fe", Z = 26, A);
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material *Galactic =
new G4Material(name="Galactic", z=1., A=1.01*g/mole, density,
kStateGas,temperature,pressure);
density = universe_mean_density; // from PhysicalConstants.h
pressure = 3.e-18 * pascal;
temperature = 2.73 * kelvin;
G4Material* Galactic = new G4Material(name = "Galactic", z = 1., A = 1.01 * g / mole, density,
kStateGas, temperature, pressure);
density = 2.03*g/cm3;
density = 2.03 * g / cm3;
G4Material* Concrete = new G4Material("Concrete", density, 10);
Concrete->AddElement(elH , fractionmass= 0.01);
Concrete->AddElement(elO , fractionmass= 0.529);
Concrete->AddElement(elNa , fractionmass= 0.016);
Concrete->AddElement(elHg , fractionmass= 0.002);
Concrete->AddElement(elAl , fractionmass= 0.034);
Concrete->AddElement(elSi , fractionmass= 0.337);
Concrete->AddElement(elK , fractionmass= 0.013);
Concrete->AddElement(elCa , fractionmass= 0.044);
Concrete->AddElement(elFe , fractionmass= 0.014);
Concrete->AddElement(elC , fractionmass= 0.001);
Concrete->AddElement(elH, fractionmass = 0.01);
Concrete->AddElement(elO, fractionmass = 0.529);
Concrete->AddElement(elNa, fractionmass = 0.016);
Concrete->AddElement(elHg, fractionmass = 0.002);
Concrete->AddElement(elAl, fractionmass = 0.034);
Concrete->AddElement(elSi, fractionmass = 0.337);
Concrete->AddElement(elK, fractionmass = 0.013);
Concrete->AddElement(elCa, fractionmass = 0.044);
Concrete->AddElement(elFe, fractionmass = 0.014);
Concrete->AddElement(elC, fractionmass = 0.001);
/////////////////////////////
// world cylinder volume
@@ -149,111 +149,83 @@ G4VPhysicalVolume* B01DetectorConstruction::Construct()
// world solid
G4double innerRadiusCylinder = 0*cm;
G4double outerRadiusCylinder = 100*cm;
G4double heightCylinder = 100*cm;
G4double startAngleCylinder = 0*deg;
G4double spanningAngleCylinder = 360*deg;
G4double innerRadiusCylinder = 0 * cm;
G4double outerRadiusCylinder = 100 * cm;
G4double heightCylinder = 100 * cm;
G4double startAngleCylinder = 0 * deg;
G4double spanningAngleCylinder = 360 * deg;
G4Tubs *worldCylinder = new G4Tubs("worldCylinder",
innerRadiusCylinder,
outerRadiusCylinder,
heightCylinder,
startAngleCylinder,
spanningAngleCylinder);
G4Tubs* worldCylinder = new G4Tubs("worldCylinder", innerRadiusCylinder, outerRadiusCylinder,
heightCylinder, startAngleCylinder, spanningAngleCylinder);
// logical world
G4LogicalVolume *worldCylinder_log =
G4LogicalVolume* worldCylinder_log =
new G4LogicalVolume(worldCylinder, Galactic, "worldCylinder_log");
fLogicalVolumeVector.push_back(worldCylinder_log);
fLogicalVolumeVector.push_back(worldCylinder_log);
name = "shieldWorld";
fWorldVolume = new
G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log,
name, 0, false, 0);
fWorldVolume = new G4PVPlacement(0, G4ThreeVector(0, 0, 0), worldCylinder_log, name, 0, false, 0);
fPhysicalVolumeVector.push_back(fWorldVolume);
// creating 18 slabs of 10 cm thick concrete
G4double innerRadiusShield = 0*cm;
G4double outerRadiusShield = 100*cm;
G4double heightShield = 5*cm;
G4double startAngleShield = 0*deg;
G4double spanningAngleShield = 360*deg;
G4double innerRadiusShield = 0 * cm;
G4double outerRadiusShield = 100 * cm;
G4double heightShield = 5 * cm;
G4double startAngleShield = 0 * deg;
G4double spanningAngleShield = 360 * deg;
G4Tubs* aShield = new G4Tubs("aShield", innerRadiusShield, outerRadiusShield, heightShield,
startAngleShield, spanningAngleShield);
G4Tubs *aShield = new G4Tubs("aShield",
innerRadiusShield,
outerRadiusShield,
heightShield,
startAngleShield,
spanningAngleShield);
// logical shield
G4LogicalVolume *aShield_log =
new G4LogicalVolume(aShield, Concrete, "aShield_log");
G4LogicalVolume* aShield_log = new G4LogicalVolume(aShield, Concrete, "aShield_log");
fLogicalVolumeVector.push_back(aShield_log);
G4VisAttributes* pShieldVis = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
G4VisAttributes* pShieldVis = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
pShieldVis->SetForceSolid(true);
aShield_log->SetVisAttributes(pShieldVis);
// physical shields
G4int i;
G4double startz = -85*cm;
for (i=1; i<=18; i++)
{
G4double startz = -85 * cm;
for (i = 1; i <= 18; i++) {
name = GetCellName(i);
pos_x = 0*cm;
pos_y = 0*cm;
pos_z = startz + (i-1) * (2*heightShield);
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log,
name,
worldCylinder_log,
false,
i);
pos_x = 0 * cm;
pos_y = 0 * cm;
pos_z = startz + (i - 1) * (2 * heightShield);
G4VPhysicalVolume* pvol = new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z), aShield_log,
name, worldCylinder_log, false, i);
fPhysicalVolumeVector.push_back(pvol);
}
// filling the rest of the world volume behind the concrete with
// another slab which should get the same importance value
// another slab which should get the same importance value
// or lower weight bound as the last slab
//
innerRadiusShield = 0*cm;
outerRadiusShield = 100*cm;
heightShield = 5*cm;
startAngleShield = 0*deg;
spanningAngleShield = 360*deg;
innerRadiusShield = 0 * cm;
outerRadiusShield = 100 * cm;
heightShield = 5 * cm;
startAngleShield = 0 * deg;
spanningAngleShield = 360 * deg;
G4Tubs *aRest = new G4Tubs("Rest",
innerRadiusShield,
outerRadiusShield,
heightShield,
startAngleShield,
spanningAngleShield);
G4LogicalVolume *aRest_log =
new G4LogicalVolume(aRest, Galactic, "aRest_log");
G4Tubs* aRest = new G4Tubs("Rest", innerRadiusShield, outerRadiusShield, heightShield,
startAngleShield, spanningAngleShield);
G4LogicalVolume* aRest_log = new G4LogicalVolume(aRest, Galactic, "aRest_log");
fLogicalVolumeVector.push_back(aRest_log);
name = "rest";
pos_x = 0*cm;
pos_y = 0*cm;
pos_z = 95*cm;
G4VPhysicalVolume *pvol_rest =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aRest_log,
name,
worldCylinder_log,
false,
19); // i=19
pos_x = 0 * cm;
pos_y = 0 * cm;
pos_z = 95 * cm;
G4VPhysicalVolume* pvol_rest = new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z), aRest_log,
name, worldCylinder_log, false,
19); // i=19
fPhysicalVolumeVector.push_back(pvol_rest);
@@ -266,86 +238,77 @@ G4VPhysicalVolume* B01DetectorConstruction::Construct()
G4VIStore* B01DetectorConstruction::CreateImportanceStore()
{
G4cout << " B01DetectorConstruction:: Creating Importance Store " << G4endl;
if (!fPhysicalVolumeVector.size())
{
G4Exception("B01DetectorConstruction::CreateImportanceStore"
,"exampleB01_0001",RunMustBeAborted
,"no physical volumes created yet!");
if (!fPhysicalVolumeVector.size()) {
G4Exception("B01DetectorConstruction::CreateImportanceStore", "exampleB01_0001",
RunMustBeAborted, "no physical volumes created yet!");
}
fWorldVolume = fPhysicalVolumeVector[0];
// creating and filling the importance store
G4IStore *istore = G4IStore::GetInstance();
G4IStore* istore = G4IStore::GetInstance();
G4int n = 0;
G4double imp =1;
istore->AddImportanceGeometryCell(1, *fWorldVolume);
for (std::vector<G4VPhysicalVolume *>::iterator
it = fPhysicalVolumeVector.begin();
G4double imp = 1;
istore->AddImportanceGeometryCell(1, *fWorldVolume);
for (std::vector<G4VPhysicalVolume*>::iterator it = fPhysicalVolumeVector.begin();
it != fPhysicalVolumeVector.end() - 1; it++)
{
if (*it != fWorldVolume)
{
if (*it != fWorldVolume) {
imp = std::pow(2., n++);
G4cout << "Going to assign importance: " << imp << ", to volume: "
<< (*it)->GetName() << G4endl;
istore->AddImportanceGeometryCell(imp, *(*it),n);
G4cout << "Going to assign importance: " << imp << ", to volume: " << (*it)->GetName()
<< G4endl;
istore->AddImportanceGeometryCell(imp, *(*it), n);
}
}
// the remaining part pf the geometry (rest) gets the same
// importance as the last conrete cell
//
istore->AddImportanceGeometryCell(imp,
*(fPhysicalVolumeVector[fPhysicalVolumeVector.size()-1]),++n);
istore->AddImportanceGeometryCell(imp, *(fPhysicalVolumeVector[fPhysicalVolumeVector.size() - 1]),
++n);
return istore;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VWeightWindowStore *B01DetectorConstruction::CreateWeightWindowStore()
G4VWeightWindowStore* B01DetectorConstruction::CreateWeightWindowStore()
{
if (!fPhysicalVolumeVector.size())
{
G4Exception("B01DetectorConstruction::CreateWeightWindowStore"
,"exampleB01_0002",RunMustBeAborted
,"no physical volumes created yet!");
if (!fPhysicalVolumeVector.size()) {
G4Exception("B01DetectorConstruction::CreateWeightWindowStore", "exampleB01_0002",
RunMustBeAborted, "no physical volumes created yet!");
}
fWorldVolume = fPhysicalVolumeVector[0];
// creating and filling the weight window store
G4WeightWindowStore *wwstore = G4WeightWindowStore::GetInstance();
G4WeightWindowStore* wwstore = G4WeightWindowStore::GetInstance();
// create one energy region covering the energies of the problem
//
std::set<G4double, std::less<G4double> > enBounds;
std::set<G4double, std::less<G4double>> enBounds;
enBounds.insert(1 * GeV);
wwstore->SetGeneralUpperEnergyBounds(enBounds);
G4int n = 0;
G4double lowerWeight =1;
G4double lowerWeight = 1;
std::vector<G4double> lowerWeights;
lowerWeights.push_back(1);
G4GeometryCell gWorldCell(*fWorldVolume,0);
G4GeometryCell gWorldCell(*fWorldVolume, 0);
wwstore->AddLowerWeights(gWorldCell, lowerWeights);
for (std::vector<G4VPhysicalVolume *>::iterator
it = fPhysicalVolumeVector.begin();
for (std::vector<G4VPhysicalVolume*>::iterator it = fPhysicalVolumeVector.begin();
it != fPhysicalVolumeVector.end() - 1; it++)
{
if (*it != fWorldVolume)
{
lowerWeight = 1./std::pow(2., n++);
G4cout << "Going to assign lower weight: " << lowerWeight
<< ", to volume: "
<< (*it)->GetName() << G4endl;
G4GeometryCell gCell(*(*it),n);
if (*it != fWorldVolume) {
lowerWeight = 1. / std::pow(2., n++);
G4cout << "Going to assign lower weight: " << lowerWeight
<< ", to volume: " << (*it)->GetName() << G4endl;
G4GeometryCell gCell(*(*it), n);
lowerWeights.clear();
lowerWeights.push_back(lowerWeight);
wwstore->AddLowerWeights(gCell, lowerWeights);
@@ -355,9 +318,8 @@ G4VWeightWindowStore *B01DetectorConstruction::CreateWeightWindowStore()
// the remaining part pf the geometry (rest) gets the same
// lower weight bound as the last conrete cell
//
G4GeometryCell
gRestCell(*(fPhysicalVolumeVector[fPhysicalVolumeVector.size()-1]), ++n);
wwstore->AddLowerWeights(gRestCell, lowerWeights);
G4GeometryCell gRestCell(*(fPhysicalVolumeVector[fPhysicalVolumeVector.size() - 1]), ++n);
wwstore->AddLowerWeights(gRestCell, lowerWeights);
return wwstore;
}
@@ -368,23 +330,23 @@ G4String B01DetectorConstruction::GetCellName(G4int i)
{
std::ostringstream os;
os << "cell_";
if (i<10)
{
if (i < 10) {
os << "0";
}
os << i ;
os << i;
G4String name = os.str();
return name;
}
G4VPhysicalVolume *B01DetectorConstruction::GetWorldVolume() {
return fWorldVolume;
G4VPhysicalVolume* B01DetectorConstruction::GetWorldVolume()
{
return fWorldVolume;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B01DetectorConstruction::SetSensitive(){
void B01DetectorConstruction::SetSensitive()
{
// -------------------------------------------------
// The collection names of defined Primitives are
// 0 ConcreteSD/Collisions
@@ -399,14 +361,12 @@ void B01DetectorConstruction::SetSensitive(){
// -------------------------------------------------
// moved to ConstructSDandField() for MT compliance
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B01DetectorConstruction::ConstructSDandField()
{
// Sensitive Detector Manager.
G4SDManager* SDman = G4SDManager::GetSDMpointer();
// Sensitive Detector Name
@@ -417,61 +377,58 @@ void B01DetectorConstruction::ConstructSDandField()
//------------------------
//
// Define MultiFunctionalDetector with name.
G4MultiFunctionalDetector* MFDet =
new G4MultiFunctionalDetector(concreteSDname);
SDman->AddNewDetector( MFDet ); // Register SD to SDManager
G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(concreteSDname);
SDman->AddNewDetector(MFDet); // Register SD to SDManager
G4String fltName,particleName;
G4SDParticleFilter* neutronFilter =
new G4SDParticleFilter(fltName="neutronFilter", particleName="neutron");
G4String fltName, particleName;
G4SDParticleFilter* neutronFilter =
new G4SDParticleFilter(fltName = "neutronFilter", particleName = "neutron");
MFDet->SetFilter(neutronFilter);
for (std::vector<G4LogicalVolume *>::iterator it =
fLogicalVolumeVector.begin();
it != fLogicalVolumeVector.end(); it++){
for (std::vector<G4LogicalVolume*>::iterator it = fLogicalVolumeVector.begin();
it != fLogicalVolumeVector.end(); it++)
{
// (*it)->SetSensitiveDetector(MFDet);
SetSensitiveDetector((*it)->GetName(), MFDet);
SetSensitiveDetector((*it)->GetName(), MFDet);
}
G4String psName;
G4PSNofCollision* scorer0 = new G4PSNofCollision(psName="Collisions");
G4PSNofCollision* scorer0 = new G4PSNofCollision(psName = "Collisions");
MFDet->RegisterPrimitive(scorer0);
G4PSNofCollision* scorer1 = new G4PSNofCollision(psName="CollWeight");
G4PSNofCollision* scorer1 = new G4PSNofCollision(psName = "CollWeight");
scorer1->Weighted(true);
MFDet->RegisterPrimitive(scorer1);
G4PSPopulation* scorer2 = new G4PSPopulation(psName="Population");
G4PSPopulation* scorer2 = new G4PSPopulation(psName = "Population");
MFDet->RegisterPrimitive(scorer2);
G4PSTrackCounter* scorer3 = new G4PSTrackCounter(psName="TrackEnter"
,fCurrent_In);
G4PSTrackCounter* scorer3 = new G4PSTrackCounter(psName = "TrackEnter", fCurrent_In);
MFDet->RegisterPrimitive(scorer3);
G4PSTrackLength* scorer4 = new G4PSTrackLength(psName="SL");
G4PSTrackLength* scorer4 = new G4PSTrackLength(psName = "SL");
MFDet->RegisterPrimitive(scorer4);
G4PSTrackLength* scorer5 = new G4PSTrackLength(psName="SLW");
G4PSTrackLength* scorer5 = new G4PSTrackLength(psName = "SLW");
scorer5->Weighted(true);
MFDet->RegisterPrimitive(scorer5);
G4PSTrackLength* scorer6 = new G4PSTrackLength(psName="SLWE");
G4PSTrackLength* scorer6 = new G4PSTrackLength(psName = "SLWE");
scorer6->Weighted(true);
scorer6->MultiplyKineticEnergy(true);
MFDet->RegisterPrimitive(scorer6);
G4PSTrackLength* scorer7 = new G4PSTrackLength(psName="SLW_V");
G4PSTrackLength* scorer7 = new G4PSTrackLength(psName = "SLW_V");
scorer7->Weighted(true);
scorer7->DivideByVelocity(true);
MFDet->RegisterPrimitive(scorer7);
G4PSTrackLength* scorer8 = new G4PSTrackLength(psName="SLWE_V");
G4PSTrackLength* scorer8 = new G4PSTrackLength(psName = "SLWE_V");
scorer8->Weighted(true);
scorer8->MultiplyKineticEnergy(true);
scorer8->DivideByVelocity(true);
MFDet->RegisterPrimitive(scorer8);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,26 +29,25 @@
//
//
#include "globals.hh"
#include "B01PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4Neutron.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleGun.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B01PrimaryGeneratorAction::B01PrimaryGeneratorAction() :
G4VUserPrimaryGeneratorAction(), fParticleGun(0)
B01PrimaryGeneratorAction::B01PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun->SetParticleDefinition(G4Neutron::NeutronDefinition());
fParticleGun->SetParticleEnergy(10.0*MeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -90.0005*cm));
fParticleGun->SetParticleEnergy(10.0 * MeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -90.0005 * cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0));
}
+65 -70
View File
@@ -32,7 +32,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// (Description)
// B01Run Class is for accumulating scored quantities which is
// B01Run Class is for accumulating scored quantities which is
// scored using G4MutiFunctionalDetector and G4VPrimitiveScorer.
// Accumulation is done using G4THitsMap object.
//
@@ -41,10 +41,10 @@
// was assigned at instantiation of MultiFunctionalDetector(MFD).
// Then B01Run constructor automatically scans primitive scorers
// in the MFD, and obtains collectionIDs of all collections associated
// to those primitive scorers. Futhermore, the G4THitsMap objects
// to those primitive scorers. Futhermore, the G4THitsMap objects
// for accumulating during a RUN are automatically created too.
// (*) Collection Name is same as primitive scorer name.
//
//
// The resultant information is kept inside B01Run objects as
// data members.
// std::vector<G4String> fCollName; // Collection Name,
@@ -57,16 +57,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "B01Run.hh"
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDManager.hh"
#include "G4VPrimitiveScorer.hh"
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Constructor.
// Constructor.
// (The vector of MultiFunctionalDetector name has to given.)
B01Run::B01Run(const std::vector<G4String> mfdName): G4Run()
B01Run::B01Run(const std::vector<G4String> mfdName) : G4Run()
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
//=================================================
@@ -74,38 +74,36 @@ B01Run::B01Run(const std::vector<G4String> mfdName): G4Run()
// Get CollectionIDs for HitCollections.
//=================================================
G4int Nmfd = mfdName.size();
for ( G4int idet = 0; idet < Nmfd ; idet++){ // Loop for all MFD.
for (G4int idet = 0; idet < Nmfd; idet++) { // Loop for all MFD.
G4String detName = mfdName[idet];
//--- Seek and Obtain MFD objects from SDmanager.
G4MultiFunctionalDetector* mfd =
(G4MultiFunctionalDetector*)(SDman->FindSensitiveDetector(detName));
//
if ( mfd ){
//--- Loop over the registered primitive scorers.
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
// Get Primitive Scorer object.
G4VPrimitiveScorer* scorer=mfd->GetPrimitive(icol);
// collection name and collectionID for HitsCollection,
// where type of HitsCollection is G4THitsMap in case of primitive scorer.
// The collection name is given by <MFD name>/<Primitive Scorer name>.
G4String collectionName = scorer->GetName();
G4String fullCollectionName = detName+"/"+collectionName;
G4int collectionID = SDman->GetCollectionID(fullCollectionName);
if (mfd) {
//--- Loop over the registered primitive scorers.
for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++) {
// Get Primitive Scorer object.
G4VPrimitiveScorer* scorer = mfd->GetPrimitive(icol);
// collection name and collectionID for HitsCollection,
// where type of HitsCollection is G4THitsMap in case of primitive scorer.
// The collection name is given by <MFD name>/<Primitive Scorer name>.
G4String collectionName = scorer->GetName();
G4String fullCollectionName = detName + "/" + collectionName;
G4int collectionID = SDman->GetCollectionID(fullCollectionName);
if ( collectionID >= 0 ){
G4cout << "++ "<<fullCollectionName<< " id " << collectionID
<< G4endl;
// Store obtained HitsCollection information into data members.
// And, creates new G4THitsMap for accumulating quantities during RUN.
fCollName.push_back(fullCollectionName);
fCollID.push_back(collectionID);
fRunMap.push_back(new G4THitsMap<G4double>(detName
,collectionName));
}else{
G4cout << "** collection " << fullCollectionName
<< " not found. "<<G4endl;
}
if (collectionID >= 0) {
G4cout << "++ " << fullCollectionName << " id " << collectionID << G4endl;
// Store obtained HitsCollection information into data members.
// And, creates new G4THitsMap for accumulating quantities during RUN.
fCollName.push_back(fullCollectionName);
fCollID.push_back(collectionID);
fRunMap.push_back(new G4THitsMap<G4double>(detName, collectionName));
}
else {
G4cout << "** collection " << fullCollectionName << " not found. " << G4endl;
}
}
}
}
}
@@ -118,8 +116,8 @@ B01Run::~B01Run()
{
//--- Clear HitsMap for RUN
G4int Nmap = fRunMap.size();
for ( G4int i = 0; i < Nmap; i++){
if(fRunMap[i] ) fRunMap[i]->clear();
for (G4int i = 0; i < Nmap; i++) {
if (fRunMap[i]) fRunMap[i]->clear();
}
fCollName.clear();
fCollID.clear();
@@ -145,21 +143,20 @@ void B01Run::RecordEvent(const G4Event* aEvent)
// Sum up HitsMap of this Event into HitsMap of this RUN
//=======================================================
G4int Ncol = fCollID.size();
for ( G4int i = 0; i < Ncol ; i++ ){ // Loop over HitsCollection
G4THitsMap<G4double>* EvtMap=0;
if ( fCollID[i] >= 0 ){ // Collection is attached to HCE
for (G4int i = 0; i < Ncol; i++) { // Loop over HitsCollection
G4THitsMap<G4double>* EvtMap = 0;
if (fCollID[i] >= 0) { // Collection is attached to HCE
EvtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID[i]));
}else{
G4cout <<" Error EvtMap Not Found "<< i << G4endl;
}
if ( EvtMap ) {
else {
G4cout << " Error EvtMap Not Found " << i << G4endl;
}
if (EvtMap) {
//=== Sum up HitsMap of this event to HitsMap of RUN.===
*fRunMap[i] += *EvtMap;
//======================================================
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -169,46 +166,45 @@ void B01Run::RecordEvent(const G4Event* aEvent)
//-----
// Access HitsMap.
// By MultiFunctionalDetector name and Collection Name.
G4THitsMap<G4double>* B01Run::GetHitsMap(const G4String& detName,
const G4String& colName){
G4String fullName = detName+"/"+colName;
return GetHitsMap(fullName);
G4THitsMap<G4double>* B01Run::GetHitsMap(const G4String& detName, const G4String& colName)
{
G4String fullName = detName + "/" + colName;
return GetHitsMap(fullName);
}
//-----
// Access HitsMap.
// By full description of collection name, that is
// <MultiFunctional Detector Name>/<Primitive Scorer Name>
G4THitsMap<G4double>* B01Run::GetHitsMap(const G4String& fullName){
G4int Ncol = fCollName.size();
for ( G4int i = 0; i < Ncol; i++){
if ( fCollName[i] == fullName ){
return fRunMap[i];
}
G4THitsMap<G4double>* B01Run::GetHitsMap(const G4String& fullName)
{
G4int Ncol = fCollName.size();
for (G4int i = 0; i < Ncol; i++) {
if (fCollName[i] == fullName) {
return fRunMap[i];
}
return NULL;
}
return NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// - Dump All HitsMap of this RUN. (for debuging and monitoring of quantity).
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void B01Run::DumpAllScorer(){
void B01Run::DumpAllScorer()
{
// - Number of HitsMap in this RUN.
G4int n = GetNumberOfHitsMap();
// - GetHitsMap and dump values.
for ( G4int i = 0; i < n ; i++ ){
G4THitsMap<G4double>* RunMap =GetHitsMap(i);
if ( RunMap ) {
G4cout << " PrimitiveScorer RUN "
<< RunMap->GetSDname() <<","<< RunMap->GetName() << G4endl;
for (G4int i = 0; i < n; i++) {
G4THitsMap<G4double>* RunMap = GetHitsMap(i);
if (RunMap) {
G4cout << " PrimitiveScorer RUN " << RunMap->GetSDname() << "," << RunMap->GetName()
<< G4endl;
G4cout << " Number of entries " << RunMap->entries() << G4endl;
std::map<G4int,G4double*>::iterator itr = RunMap->GetMap()->begin();
for(; itr != RunMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first
<< " Run Value : " << *(itr->second)
<< G4endl;
std::map<G4int, G4double*>::iterator itr = RunMap->GetMap()->begin();
for (; itr != RunMap->GetMap()->end(); itr++) {
G4cout << " copy no.: " << itr->first << " Run Value : " << *(itr->second) << G4endl;
}
}
}
@@ -218,19 +214,18 @@ void B01Run::DumpAllScorer(){
void B01Run::Merge(const G4Run* aRun)
{
const B01Run * localRun = static_cast<const B01Run *>(aRun);
const B01Run* localRun = static_cast<const B01Run*>(aRun);
//=======================================================
// Merge HitsMap of working threads
//=======================================================
G4int nCol = localRun->fCollID.size();
for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection
if ( localRun->fCollID[i] >= 0 ){
for (G4int i = 0; i < nCol; i++) { // Loop over HitsCollection
if (localRun->fCollID[i] >= 0) {
*fRunMap[i] += *localRun->fRunMap[i];
}
}
G4Run::Merge(aRun);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+83 -105
View File
@@ -27,30 +27,31 @@
/// \brief Implementation of the B01RunAction class
//
//
//
//
#include "B01RunAction.hh"
#include "B01Run.hh"
//-- In order to obtain detector information.
#include "G4RunManager.hh"
#include "B01DetectorConstruction.hh"
#include "G4THitsMap.hh"
#include "G4RunManager.hh"
#include "G4THitsMap.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// B01RunAction
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Constructor
B01RunAction::B01RunAction():
G4UserRunAction(),
// fFieldName(15),
fFieldValue(14)
B01RunAction::B01RunAction()
: G4UserRunAction(),
// fFieldName(15),
fFieldValue(14)
{
// - Prepare data member for B01Run.
// vector represents a list of MultiFunctionalDetector names.
@@ -86,7 +87,7 @@ void B01RunAction::BeginOfRunAction(const G4Run* aRun)
void B01RunAction::EndOfRunAction(const G4Run* aRun)
{
G4cout << " ###### EndOfRunAction " <<G4endl;
G4cout << " ###### EndOfRunAction " << G4endl;
//- B01Run object.
B01Run* b01Run = (B01Run*)aRun;
//--- Dump all socred quantities involved in B01Run.
@@ -94,13 +95,12 @@ void B01RunAction::EndOfRunAction(const G4Run* aRun)
//---
G4RunManager* mgr = G4RunManager::GetRunManager();
//
for ( G4int i = 0; i < (G4int)fSDName.size(); i++ ){
const G4VUserDetectorConstruction* vdet =
mgr->GetUserDetectorConstruction();
for (G4int i = 0; i < (G4int)fSDName.size(); i++) {
const G4VUserDetectorConstruction* vdet = mgr->GetUserDetectorConstruction();
B01DetectorConstruction* bdet = (B01DetectorConstruction*)vdet;
//
//---------------------------------------------
// Dump accumulated quantities for this RUN.
// (Display only central region of x-y plane)
@@ -114,94 +114,73 @@ void B01RunAction::EndOfRunAction(const G4Run* aRun)
// 7 ConcreteSD/SLW_V
// 8 ConcreteSD/SLWE_V
//---------------------------------------------
G4THitsMap<G4double>* Collisions =
b01Run->GetHitsMap(fSDName[i]+"/Collisions");
G4THitsMap<G4double>* CollWeight =
b01Run->GetHitsMap(fSDName[i]+"/CollWeight");
G4THitsMap<G4double>* Population =
b01Run->GetHitsMap(fSDName[i]+"/Population");
G4THitsMap<G4double>* TrackEnter =
b01Run->GetHitsMap(fSDName[i]+"/TrackEnter");
G4THitsMap<G4double>* SL = b01Run->GetHitsMap(fSDName[i]+"/SL");
G4THitsMap<G4double>* SLW = b01Run->GetHitsMap(fSDName[i]+"/SLW");
G4THitsMap<G4double>* SLWE = b01Run->GetHitsMap(fSDName[i]+"/SLWE");
G4THitsMap<G4double>* SLW_V = b01Run->GetHitsMap(fSDName[i]+"/SLW_V");
G4THitsMap<G4double>* SLWE_V = b01Run->GetHitsMap(fSDName[i]+"/SLWE_V");
G4THitsMap<G4double>* Collisions = b01Run->GetHitsMap(fSDName[i] + "/Collisions");
G4THitsMap<G4double>* CollWeight = b01Run->GetHitsMap(fSDName[i] + "/CollWeight");
G4THitsMap<G4double>* Population = b01Run->GetHitsMap(fSDName[i] + "/Population");
G4THitsMap<G4double>* TrackEnter = b01Run->GetHitsMap(fSDName[i] + "/TrackEnter");
G4THitsMap<G4double>* SL = b01Run->GetHitsMap(fSDName[i] + "/SL");
G4THitsMap<G4double>* SLW = b01Run->GetHitsMap(fSDName[i] + "/SLW");
G4THitsMap<G4double>* SLWE = b01Run->GetHitsMap(fSDName[i] + "/SLWE");
G4THitsMap<G4double>* SLW_V = b01Run->GetHitsMap(fSDName[i] + "/SLW_V");
G4THitsMap<G4double>* SLWE_V = b01Run->GetHitsMap(fSDName[i] + "/SLWE_V");
if (IsMaster())
{
G4cout <<
"\n--------------------End of Global Run-----------------------" <<
G4endl;
G4cout <<
" Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl;
}
else
{
G4cout <<
"\n--------------------End of Local Run------------------------" <<
G4endl;
G4cout <<
" Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl;
}
G4cout << "============================================================="
<<G4endl;
G4cout << "============================================================="
<<G4endl;
if (IsMaster()) {
G4cout << "\n--------------------End of Global Run-----------------------" << G4endl;
G4cout << " Number of event processed : " << aRun->GetNumberOfEvent() << G4endl;
}
else {
G4cout << "\n--------------------End of Local Run------------------------" << G4endl;
G4cout << " Number of event processed : " << aRun->GetNumberOfEvent() << G4endl;
}
std::ostream *myout = &G4cout;
G4cout << "=============================================================" << G4endl;
G4cout << "=============================================================" << G4endl;
std::ostream* myout = &G4cout;
PrintHeader(myout);
for ( G4int iz = 0; iz < 20; iz++){
for (G4int iz = 0; iz < 20; iz++) {
G4double* SumCollisions = (*Collisions)[iz];
G4double* SumCollWeight = (*CollWeight)[iz];
G4double* Populations = (*Population)[iz];
G4double* TrackEnters = (*TrackEnter)[iz];
G4double* SLs = (*SL)[iz];
G4double* SLWs = (*SLW)[iz];
G4double* SLWEs = (*SLWE)[iz];
G4double* SLW_Vs = (*SLW_V)[iz];
G4double* SLWE_Vs = (*SLWE_V)[iz];
if ( !SumCollisions ) SumCollisions = new G4double(0.0);
if ( !SumCollWeight ) SumCollWeight = new G4double(0.0);
if ( !Populations ) Populations = new G4double(0.0);
if ( !TrackEnters ) TrackEnters = new G4double(0.0);
if ( !SLs ) SLs = new G4double(0.0);
if ( !SLWs ) SLWs = new G4double(0.0);
if ( !SLWEs ) SLWEs = new G4double(0.0);
if ( !SLW_Vs ) SLW_Vs = new G4double(0.0);
if ( !SLWE_Vs ) SLWE_Vs = new G4double(0.0);
G4double NumWeightedEnergy =0.0;
G4double FluxWeightedEnergy=0.0;
G4double AverageTrackWeight=0.0;
if ( *SLW_Vs !=0. ) NumWeightedEnergy = (*SLWE_Vs)/(*SLW_Vs);
if ( *SLWs !=0. ) FluxWeightedEnergy = (*SLWEs)/(*SLWs);
if ( *SLs !=0. ) AverageTrackWeight = (*SLWs)/(*SLs);
G4double* Populations = (*Population)[iz];
G4double* TrackEnters = (*TrackEnter)[iz];
G4double* SLs = (*SL)[iz];
G4double* SLWs = (*SLW)[iz];
G4double* SLWEs = (*SLWE)[iz];
G4double* SLW_Vs = (*SLW_V)[iz];
G4double* SLWE_Vs = (*SLWE_V)[iz];
if (!SumCollisions) SumCollisions = new G4double(0.0);
if (!SumCollWeight) SumCollWeight = new G4double(0.0);
if (!Populations) Populations = new G4double(0.0);
if (!TrackEnters) TrackEnters = new G4double(0.0);
if (!SLs) SLs = new G4double(0.0);
if (!SLWs) SLWs = new G4double(0.0);
if (!SLWEs) SLWEs = new G4double(0.0);
if (!SLW_Vs) SLW_Vs = new G4double(0.0);
if (!SLWE_Vs) SLWE_Vs = new G4double(0.0);
G4double NumWeightedEnergy = 0.0;
G4double FluxWeightedEnergy = 0.0;
G4double AverageTrackWeight = 0.0;
if (*SLW_Vs != 0.) NumWeightedEnergy = (*SLWE_Vs) / (*SLW_Vs);
if (*SLWs != 0.) FluxWeightedEnergy = (*SLWEs) / (*SLWs);
if (*SLs != 0.) AverageTrackWeight = (*SLWs) / (*SLs);
G4String cname = bdet->GetCellName(iz);
G4cout
<< std::setw(fFieldValue) << cname << " |"
<< std::setw(fFieldValue) << (*TrackEnters) << " |"
<< std::setw(fFieldValue) << (*Populations) << " |"
<< std::setw(fFieldValue) << (*SumCollisions) << " |"
<< std::setw(fFieldValue) << (*SumCollWeight) << " |"
<< std::setw(fFieldValue) << NumWeightedEnergy << " |"
<< std::setw(fFieldValue) << FluxWeightedEnergy << " |"
<< std::setw(fFieldValue) << AverageTrackWeight << " |"
<< std::setw(fFieldValue) << (*SLs) << " |"
<< std::setw(fFieldValue) << (*SLWs) << " |"
<< std::setw(fFieldValue) << (*SLW_Vs) << " |"
<< std::setw(fFieldValue) << (*SLWEs) << " |"
<< std::setw(fFieldValue) << (*SLWE_Vs) << " |"
<< G4endl;
G4cout << std::setw(fFieldValue) << cname << " |" << std::setw(fFieldValue) << (*TrackEnters)
<< " |" << std::setw(fFieldValue) << (*Populations) << " |" << std::setw(fFieldValue)
<< (*SumCollisions) << " |" << std::setw(fFieldValue) << (*SumCollWeight) << " |"
<< std::setw(fFieldValue) << NumWeightedEnergy << " |" << std::setw(fFieldValue)
<< FluxWeightedEnergy << " |" << std::setw(fFieldValue) << AverageTrackWeight << " |"
<< std::setw(fFieldValue) << (*SLs) << " |" << std::setw(fFieldValue) << (*SLWs)
<< " |" << std::setw(fFieldValue) << (*SLW_Vs) << " |" << std::setw(fFieldValue)
<< (*SLWEs) << " |" << std::setw(fFieldValue) << (*SLWE_Vs) << " |" << G4endl;
}
G4cout << "============================================="<<G4endl;
G4cout << "=============================================" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B01RunAction::PrintHeader(std::ostream *out)
void B01RunAction::PrintHeader(std::ostream* out)
{
std::vector<G4String> vecScoreName;
vecScoreName.push_back("Tr.Entering");
@@ -218,36 +197,35 @@ void B01RunAction::PrintHeader(std::ostream *out)
vecScoreName.push_back("SLWE_v");
// head line
// std::string vname;
// vname = FillString("Volume", ' ', fFieldName+1);
// std::string vname;
// vname = FillString("Volume", ' ', fFieldName+1);
//*out << vname << '|';
*out << std::setw(fFieldValue) << "Volume" << " |";
for (std::vector<G4String>::iterator it = vecScoreName.begin();
it != vecScoreName.end(); it++) {
// vname = FillString((*it),
// ' ',
// fFieldValue+1,
// false);
// *out << vname << '|';
*out << std::setw(fFieldValue) << (*it) << " |";
*out << std::setw(fFieldValue) << "Volume"
<< " |";
for (std::vector<G4String>::iterator it = vecScoreName.begin(); it != vecScoreName.end(); it++) {
// vname = FillString((*it),
// ' ',
// fFieldValue+1,
// false);
// *out << vname << '|';
*out << std::setw(fFieldValue) << (*it) << " |";
}
*out << G4endl;
*out << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::string B01RunAction::FillString(const std::string &name,
char c, G4int n, G4bool back)
std::string B01RunAction::FillString(const std::string& name, char c, G4int n, G4bool back)
{
std::string fname("");
G4int k = n - name.size();
if (k > 0) {
if (back) {
fname = name;
fname += std::string(k,c);
fname += std::string(k, c);
}
else {
fname = std::string(k,c);
fname = std::string(k, c);
fname += name;
}
}
+19 -25
View File
@@ -47,26 +47,23 @@
// --------------------------------------------------------------
#include <iostream>
#include "G4GeometryManager.hh"
#include "G4RunManagerFactory.hh"
#include "G4Types.hh"
#include "G4UImanager.hh"
#include "G4VPhysicalVolume.hh"
#include <iostream>
#include <stdlib.h>
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UImanager.hh"
#include "G4GeometryManager.hh"
// user classes
#include "B02ActionInitialization.hh"
#include "B02DetectorConstruction.hh"
#include "B02ImportanceDetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ImportanceBiasing.hh"
#include "G4ParallelWorldPhysics.hh"
#include "B02ActionInitialization.hh"
// #include "B02PrimaryGeneratorAction.hh"
// #include "B02RunAction.hh"
@@ -78,13 +75,12 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc, char **argv)
int main(int argc, char** argv)
{
G4int mode = 0;
if (argc>1) mode = atoi(argv[1]);
if(mode != 0) {
G4cout << " mode not used yet, refer to B01 to see WeightWindow technique "
<< mode << G4endl;
if (argc > 1) mode = atoi(argv[1]);
if (mode != 0) {
G4cout << " mode not used yet, refer to B01 to see WeightWindow technique " << mode << G4endl;
}
G4int numberOfEvents = 100;
@@ -100,22 +96,21 @@ int main(int argc, char **argv)
runManager->SetUserInitialization(detector);
G4String parallelName("ParallelBiasingWorld");
B02ImportanceDetectorConstruction* pdet =
new B02ImportanceDetectorConstruction(parallelName);
B02ImportanceDetectorConstruction* pdet = new B02ImportanceDetectorConstruction(parallelName);
detector->RegisterParallelWorld(pdet);
G4GeometrySampler pgs(pdet->GetWorldVolume(),"neutron");
G4GeometrySampler pgs(pdet->GetWorldVolume(), "neutron");
pgs.SetParallel(true);
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs,parallelName));
physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs, parallelName));
physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName));
runManager->SetUserInitialization(physicsList);
// Set user action classes through Worker Initialization
//
// Set user action classes through Worker Initialization
//
B02ActionInitialization* actions = new B02ActionInitialization;
runManager->SetUserInitialization(actions);
@@ -123,12 +118,11 @@ int main(int argc, char **argv)
pdet->CreateImportanceStore();
//temporary fix before runManager->BeamOn works...
// temporary fix before runManager->BeamOn works...
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4String command1 = "/control/cout/setCoutFile threadOut";
UImanager->ApplyCommand(command1);
G4String command2 = "/run/beamOn " +
G4UIcommand::ConvertToString(numberOfEvents);
G4String command2 = "/run/beamOn " + G4UIcommand::ConvertToString(numberOfEvents);
UImanager->ApplyCommand(command2);
// open geometry for clean biasing stores clean-up
+23 -23
View File
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -273,7 +273,7 @@ eBrem: for e+ XStype:4 SubType=3
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 BuildTable=0
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
@@ -828,7 +828,7 @@ Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
@@ -853,24 +853,24 @@ Max 2J for sampling of angular correlations 10
=============================================================
=============================================================
Volume | Tr.Entering | Population | Collisions | Coll*WGT | NumWGTedE | FluxWGTedE | Av.Tr.WGT | SL | SLW | SLW_v | SLWE | SLWE_v |
cell_00 | 46 | 138 | 0 | 0 | 0.0753216 | 2.63717 | 1 | 9079.87 | 9079.87 | 11859.1 | 23945.1 | 893.249 |
cell_01 | 155 | 182 | 588 | 588 | 0.0225928 | 4.15715 | 1 | 24717.2 | 24717.2 | 131903 | 102753 | 2980.06 |
cell_02 | 151 | 252 | 979 | 489.5 | 0.0103622 | 3.09781 | 0.5 | 40582.2 | 20291.1 | 191708 | 62858 | 1986.52 |
cell_03 | 219 | 366 | 1826 | 456.5 | 0.00811717 | 2.27814 | 0.25 | 64337.3 | 16084.3 | 152601 | 36642.3 | 1238.68 |
cell_04 | 316 | 465 | 2802 | 350.25 | 0.00576402 | 1.71551 | 0.125 | 89222.7 | 11152.8 | 121777 | 19132.8 | 701.925 |
cell_05 | 388 | 561 | 3404 | 212.75 | 0.0039408 | 1.48412 | 0.0625 | 102426 | 6401.6 | 91297.4 | 9500.76 | 359.784 |
cell_06 | 404 | 547 | 3732 | 116.625 | 0.00320585 | 1.23062 | 0.03125 | 109588 | 3424.63 | 51832.8 | 4214.42 | 166.168 |
cell_07 | 393 | 580 | 3700 | 57.8125 | 0.00309585 | 1.25071 | 0.015625 | 106356 | 1661.81 | 27064.7 | 2078.44 | 83.7882 |
cell_08 | 351 | 505 | 3365 | 26.2891 | 0.00299826 | 1.20118 | 0.0078125 | 99319.7 | 775.935 | 12825.3 | 932.037 | 38.4535 |
cell_09 | 313 | 477 | 3029 | 11.832 | 0.0025767 | 1.2116 | 0.00390625 | 89637.9 | 350.148 | 6606.23 | 424.241 | 17.0223 |
cell_10 | 261 | 402 | 2410 | 4.70703 | 0.00297818 | 1.30127 | 0.00195312 | 70860.8 | 138.4 | 2390.2 | 180.095 | 7.11843 |
cell_11 | 240 | 357 | 2146 | 2.0957 | 0.00251627 | 1.24978 | 0.000976562 | 64003.5 | 62.5034 | 1222.31 | 78.1152 | 3.07567 |
cell_12 | 201 | 284 | 1897 | 0.92627 | 0.0030549 | 1.06885 | 0.000488281 | 57041.2 | 27.8521 | 433.343 | 29.7696 | 1.32382 |
cell_13 | 155 | 233 | 1556 | 0.379883 | 0.00289978 | 1.15727 | 0.000244141 | 45804.7 | 11.1828 | 190.82 | 12.9415 | 0.553335 |
cell_14 | 132 | 209 | 1141 | 0.139282 | 0.00288871 | 1.11088 | 0.00012207 | 35938 | 4.38696 | 72.6168 | 4.8734 | 0.209769 |
cell_15 | 148 | 201 | 1198 | 0.0731201 | 0.00377927 | 1.26671 | 6.10352e-05 | 36156.5 | 2.20682 | 30.94 | 2.79539 | 0.116931 |
cell_16 | 163 | 218 | 1462 | 0.0446167 | 0.00284873 | 1.14204 | 3.05176e-05 | 43141.7 | 1.31658 | 22.0107 | 1.50359 | 0.0627025 |
cell_17 | 142 | 202 | 1264 | 0.0192871 | 0.0033324 | 0.98168 | 1.52588e-05 | 37896.8 | 0.57826 | 7.71457 | 0.567666 | 0.025708 |
cell_18 | 86 | 163 | 894 | 0.00682068 | 0.00375007 | 1.18866 | 7.62939e-06 | 28142.3 | 0.214709 | 3.01047 | 0.255217 | 0.0112895 |
cell_19 | 58 | 58 | 0 | 0 | 0.00965017 | 1.94993 | 7.62939e-06 | 8615.98 | 0.0657347 | 0.525426 | 0.128178 | 0.00507045 |
cell_00 | 42 | 131 | 0 | 0 | 0.184971 | 3.37607 | 1 | 8498.22 | 8498.22 | 4902.45 | 28690.6 | 906.81 |
cell_01 | 156 | 177 | 591 | 591 | 0.0253005 | 4.59154 | 1 | 26095.4 | 26095.4 | 128533 | 119818 | 3251.96 |
cell_02 | 151 | 270 | 1364 | 682 | 0.00824517 | 2.88448 | 0.5 | 46809.7 | 23404.8 | 248723 | 67510.8 | 2050.76 |
cell_03 | 213 | 339 | 1847 | 461.75 | 0.00784637 | 2.49261 | 0.25 | 60023.3 | 15005.8 | 152868 | 37403.7 | 1199.46 |
cell_04 | 292 | 439 | 2704 | 338 | 0.00395717 | 1.82087 | 0.125 | 85481.2 | 10685.1 | 170951 | 19456.3 | 676.482 |
cell_05 | 354 | 521 | 2902 | 181.375 | 0.00381489 | 1.74643 | 0.0625 | 90527.3 | 5657.96 | 92037.5 | 9881.21 | 351.113 |
cell_06 | 357 | 536 | 3259 | 101.844 | 0.0036991 | 1.51354 | 0.03125 | 101450 | 3170.31 | 49567.1 | 4798.39 | 183.354 |
cell_07 | 365 | 520 | 3235 | 50.5469 | 0.00397513 | 1.30445 | 0.015625 | 98869.1 | 1544.83 | 20778.6 | 2015.16 | 82.5977 |
cell_08 | 353 | 506 | 3520 | 27.5 | 0.00341526 | 1.16311 | 0.0078125 | 104366 | 815.361 | 11933.1 | 948.352 | 40.7546 |
cell_09 | 329 | 479 | 3030 | 11.8359 | 0.00321627 | 1.21251 | 0.00390625 | 89437.1 | 349.364 | 5523.33 | 423.608 | 17.7645 |
cell_10 | 342 | 473 | 3183 | 6.2168 | 0.0026826 | 1.0116 | 0.00195312 | 96625 | 188.721 | 3212.72 | 190.91 | 8.61842 |
cell_11 | 332 | 478 | 3205 | 3.12988 | 0.00238013 | 0.885205 | 0.000976562 | 90989 | 88.8565 | 1471.85 | 78.6562 | 3.50321 |
cell_12 | 277 | 397 | 2565 | 1.25244 | 0.00235102 | 0.832991 | 0.000488281 | 71004.1 | 34.67 | 564.603 | 28.8798 | 1.32739 |
cell_13 | 240 | 326 | 2169 | 0.529541 | 0.0021402 | 0.936454 | 0.000244141 | 62727.9 | 15.3144 | 290.008 | 14.3413 | 0.620674 |
cell_14 | 191 | 291 | 1962 | 0.239502 | 0.00265347 | 1.12766 | 0.00012207 | 55184.8 | 6.73643 | 119.225 | 7.59638 | 0.316361 |
cell_15 | 153 | 230 | 1472 | 0.0898438 | 0.00326666 | 1.15395 | 6.10352e-05 | 43572.5 | 2.65945 | 39.9852 | 3.06887 | 0.130618 |
cell_16 | 152 | 221 | 1581 | 0.0482483 | 0.00272235 | 1.00827 | 3.05176e-05 | 45287.1 | 1.38205 | 22.507 | 1.39349 | 0.0612721 |
cell_17 | 132 | 197 | 1326 | 0.0202332 | 0.00255942 | 1.01292 | 1.52588e-05 | 38901.4 | 0.593589 | 10.9514 | 0.601259 | 0.0280292 |
cell_18 | 76 | 142 | 931 | 0.00710297 | 0.00258 | 0.814225 | 7.62939e-06 | 24945.4 | 0.190318 | 2.97786 | 0.154962 | 0.00768286 |
cell_19 | 46 | 46 | 0 | 0 | 0.0218231 | 1.52808 | 7.62939e-06 | 6737.27 | 0.0514013 | 0.15395 | 0.0785454 | 0.00335965 |
=============================================
@@ -37,13 +37,12 @@
class B02ActionInitialization : public G4VUserActionInitialization
{
public:
B02ActionInitialization();
B02ActionInitialization();
virtual ~B02ActionInitialization();
public:
virtual void BuildForMaster() const;
virtual void Build() const;
};
#endif
@@ -32,8 +32,9 @@
#ifndef B02DetectorConstruction_hh
#define B02DetectorConstruction_hh B02DetectorConstruction_hh
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -42,30 +43,30 @@ class G4VWeightWindowStore;
class B02DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B02DetectorConstruction();
~B02DetectorConstruction();
virtual G4VPhysicalVolume* Construct();
public:
B02DetectorConstruction();
~B02DetectorConstruction();
G4VIStore* CreateImportanceStore();
virtual G4VPhysicalVolume* Construct();
G4VIStore* CreateImportanceStore();
// create an importance store, caller is responsible for deleting it
G4VWeightWindowStore *CreateWeightWindowStore();
// create an weight window store, caller is responsible for
G4VWeightWindowStore* CreateWeightWindowStore();
// create an weight window store, caller is responsible for
// deleting it
G4VPhysicalVolume* GetWorldVolume();
G4VPhysicalVolume* GetWorldVolume();
void SetSensitive();
void SetSensitive();
// virtual void ConstructSDandField();
// virtual void ConstructSDandField();
private:
std::vector< G4LogicalVolume * > fLogicalVolumeVector;
std::vector< G4VPhysicalVolume * > fPhysicalVolumeVector;
private:
std::vector<G4LogicalVolume*> fLogicalVolumeVector;
std::vector<G4VPhysicalVolume*> fPhysicalVolumeVector;
G4VPhysicalVolume* fWorldVolume;
G4VPhysicalVolume* fWorldVolume;
};
#endif
@@ -29,16 +29,17 @@
//
//
#ifndef B02ImportanceDetectorConstruction_hh
#define B02ImportanceDetectorConstruction_hh B02ImportanceDetectorConstruction_hh
#ifndef B02ImportanceDetectorConstruction_hh
#define B02ImportanceDetectorConstruction_hh B02ImportanceDetectorConstruction_hh
#include "globals.hh"
#include <map>
#include <vector>
#include "G4GeometryCell.hh"
#include "B02PVolumeStore.hh"
#include "G4GeometryCell.hh"
#include "G4VUserParallelWorld.hh"
#include "globals.hh"
#include <map>
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -47,40 +48,39 @@ class G4VWeightWindowStore;
class B02ImportanceDetectorConstruction : public G4VUserParallelWorld
{
public:
B02ImportanceDetectorConstruction(G4String worldName);
virtual ~B02ImportanceDetectorConstruction();
public:
B02ImportanceDetectorConstruction(G4String worldName);
virtual ~B02ImportanceDetectorConstruction();
const G4VPhysicalVolume &GetPhysicalVolumeByName(const G4String& name) const;
G4VPhysicalVolume &GetWorldVolumeAddress() const;
G4String ListPhysNamesAsG4String();
G4String GetCellName(G4int i);
G4GeometryCell GetGeometryCell(G4int i);
const G4VPhysicalVolume& GetPhysicalVolumeByName(const G4String& name) const;
G4VPhysicalVolume& GetWorldVolumeAddress() const;
G4String ListPhysNamesAsG4String();
G4String GetCellName(G4int i);
G4GeometryCell GetGeometryCell(G4int i);
G4VPhysicalVolume* GetWorldVolume();
G4VPhysicalVolume* GetWorldVolume();
void SetSensitive();
void SetSensitive();
virtual void Construct();
virtual void ConstructSD();
virtual void Construct();
virtual void ConstructSD();
G4VIStore* CreateImportanceStore();
G4VIStore* CreateImportanceStore();
// create an importance store, caller is responsible for deleting it
G4VWeightWindowStore *CreateWeightWindowStore();
// create an weight window store, caller is responsible for
G4VWeightWindowStore* CreateWeightWindowStore();
// create an weight window store, caller is responsible for
// deleting it
private:
B02PVolumeStore fPVolumeStore;
private:
B02PVolumeStore fPVolumeStore;
// std::vector< G4VPhysicalVolume * > fPhysicalVolumeVector;
std::vector< G4LogicalVolume * > fLogicalVolumeVector;
// std::vector< G4VPhysicalVolume * > fPhysicalVolumeVector;
std::vector<G4LogicalVolume*> fLogicalVolumeVector;
// G4VPhysicalVolume *fWorldVolume;
G4VPhysicalVolume* fGhostWorld;
// G4VPhysicalVolume *fWorldVolume;
G4VPhysicalVolume* fGhostWorld;
};
#endif
@@ -27,7 +27,7 @@
/// \brief Definition of the B02PVolumeStore class
//
//
// GEANT4 tag
// GEANT4 tag
//
// ----------------------------------------------------------------------
// Class B02PVolumeStore
@@ -42,25 +42,27 @@
#ifndef B02PVolumeStore_hh
#define B02PVolumeStore_hh B02PVolumeStore_hh
#include "globals.hh"
#include <set>
#include "G4GeometryCell.hh"
#include "G4GeometryCellComp.hh"
#include "globals.hh"
typedef std::set< G4GeometryCell, G4GeometryCellComp > B02SetGeometryCell;
#include <set>
class B02PVolumeStore {
public:
B02PVolumeStore();
~B02PVolumeStore();
void AddPVolume(const G4GeometryCell &cell);
const G4VPhysicalVolume *GetPVolume(const G4String &name) const;
G4int Size();
G4String GetPNames() const;
typedef std::set<G4GeometryCell, G4GeometryCellComp> B02SetGeometryCell;
private:
B02SetGeometryCell fSetGeometryCell;
class B02PVolumeStore
{
public:
B02PVolumeStore();
~B02PVolumeStore();
void AddPVolume(const G4GeometryCell& cell);
const G4VPhysicalVolume* GetPVolume(const G4String& name) const;
G4int Size();
G4String GetPNames() const;
private:
B02SetGeometryCell fSetGeometryCell;
};
#endif
@@ -29,7 +29,7 @@
//
#ifndef B02PrimaryGeneratorAction_hh
#define B02PrimaryGeneratorAction_hh B02PrimaryGeneratorAction_hh
#define B02PrimaryGeneratorAction_hh B02PrimaryGeneratorAction_hh
#include "G4VUserPrimaryGeneratorAction.hh"
@@ -50,4 +50,3 @@ class B02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
};
#endif
+34 -35
View File
@@ -27,10 +27,10 @@
/// \brief Definition of the B02Run class
//
//
//
//
//---------------------------------------------------------------------
// (Purpose)
// Example implementation for multi-functional-detector and
// (Purpose)
// Example implementation for multi-functional-detector and
// primitive scorer.
// This B02Run class has collections which accumulate
// a event information into a run information.
@@ -40,46 +40,45 @@
#ifndef B02Run_h
#define B02Run_h 1
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Run.hh"
#include "G4THitsMap.hh"
#include <vector>
//
class B02Run : public G4Run {
class B02Run : public G4Run
{
public:
// constructor and destructor.
// vector of multifunctionaldetector name has to given to constructor.
B02Run(const std::vector<G4String> mfdName);
virtual ~B02Run();
public:
// constructor and destructor.
// vector of multifunctionaldetector name has to given to constructor.
B02Run(const std::vector<G4String> mfdName);
virtual ~B02Run();
public:
// virtual method from G4Run.
// The method is overriden in this class for scoring.
virtual void RecordEvent(const G4Event*);
public:
// virtual method from G4Run.
// The method is overriden in this class for scoring.
virtual void RecordEvent(const G4Event*);
// Access methods for scoring information.
// - Number of HitsMap for this RUN.
// This is equal to number of collections.
G4int GetNumberOfHitsMap() const { return fRunMap.size(); }
// - Get HitsMap of this RUN.
// by sequential number, by multifucntional name and collection name,
// and by collection name with full path.
G4THitsMap<G4double>* GetHitsMap(G4int i) { return fRunMap[i]; }
G4THitsMap<G4double>* GetHitsMap(const G4String& detName, const G4String& colName);
G4THitsMap<G4double>* GetHitsMap(const G4String& fullName);
// - Dump All HitsMap of this RUN.
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void DumpAllScorer();
// Access methods for scoring information.
// - Number of HitsMap for this RUN.
// This is equal to number of collections.
G4int GetNumberOfHitsMap() const {return fRunMap.size();}
// - Get HitsMap of this RUN.
// by sequential number, by multifucntional name and collection name,
// and by collection name with full path.
G4THitsMap<G4double>* GetHitsMap(G4int i){return fRunMap[i];}
G4THitsMap<G4double>* GetHitsMap(const G4String& detName,
const G4String& colName);
G4THitsMap<G4double>* GetHitsMap(const G4String& fullName);
// - Dump All HitsMap of this RUN.
// This method calls G4THisMap::PrintAll() for individual HitsMap.
void DumpAllScorer();
virtual void Merge(const G4Run*);
virtual void Merge(const G4Run*);
private:
std::vector<G4String> fCollName;
std::vector<G4int> fCollID;
std::vector<G4THitsMap<G4double>*> fRunMap;
private:
std::vector<G4String> fCollName;
std::vector<G4int> fCollID;
std::vector<G4THitsMap<G4double>*> fRunMap;
};
//
@@ -27,49 +27,48 @@
/// \brief Definition of the B02RunAction class
//
//
//
//
#ifndef B02RunAction_h
#define B02RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#include <vector>
class G4Run;
//=======================================================================
// B02RunAction
//
//
//
//
//=======================================================================
//
class B02RunAction : public G4UserRunAction
{
public:
// constructor and destructor
B02RunAction();
virtual ~B02RunAction();
public:
// constructor and destructor
B02RunAction();
virtual ~B02RunAction();
public:
// virtual method from G4UserRunAction.
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
public:
// virtual method from G4UserRunAction.
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
public:
void PrintHeader(std::ostream *out);
std::string FillString(const std::string &name, char c, G4int n,
G4bool back=true);
private:
// Data member
// - vector of MultiFunctionalDetecor names.
std::vector<G4String> fSDName;
// G4int fFieldName;
G4int fFieldValue;
public:
void PrintHeader(std::ostream* out);
std::string FillString(const std::string& name, char c, G4int n, G4bool back = true);
private:
// Data member
// - vector of MultiFunctionalDetecor names.
std::vector<G4String> fSDName;
// G4int fFieldName;
G4int fFieldValue;
};
//
@@ -30,18 +30,23 @@
//
#include "B02ActionInitialization.hh"
#include "B02PrimaryGeneratorAction.hh"
#include "B02RunAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02ActionInitialization::B02ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02ActionInitialization::~B02ActionInitialization()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -54,10 +59,8 @@ void B02ActionInitialization::BuildForMaster() const
void B02ActionInitialization::Build() const
{
SetUserAction(new B02PrimaryGeneratorAction);
SetUserAction(new B02RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,44 +28,46 @@
//
//
//
#include "G4Types.hh"
#include "globals.hh"
#include "B02DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4Types.hh"
#include "G4VisAttributes.hh"
#include "globals.hh"
// for importance biasing
#include "G4IStore.hh"
// For Primitive Scorers
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDParticleFilter.hh"
#include "G4PSNofCollision.hh"
#include "G4PSPopulation.hh"
#include "G4PSTrackCounter.hh"
#include "G4PSTrackLength.hh"
#include "G4SDManager.hh"
#include "G4SDParticleFilter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02DetectorConstruction::B02DetectorConstruction()
: G4VUserDetectorConstruction()
{;}
B02DetectorConstruction::B02DetectorConstruction() : G4VUserDetectorConstruction()
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02DetectorConstruction::~B02DetectorConstruction()
{;}
{
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -73,7 +75,7 @@ G4VPhysicalVolume* B02DetectorConstruction::Construct()
{
G4double pos_x;
G4double pos_y;
G4double pos_z;
G4double pos_z;
G4double density, pressure, temperature;
G4double A;
@@ -83,109 +85,97 @@ G4VPhysicalVolume* B02DetectorConstruction::Construct()
G4double z;
G4double fractionmass;
A = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , Z= 1, A);
A = 1.01 * g / mole;
G4Element* elH = new G4Element(name = "Hydrogen", symbol = "H", Z = 1, A);
A = 12.01*g/mole;
G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , Z = 6, A);
A = 12.01 * g / mole;
G4Element* elC = new G4Element(name = "Carbon", symbol = "C", Z = 6, A);
A = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , Z= 8, A);
A = 16.00 * g / mole;
G4Element* elO = new G4Element(name = "Oxygen", symbol = "O", Z = 8, A);
A = 22.99*g/mole;
G4Element* elNa = new G4Element(name="Natrium" ,symbol="Na" , Z=11 , A);
A = 22.99 * g / mole;
G4Element* elNa = new G4Element(name = "Natrium", symbol = "Na", Z = 11, A);
A = 200.59*g/mole;
G4Element* elHg = new G4Element(name="Hg" ,symbol="Hg" , Z=80, A);
A = 200.59 * g / mole;
G4Element* elHg = new G4Element(name = "Hg", symbol = "Hg", Z = 80, A);
A = 26.98*g/mole;
G4Element* elAl = new G4Element(name="Aluminium" ,symbol="Al" , Z=13, A);
A = 26.98 * g / mole;
G4Element* elAl = new G4Element(name = "Aluminium", symbol = "Al", Z = 13, A);
A = 28.09*g/mole;
G4Element* elSi = new G4Element(name="Silicon", symbol="Si", Z=14, A);
A = 28.09 * g / mole;
G4Element* elSi = new G4Element(name = "Silicon", symbol = "Si", Z = 14, A);
A = 39.1*g/mole;
G4Element* elK = new G4Element(name="K" ,symbol="K" , Z=19 , A);
A = 39.1 * g / mole;
G4Element* elK = new G4Element(name = "K", symbol = "K", Z = 19, A);
A = 69.72*g/mole;
G4Element* elCa = new G4Element(name="Calzium" ,symbol="Ca" , Z=31 , A);
A = 69.72 * g / mole;
G4Element* elCa = new G4Element(name = "Calzium", symbol = "Ca", Z = 31, A);
A = 55.85*g/mole;
G4Element* elFe = new G4Element(name="Iron" ,symbol="Fe", Z=26, A);
A = 55.85 * g / mole;
G4Element* elFe = new G4Element(name = "Iron", symbol = "Fe", Z = 26, A);
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material *Galactic =
new G4Material(name="Galactic", z=1., A=1.01*g/mole, density,
kStateGas,temperature,pressure);
density = universe_mean_density; // from PhysicalConstants.h
pressure = 3.e-18 * pascal;
temperature = 2.73 * kelvin;
G4Material* Galactic = new G4Material(name = "Galactic", z = 1., A = 1.01 * g / mole, density,
kStateGas, temperature, pressure);
density = 2.03*g/cm3;
density = 2.03 * g / cm3;
G4Material* Concrete = new G4Material("Concrete", density, 10);
Concrete->AddElement(elH , fractionmass= 0.01);
Concrete->AddElement(elO , fractionmass= 0.529);
Concrete->AddElement(elNa , fractionmass= 0.016);
Concrete->AddElement(elHg , fractionmass= 0.002);
Concrete->AddElement(elAl , fractionmass= 0.034);
Concrete->AddElement(elSi , fractionmass= 0.337);
Concrete->AddElement(elK , fractionmass= 0.013);
Concrete->AddElement(elCa , fractionmass= 0.044);
Concrete->AddElement(elFe , fractionmass= 0.014);
Concrete->AddElement(elC , fractionmass= 0.001);
Concrete->AddElement(elH, fractionmass = 0.01);
Concrete->AddElement(elO, fractionmass = 0.529);
Concrete->AddElement(elNa, fractionmass = 0.016);
Concrete->AddElement(elHg, fractionmass = 0.002);
Concrete->AddElement(elAl, fractionmass = 0.034);
Concrete->AddElement(elSi, fractionmass = 0.337);
Concrete->AddElement(elK, fractionmass = 0.013);
Concrete->AddElement(elCa, fractionmass = 0.044);
Concrete->AddElement(elFe, fractionmass = 0.014);
Concrete->AddElement(elC, fractionmass = 0.001);
/////////////////////////////
// world cylinder volume
////////////////////////////
// world solid
G4double innerRadiusCylinder = 0*cm;
G4double innerRadiusCylinder = 0 * cm;
// G4double outerRadiusCylinder = 101*cm; // dont't have scoring
G4double outerRadiusCylinder = 100*cm; // dont't have scoring
// cells coinside eith world volume boundary
G4double outerRadiusCylinder = 100 * cm; // dont't have scoring
// cells coinside eith world volume boundary
// G4double heightCylinder = 105*cm;
G4double heightCylinder = 100*cm;
G4double startAngleCylinder = 0*deg;
G4double spanningAngleCylinder = 360*deg;
G4double heightCylinder = 100 * cm;
G4double startAngleCylinder = 0 * deg;
G4double spanningAngleCylinder = 360 * deg;
G4Tubs *worldCylinder = new G4Tubs("worldCylinder",
innerRadiusCylinder,
outerRadiusCylinder,
heightCylinder,
startAngleCylinder,
spanningAngleCylinder);
G4Tubs* worldCylinder = new G4Tubs("worldCylinder", innerRadiusCylinder, outerRadiusCylinder,
heightCylinder, startAngleCylinder, spanningAngleCylinder);
// logical world
G4LogicalVolume *worldCylinder_log =
G4LogicalVolume* worldCylinder_log =
new G4LogicalVolume(worldCylinder, Galactic, "worldCylinder_log");
name = "shieldWorld";
fWorldVolume = new G4PVPlacement(0, G4ThreeVector(0,0,0), worldCylinder_log
,name, 0, false, 0);
fWorldVolume = new G4PVPlacement(0, G4ThreeVector(0, 0, 0), worldCylinder_log, name, 0, false, 0);
// creating 18 slobs of 10 cm thick concrete
G4double innerRadiusShield = 0*cm;
G4double outerRadiusShield = 100*cm;
G4double heightShield = 90*cm;
G4double startAngleShield = 0*deg;
G4double spanningAngleShield = 360*deg;
G4double innerRadiusShield = 0 * cm;
G4double outerRadiusShield = 100 * cm;
G4double heightShield = 90 * cm;
G4double startAngleShield = 0 * deg;
G4double spanningAngleShield = 360 * deg;
G4Tubs* aShield = new G4Tubs("aShield", innerRadiusShield, outerRadiusShield, heightShield,
startAngleShield, spanningAngleShield);
G4Tubs *aShield = new G4Tubs("aShield",
innerRadiusShield,
outerRadiusShield,
heightShield,
startAngleShield,
spanningAngleShield);
// logical shield
G4LogicalVolume *aShield_log =
new G4LogicalVolume(aShield, Concrete, "aShield_log");
G4LogicalVolume* aShield_log = new G4LogicalVolume(aShield, Concrete, "aShield_log");
G4VisAttributes* pShieldVis = new
G4VisAttributes(G4Colour(0.0,0.0,1.0));
G4VisAttributes* pShieldVis = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
pShieldVis->SetForceSolid(true);
aShield_log->SetVisAttributes(pShieldVis);
@@ -193,25 +183,21 @@ G4VPhysicalVolume* B02DetectorConstruction::Construct()
name = "concreteShield";
pos_x = 0*cm;
pos_y = 0*cm;
pos_x = 0 * cm;
pos_y = 0 * cm;
pos_z = 0;
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log,
name,
worldCylinder_log,
false,
0);
new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z), aShield_log, name, worldCylinder_log,
false, 0);
return fWorldVolume;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume *B02DetectorConstruction::GetWorldVolume() {
return fWorldVolume;
G4VPhysicalVolume* B02DetectorConstruction::GetWorldVolume()
{
return fWorldVolume;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,27 +29,27 @@
//
//
#include "globals.hh"
#include <sstream>
#include "B02ImportanceDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "globals.hh"
#include <sstream>
// For Primitive Scorers
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDParticleFilter.hh"
#include "G4PSNofCollision.hh"
#include "G4PSPopulation.hh"
#include "G4PSTrackCounter.hh"
#include "G4PSTrackLength.hh"
#include "G4SDManager.hh"
#include "G4SDParticleFilter.hh"
// for importance biasing
#include "G4IStore.hh"
@@ -59,9 +59,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02ImportanceDetectorConstruction::
B02ImportanceDetectorConstruction(G4String worldName)
:G4VUserParallelWorld(worldName),fLogicalVolumeVector()
B02ImportanceDetectorConstruction::B02ImportanceDetectorConstruction(G4String worldName)
: G4VUserParallelWorld(worldName), fLogicalVolumeVector()
{
// Construct();
}
@@ -76,16 +75,16 @@ B02ImportanceDetectorConstruction::~B02ImportanceDetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02ImportanceDetectorConstruction::Construct()
{
{
G4cout << " constructing parallel world " << G4endl;
G4Material* dummyMat = 0;
G4Material* dummyMat = 0;
//GetWorld methods create a clone of the mass world to the parallel world (!)
// via the transportation manager
// GetWorld methods create a clone of the mass world to the parallel world (!)
// via the transportation manager
fGhostWorld = GetWorld();
G4cout << " B02ImportanceDetectorConstruction:: ghostWorldName = "
<< fGhostWorld->GetName() << G4endl;
G4cout << " B02ImportanceDetectorConstruction:: ghostWorldName = " << fGhostWorld->GetName()
<< G4endl;
G4LogicalVolume* worldLogical = fGhostWorld->GetLogicalVolume();
fLogicalVolumeVector.push_back(worldLogical);
@@ -94,45 +93,33 @@ void B02ImportanceDetectorConstruction::Construct()
// creating 18 slobs of 10 cm thicknes
G4double innerRadiusShield = 0*cm;
G4double outerRadiusShield = 100*cm;
G4double heightShield = 5*cm;
G4double startAngleShield = 0*deg;
G4double spanningAngleShield = 360*deg;
G4double innerRadiusShield = 0 * cm;
G4double outerRadiusShield = 100 * cm;
G4double heightShield = 5 * cm;
G4double startAngleShield = 0 * deg;
G4double spanningAngleShield = 360 * deg;
G4Tubs* aShield = new G4Tubs("aShield", innerRadiusShield, outerRadiusShield, heightShield,
startAngleShield, spanningAngleShield);
G4Tubs *aShield = new G4Tubs("aShield",
innerRadiusShield,
outerRadiusShield,
heightShield,
startAngleShield,
spanningAngleShield);
// logical parallel cells
G4LogicalVolume *aShield_log_imp =
new G4LogicalVolume(aShield, dummyMat, "aShield_log_imp");
G4LogicalVolume* aShield_log_imp = new G4LogicalVolume(aShield, dummyMat, "aShield_log_imp");
fLogicalVolumeVector.push_back(aShield_log_imp);
// physical parallel cells
G4String name = "none";
G4int i = 1;
G4double startz = -85*cm;
G4double startz = -85 * cm;
// for (i=1; i<=18; ++i) {
for (i=1; i<=18; i++) {
for (i = 1; i <= 18; i++) {
name = GetCellName(i);
G4double pos_x = 0*cm;
G4double pos_y = 0*cm;
G4double pos_z = startz + (i-1) * (2*heightShield);
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log_imp,
name,
worldLogical,
false,
i);
G4double pos_x = 0 * cm;
G4double pos_y = 0 * cm;
G4double pos_z = startz + (i - 1) * (2 * heightShield);
G4VPhysicalVolume* pvol = new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z),
aShield_log_imp, name, worldLogical, false, i);
// 0);
G4GeometryCell cell(*pvol, i);
// G4GeometryCell cell(*pvol, 0);
@@ -140,71 +127,62 @@ void B02ImportanceDetectorConstruction::Construct()
}
// filling the rest of the world volumr behind the concrete with
// another slob which should get the same importance value as the
// another slob which should get the same importance value as the
// last slob
innerRadiusShield = 0*cm;
innerRadiusShield = 0 * cm;
// outerRadiusShield = 110*cm; exceeds world volume!!!!
outerRadiusShield = 100*cm;
outerRadiusShield = 100 * cm;
// heightShield = 10*cm;
heightShield = 5*cm;
startAngleShield = 0*deg;
spanningAngleShield = 360*deg;
heightShield = 5 * cm;
startAngleShield = 0 * deg;
spanningAngleShield = 360 * deg;
G4Tubs *aRest = new G4Tubs("Rest",
innerRadiusShield,
outerRadiusShield,
heightShield,
startAngleShield,
spanningAngleShield);
G4LogicalVolume *aRest_log =
new G4LogicalVolume(aRest, dummyMat, "aRest_log");
G4Tubs* aRest = new G4Tubs("Rest", innerRadiusShield, outerRadiusShield, heightShield,
startAngleShield, spanningAngleShield);
G4LogicalVolume* aRest_log = new G4LogicalVolume(aRest, dummyMat, "aRest_log");
fLogicalVolumeVector.push_back(aRest_log);
name = GetCellName(19);
G4double pos_x = 0*cm;
G4double pos_y = 0*cm;
G4double pos_x = 0 * cm;
G4double pos_y = 0 * cm;
// G4double pos_z = 100*cm;
G4double pos_z = 95*cm;
G4VPhysicalVolume *pvol =
new G4PVPlacement(0,
G4ThreeVector(pos_x, pos_y, pos_z),
aRest_log,
name,
worldLogical,
false,
19);
G4double pos_z = 95 * cm;
G4VPhysicalVolume* pvol = new G4PVPlacement(0, G4ThreeVector(pos_x, pos_y, pos_z), aRest_log,
name, worldLogical, false, 19);
// 0);
G4GeometryCell cell(*pvol, 19);
// G4GeometryCell cell(*pvol, 0);
fPVolumeStore.AddPVolume(cell);
SetSensitive();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4VPhysicalVolume &B02ImportanceDetectorConstruction::
GetPhysicalVolumeByName(const G4String& name) const {
const G4VPhysicalVolume&
B02ImportanceDetectorConstruction::GetPhysicalVolumeByName(const G4String& name) const
{
return *fPVolumeStore.GetPVolume(name);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String B02ImportanceDetectorConstruction::ListPhysNamesAsG4String(){
G4String B02ImportanceDetectorConstruction::ListPhysNamesAsG4String()
{
G4String names(fPVolumeStore.GetPNames());
return names;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String B02ImportanceDetectorConstruction::GetCellName(G4int i) {
G4String B02ImportanceDetectorConstruction::GetCellName(G4int i)
{
std::ostringstream os;
os << "cell_";
if (i<10) {
if (i < 10) {
os << "0";
}
os << i;
@@ -214,37 +192,39 @@ G4String B02ImportanceDetectorConstruction::GetCellName(G4int i) {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4GeometryCell B02ImportanceDetectorConstruction::GetGeometryCell(G4int i){
G4GeometryCell B02ImportanceDetectorConstruction::GetGeometryCell(G4int i)
{
G4String name(GetCellName(i));
const G4VPhysicalVolume *p=0;
const G4VPhysicalVolume* p = 0;
p = fPVolumeStore.GetPVolume(name);
if (p) {
return G4GeometryCell(*p,0);
return G4GeometryCell(*p, 0);
}
else {
G4cout << "B02ImportanceDetectorConstruction::GetGeometryCell: " << G4endl
<< " couldn't get G4GeometryCell" << G4endl;
return G4GeometryCell(*fGhostWorld,-2);
return G4GeometryCell(*fGhostWorld, -2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume &B02ImportanceDetectorConstruction::
GetWorldVolumeAddress() const{
return *fGhostWorld;
G4VPhysicalVolume& B02ImportanceDetectorConstruction::GetWorldVolumeAddress() const
{
return *fGhostWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume *B02ImportanceDetectorConstruction::GetWorldVolume() {
G4VPhysicalVolume* B02ImportanceDetectorConstruction::GetWorldVolume()
{
return fGhostWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02ImportanceDetectorConstruction::SetSensitive(){
void B02ImportanceDetectorConstruction::SetSensitive()
{
// -------------------------------------------------
// The collection names of defined Primitives are
// 0 ConcreteSD/Collisions
@@ -259,13 +239,11 @@ void B02ImportanceDetectorConstruction::SetSensitive(){
// -------------------------------------------------
// moved to ConstructSD() for MT compliance
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02ImportanceDetectorConstruction::ConstructSD()
{
G4SDManager* SDman = G4SDManager::GetSDMpointer();
//
// Sensitive Detector Name
@@ -276,56 +254,54 @@ void B02ImportanceDetectorConstruction::ConstructSD()
//------------------------
//
// Define MultiFunctionalDetector with name.
G4MultiFunctionalDetector* MFDet =
new G4MultiFunctionalDetector(concreteSDname);
SDman->AddNewDetector( MFDet ); // Register SD to SDManager
G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(concreteSDname);
SDman->AddNewDetector(MFDet); // Register SD to SDManager
G4String fltName,particleName;
G4SDParticleFilter* neutronFilter =
new G4SDParticleFilter(fltName="neutronFilter", particleName="neutron");
G4String fltName, particleName;
G4SDParticleFilter* neutronFilter =
new G4SDParticleFilter(fltName = "neutronFilter", particleName = "neutron");
MFDet->SetFilter(neutronFilter);
for (std::vector<G4LogicalVolume *>::iterator it =
fLogicalVolumeVector.begin();
it != fLogicalVolumeVector.end(); it++){
for (std::vector<G4LogicalVolume*>::iterator it = fLogicalVolumeVector.begin();
it != fLogicalVolumeVector.end(); it++)
{
// (*it)->SetSensitiveDetector(MFDet);
SetSensitiveDetector((*it)->GetName(), MFDet);
}
G4String psName;
G4PSNofCollision* scorer0 = new G4PSNofCollision(psName="Collisions");
G4PSNofCollision* scorer0 = new G4PSNofCollision(psName = "Collisions");
MFDet->RegisterPrimitive(scorer0);
G4PSNofCollision* scorer1 = new G4PSNofCollision(psName="CollWeight");
G4PSNofCollision* scorer1 = new G4PSNofCollision(psName = "CollWeight");
scorer1->Weighted(true);
MFDet->RegisterPrimitive(scorer1);
G4PSPopulation* scorer2 = new G4PSPopulation(psName="Population");
G4PSPopulation* scorer2 = new G4PSPopulation(psName = "Population");
MFDet->RegisterPrimitive(scorer2);
G4PSTrackCounter* scorer3 =
new G4PSTrackCounter(psName="TrackEnter",fCurrent_In);
G4PSTrackCounter* scorer3 = new G4PSTrackCounter(psName = "TrackEnter", fCurrent_In);
MFDet->RegisterPrimitive(scorer3);
G4PSTrackLength* scorer4 = new G4PSTrackLength(psName="SL");
G4PSTrackLength* scorer4 = new G4PSTrackLength(psName = "SL");
MFDet->RegisterPrimitive(scorer4);
G4PSTrackLength* scorer5 = new G4PSTrackLength(psName="SLW");
G4PSTrackLength* scorer5 = new G4PSTrackLength(psName = "SLW");
scorer5->Weighted(true);
MFDet->RegisterPrimitive(scorer5);
G4PSTrackLength* scorer6 = new G4PSTrackLength(psName="SLWE");
G4PSTrackLength* scorer6 = new G4PSTrackLength(psName = "SLWE");
scorer6->Weighted(true);
scorer6->MultiplyKineticEnergy(true);
MFDet->RegisterPrimitive(scorer6);
G4PSTrackLength* scorer7 = new G4PSTrackLength(psName="SLW_V");
G4PSTrackLength* scorer7 = new G4PSTrackLength(psName = "SLW_V");
scorer7->Weighted(true);
scorer7->DivideByVelocity(true);
MFDet->RegisterPrimitive(scorer7);
G4PSTrackLength* scorer8 = new G4PSTrackLength(psName="SLWE_V");
G4PSTrackLength* scorer8 = new G4PSTrackLength(psName = "SLWE_V");
scorer8->Weighted(true);
scorer8->MultiplyKineticEnergy(true);
scorer8->DivideByVelocity(true);
@@ -335,40 +311,35 @@ void B02ImportanceDetectorConstruction::ConstructSD()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VIStore* B02ImportanceDetectorConstruction::CreateImportanceStore()
{
G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store "
<< G4endl;
if (!fPVolumeStore.Size())
{
G4Exception("B02ImportanceDetectorConstruction::CreateImportanceStore"
,"exampleB02_0001",RunMustBeAborted
,"no physical volumes created yet!");
G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store " << G4endl;
if (!fPVolumeStore.Size()) {
G4Exception("B02ImportanceDetectorConstruction::CreateImportanceStore", "exampleB02_0001",
RunMustBeAborted, "no physical volumes created yet!");
}
// creating and filling the importance store
// G4IStore *istore = new G4IStore(*fWorldVolume);
G4IStore *istore = G4IStore::GetInstance(GetName());
G4IStore* istore = G4IStore::GetInstance(GetName());
G4GeometryCell gWorldVolumeCell(GetWorldVolumeAddress(), 0);
G4double imp =1;
G4double imp = 1;
istore->AddImportanceGeometryCell(1, gWorldVolumeCell);
// set importance values and create scorers
// set importance values and create scorers
G4int cell(1);
for (cell=1; cell<=18; cell++) {
for (cell = 1; cell <= 18; cell++) {
G4GeometryCell gCell = GetGeometryCell(cell);
G4cout << " adding cell: " << cell
<< " replica: " << gCell.GetReplicaNumber()
G4cout << " adding cell: " << cell << " replica: " << gCell.GetReplicaNumber()
<< " name: " << gCell.GetPhysicalVolume().GetName() << G4endl;
imp = std::pow(2.0,cell-1);
imp = std::pow(2.0, cell - 1);
G4cout << "Going to assign importance: " << imp << ", to volume: "
<< gCell.GetPhysicalVolume().GetName() << G4endl;
//x aIstore.AddImportanceGeometryCell(imp, gCell);
G4cout << "Going to assign importance: " << imp
<< ", to volume: " << gCell.GetPhysicalVolume().GetName() << G4endl;
// x aIstore.AddImportanceGeometryCell(imp, gCell);
istore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), cell);
}
@@ -376,64 +347,57 @@ G4VIStore* B02ImportanceDetectorConstruction::CreateImportanceStore()
// G4GeometryCell gCell = GetGeometryCell(18);
// create importance geometry cell pair for the "rest"cell
// with the same importance as the last concrete cell
// with the same importance as the last concrete cell
G4GeometryCell gCell = GetGeometryCell(19);
// G4double imp = std::pow(2.0,18);
imp = std::pow(2.0,17);
// G4double imp = std::pow(2.0,18);
imp = std::pow(2.0, 17);
istore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), 19);
return istore;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VWeightWindowStore *B02ImportanceDetectorConstruction::
CreateWeightWindowStore()
G4VWeightWindowStore* B02ImportanceDetectorConstruction::CreateWeightWindowStore()
{
G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store "
<< G4endl;
if (!fPVolumeStore.Size())
{
G4Exception("B02ImportanceDetectorConstruction::CreateWeightWindowStore"
,"exampleB02_0002",RunMustBeAborted
,"no physical volumes created yet!");
G4cout << " B02ImportanceDetectorConstruction:: Creating Importance Store " << G4endl;
if (!fPVolumeStore.Size()) {
G4Exception("B02ImportanceDetectorConstruction::CreateWeightWindowStore", "exampleB02_0002",
RunMustBeAborted, "no physical volumes created yet!");
}
// creating and filling the importance store
// G4IStore *istore = new G4IStore(*fWorldVolume);
G4WeightWindowStore *wwstore = G4WeightWindowStore::GetInstance(GetName());
G4WeightWindowStore* wwstore = G4WeightWindowStore::GetInstance(GetName());
// create one energy region covering the energies of the problem
//
std::set<G4double, std::less<G4double> > enBounds;
std::set<G4double, std::less<G4double>> enBounds;
enBounds.insert(1 * GeV);
wwstore->SetGeneralUpperEnergyBounds(enBounds);
G4int n = 0;
G4double lowerWeight =1;
G4double lowerWeight = 1;
std::vector<G4double> lowerWeights;
lowerWeights.push_back(1);
G4GeometryCell gWorldCell(GetWorldVolumeAddress(),0);
G4GeometryCell gWorldCell(GetWorldVolumeAddress(), 0);
wwstore->AddLowerWeights(gWorldCell, lowerWeights);
G4int cell(1);
for (cell=1; cell<=18; cell++) {
for (cell = 1; cell <= 18; cell++) {
G4GeometryCell gCell = GetGeometryCell(cell);
G4cout << " adding cell: " << cell
<< " replica: " << gCell.GetReplicaNumber()
G4cout << " adding cell: " << cell << " replica: " << gCell.GetReplicaNumber()
<< " name: " << gCell.GetPhysicalVolume().GetName() << G4endl;
lowerWeight = 1./std::pow(2., n++);
G4cout << "Going to assign lower weight: " << lowerWeight
<< ", to volume: "
<< gCell.GetPhysicalVolume().GetName() << G4endl;
lowerWeights.clear();
lowerWeights.push_back(lowerWeight);
wwstore->AddLowerWeights(gCell, lowerWeights);
lowerWeight = 1. / std::pow(2., n++);
G4cout << "Going to assign lower weight: " << lowerWeight
<< ", to volume: " << gCell.GetPhysicalVolume().GetName() << G4endl;
lowerWeights.clear();
lowerWeights.push_back(lowerWeight);
wwstore->AddLowerWeights(gCell, lowerWeights);
}
// the remaining part pf the geometry (rest) gets the same
@@ -441,10 +405,9 @@ CreateWeightWindowStore()
//
// create importance geometry cell pair for the "rest"cell
// with the same importance as the last concrete cell
// with the same importance as the last concrete cell
G4GeometryCell gCell = GetGeometryCell(19);
wwstore->AddLowerWeights(gCell, lowerWeights);
wwstore->AddLowerWeights(gCell, lowerWeights);
return wwstore;
}
@@ -27,7 +27,7 @@
/// \brief Implementation of the B02PVolumeStore class
//
//
// GEANT4 tag
// GEANT4 tag
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -37,65 +37,65 @@
// ----------------------------------------------------------------------
#include "B02PVolumeStore.hh"
#include <sstream>
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02PVolumeStore::B02PVolumeStore(){}
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02PVolumeStore::~B02PVolumeStore(){}
B02PVolumeStore::B02PVolumeStore() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02PVolumeStore::AddPVolume(const G4GeometryCell &cell){
B02SetGeometryCell::iterator it =
fSetGeometryCell.find(cell);
B02PVolumeStore::~B02PVolumeStore() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B02PVolumeStore::AddPVolume(const G4GeometryCell& cell)
{
B02SetGeometryCell::iterator it = fSetGeometryCell.find(cell);
if (it != fSetGeometryCell.end()) {
G4cout << "B02PVolumeStore::AddPVolume: cell already stored"
<< G4endl;
G4cout << "B02PVolumeStore::AddPVolume: cell already stored" << G4endl;
return;
}
fSetGeometryCell.insert(cell);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4VPhysicalVolume *B02PVolumeStore::
GetPVolume(const G4String &name) const {
const G4VPhysicalVolume *pvol = 0;
const G4VPhysicalVolume* B02PVolumeStore::GetPVolume(const G4String& name) const
{
const G4VPhysicalVolume* pvol = 0;
for (B02SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
it != fSetGeometryCell.end(); ++it) {
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
it != fSetGeometryCell.end(); ++it)
{
const G4VPhysicalVolume& vol = it->GetPhysicalVolume();
if (vol.GetName() == name) {
pvol = &vol;
}
pvol = &vol;
}
}
if (!pvol) {
G4cout << "B02PVolumeStore::GetPVolume: no physical volume named: "
<< name << ", found" << G4endl;
G4cout << "B02PVolumeStore::GetPVolume: no physical volume named: " << name << ", found"
<< G4endl;
}
return pvol;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String B02PVolumeStore::GetPNames() const {
G4String B02PVolumeStore::GetPNames() const
{
G4String NameString;
for (B02SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
it != fSetGeometryCell.end(); ++it) {
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
it != fSetGeometryCell.end(); ++it)
{
const G4VPhysicalVolume& vol = it->GetPhysicalVolume();
std::ostringstream os;
os << vol.GetName() << "_" << it->GetReplicaNumber()
<< "\n";
os << vol.GetName() << "_" << it->GetReplicaNumber() << "\n";
G4String cellname = os.str();
// G4String cellname(vol.GetName());
// cellname += G4String("_");
// cellname += std::str(it->GetReplicaNumber());
@@ -107,7 +107,8 @@ G4String B02PVolumeStore::GetPNames() const {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int B02PVolumeStore::Size() {
G4int B02PVolumeStore::Size()
{
return fSetGeometryCell.size();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,26 +29,25 @@
//
//
#include "globals.hh"
#include "B02PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4Neutron.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleGun.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B02PrimaryGeneratorAction::B02PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun->SetParticleDefinition(G4Neutron::NeutronDefinition());
fParticleGun->SetParticleEnergy(10.0*MeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -90.0005*cm));
fParticleGun->SetParticleEnergy(10.0 * MeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0, 0.0, -90.0005 * cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0));
}

Some files were not shown because too many files have changed in this diff Show More