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
@@ -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;
}
}