Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -5,52 +5,56 @@
|
||||
|
||||
/*! \page ExampleAnaEx01 Example AnaEx01
|
||||
|
||||
Examples AnaEx01, AnaEx02 and AnaEx03 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis, ROOT and AIDA compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
G4Analysis system. All analysis manipulations
|
||||
(histo booking, filling, saving histos in a file, etc...)
|
||||
are located in one class : HistoManager.
|
||||
G4Analysis system.
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
|
||||
|
||||
\section AnaEx01_s1 Detector description
|
||||
|
||||
|
||||
The calorimeter is a box made of a given number of layers. A layer
|
||||
consists of an absorber plate and of a detection gap. The layer is
|
||||
replicated.
|
||||
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
<pre>
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| absorber | gap || absorber | gap || absorber | gap ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || | || | || | ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
</pre>
|
||||
|
||||
\section AnaEx01_s2 Action Initialization
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
</pre>
|
||||
|
||||
\section AnaEx01_s2 Physics list
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
\section AnaEx01_s3 Action Initialization
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
@@ -64,15 +68,15 @@
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
\section AnaEx01_s3 An event : PrimaryGeneratorAction
|
||||
\section AnaEx01_s4 An event : PrimaryGeneratorAction
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
|
||||
\section AnaEx01_s4 Histograms
|
||||
|
||||
\section AnaEx01_s5 Histograms
|
||||
|
||||
AnaEx01 can produce 4 histograms :
|
||||
|
||||
@@ -95,10 +99,33 @@
|
||||
The format of the histogram file can be : root (default),
|
||||
hbook, xml, csv. Include correct g4nnn.hh in HistoManager.hh
|
||||
|
||||
\section AnaEx01_s5 Using hbook format
|
||||
\section AnaEx01_s6 Using hbook format
|
||||
|
||||
Need a special treatement : the Cern Library must be installed and the
|
||||
environment variable CERNLIB correctly set. Then, *before* compiling,
|
||||
activate G4_USE_HBOOK in GNUmakefile and g4hbook.hh in HistoManager.hh
|
||||
This example provides the implementation of G4AnalysisManager for
|
||||
Hbook in hbook directory. As this package requires CERNLIB libraries,
|
||||
its compilation is optional. To build it, the following environment variables
|
||||
must be defined:
|
||||
\verbatim
|
||||
G4_USE_HBOOK = 1
|
||||
CERNLIB = path to the CERNLIB installation
|
||||
\endverbatim
|
||||
|
||||
Then, *before* compiling, activate g4hbook.hh in HistoManager.hh
|
||||
|
||||
\section AnaEx01_s7 How to build
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
\verbatim
|
||||
% cd path_to_AnaEx01/AnaEx01
|
||||
% gmake setup
|
||||
% gmake
|
||||
\endverbatim
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
\verbatim
|
||||
% gmake clean_setup
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
|
||||
@@ -27,14 +27,13 @@
|
||||
/// \brief Main program of the analysis/AnaEx01 example
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01.cc 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
// $Id: AnaEx01.cc 81444 2014-05-28 14:28:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
@@ -44,6 +43,7 @@
|
||||
#endif
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
@@ -71,7 +71,7 @@ int main(int argc,char** argv)
|
||||
//
|
||||
DetectorConstruction* detector = new DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
runManager->SetUserInitialization(new PhysicsList);
|
||||
runManager->SetUserInitialization(new FTFP_BERT);
|
||||
runManager->SetUserInitialization(new ActionInitialization(detector));
|
||||
|
||||
// Initialize G4 kernel
|
||||
|
||||
@@ -0,0 +1,777 @@
|
||||
|
||||
############################################
|
||||
!!! WARNING - FPE detection is activated !!!
|
||||
############################################
|
||||
|
||||
*************************************************************
|
||||
Geant4 version Name: geant4-10-01-ref-00 (5-December-2014)
|
||||
Copyright : Geant4 Collaboration
|
||||
Reference : NIM A 506 (2003), 250-303
|
||||
WWW : http://cern.ch/geant4
|
||||
*************************************************************
|
||||
|
||||
|
||||
***** Table : Nb of materials = 3 *****
|
||||
|
||||
Material: G4_Galactic density: 0.000 kg/m3 RadL: 204310101.835 pc Nucl.Int.Length: 114314827.001 pc
|
||||
Imean: 21.800 eV temperature: 2.73 K pressure: 0.00 atm
|
||||
|
||||
---> Element: H (H) Z = 1.0 N = 1.0 A = 1.01 g/mole
|
||||
---> Isotope: H1 Z = 1 N = 1 A = 1.01 g/mole abundance: 99.99 %
|
||||
---> Isotope: H2 Z = 1 N = 2 A = 2.01 g/mole abundance: 0.01 %
|
||||
ElmMassFraction: 100.00 % ElmAbundance 100.00 %
|
||||
|
||||
|
||||
Material: G4_Pb density: 11.350 g/cm3 RadL: 5.613 mm Nucl.Int.Length: 18.247 cm
|
||||
Imean: 823.000 eV
|
||||
|
||||
---> Element: Pb (Pb) Z = 82.0 N = 207.2 A = 207.22 g/mole
|
||||
---> Isotope: Pb204 Z = 82 N = 204 A = 203.97 g/mole abundance: 1.40 %
|
||||
---> Isotope: Pb206 Z = 82 N = 206 A = 205.97 g/mole abundance: 24.10 %
|
||||
---> Isotope: Pb207 Z = 82 N = 207 A = 206.98 g/mole abundance: 22.10 %
|
||||
---> Isotope: Pb208 Z = 82 N = 208 A = 207.98 g/mole abundance: 52.40 %
|
||||
ElmMassFraction: 100.00 % ElmAbundance 100.00 %
|
||||
|
||||
|
||||
Material: G4_lAr density: 1.396 g/cm3 RadL: 14.003 cm Nucl.Int.Length: 85.653 cm
|
||||
Imean: 188.000 eV
|
||||
|
||||
---> Element: Ar (Ar) Z = 18.0 N = 40.0 A = 39.95 g/mole
|
||||
---> Isotope: Ar36 Z = 18 N = 36 A = 35.97 g/mole abundance: 0.34 %
|
||||
---> Isotope: Ar38 Z = 18 N = 38 A = 37.96 g/mole abundance: 0.06 %
|
||||
---> Isotope: Ar40 Z = 18 N = 40 A = 39.96 g/mole abundance: 99.60 %
|
||||
ElmMassFraction: 100.00 % ElmAbundance 100.00 %
|
||||
|
||||
|
||||
|
||||
<<< Geant4 Physics List simulation engine: FTFP_BERT 2.0
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
---> The calorimeter is 10 layers of: [ 10mm of G4_Pb + 5mm of G4_lAr ]
|
||||
------------------------------------------------------------
|
||||
### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0
|
||||
|
||||
phot: for gamma SubType= 12 BuildTable= 0
|
||||
LambdaPrime table from 200 keV to 10 TeV in 54 bins
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
PhotoElectric : Emin= 0 eV Emax= 10 TeV AngularGenSauterGavrila FluoActive
|
||||
|
||||
compt: for gamma SubType= 13 BuildTable= 1
|
||||
Lambda table from 100 eV to 1 MeV, 7 bins per decade, spline: 1
|
||||
LambdaPrime table from 1 MeV to 10 TeV in 49 bins
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Klein-Nishina : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
conv: for gamma SubType= 14 BuildTable= 1
|
||||
Lambda table from 1.022 MeV to 10 TeV, 20 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
BetheHeitler : Emin= 0 eV Emax= 80 GeV
|
||||
BetheHeitlerLPM : Emin= 80 GeV Emax= 10 TeV
|
||||
|
||||
msc: for e- SubType= 10
|
||||
RangeFactor= 0.04, stepLimitType: 1, latDisplacement: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMsc : Emin= 0 eV Emax= 100 MeV Table with 42 bins Emin= 100 eV Emax= 100 MeV
|
||||
WentzelVIUni : Emin= 100 MeV Emax= 10 TeV Table with 35 bins Emin= 100 MeV Emax= 10 TeV
|
||||
|
||||
eIoni: for e- SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
MollerBhabha : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
eBrem: for e- SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
LPM flag: 1 for E > 1 GeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eBremSB : Emin= 0 eV Emax= 1 GeV DipBustGen
|
||||
eBremLPM : Emin= 1 GeV Emax= 10 TeV DipBustGen
|
||||
|
||||
CoulombScat: for e-, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from 100 MeV to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 100 MeV Emax= 10 TeV
|
||||
|
||||
msc: for e+ SubType= 10
|
||||
RangeFactor= 0.04, stepLimitType: 1, latDisplacement: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMsc : Emin= 0 eV Emax= 100 MeV Table with 42 bins Emin= 100 eV Emax= 100 MeV
|
||||
WentzelVIUni : Emin= 100 MeV Emax= 10 TeV Table with 35 bins Emin= 100 MeV Emax= 10 TeV
|
||||
|
||||
eIoni: for e+ SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
MollerBhabha : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
eBrem: for e+ SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
LPM flag: 1 for E > 1 GeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eBremSB : Emin= 0 eV Emax= 1 GeV DipBustGen
|
||||
eBremLPM : Emin= 1 GeV Emax= 10 TeV DipBustGen
|
||||
|
||||
annihil: for e+, integral: 1 SubType= 5 BuildTable= 0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eplus2gg : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for e+, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from 100 MeV to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 100 MeV Emax= 10 TeV
|
||||
|
||||
msc: for proton SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for proton SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 2 MeV
|
||||
BetheBloch : Emin= 2 MeV Emax= 10 TeV
|
||||
|
||||
hBrems: for proton SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for proton SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 13x1001 from 7.50618 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for proton, integral: 1 SubType= 1 BuildTable= 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for GenericIon SubType= 10
|
||||
RangeFactor= 0.2, stepLimitType: 0, latDisplacement: 0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMsc : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
ionIoni: for GenericIon SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.01, dRoverRange= 0.1, integral: 1, fluct: 1, linLossLimit= 0.02
|
||||
Stopping Power data for 17 ion/material pairs
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
BraggIon : Emin= 0 eV Emax= 2 MeV
|
||||
BetheBloch : Emin= 2 MeV Emax= 10 TeV
|
||||
|
||||
msc: for alpha SubType= 10
|
||||
RangeFactor= 0.2, stepLimitType: 0, latDisplacement: 0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMsc : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
ionIoni: for alpha SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.01, dRoverRange= 0.1, integral: 1, fluct: 1, linLossLimit= 0.02
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
BraggIon : Emin= 0 eV Emax= 7.9452 MeV
|
||||
BetheBloch : Emin= 7.9452 MeV Emax= 10 TeV
|
||||
|
||||
msc: for anti_proton SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for anti_proton SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
ICRU73QO : Emin= 0 eV Emax= 2 MeV
|
||||
BetheBloch : Emin= 2 MeV Emax= 10 TeV
|
||||
|
||||
hBrems: for anti_proton SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for anti_proton SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 13x1001 from 7.50618 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for anti_proton, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for kaon+ SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for kaon+ SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 1.05231 MeV
|
||||
BetheBloch : Emin= 1.05231 MeV Emax= 10 TeV
|
||||
|
||||
hBrems: for kaon+ SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for kaon+ SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 14x1001 from 3.94942 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for kaon+, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for kaon- SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for kaon- SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
ICRU73QO : Emin= 0 eV Emax= 1.05231 MeV
|
||||
BetheBloch : Emin= 1.05231 MeV Emax= 10 TeV
|
||||
|
||||
hBrems: for kaon- SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for kaon- SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 14x1001 from 3.94942 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for kaon-, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for mu+ SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
muIoni: for mu+ SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 200 keV
|
||||
BetheBloch : Emin= 200 keV Emax= 1 GeV
|
||||
MuBetheBloch : Emin= 1 GeV Emax= 10 TeV
|
||||
|
||||
muBrems: for mu+ SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
MuBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
muPairProd: for mu+ SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 17x1001 from 1 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
muPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for mu+, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for mu- SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
muIoni: for mu- SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
ICRU73QO : Emin= 0 eV Emax= 200 keV
|
||||
BetheBloch : Emin= 200 keV Emax= 1 GeV
|
||||
MuBetheBloch : Emin= 1 GeV Emax= 10 TeV
|
||||
|
||||
muBrems: for mu- SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
MuBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
muPairProd: for mu- SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 17x1001 from 1 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
muPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for mu-, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for pi+ SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for pi+ SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 297.505 keV
|
||||
BetheBloch : Emin= 297.505 keV Emax= 10 TeV
|
||||
|
||||
hBrems: for pi+ SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for pi+ SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 16x1001 from 1.11656 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for pi+, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
msc: for pi- SubType= 10
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, polarAngleLimit(deg)= 180
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
WentzelVIUni : Emin= 0 eV Emax= 10 TeV Table with 77 bins Emin= 100 eV Emax= 10 TeV
|
||||
|
||||
hIoni: for pi- SubType= 2
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
finalRange(mm)= 0.1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
ICRU73QO : Emin= 0 eV Emax= 297.505 keV
|
||||
BetheBloch : Emin= 297.505 keV Emax= 10 TeV
|
||||
|
||||
hBrems: for pi- SubType= 3
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hBrem : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
hPairProd: for pi- SubType= 4
|
||||
dE/dx and range tables from 100 eV to 10 TeV in 77 bins
|
||||
Lambda tables from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
Sampling table 16x1001 from 1.11656 GeV to 10 TeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
hPairProd : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
CoulombScat: for pi-, integral: 1 SubType= 1 BuildTable= 1
|
||||
Lambda table from threshold to 10 TeV, 7 bins per decade, spline: 1
|
||||
180 < Theta(degree) < 180 pLimit(GeV^1)= 0.139531
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eCoulombScattering : Emin= 0 eV Emax= 10 TeV
|
||||
|
||||
====================================================================
|
||||
HADRONIC PROCESSES SUMMARY (verbose level 1)
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for neutron
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticCHIPS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: ChipsNeutronElasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: neutronInelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: G4NeutronInelasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: Barashenkov-Glauber: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: nCapture
|
||||
Model: nRadCapture: 0 eV ---> 100 TeV
|
||||
Cr_sctns: G4NeutronCaptureXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaCaptureXS: 0 eV ---> 100 TeV
|
||||
|
||||
Process: nKiller
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for GenericIon
|
||||
|
||||
Process: ionInelastic
|
||||
Model: Binary Light Ion Cascade: 0 eV ---> 4 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: Glauber-Gribov nucleus nucleus: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for He3
|
||||
|
||||
Process: He3Inelastic
|
||||
Model: Binary Light Ion Cascade: 0 eV ---> 4 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: Glauber-Gribov nucleus nucleus: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for alpha
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: alphaInelastic
|
||||
Model: Binary Light Ion Cascade: 0 eV ---> 4 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: Glauber-Gribov nucleus nucleus: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_He3
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
|
||||
Model: AntiAElastic: 100 MeV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_He3Inelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hFritiofCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_alpha
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
|
||||
Model: AntiAElastic: 100 MeV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_alphaInelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hFritiofCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_deuteron
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
|
||||
Model: AntiAElastic: 100 MeV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_deuteronInelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hFritiofCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_neutron
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_neutronInelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_proton
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
|
||||
Model: AntiAElastic: 100 MeV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_protonInelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hFritiofCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for anti_triton
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
|
||||
Model: AntiAElastic: 100 MeV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: anti_tritonInelastic
|
||||
Model: FTFP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: AntiAGlauber: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hFritiofCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for deuteron
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: dInelastic
|
||||
Model: Binary Light Ion Cascade: 0 eV ---> 4 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: Glauber-Gribov nucleus nucleus: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for e+
|
||||
|
||||
Process: positronNuclear
|
||||
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
|
||||
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for e-
|
||||
|
||||
Process: electronNuclear
|
||||
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
|
||||
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for gamma
|
||||
|
||||
Process: photonNuclear
|
||||
Model: BertiniCascade: 0 eV ---> 3.5 GeV
|
||||
Model: TheoFSGenerator: 3 GeV ---> 100 TeV
|
||||
Cr_sctns: PhotoNuclearXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for kaon+
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: kaon+Inelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: ChipsKaonPlusInelasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for kaon-
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: kaon-Inelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: ChipsKaonMinusInelasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hBertiniCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for lambda
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: lambdaInelastic
|
||||
Model: BertiniCascade: 0 eV ---> 6 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: ChipsHyperonInelasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for mu+
|
||||
|
||||
Process: muonNuclear
|
||||
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
|
||||
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for mu-
|
||||
|
||||
Process: muonNuclear
|
||||
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
|
||||
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
|
||||
|
||||
Process: muMinusCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for pi+
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 1.0001 GeV
|
||||
Model: hElasticGlauber: 1 GeV ---> 100 TeV
|
||||
Cr_sctns: Barashenkov-Glauber: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: pi+Inelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: G4CrossSectionPairGG: 0 eV ---> 100 TeV
|
||||
G4CrossSectionPairGG: G4PiNuclearCrossSection cross sections
|
||||
below 91 GeV, Glauber-Gribov above
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for pi-
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 1.0001 GeV
|
||||
Model: hElasticGlauber: 1 GeV ---> 100 TeV
|
||||
Cr_sctns: Barashenkov-Glauber: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: pi-Inelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: G4CrossSectionPairGG: 0 eV ---> 100 TeV
|
||||
G4CrossSectionPairGG: G4PiNuclearCrossSection cross sections
|
||||
below 91 GeV, Glauber-Gribov above
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: hBertiniCaptureAtRest
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for proton
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticCHIPS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: ChipsProtonElasticXS: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: protonInelastic
|
||||
Model: FTFP: 4 GeV ---> 100 TeV
|
||||
Model: BertiniCascade: 0 eV ---> 5 GeV
|
||||
Cr_sctns: Barashenkov-Glauber: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
---------------------------------------------------
|
||||
Hadronic Processes for triton
|
||||
|
||||
Process: hadElastic
|
||||
Model: hElasticLHEP: 0 eV ---> 100 TeV
|
||||
Cr_sctns: GheishaElastic: 0 eV ---> 100 TeV
|
||||
|
||||
Process: tInelastic
|
||||
Model: Binary Light Ion Cascade: 0 eV ---> 4 GeV
|
||||
Model: FTFP: 2 GeV ---> 100 TeV
|
||||
Cr_sctns: Glauber-Gribov nucleus nucleus: 0 eV ---> 2.88022e+295 J
|
||||
Cr_sctns: GheishaInelastic: 0 eV ---> 100 TeV
|
||||
|
||||
================================================================
|
||||
### Run 0 start.
|
||||
... create Root directory for histograms : histo - done
|
||||
... create Root directory for ntuples : ntuple - done
|
||||
... open Root analysis file : AnaEx01.root - done
|
||||
... create Root H1 : 1 - done
|
||||
... create Root H1 : 2 - done
|
||||
... create Root H1 : 3 - done
|
||||
... create Root H1 : 4 - done
|
||||
... create Root ntuple : 101 ntupleId 1 - done
|
||||
... create Root ntuple D column : Eabs ntupleId 1 - done
|
||||
... create Root ntuple D column : Egap ntupleId 1 - done
|
||||
... create Root ntuple : 102 ntupleId 2 - done
|
||||
... create Root ntuple D column : Labs ntupleId 2 - done
|
||||
... create Root ntuple D column : Lgap ntupleId 2 - done
|
||||
|
||||
----> Histogram Tree is opened in AnaEx01.root
|
||||
|
||||
---> Begin of event: 0
|
||||
|
||||
---> Begin of event: 100
|
||||
|
||||
---> Begin of event: 200
|
||||
|
||||
---> Begin of event: 300
|
||||
|
||||
---> Begin of event: 400
|
||||
|
||||
---> Begin of event: 500
|
||||
|
||||
---> Begin of event: 600
|
||||
|
||||
---> Begin of event: 700
|
||||
|
||||
---> Begin of event: 800
|
||||
|
||||
---> Begin of event: 900
|
||||
|
||||
--------------------End of Run------------------------------
|
||||
|
||||
mean Energy in Absorber : 453.339 MeV +- 14.5813 MeV
|
||||
mean Energy in Gap : 23.591 MeV +- 7.0809 MeV
|
||||
|
||||
mean trackLength in Absorber : 32.4232 cm +- 1.14085 cm
|
||||
mean trackLength in Gap : 11.6974 cm +- 3.62573 cm
|
||||
------------------------------------------------------------
|
||||
|
||||
|
||||
----> print histograms statistic
|
||||
|
||||
EAbs : mean = 453.339 MeV rms = 14.5813 MeV
|
||||
EGap : mean = 23.591 MeV rms = 7.0809 MeV
|
||||
LAbs : mean = 32.4232 cm rms = 1.14085 cm
|
||||
LGap : mean = 11.6974 cm rms = 3.62573 cm
|
||||
... write Root file : AnaEx01.root - done
|
||||
|
||||
----> Histogram Tree is saved in AnaEx01.root
|
||||
Total navigation history collections cleaned: 64
|
||||
@@ -24,28 +24,17 @@ include(${Geant4_USE_FILE})
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/../shared/include
|
||||
${PROJECT_SOURCE_DIR}/shared/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Get examples sources from common and shared
|
||||
#
|
||||
list(APPEND sources
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/ActionInitialization.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/DetectorConstruction.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/DetectorMessenger.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/EventAction.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/PhysicsList.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/PrimaryGeneratorAction.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/RunAction.cc
|
||||
${PROJECT_SOURCE_DIR}/../shared/src/SteppingAction.cc)
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc
|
||||
${PROJECT_SOURCE_DIR}/shared/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh
|
||||
${PROJECT_SOURCE_DIR}/shared/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find HBOOK (optional package)
|
||||
#
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../common/analysis/cmake ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/hbook/cmake ${CMAKE_MODULE_PATH})
|
||||
find_package(HBOOK QUIET)
|
||||
if(NOT HBOOK_FOUND)
|
||||
message(STATUS "G4 Examples: HBOOK package not found. --> g4tools/hbook analysis disabled")
|
||||
@@ -59,33 +48,19 @@ endif()
|
||||
#
|
||||
|
||||
if (HBOOK_FOUND)
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/../../common/analysis/include)
|
||||
|
||||
file(GLOB add_sources ${PROJECT_SOURCE_DIR}/../../common/analysis/src/*.cc)
|
||||
list(APPEND sources ${add_sources})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/close.o
|
||||
COMMAND gfortran
|
||||
ARGS -c ${Geant4_INCLUDE_DIR}/tools/hbook/close.f )
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/setpawc.o
|
||||
COMMAND gfortran
|
||||
ARGS -c ${Geant4_INCLUDE_DIR}/tools/hbook/setpawc.f )
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/setntuc.o
|
||||
COMMAND gfortran
|
||||
ARGS -c ${Geant4_INCLUDE_DIR}/tools/hbook/setntuc.f )
|
||||
set(TOOLS_FORTRAN_OBJECTS close.o setpawc.o setntuc.o)
|
||||
enable_language(Fortran)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/hbook/include)
|
||||
file(GLOB add_sources ${PROJECT_SOURCE_DIR}/hbook/src/*.cc)
|
||||
file(GLOB fortran_sources ${PROJECT_SOURCE_DIR}/hbook/src/*.f)
|
||||
file(GLOB add_headers ${PROJECT_SOURCE_DIR}/hbook/include/*.hh)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(AnaEx01 AnaEx01.cc ${sources} ${headers} ${TOOLS_FORTRAN_OBJECTS})
|
||||
add_executable(AnaEx01 AnaEx01.cc
|
||||
${sources} ${add_sources} ${fortran_sources}
|
||||
${headers} ${add_headers})
|
||||
target_link_libraries(AnaEx01 ${Geant4_LIBRARIES} ${HBOOK_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile 68015 2013-03-13 13:27:27Z gcosmo $
|
||||
# $Id: GNUmakefile 85989 2014-11-06 15:40:05Z gcosmo $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
@@ -11,24 +11,32 @@ ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
# HBOOK support
|
||||
#
|
||||
#### G4_USE_HBOOK := true
|
||||
|
||||
.PHONY: setup clean_setup all
|
||||
all: hbook lib bin
|
||||
|
||||
setup:
|
||||
@echo "Copying files from common"
|
||||
@$(G4INSTALL)/examples/extended/common/scripts/copy_files.sh
|
||||
|
||||
@echo "Copying files from shared and hbook"
|
||||
@./shared/scripts/copy_files.sh shared
|
||||
ifdef G4_USE_HBOOK
|
||||
@./shared/scripts/copy_files.sh hbook
|
||||
endif
|
||||
|
||||
clean_setup:
|
||||
@echo "Removing files copied from common"
|
||||
@$(G4INSTALL)/examples/extended/common/scripts/clean_files.sh
|
||||
@echo "Removing files copied from shared and hbook"
|
||||
@./shared/scripts/clean_files.sh shared
|
||||
ifdef G4_USE_HBOOK
|
||||
@./shared/scripts/clean_files.sh hbook
|
||||
endif
|
||||
|
||||
# HBOOK support
|
||||
#
|
||||
#### G4_USE_HBOOK := true
|
||||
include GNUmakefile.tools_hbook
|
||||
include hbook/GNUmakefile.tools_hbook
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
|
||||
CPPFLAGS += -I./shared/include
|
||||
|
||||
visclean:
|
||||
rm -f g4*.prim g4*.eps g4*.wrl
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 73921 2013-09-17 07:45:43Z gcosmo $
|
||||
$Id: History 85989 2014-11-06 15:40:05Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -15,6 +15,50 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
06-11-14 I. Hrivnacova (AnaEx01-V10-00-05)
|
||||
- Updated for moving script in shared (analysisShared-V10-00-01)
|
||||
- Updated README - commented special compilation (via make setup)
|
||||
- Updated comments for Doxygen in hbook
|
||||
|
||||
05-11-14 I. Hrivnacova (AnaEx01-V10-00-04)
|
||||
- Including shared directory directly in the example
|
||||
to avoid out-of-project sources
|
||||
- based on analysisShared-V10-00-00
|
||||
- Adding utility scripts for GNUmake build (much simpler replacement
|
||||
for scripts from common) \
|
||||
- based on analysisScripts-V10-00-00
|
||||
- Moved implementation of G4AnalysisManager for hbook from
|
||||
extended/common/analysis in hbook sub-directory
|
||||
|
||||
13-08-14 mma (AnaEx01-V10-00-03)
|
||||
- update Readme and .Readme again
|
||||
|
||||
12-08-14 mma (AnaEx01-V10-00-02)
|
||||
- restaure calorimeter drawing in Readme and .Readme
|
||||
|
||||
17-06-14 I. Hrivnacova (AnaEx01-V10-00-01)
|
||||
- Fixed problems reported by Davide Mancusi:
|
||||
- Moving tools/hbook/*.f files in examples/extended/common/analysis/src
|
||||
to avoid their retrieval from Geant4 source/includes which causes problem
|
||||
when building examples against Geant4 build directory.
|
||||
- Added -lkernlib in list of libraries (required with Debian cernlib
|
||||
distribution 20061220)
|
||||
- In CMake build: replaced explicit use of gfortran with
|
||||
enable_language(Fortran) and using fortran_sources variable in analogous
|
||||
way as sources
|
||||
|
||||
11-06-14 I. Hrivnacova (AnaEx01-V10-00-00)
|
||||
- Fixed path to copy_files.sh, clean_files.sh in GNUmalefile
|
||||
(this makes GNUmake build working with Geant4 installation via
|
||||
CMake)
|
||||
- Fixed SharedFilesList.txt - removed PhysicList class
|
||||
- Fixed path to hbook *.f files in GNUmakefile.tools_hbook
|
||||
|
||||
28-05-14 I. Hrivnacova
|
||||
- Use Geant4 physics list (FTFP_BERT) in AnaEx01,02,03,
|
||||
removed PhysicList class from shared
|
||||
(tag in examples/analysis)
|
||||
|
||||
16-09-13 I. Hrivnacova (AnaEx01-V09-06-02)
|
||||
- Updated SharedFilesList.txt for addedActionInitialization class
|
||||
(missing in analysisExample-V09-06-02 in top directory)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: README 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
$Id: README 85989 2014-11-06 15:40:05Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -7,10 +7,16 @@ $Id: README 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
|
||||
AnaEx01
|
||||
-------
|
||||
|
||||
Examples AnaEx01, AnaEx02 and AnaEx03 show the usage of histogram and tuple
|
||||
manipulations using G4Analysis, ROOT and AIDA compliant systems on the same
|
||||
scenario. All analysis manipulations (histo booking, filling, saving histos
|
||||
in a file, etc...) are located in one class : HistoManager, implementation of
|
||||
which is different in each example. All the other classes are same in all
|
||||
three examples.
|
||||
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
G4Analysis system. All analysis manipulations
|
||||
(histo booking, filling, saving histos in a file, etc...)
|
||||
are located in one class : HistoManager.
|
||||
G4Analysis system.
|
||||
|
||||
The example is an adaptation of examples/novice/N03. It describes a simple
|
||||
sampling calorimeter setup.
|
||||
@@ -23,38 +29,36 @@ $Id: README 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
replicated.
|
||||
|
||||
Six parameters define the calorimeter :
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
- the material of the absorber,
|
||||
- the thickness of an absorber plate,
|
||||
- the material of the detection gap,
|
||||
- the thickness of a gap,
|
||||
- the number of layers,
|
||||
- the transverse size of the calorimeter (the input face is a square).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class,
|
||||
but all of the above parameters can be modified interactively via
|
||||
the commands defined in the DetectorMessenger class.
|
||||
|
||||
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| absorber | gap || absorber | gap || absorber | gap ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || | || | || | ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
|
||||
2- Action Initialization
|
||||
------------------------------------
|
||||
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
|
||||
| | | |
|
||||
==========================================================================
|
||||
|| | || | || | ||
|
||||
|| | || | || | ||
|
||||
beam || absorber | gap || absorber | gap || absorber | gap ||
|
||||
======> || | || | || | ||
|
||||
|| | || | || | ||
|
||||
==========================================================================
|
||||
|
||||
|
||||
2- Physics list
|
||||
---------------
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in the FTFP_BERT physics list.
|
||||
|
||||
3- Action Initialization
|
||||
------------------------
|
||||
|
||||
A newly introduced class, ActionInitialization,
|
||||
instantiates and registers to Geant4 kernel all user action classes
|
||||
@@ -67,17 +71,16 @@ $Id: README 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
ActionInitialization::BuildForMaster().
|
||||
Note that ActionInitialization::Build() is also used to
|
||||
instatiate user action clasess in sequential mode.
|
||||
|
||||
3- An event : PrimaryGeneratorAction
|
||||
|
||||
4- An event : PrimaryGeneratorAction
|
||||
------------------------------------
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
calorimeter perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
|
||||
4- Histograms
|
||||
5- Histograms
|
||||
-------------
|
||||
|
||||
AnaEx01 can produce 4 histograms :
|
||||
@@ -104,6 +107,25 @@ $Id: README 73919 2013-09-17 07:38:47Z gcosmo $
|
||||
Using hbook format
|
||||
------------------
|
||||
|
||||
Need a special treatement : the Cern Library must be installed and the
|
||||
environment variable CERNLIB correctly set. Then, *before* compiling,
|
||||
activate G4_USE_HBOOK in GNUmakefile and g4hbook.hh in HistoManager.hh
|
||||
This example provides the implementation of G4AnalysisManager for
|
||||
Hbook in hbook directory. As this package requires CERNLIB libraries,
|
||||
its compilation is optional. To build it, the following environment variables
|
||||
must be defined:
|
||||
G4_USE_HBOOK = 1
|
||||
CERNLIB = path to the CERNLIB installation
|
||||
|
||||
Then, *before* compiling, activate g4hbook.hh in HistoManager.hh
|
||||
|
||||
6- How to build
|
||||
---------------
|
||||
|
||||
An additional step is needed when building the example with GNUmake
|
||||
due to using the extra shared directory:
|
||||
% cd path_to_AnaEx01/AnaEx01
|
||||
% gmake setup
|
||||
% gmake
|
||||
|
||||
This will copy the files from shared in the example include and src;
|
||||
to remove these files:
|
||||
% gmake clean_setup
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
EXAMPLE extended/analysis/AnaEx01
|
||||
|
||||
COMMON_CLASSES_PATH ../../common
|
||||
COMMON_CLASSES_LIST
|
||||
g4hbook.hh
|
||||
g4hbook_defs.hh
|
||||
ExG4HbookNtupleDescription.hh
|
||||
ExG4HbookAnalysisManager.icc
|
||||
ExG4HbookAnalysisManager
|
||||
ExG4HbookFileManager
|
||||
ExG4HbookH1Manager
|
||||
ExG4HbookH2Manager
|
||||
ExG4HbookNtupleManager
|
||||
|
||||
SHARED_CLASSES_PATH ../shared
|
||||
SHARED_CLASSES_LIST
|
||||
ActionInitialization
|
||||
DetectorConstruction
|
||||
DetectorMessenger
|
||||
EventAction
|
||||
PhysicsList
|
||||
PrimaryGeneratorAction
|
||||
RunAction
|
||||
SteppingAction
|
||||
@@ -0,0 +1,80 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
project(analysis)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, no UI and Vis drivers activated
|
||||
#
|
||||
find_package(Geant4 REQUIRED)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find HBOOK (required package)
|
||||
#
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
find_package(HBOOK QUIET)
|
||||
if(NOT HBOOK_FOUND)
|
||||
message(STATUS "G4 Examples: HBOOK package not found. --> g4tools/hbook analysis disabled")
|
||||
return()
|
||||
else()
|
||||
message(STATUS "G4 Examples: HBOOK package found. --> g4tools/hbook analysis enabled")
|
||||
add_definitions(-DG4_USE_HBOOK)
|
||||
endif()
|
||||
|
||||
#--- Enable Fortran ------------------------------------------------------------
|
||||
enable_language(Fortran)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
#
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate fortran sources
|
||||
#
|
||||
if(HBOOK_FOUND)
|
||||
file(GLOB fortran_sources ${PROJECT_SOURCE_DIR}/src/*.f)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(testAnalysis testAnalysis.cc ${sources} ${fortran_sources} ${headers})
|
||||
target_link_libraries(testAnalysis ${Geant4_LIBRARIES} ${HBOOK_LIBRARIES} )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build analysis. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(analysis_SCRIPTS
|
||||
|
||||
)
|
||||
|
||||
foreach(_script ${analysis_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add program to the project targets
|
||||
# (this avoids the need of typing the program name after make)
|
||||
#
|
||||
add_custom_target(analysis DEPENDS testAnalysis)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS testAnalysis DESTINATION bin)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# $Id: GNUmakefile 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := testAnalysis
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: hbook lib bin
|
||||
|
||||
# HBOOK support
|
||||
include GNUmakefile.tools_hbook
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
|
||||
visclean:
|
||||
rm -f g4*.prim g4*.eps g4*.wrl
|
||||
rm -f .DAWN_*
|
||||
|
||||
histclean:
|
||||
rm ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/HistoManager.o
|
||||
+15
-10
@@ -8,36 +8,41 @@ ifdef G4_USE_HBOOK
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -DG4_USE_HBOOK
|
||||
CPPFLAGS += -I./hbook/include
|
||||
EXTRALIBS += $(G4TMPDIR)/exe/close.o $(G4TMPDIR)/exe/setpawc.o $(G4TMPDIR)/exe/setntuc.o
|
||||
EXTRALIBS += -L${CERNLIB}/lib -lpacklib -lmathlib -lgfortran -lcrypt
|
||||
EXTRALIBS += -L${CERNLIB}/lib -lpacklib -lmathlib -lgfortran -lcrypt -lkernlib
|
||||
|
||||
#FC=gfortran
|
||||
|
||||
hbook: close.o setpawc.o setntuc.o
|
||||
ifdef CPPVERBOSE
|
||||
(mv *.o $(G4TMPDIR)/exe);
|
||||
else
|
||||
@(mv *.o $(G4TMPDIR)/exe);
|
||||
endif
|
||||
|
||||
close.o : $(G4BASE)/analysis/include/tools/hbook/close.f
|
||||
close.o : hbook/src/close.f
|
||||
@echo Compiling close.f
|
||||
ifdef CPPVERBOSE
|
||||
$(FC) -c $(G4BASE)/analysis/include/tools/hbook/close.f
|
||||
$(FC) -c hbook/src/close.f
|
||||
else
|
||||
@$(FC) -c $(G4BASE)/analysis/include/tools/hbook/close.f
|
||||
@$(FC) -c hbook/src/close.f
|
||||
endif
|
||||
|
||||
setpawc.o : $(G4BASE)/analysis/include/tools/hbook/setpawc.f
|
||||
setpawc.o : hbook/src/setpawc.f
|
||||
@echo Compiling setpawc.f
|
||||
ifdef CPPVERBOSE
|
||||
$(FC) -c $(G4BASE)/analysis/include/tools/hbook/setpawc.f
|
||||
$(FC) -c hbook/src/setpawc.f
|
||||
else
|
||||
@$(FC) -c $(G4BASE)/analysis/include/tools/hbook/setpawc.f
|
||||
@$(FC) -c hbook/src/setpawc.f
|
||||
endif
|
||||
|
||||
setntuc.o : $(G4BASE)/analysis/include/tools/hbook/setntuc.f
|
||||
setntuc.o : hbook/src/setntuc.f
|
||||
@echo Compiling setntuc.f
|
||||
ifdef CPPVERBOSE
|
||||
$(FC) -c $(G4BASE)/analysis/include/tools/hbook/setntuc.f
|
||||
$(FC) -c hbook/src/setntuc.f
|
||||
else
|
||||
@$(FC) -c $(G4BASE)/analysis/include/tools/hbook/setntuc.f
|
||||
@$(FC) -c hbook/src/setntuc.f
|
||||
endif
|
||||
|
||||
else
|
||||
@@ -0,0 +1,117 @@
|
||||
$Id$
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
extended/commmon/analysis History file
|
||||
--------------------------------------
|
||||
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
03/11/2014 I. Hrivnacova (excommon-analysis-V10-00-03)
|
||||
- Updated for changes in analysis category
|
||||
- Implemented P1 manager
|
||||
- Added H3 and P2 dummy managers (now removed from Geant4 kernel)
|
||||
- Fixed applying units
|
||||
- Applied new exception classification
|
||||
|
||||
17/06/2014 I. Hrivnacova (excommon-analysis-V10-00-02)
|
||||
- Fixed problems reported by Davide Mancusi:
|
||||
- Moving tools/hbook/*.f files in examples/extended/common/analysis/src
|
||||
to avoid their retrieval from Geant4 source/includes which causes problem
|
||||
when building examples against Geant4 build directory.
|
||||
- Added -lkernlib in list of libraries (required with Debian cernlib
|
||||
distribution 20061220)
|
||||
- In CMake build: replaced explicit use of gfortran with
|
||||
enable_language(Fortran) and using fortran_sources variable in analogous
|
||||
way as sources
|
||||
|
||||
12/06/2014 I. Hrivnacova (excommon-analysis-V10-00-01)
|
||||
- Added typedefs and functions for accessing iterators
|
||||
over H1, H2, Ntuples;
|
||||
Usage:
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
for (G4H1Iterator it = analysisManager->BeginH1();
|
||||
it != analysisManager->EndH1(); it++ ) {
|
||||
G4H1* h1 = *it;
|
||||
// call any h1 function define in tools
|
||||
}
|
||||
|
||||
11/06/2014 I. Hrivnacova (excommon-analysis-V10-00-00)
|
||||
- Updated for changes in analysis category:
|
||||
ntuple columns of vectors (disabled), changes in ntuple_booking
|
||||
- Updated to g4tools 1.10.0 (by G. Barrand):
|
||||
See History_tools for complete list of modifications.
|
||||
|
||||
07/11/2013 I. Hrivnacova (excommon-analysis-V09-06-04)
|
||||
- Implemented functions for user defined/logarithmic binning for H1
|
||||
and H2; in case of H2 an exception is (not available in HBOOK)
|
||||
|
||||
11/07/2013 I. Hrivnacova (excommon-analysis-V09-06-03)
|
||||
- Refactoring ExG4Hnook manager class following changes
|
||||
in analysis (analysis-V09-06-11)
|
||||
|
||||
20/06/2013 I. Hrivnacova (excommon-analysis-V09-06-02)
|
||||
- Fixed a typo in ExG4HbookAnalysisManager.hh which caused compilation
|
||||
error
|
||||
|
||||
03/06/2013 I. Hrivnacova (excommon-analysis-V09-06-01)
|
||||
- Implemented ExG4HbookAnalysisManager::Create() required with
|
||||
update for MT migration; returns an exception in case of MT mode
|
||||
(as Hbook is not supported with MT)
|
||||
|
||||
29/03/2013 I. Hrivnacova (excommon-analysis-V09-06-00)
|
||||
- Updated to analysis-V09-06-05
|
||||
- Extended the manager class for handling more than one ntuple
|
||||
|
||||
19/11/2012 I. Hrivnacova (excommon-analysis-V09-05-04)
|
||||
- Updated to analysis-V09-05-15
|
||||
- Adding functions for accessing h1, h2 by name
|
||||
- Splitting verbose level 1 in 2 levels and shifting the upper levels
|
||||
- Fixed GetH1[2]Width: return the correct value also when histogram is
|
||||
inactive.
|
||||
|
||||
28/08/2012 I. Hrivnacova (excommon-analysis-V09-05-03)
|
||||
- Updated to analysis-V09-05-10
|
||||
- Adding a possibility to fill h1, h2 with values with automatically
|
||||
applied function (eg. log10, exp)
|
||||
- Pass units via a name instead of value
|
||||
- Adding getters for many h1, h2 attributes
|
||||
- Adding ScaleH1(), ScaleH2()
|
||||
- Adding setters/getters for histogram axis titles
|
||||
(though they are not propagated to paw)
|
||||
|
||||
27/07/2012 I. Hrivnacova (excommon-analysis-V09-05-02)
|
||||
- Adding an additional information to analysis objects:
|
||||
units, activation option (defined in G4HnInformation.hh)
|
||||
- Make possible to book histograms/ntuple before openning a file
|
||||
(using new h1_booking, h2_booking and tools::ntuple_booking classes)
|
||||
- Using new bN::configure functions in SetHN(..)
|
||||
- Messages from Fill functions only in verbose level 3
|
||||
- Fixes in memory management
|
||||
delete file before opening a new one (all)
|
||||
delete ntuple before closing a file
|
||||
- Based on g4tools 1.3.1 (by G. Barrand) - see History_tools
|
||||
|
||||
23/02/2012 I. Hrivnacova (excommon-analysis-V09-05-01)
|
||||
- Added functions to customize the HBOOK IDs by user:
|
||||
G4bool SetH1HbookIdOffset(G4int offset);
|
||||
G4bool SetH2HbookIdOffset(G4int offset);
|
||||
G4bool SetNtupleHbookId(G4int ntupleId);
|
||||
and appropriate data members and their getters
|
||||
- Added setting locks introduced in the base class
|
||||
- Fixed handling of directories for both histograms and ntuple
|
||||
|
||||
14/02/2012 I. Hrivnacova (excommon-analysis-V09-05-00)
|
||||
- Adding defs include files for Hbook manager
|
||||
- Adding GetNtuple() function to specific managers
|
||||
- Increased granularity of verbose levels (now 3 levels are available)
|
||||
- Making creating directories optional
|
||||
@@ -0,0 +1,21 @@
|
||||
# Locate CERNLIB libraries (needed for g4tools/hbook)
|
||||
# in a directory defined via CERNLIB environment variable
|
||||
#
|
||||
# Defines:
|
||||
# HBOOK_FOUND
|
||||
# HBOOK_LIBRARIES
|
||||
|
||||
find_library(PACKLIB_LIBRARY NAMES packlib
|
||||
HINTS $ENV{CERNLIB} $ENV{CERNLIB}/lib)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set HBOOK_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HBOOK DEFAULT_MSG PACKLIB_LIBRARY)
|
||||
|
||||
if (HBOOK_FOUND)
|
||||
get_filename_component(CERNLIB_LIBRARY_DIR ${PACKLIB_LIBRARY} PATH)
|
||||
set(HBOOK_LIBRARIES "-L${CERNLIB_LIBRARY_DIR} -lpacklib -lmathlib -lgfortran -lcrypt -lkernlib")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(HBOOK_FOUND HBOOK_LIBRARIES)
|
||||
@@ -0,0 +1,164 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookAnalysisManager.hh
|
||||
/// \brief Definition of the ExG4HbookAnalysisManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookAnalysisManager_h
|
||||
#define ExG4HbookAnalysisManager_h 1
|
||||
|
||||
#include "G4VAnalysisManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/wfile>
|
||||
#include <tools/hbook/h1>
|
||||
#include <tools/hbook/h2>
|
||||
#include <tools/hbook/p1>
|
||||
#include <tools/hbook/wntuple>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#define setpawc setpawc_
|
||||
#define setntuc setntuc_
|
||||
//#define ntuc ntuc_
|
||||
|
||||
class ExG4HbookAnalysisManager;
|
||||
|
||||
namespace G4Hbook {
|
||||
typedef tools::hbook::h1 G4AnaH1;
|
||||
typedef tools::hbook::h1 G4H1;
|
||||
typedef tools::hbook::h2 G4AnaH2;
|
||||
typedef tools::hbook::h2 G4H2;
|
||||
typedef tools::hbook::p1 G4P1;
|
||||
typedef tools::hbook::wntuple G4Ntuple;
|
||||
typedef ExG4HbookAnalysisManager G4AnalysisManager;
|
||||
}
|
||||
|
||||
class ExG4HbookFileManager;
|
||||
class ExG4HbookH1Manager;
|
||||
class ExG4HbookH2Manager;
|
||||
class ExG4HbookH3DummyManager;
|
||||
class ExG4HbookP1Manager;
|
||||
class ExG4HbookP2DummyManager;
|
||||
class ExG4HbookNtupleManager;
|
||||
|
||||
/// HBook Analysis manager
|
||||
///
|
||||
/// The class implements the G4VAnalysisManager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookAnalysisManager : public G4VAnalysisManager
|
||||
{
|
||||
public:
|
||||
ExG4HbookAnalysisManager();
|
||||
virtual ~ExG4HbookAnalysisManager();
|
||||
|
||||
// static methods
|
||||
static ExG4HbookAnalysisManager* Create(G4bool isMaster = true);
|
||||
static ExG4HbookAnalysisManager* Instance();
|
||||
|
||||
// HBOOK does not allow IDs the same IDs for H1 and H2,
|
||||
// and also IDs starting from 0; thats why there is defined an offset
|
||||
// with respect to the G4AnalysisManager generic Ids.
|
||||
// The default values of these offsets can be changed by the user.
|
||||
//
|
||||
// Set the offset of HBOOK ID for H1
|
||||
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
|
||||
G4bool SetH1HbookIdOffset(G4int offset);
|
||||
G4int GetH1HbookIdOffset() const;
|
||||
|
||||
// Set the offset of HBOOK ID for H2
|
||||
// ( default value = firstHistoID + 100 if firstHistoID > 0;
|
||||
// otherwise = 101 )
|
||||
G4bool SetH2HbookIdOffset(G4int offset);
|
||||
G4int GetH2HbookIdOffset() const;
|
||||
|
||||
// Set the offset of NTUPLE ID for ntuples
|
||||
// ( default value = firstNtupleID if firstNtupleID > 0; otherwise = 1)
|
||||
G4bool SetNtupleHbookIdOffset(G4int offset);
|
||||
G4int GetNtupleHbookIdOffset() const;
|
||||
|
||||
// Access methods
|
||||
//
|
||||
tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
tools::hbook::wntuple* GetNtuple() const;
|
||||
tools::hbook::wntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hbook::h1*>::iterator BeginH1();
|
||||
std::vector<tools::hbook::h1*>::iterator EndH1();
|
||||
std::vector<tools::hbook::h1*>::const_iterator BeginConstH1() const;
|
||||
std::vector<tools::hbook::h1*>::const_iterator EndConstH1() const;
|
||||
|
||||
std::vector<tools::hbook::h2*>::iterator BeginH2();
|
||||
std::vector<tools::hbook::h2*>::iterator EndH2();
|
||||
std::vector<tools::hbook::h2*>::const_iterator BeginConstH2() const;
|
||||
std::vector<tools::hbook::h2*>::const_iterator EndConstH2() const;
|
||||
|
||||
std::vector<tools::hbook::wntuple*>::iterator BeginNtuple();
|
||||
std::vector<tools::hbook::wntuple*>::iterator EndNtuple();
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
protected:
|
||||
// virtual methods from base class
|
||||
virtual G4bool OpenFileImpl(const G4String& fileName);
|
||||
virtual G4bool WriteImpl();
|
||||
virtual G4bool CloseFileImpl();
|
||||
|
||||
private:
|
||||
// static data members
|
||||
//
|
||||
static ExG4HbookAnalysisManager* fgInstance;
|
||||
|
||||
// methods
|
||||
//
|
||||
void Reset();
|
||||
|
||||
ExG4HbookH1Manager* fH1Manager;
|
||||
ExG4HbookH2Manager* fH2Manager;
|
||||
ExG4HbookH3DummyManager* fH3Manager;
|
||||
ExG4HbookP1Manager* fP1Manager;
|
||||
ExG4HbookP2DummyManager* fP2Manager;
|
||||
ExG4HbookNtupleManager* fNtupleManager;
|
||||
ExG4HbookFileManager* fFileManager;
|
||||
};
|
||||
|
||||
#include "ExG4HbookAnalysisManager.icc"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExG4HbookAnalysisManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
/// \file hbook/include/ExG4HbookAnalysisManager.icc
|
||||
/// \brief Inline functions of the ExG4HbookAnalysisManager class
|
||||
|
||||
|
||||
#include "ExG4HbookH1Manager.hh"
|
||||
#include "ExG4HbookH2Manager.hh"
|
||||
#include "ExG4HbookNtupleManager.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4bool ExG4HbookAnalysisManager::SetH1HbookIdOffset(G4int offset)
|
||||
{
|
||||
return fH1Manager->SetH1HbookIdOffset(offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4int ExG4HbookAnalysisManager::GetH1HbookIdOffset() const
|
||||
{
|
||||
return fH1Manager->GetH1HbookIdOffset();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4bool ExG4HbookAnalysisManager::SetH2HbookIdOffset(G4int offset)
|
||||
{
|
||||
return fH2Manager->SetH2HbookIdOffset(offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4int ExG4HbookAnalysisManager::GetH2HbookIdOffset() const
|
||||
{
|
||||
return fH2Manager->GetH2HbookIdOffset();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4bool ExG4HbookAnalysisManager::SetNtupleHbookIdOffset(G4int offset)
|
||||
{
|
||||
return fNtupleManager->SetNtupleHbookIdOffset(offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
G4int ExG4HbookAnalysisManager::GetNtupleHbookIdOffset() const
|
||||
{
|
||||
return fNtupleManager->GetNtupleHbookIdOffset();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hbook::h1* ExG4HbookAnalysisManager::GetH1(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fH1Manager->GetH1(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hbook::h2* ExG4HbookAnalysisManager::GetH2(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return fH2Manager->GetH2(id, warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hbook::wntuple* ExG4HbookAnalysisManager::GetNtuple() const
|
||||
{
|
||||
return fNtupleManager->GetNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
tools::hbook::wntuple* ExG4HbookAnalysisManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
return fNtupleManager->GetNtuple(ntupleId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h1*>::iterator ExG4HbookAnalysisManager::BeginH1()
|
||||
{
|
||||
return fH1Manager->BeginH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h1*>::iterator ExG4HbookAnalysisManager::EndH1()
|
||||
{
|
||||
return fH1Manager->EndH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h1*>::const_iterator
|
||||
ExG4HbookAnalysisManager::BeginConstH1() const
|
||||
{
|
||||
return fH1Manager->BeginConstH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h1*>::const_iterator
|
||||
ExG4HbookAnalysisManager::EndConstH1() const
|
||||
{
|
||||
return fH1Manager->EndConstH1();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h2*>::iterator ExG4HbookAnalysisManager::BeginH2()
|
||||
{
|
||||
return fH2Manager->BeginH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h2*>::iterator ExG4HbookAnalysisManager::EndH2()
|
||||
{
|
||||
return fH2Manager->EndH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h2*>::const_iterator
|
||||
ExG4HbookAnalysisManager::BeginConstH2() const
|
||||
{
|
||||
return fH2Manager->BeginConstH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::h2*>::const_iterator
|
||||
ExG4HbookAnalysisManager::EndConstH2() const
|
||||
{
|
||||
return fH2Manager->EndConstH2();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::wntuple*>::iterator ExG4HbookAnalysisManager::BeginNtuple()
|
||||
{
|
||||
return fNtupleManager->BeginNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::wntuple*>::iterator ExG4HbookAnalysisManager::EndNtuple()
|
||||
{
|
||||
return fNtupleManager->EndNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator
|
||||
ExG4HbookAnalysisManager::BeginConstNtuple() const
|
||||
{
|
||||
return fNtupleManager->BeginConstNtuple();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator
|
||||
ExG4HbookAnalysisManager::EndConstNtuple() const
|
||||
{
|
||||
return fNtupleManager->EndConstNtuple();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// \file hbook/include/ExG4HbookBaseHnManager.hh
|
||||
/// \brief Definition of the ExG4HbookBaseHnManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef ExG4HbookBaseHnManager_h
|
||||
#define ExG4HbookBaseHnManager_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "tools/hbook/base_histo"
|
||||
#include "tools/hbook/axis"
|
||||
|
||||
/// Manager class for tools::hbook::base_histo functions.
|
||||
///
|
||||
/// It implements functions common to all hbook histograms and profiles.
|
||||
|
||||
class ExG4HbookBaseHnManager //: public G4VH1Manager
|
||||
{
|
||||
public:
|
||||
ExG4HbookBaseHnManager(const G4String& hnType);
|
||||
virtual ~ExG4HbookBaseHnManager();
|
||||
|
||||
friend class ExG4HbookH1Manager;
|
||||
friend class ExG4HbookH2Manager;
|
||||
friend class ExG4HbookP1Manager;
|
||||
|
||||
protected:
|
||||
typedef tools::hbook::base_histo G4HbookBaseHisto;
|
||||
|
||||
// Access to datA parameters
|
||||
G4int GetNbins(const tools::hbook::axis& axis) const;
|
||||
G4double GetMin(const tools::hbook::axis& axis) const;
|
||||
G4double GetMax(const tools::hbook::axis& axis) const;
|
||||
G4double GetWidth(const tools::hbook::axis& axis) const;
|
||||
|
||||
// Attributes for plotting
|
||||
//
|
||||
|
||||
// Setters
|
||||
//G4bool SetTitle(G4HbookBaseHisto& baseHisto, const G4String& title);
|
||||
G4bool SetAxisTitle(G4HbookBaseHisto& baseHisto, G4int dimension, const G4String& title);
|
||||
|
||||
// Accessors
|
||||
//G4String GetTitle(const G4HbookBaseHisto& baseHisto) const;
|
||||
G4String GetAxisTitle(const G4HbookBaseHisto& baseHisto, G4int dimension) const;
|
||||
|
||||
// Static data members
|
||||
static const G4int kX;
|
||||
static const G4int kY;
|
||||
static const G4int kZ;
|
||||
|
||||
private:
|
||||
// Data members
|
||||
G4String fHnType;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookFileManager.hh
|
||||
/// \brief Definition of the ExG4HbookFileManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookFileManager_h
|
||||
#define ExG4HbookFileManager_h 1
|
||||
|
||||
#include "G4VFileManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/wfile>
|
||||
|
||||
/// Manager class for HBook file operations.
|
||||
///
|
||||
/// The class implements the G4VFileManager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookFileManager : public G4VFileManager
|
||||
{
|
||||
public:
|
||||
ExG4HbookFileManager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookFileManager();
|
||||
|
||||
// Methods to manipulate files
|
||||
using G4VFileManager::OpenFile;
|
||||
virtual G4bool OpenFile(const G4String& fileName);
|
||||
virtual G4bool WriteFile();
|
||||
virtual G4bool CloseFile();
|
||||
|
||||
// Specific methods for files per objects
|
||||
void CreateNtupleDirectory();
|
||||
|
||||
// Get method
|
||||
G4bool IsFile() const;
|
||||
|
||||
private:
|
||||
static const G4String fgkDefaultNtupleDirectoryName;
|
||||
|
||||
// data members
|
||||
tools::hbook::wfile* fFile;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline G4bool ExG4HbookFileManager::IsFile() const
|
||||
{ return fFile; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,237 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookH1Manager.hh
|
||||
/// \brief Definition of the ExG4HbookH1Manager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookH1Manager_h
|
||||
#define ExG4HbookH1Manager_h 1
|
||||
|
||||
#include "G4VH1Manager.hh"
|
||||
#include "G4HnInformation.hh"
|
||||
#include "ExG4HbookBaseHnManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/h1>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class ExG4HbookFileManager;
|
||||
|
||||
struct h1_booking {
|
||||
h1_booking(G4int nbins, G4double xmin, G4double xmax)
|
||||
: fTitle(""),
|
||||
fNbins(nbins),
|
||||
fXmin(xmin),
|
||||
fXmax(xmax),
|
||||
fEdges() {}
|
||||
h1_booking(const std::vector<G4double>& edges)
|
||||
: fTitle(""),
|
||||
fNbins(0),
|
||||
fXmin(0),
|
||||
fXmax(0),
|
||||
fEdges() {
|
||||
for (G4int i=0; i<=G4int(edges.size()); ++i) fEdges.push_back(edges[i]);
|
||||
}
|
||||
G4String fTitle;
|
||||
G4int fNbins;
|
||||
G4double fXmin;
|
||||
G4double fXmax;
|
||||
std::vector<G4double> fEdges;
|
||||
};
|
||||
|
||||
/// Manager class for HBook H1 histograms
|
||||
///
|
||||
/// The class implements the G4VH1Manager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookH1Manager : public G4VH1Manager
|
||||
{
|
||||
friend class ExG4HbookAnalysisManager;
|
||||
|
||||
protected:
|
||||
ExG4HbookH1Manager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookH1Manager();
|
||||
|
||||
// Functions specific to the output type
|
||||
//
|
||||
|
||||
// HBOOK does not allow IDs the same IDs for H1 and H2,
|
||||
// and also IDs starting from 0; thats why there is defined an offset
|
||||
// with respect to the G4AnalysisManager generic Ids.
|
||||
// The default values of these offsets can be changed by the user.
|
||||
//
|
||||
// Set the offset of HBOOK ID for H1
|
||||
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
|
||||
G4bool SetH1HbookIdOffset(G4int offset);
|
||||
G4int GetH1HbookIdOffset() const;
|
||||
|
||||
// Set methods
|
||||
void SetFileManager(ExG4HbookFileManager* fileManager);
|
||||
|
||||
// Access methods
|
||||
//
|
||||
tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hbook::h1*>::iterator BeginH1();
|
||||
std::vector<tools::hbook::h1*>::iterator EndH1();
|
||||
std::vector<tools::hbook::h1*>::const_iterator BeginConstH1() const;
|
||||
std::vector<tools::hbook::h1*>::const_iterator EndConstH1() const;
|
||||
|
||||
// Virtual functions from base class
|
||||
//
|
||||
|
||||
// Methods to create histogrammes, ntuples
|
||||
virtual G4int CreateH1(const G4String& name, const G4String& title,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName = "none",
|
||||
const G4String& fcnName = "none",
|
||||
const G4String& binSchemeName = "linear");
|
||||
virtual G4int CreateH1(const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName = "none",
|
||||
const G4String& fcnName = "none");
|
||||
|
||||
virtual G4bool SetH1(G4int id,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName = "none",
|
||||
const G4String& fcnName = "none",
|
||||
const G4String& binSchemeName = "linear");
|
||||
virtual G4bool SetH1(G4int id,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName = "none",
|
||||
const G4String& fcnName = "none");
|
||||
|
||||
virtual G4bool ScaleH1(G4int id, G4double factor);
|
||||
|
||||
|
||||
// Methods to fill histogrammes, ntuples
|
||||
virtual G4bool FillH1(G4int id, G4double value, G4double weight = 1.0);
|
||||
|
||||
// Access methods
|
||||
//
|
||||
virtual G4int GetH1Id(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Access to H1 parameters
|
||||
virtual G4int GetH1Nbins(G4int id) const;
|
||||
virtual G4double GetH1Xmin(G4int id) const;
|
||||
virtual G4double GetH1Xmax(G4int id) const;
|
||||
virtual G4double GetH1Width(G4int id) const;
|
||||
|
||||
// Setters for attributes for plotting
|
||||
virtual G4bool SetH1Title(G4int id, const G4String& title);
|
||||
virtual G4bool SetH1XAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetH1YAxisTitle(G4int id, const G4String& title);
|
||||
|
||||
// Access attributes for plotting
|
||||
virtual G4String GetH1Title(G4int id) const;
|
||||
virtual G4String GetH1XAxisTitle(G4int id) const;
|
||||
virtual G4String GetH1YAxisTitle(G4int id) const;
|
||||
|
||||
// Write data on ASCII file
|
||||
virtual G4bool WriteOnAscii(std::ofstream& output);
|
||||
|
||||
private:
|
||||
// methods
|
||||
//
|
||||
void SetH1HbookIdOffset();
|
||||
void AddH1Information(const G4String& name,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme) const;
|
||||
|
||||
G4int CreateH1FromBooking(h1_booking* h1Booking,
|
||||
G4bool chDir = true);
|
||||
G4int RegisterH1Booking(const G4String& name,
|
||||
h1_booking* h1Booking);
|
||||
|
||||
void BeginCreateH1(const G4String& name);
|
||||
G4int FinishCreateH1(const G4String& name, h1_booking* h1Booking,
|
||||
const G4String& unitName, const G4String& fcnName,
|
||||
G4BinScheme binScheme);
|
||||
|
||||
G4bool BeginSetH1(G4int id,
|
||||
h1_booking* h1Booking,
|
||||
G4HnInformation* info);
|
||||
G4bool FinishSetH1(G4int id,
|
||||
G4HnInformation* info,
|
||||
const G4String& unitName, const G4String& fcnName,
|
||||
G4BinScheme binScheme);
|
||||
|
||||
void CreateH1sFromBooking();
|
||||
void Reset();
|
||||
virtual h1_booking* GetH1Booking(G4int id, G4bool warn = true) const;
|
||||
|
||||
virtual tools::hbook::h1* GetH1InFunction(G4int id, G4String function,
|
||||
G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// data members
|
||||
//
|
||||
ExG4HbookBaseHnManager fBaseToolsManager;
|
||||
ExG4HbookFileManager* fFileManager;
|
||||
G4int fH1HbookIdOffset;
|
||||
std::vector<tools::hbook::h1*> fH1Vector;
|
||||
std::vector<h1_booking*> fH1BookingVector;
|
||||
std::map<G4String, G4int> fH1NameIdMap;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void ExG4HbookH1Manager::SetFileManager(ExG4HbookFileManager* fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
inline G4int ExG4HbookH1Manager::GetH1HbookIdOffset() const {
|
||||
return fH1HbookIdOffset;
|
||||
}
|
||||
|
||||
inline std::vector<tools::hbook::h1*>::iterator ExG4HbookH1Manager::BeginH1()
|
||||
{ return fH1Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::h1*>::iterator ExG4HbookH1Manager::EndH1()
|
||||
{ return fH1Vector.end(); }
|
||||
|
||||
inline std::vector<tools::hbook::h1*>::const_iterator
|
||||
ExG4HbookH1Manager::BeginConstH1() const
|
||||
{ return fH1Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::h1*>::const_iterator
|
||||
ExG4HbookH1Manager::EndConstH1() const
|
||||
{ return fH1Vector.end(); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,232 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookH2Manager.hh
|
||||
/// \brief Definition of the ExG4HbookH2Manager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookH2Manager_h
|
||||
#define ExG4HbookH2Manager_h 1
|
||||
|
||||
#include "G4VH2Manager.hh"
|
||||
#include "ExG4HbookBaseHnManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/h2>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class ExG4HbookFileManager;
|
||||
|
||||
struct h2_booking {
|
||||
h2_booking(G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax)
|
||||
: fTitle(""),
|
||||
fNxbins(nxbins),
|
||||
fXmin(xmin),
|
||||
fXmax(xmax),
|
||||
fNybins(nybins),
|
||||
fYmin(ymin),
|
||||
fYmax(ymax) {}
|
||||
G4String fTitle;
|
||||
G4int fNxbins;
|
||||
G4double fXmin;
|
||||
G4double fXmax;
|
||||
G4int fNybins;
|
||||
G4double fYmin;
|
||||
G4double fYmax;
|
||||
};
|
||||
|
||||
/// Manager class for HBook H2 histograms
|
||||
///
|
||||
/// The class implements the G4VH2Manager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookH2Manager : public G4VH2Manager
|
||||
{
|
||||
friend class ExG4HbookAnalysisManager;
|
||||
|
||||
protected:
|
||||
ExG4HbookH2Manager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookH2Manager();
|
||||
|
||||
// Functions specific to the output type
|
||||
//
|
||||
|
||||
// Set the offset of HBOOK ID for H2
|
||||
// ( default value = firstHistoID + 100 if firstHistoID > 0;
|
||||
// otherwise = 101 )
|
||||
G4bool SetH2HbookIdOffset(G4int offset);
|
||||
G4int GetH2HbookIdOffset() const;
|
||||
|
||||
// Set methods
|
||||
void SetFileManager(ExG4HbookFileManager* fileManager);
|
||||
|
||||
// Access methods
|
||||
tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hbook::h2*>::iterator BeginH2();
|
||||
std::vector<tools::hbook::h2*>::iterator EndH2();
|
||||
std::vector<tools::hbook::h2*>::const_iterator BeginConstH2() const;
|
||||
std::vector<tools::hbook::h2*>::const_iterator EndConstH2() const;
|
||||
|
||||
protected:
|
||||
// Virtual functions from base class
|
||||
//
|
||||
|
||||
// Methods to create histogrammes, ntuples
|
||||
virtual G4int CreateH2(const G4String& name, const G4String& title,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear");
|
||||
|
||||
virtual G4int CreateH2(const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none");
|
||||
|
||||
virtual G4bool SetH2(G4int id,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear");
|
||||
|
||||
virtual G4bool SetH2(G4int id,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none");
|
||||
|
||||
virtual G4bool ScaleH2(G4int id, G4double factor);
|
||||
|
||||
// Methods to fill histogrammes, ntuples
|
||||
virtual G4bool FillH2(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight = 1.0);
|
||||
|
||||
// Access methods via names
|
||||
virtual G4int GetH2Id(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Access to H2 parameters
|
||||
virtual G4int GetH2Nxbins(G4int id) const;
|
||||
virtual G4double GetH2Xmin(G4int id) const;
|
||||
virtual G4double GetH2Xmax(G4int id) const;
|
||||
virtual G4double GetH2XWidth(G4int id) const;
|
||||
virtual G4int GetH2Nybins(G4int id) const;
|
||||
virtual G4double GetH2Ymin(G4int id) const;
|
||||
virtual G4double GetH2Ymax(G4int id) const;
|
||||
virtual G4double GetH2YWidth(G4int id) const;
|
||||
|
||||
// Setters for attributes for plotting
|
||||
virtual G4bool SetH2Title(G4int id, const G4String& title);
|
||||
virtual G4bool SetH2XAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetH2YAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetH2ZAxisTitle(G4int id, const G4String& title);
|
||||
|
||||
// Access attributes for plotting
|
||||
virtual G4String GetH2Title(G4int id) const;
|
||||
virtual G4String GetH2XAxisTitle(G4int id) const;
|
||||
virtual G4String GetH2YAxisTitle(G4int id) const;
|
||||
virtual G4String GetH2ZAxisTitle(G4int id) const;
|
||||
|
||||
// Write data on ASCII file
|
||||
virtual G4bool WriteOnAscii(std::ofstream& output);
|
||||
|
||||
private:
|
||||
// static data members
|
||||
//
|
||||
static const G4int fgkDefaultH2HbookIdOffset;
|
||||
|
||||
// methods
|
||||
//
|
||||
void SetH2HbookIdOffset();
|
||||
void CreateH2sFromBooking();
|
||||
|
||||
void Reset();
|
||||
virtual h2_booking* GetH2Booking(G4int id, G4bool warn = true) const;
|
||||
|
||||
virtual tools::hbook::h2* GetH2InFunction(G4int id, G4String function,
|
||||
G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// data members
|
||||
//
|
||||
ExG4HbookBaseHnManager fBaseToolsManager;
|
||||
ExG4HbookFileManager* fFileManager;
|
||||
G4int fH2HbookIdOffset;
|
||||
std::vector<tools::hbook::h2*> fH2Vector;
|
||||
std::vector<h2_booking*> fH2BookingVector;
|
||||
std::map<G4String, G4int> fH2NameIdMap;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void ExG4HbookH2Manager::SetFileManager(ExG4HbookFileManager* fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
inline G4int ExG4HbookH2Manager::GetH2HbookIdOffset() const {
|
||||
return fH2HbookIdOffset;
|
||||
}
|
||||
|
||||
inline std::vector<tools::hbook::h2*>::iterator ExG4HbookH2Manager::BeginH2()
|
||||
{ return fH2Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::h2*>::iterator ExG4HbookH2Manager::EndH2()
|
||||
{ return fH2Vector.end(); }
|
||||
|
||||
inline std::vector<tools::hbook::h2*>::const_iterator
|
||||
ExG4HbookH2Manager::BeginConstH2() const
|
||||
{ return fH2Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::h2*>::const_iterator
|
||||
ExG4HbookH2Manager::EndConstH2() const
|
||||
{ return fH2Vector.end(); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,170 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExG4HbookH3DummyManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
/// \file hbook/include/ExG4HbookH3DummyManager.hh
|
||||
/// \brief Definition of the ExG4HbookH3DummyManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef ExG4HbookH3DummyManager_h
|
||||
#define ExG4HbookH3DummyManager_h 1
|
||||
|
||||
#include "G4VH3Manager.hh"
|
||||
#include "G4BaseToolsManager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace tools {
|
||||
namespace histo {
|
||||
class h3d;
|
||||
}
|
||||
}
|
||||
|
||||
/// Manager class for H3 with dummy implementation.
|
||||
///
|
||||
/// It will just issue warnings.
|
||||
|
||||
class ExG4HbookH3DummyManager : public G4VH3Manager
|
||||
{
|
||||
public:
|
||||
ExG4HbookH3DummyManager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookH3DummyManager();
|
||||
|
||||
protected:
|
||||
// Virtual functions from base class
|
||||
//
|
||||
|
||||
// Methods to create histograms
|
||||
//
|
||||
virtual G4int CreateH3(const G4String& name, const G4String& title,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
G4int nzbins, G4double zmin, G4double zmax,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear",
|
||||
const G4String& zbinScheme = "linear");
|
||||
|
||||
virtual G4int CreateH3(const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
const std::vector<G4double>& zedges,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none");
|
||||
|
||||
virtual G4bool SetH3(G4int id,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
G4int nzbins, G4double zmin, G4double zmax,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear",
|
||||
const G4String& zbinScheme = "linear");
|
||||
|
||||
virtual G4bool SetH3(G4int id,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
const std::vector<G4double>& zedges,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none");
|
||||
|
||||
virtual G4bool ScaleH3(G4int id, G4double factor);
|
||||
|
||||
// Method to fill histograms
|
||||
//
|
||||
virtual G4bool FillH3(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0);
|
||||
|
||||
|
||||
// Methods to manipulate histograms
|
||||
//
|
||||
|
||||
// Access methods
|
||||
virtual G4int GetH3Id(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Access to H3 parameters
|
||||
virtual G4int GetH3Nxbins(G4int id) const;
|
||||
virtual G4double GetH3Xmin(G4int id) const;
|
||||
virtual G4double GetH3Xmax(G4int id) const;
|
||||
virtual G4double GetH3XWidth(G4int id) const;
|
||||
virtual G4int GetH3Nybins(G4int id) const;
|
||||
virtual G4double GetH3Ymin(G4int id) const;
|
||||
virtual G4double GetH3Ymax(G4int id) const;
|
||||
virtual G4double GetH3YWidth(G4int id) const;
|
||||
virtual G4int GetH3Nzbins(G4int id) const;
|
||||
virtual G4double GetH3Zmin(G4int id) const;
|
||||
virtual G4double GetH3Zmax(G4int id) const;
|
||||
virtual G4double GetH3ZWidth(G4int id) const;
|
||||
|
||||
// Setters for attributes for plotting
|
||||
virtual G4bool SetH3Title(G4int id, const G4String& title);
|
||||
virtual G4bool SetH3XAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetH3YAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetH3ZAxisTitle(G4int id, const G4String& title);
|
||||
|
||||
// Access attributes for plotting
|
||||
virtual G4String GetH3Title(G4int id) const;
|
||||
virtual G4String GetH3XAxisTitle(G4int id) const;
|
||||
virtual G4String GetH3YAxisTitle(G4int id) const;
|
||||
virtual G4String GetH3ZAxisTitle(G4int id) const;
|
||||
|
||||
// Write data on ASCII file
|
||||
virtual G4bool WriteOnAscii(std::ofstream& output);
|
||||
|
||||
private:
|
||||
// methods
|
||||
void ExceptionForHistograms(const G4String& functionName);
|
||||
void ExceptionForHistogramsConst(const G4String& functionName) const;
|
||||
|
||||
// data members
|
||||
G4bool fWarn;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4HnInformation.hh 66310 2012-12-17 11:56:35Z ihrivnac $
|
||||
|
||||
/// \file hbook/include/ExG4HbookNtupleDescription.hh
|
||||
/// \brief Definition of the ExG4HbookNtupleDescription structure
|
||||
|
||||
// Author: Ivana Hrivnacova, 04/07/2012 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookNtupleDescription_h
|
||||
#define ExG4HbookNtupleDescription_h 1
|
||||
|
||||
#include "tools/hbook/wntuple"
|
||||
#include "tools/ntuple_booking"
|
||||
|
||||
#include <map>
|
||||
|
||||
/// Structure containing the information related to one Hbook ntuple
|
||||
|
||||
struct ExG4HbookNtupleDescription
|
||||
{
|
||||
ExG4HbookNtupleDescription()
|
||||
: fNtuple(0),
|
||||
fNtupleBooking(0),
|
||||
fNtupleIColumnMap(),
|
||||
fNtupleFColumnMap(),
|
||||
fNtupleDColumnMap() {}
|
||||
|
||||
~ExG4HbookNtupleDescription()
|
||||
{ delete fNtupleBooking; }
|
||||
|
||||
tools::hbook::wntuple* fNtuple;
|
||||
tools::ntuple_booking* fNtupleBooking;
|
||||
std::map<G4int, tools::hbook::wntuple::column<int>* > fNtupleIColumnMap;
|
||||
std::map<G4int, tools::hbook::wntuple::column<float>* > fNtupleFColumnMap;
|
||||
std::map<G4int, tools::hbook::wntuple::column<double>* > fNtupleDColumnMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,186 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookNtupleManager.hh
|
||||
/// \brief Definition of the ExG4HbookNtupleManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookNtupleManager_h
|
||||
#define ExG4HbookNtupleManager_h 1
|
||||
|
||||
#include "G4VNtupleManager.hh"
|
||||
#include "ExG4HbookNtupleDescription.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/wntuple>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class ExG4HbookFileManager;
|
||||
|
||||
/// Manager class for HBook ntuples
|
||||
///
|
||||
/// The class implements the G4VAnalysisManager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookNtupleManager : public G4VNtupleManager
|
||||
{
|
||||
friend class ExG4HbookAnalysisManager;
|
||||
|
||||
protected:
|
||||
ExG4HbookNtupleManager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookNtupleManager();
|
||||
|
||||
// Functions specific to the output type
|
||||
//
|
||||
|
||||
// Set the offset of NTUPLE ID for ntuples
|
||||
// ( default value = firstNtupleID if firstNtupleID > 0; otherwise = 1)
|
||||
G4bool SetNtupleHbookIdOffset(G4int offset);
|
||||
G4int GetNtupleHbookIdOffset() const;
|
||||
|
||||
// Set methods
|
||||
void SetFileManager(ExG4HbookFileManager* fileManager);
|
||||
|
||||
// Access methods
|
||||
tools::hbook::wntuple* GetNtuple() const;
|
||||
tools::hbook::wntuple* GetNtuple(G4int ntupleId) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hbook::wntuple*>::iterator BeginNtuple();
|
||||
std::vector<tools::hbook::wntuple*>::iterator EndNtuple();
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator BeginConstNtuple() const;
|
||||
std::vector<tools::hbook::wntuple*>::const_iterator EndConstNtuple() const;
|
||||
|
||||
// Virtual functions from base class
|
||||
//
|
||||
// Methods to create ntuples
|
||||
virtual G4int CreateNtuple(const G4String& name, const G4String& title);
|
||||
// Create columns in the last created ntuple
|
||||
virtual G4int CreateNtupleIColumn(
|
||||
const G4String& name, std::vector<int>* vector);
|
||||
virtual G4int CreateNtupleFColumn(
|
||||
const G4String& name, std::vector<float>* vector);
|
||||
virtual G4int CreateNtupleDColumn(
|
||||
const G4String& name, std::vector<double>* vector);
|
||||
virtual G4int CreateNtupleSColumn(const G4String& name);
|
||||
virtual void FinishNtuple();
|
||||
// Create columns in the ntuple with given id
|
||||
virtual G4int CreateNtupleIColumn(G4int ntupleId,
|
||||
const G4String& name, std::vector<int>* vector);
|
||||
virtual G4int CreateNtupleFColumn(G4int ntupleId,
|
||||
const G4String& name, std::vector<float>* vector);
|
||||
virtual G4int CreateNtupleDColumn(G4int ntupleId,
|
||||
const G4String& name, std::vector<double>* vector);
|
||||
virtual G4int CreateNtupleSColumn(G4int ntupleId, const G4String& name);
|
||||
virtual void FinishNtuple(G4int ntupleId);
|
||||
|
||||
// Methods to fill ntuples
|
||||
// Methods for ntuple with id = FirstNtupleId
|
||||
virtual G4bool FillNtupleIColumn(G4int columnId, G4int value);
|
||||
virtual G4bool FillNtupleFColumn(G4int columnId, G4float value);
|
||||
virtual G4bool FillNtupleDColumn(G4int columnId, G4double value);
|
||||
virtual G4bool FillNtupleSColumn(G4int columnId, const G4String& value);
|
||||
virtual G4bool AddNtupleRow();
|
||||
// Methods for ntuple with id > FirstNtupleId (when more ntuples exist)
|
||||
virtual G4bool FillNtupleIColumn(
|
||||
G4int ntupleId, G4int columnId, G4int value);
|
||||
virtual G4bool FillNtupleFColumn(
|
||||
G4int ntupleId, G4int columnId, G4float value);
|
||||
virtual G4bool FillNtupleDColumn(
|
||||
G4int ntupleId, G4int columnId, G4double value);
|
||||
virtual G4bool FillNtupleSColumn(
|
||||
G4int ntupleId, G4int columnId, const G4String& value);
|
||||
virtual G4bool AddNtupleRow(G4int ntupleId);
|
||||
|
||||
// Access methods
|
||||
virtual G4int GetNofNtuples() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
//
|
||||
void SetNtupleHbookIdOffset();
|
||||
void CreateNtuplesFromBooking();
|
||||
|
||||
tools::hbook::wntuple::column<int>*
|
||||
GetNtupleIColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::hbook::wntuple::column<float>*
|
||||
GetNtupleFColumn(G4int ntupleId, G4int columnId) const;
|
||||
tools::hbook::wntuple::column<double>*
|
||||
GetNtupleDColumn(G4int ntupleId, G4int columnId) const;
|
||||
|
||||
void Reset();
|
||||
ExG4HbookNtupleDescription* GetNtupleInFunction(G4int id,
|
||||
G4String function,
|
||||
G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// data members
|
||||
//
|
||||
ExG4HbookFileManager* fFileManager;
|
||||
G4int fNtupleHbookIdOffset;
|
||||
std::vector<ExG4HbookNtupleDescription*> fNtupleDescriptionVector;
|
||||
std::vector<tools::hbook::wntuple*> fNtupleVector;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void ExG4HbookNtupleManager::SetFileManager(ExG4HbookFileManager* fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
inline G4int ExG4HbookNtupleManager::GetNtupleHbookIdOffset() const {
|
||||
return fNtupleHbookIdOffset;
|
||||
}
|
||||
|
||||
inline std::vector<tools::hbook::wntuple*>::iterator
|
||||
ExG4HbookNtupleManager::BeginNtuple()
|
||||
{ return fNtupleVector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::wntuple*>::iterator
|
||||
ExG4HbookNtupleManager::EndNtuple()
|
||||
{ return fNtupleVector.end(); }
|
||||
|
||||
inline std::vector<tools::hbook::wntuple*>::const_iterator
|
||||
ExG4HbookNtupleManager::BeginConstNtuple() const
|
||||
{ return fNtupleVector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::wntuple*>::const_iterator
|
||||
ExG4HbookNtupleManager::EndConstNtuple() const
|
||||
{ return fNtupleVector.end(); }
|
||||
|
||||
inline G4int ExG4HbookNtupleManager::GetNofNtuples() const
|
||||
{ return fNtupleVector.size(); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,267 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/ExG4HbookP1Manager.hh
|
||||
/// \brief Definition of the ExG4HbookP1Manager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#ifndef ExG4HbookP1Manager_h
|
||||
#define ExG4HbookP1Manager_h 1
|
||||
|
||||
#include "G4VP1Manager.hh"
|
||||
#include "G4HnInformation.hh"
|
||||
#include "ExG4HbookBaseHnManager.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <tools/hbook/p1>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class ExG4HbookFileManager;
|
||||
|
||||
struct p1_booking {
|
||||
p1_booking(G4int nbins, G4double xmin, G4double xmax,
|
||||
G4double ymin, G4double ymax)
|
||||
: fTitle(""),
|
||||
fNbins(nbins),
|
||||
fXmin(xmin),
|
||||
fXmax(xmax),
|
||||
fYmin(ymin),
|
||||
fYmax(ymax),
|
||||
fEdges() {}
|
||||
p1_booking(const std::vector<G4double>& edges,
|
||||
G4double ymin, G4double ymax)
|
||||
: fTitle(""),
|
||||
fNbins(0),
|
||||
fXmin(0),
|
||||
fXmax(0),
|
||||
fYmin(ymin),
|
||||
fYmax(ymax),
|
||||
fEdges() {
|
||||
for (G4int i=0; i<=G4int(edges.size()); ++i) fEdges.push_back(edges[i]);
|
||||
}
|
||||
G4String fTitle;
|
||||
G4int fNbins;
|
||||
G4double fXmin;
|
||||
G4double fXmax;
|
||||
G4double fYmin;
|
||||
G4double fYmax;
|
||||
std::vector<G4double> fEdges;
|
||||
};
|
||||
|
||||
/// Manager class for HBook P1 histograms
|
||||
///
|
||||
/// The class implements the G4VP1Manager manager for HBook.
|
||||
/// It is provided separately from geant4/source/analysis in order
|
||||
/// to avoid a need of linking Geant4 kernel libraries with cerblib.
|
||||
|
||||
class ExG4HbookP1Manager : public G4VP1Manager
|
||||
{
|
||||
friend class ExG4HbookAnalysisManager;
|
||||
|
||||
protected:
|
||||
ExG4HbookP1Manager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookP1Manager();
|
||||
|
||||
// Functions specific to the output type
|
||||
//
|
||||
|
||||
// HBOOK does not allow IDs the same IDs for P1 and H2,
|
||||
// and also IDs starting from 0; thats why there is defined an offset
|
||||
// with respect to the G4AnalysisManager generic Ids.
|
||||
// The default values of these offsets can be changed by the user.
|
||||
//
|
||||
// Set the offset of HBOOK ID for P1
|
||||
// ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
|
||||
G4bool SetP1HbookIdOffset(G4int offset);
|
||||
G4int GetP1HbookIdOffset() const;
|
||||
|
||||
// Set methods
|
||||
void SetFileManager(ExG4HbookFileManager* fileManager);
|
||||
|
||||
// Access methods
|
||||
//
|
||||
tools::hbook::p1* GetP1(G4int id, G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// Iterators
|
||||
std::vector<tools::hbook::p1*>::iterator BeginP1();
|
||||
std::vector<tools::hbook::p1*>::iterator EndP1();
|
||||
std::vector<tools::hbook::p1*>::const_iterator BeginConstP1() const;
|
||||
std::vector<tools::hbook::p1*>::const_iterator EndConstP1() const;
|
||||
|
||||
// Virtual functions from base class
|
||||
//
|
||||
|
||||
// Methods to create profiles
|
||||
virtual G4int CreateP1(const G4String& name, const G4String& title,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
G4double ymin = 0, G4double ymax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& xbinScheme = "linear");
|
||||
virtual G4int CreateP1(const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& edges,
|
||||
G4double ymin = 0, G4double ymax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none");
|
||||
|
||||
virtual G4bool SetP1(G4int id,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
G4double ymin = 0, G4double ymax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& xbinScheme = "linear");
|
||||
virtual G4bool SetP1(G4int id,
|
||||
const std::vector<G4double>& edges,
|
||||
G4double ymin = 0, G4double ymax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none");
|
||||
|
||||
virtual G4bool ScaleP1(G4int id, G4double factor);
|
||||
|
||||
|
||||
// Methods to fill profiles
|
||||
virtual G4bool FillP1(G4int id, G4double value, G4double yvalue,
|
||||
G4double weight = 1.0);
|
||||
|
||||
// Access methods
|
||||
//
|
||||
virtual G4int GetP1Id(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Access to P1 parameters
|
||||
virtual G4int GetP1Nbins(G4int id) const;
|
||||
virtual G4double GetP1Xmin(G4int id) const;
|
||||
virtual G4double GetP1Xmax(G4int id) const;
|
||||
virtual G4double GetP1XWidth(G4int id) const;
|
||||
virtual G4double GetP1Ymin(G4int id) const;
|
||||
virtual G4double GetP1Ymax(G4int id) const;
|
||||
|
||||
// Setters for attributes for plotting
|
||||
virtual G4bool SetP1Title(G4int id, const G4String& title);
|
||||
virtual G4bool SetP1XAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetP1YAxisTitle(G4int id, const G4String& title);
|
||||
|
||||
// Access attributes for plotting
|
||||
virtual G4String GetP1Title(G4int id) const;
|
||||
virtual G4String GetP1XAxisTitle(G4int id) const;
|
||||
virtual G4String GetP1YAxisTitle(G4int id) const;
|
||||
|
||||
// Write data on ASCII file
|
||||
// virtual G4bool WriteOnAscii(std::ofstream& output);
|
||||
|
||||
private:
|
||||
// methods
|
||||
//
|
||||
void SetP1HbookIdOffset();
|
||||
void AddP1Information(const G4String& name,
|
||||
const G4String& xunitName,
|
||||
const G4String& yunitName,
|
||||
const G4String& xfcnName,
|
||||
const G4String& yfcnName,
|
||||
G4BinScheme xbinScheme) const;
|
||||
|
||||
G4int CreateP1FromBooking(p1_booking* p1Booking,
|
||||
G4bool chDir = true);
|
||||
G4int RegisterP1Booking(const G4String& name,
|
||||
p1_booking* p1Booking);
|
||||
|
||||
void BeginCreateP1(const G4String& name);
|
||||
G4int FinishCreateP1(const G4String& name, p1_booking* p1Booking,
|
||||
const G4String& xunitName,
|
||||
const G4String& yunitName,
|
||||
const G4String& xfcnName,
|
||||
const G4String& yfcnName,
|
||||
G4BinScheme xbinScheme) ;
|
||||
|
||||
G4bool BeginSetP1(G4int id,
|
||||
p1_booking* p1Booking,
|
||||
G4HnInformation* info);
|
||||
G4bool FinishSetP1(G4int id,
|
||||
G4HnInformation* info,
|
||||
const G4String& xunitName,
|
||||
const G4String& yunitName,
|
||||
const G4String& xfcnName,
|
||||
const G4String& yfcnName,
|
||||
G4BinScheme xbinScheme) ;
|
||||
|
||||
void CreateP1sFromBooking();
|
||||
void Reset();
|
||||
virtual p1_booking* GetP1Booking(G4int id, G4bool warn = true) const;
|
||||
|
||||
virtual tools::hbook::p1* GetP1InFunction(G4int id, G4String function,
|
||||
G4bool warn = true,
|
||||
G4bool onlyIfActive = true) const;
|
||||
|
||||
// data members
|
||||
//
|
||||
ExG4HbookBaseHnManager fBaseToolsManager;
|
||||
ExG4HbookFileManager* fFileManager;
|
||||
G4int fP1HbookIdOffset;
|
||||
std::vector<tools::hbook::p1*> fP1Vector;
|
||||
std::vector<p1_booking*> fP1BookingVector;
|
||||
std::map<G4String, G4int> fP1NameIdMap;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void ExG4HbookP1Manager::SetFileManager(ExG4HbookFileManager* fileManager)
|
||||
{ fFileManager = fileManager; }
|
||||
|
||||
inline G4int ExG4HbookP1Manager::GetP1HbookIdOffset() const
|
||||
{ return fP1HbookIdOffset; }
|
||||
|
||||
inline std::vector<tools::hbook::p1*>::iterator ExG4HbookP1Manager::BeginP1()
|
||||
{ return fP1Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::p1*>::iterator ExG4HbookP1Manager::EndP1()
|
||||
{ return fP1Vector.end(); }
|
||||
|
||||
inline std::vector<tools::hbook::p1*>::const_iterator
|
||||
ExG4HbookP1Manager::BeginConstP1() const
|
||||
{ return fP1Vector.begin(); }
|
||||
|
||||
inline std::vector<tools::hbook::p1*>::const_iterator
|
||||
ExG4HbookP1Manager::EndConstP1() const
|
||||
{ return fP1Vector.end(); }
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,160 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ExG4HbookP2DummyManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
/// \file hbook/include/ExG4HbookP2DummyManager.hh
|
||||
/// \brief Definition of the ExG4HbookP2DummyManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 24/07/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef ExG4HbookP2DummyManager_h
|
||||
#define ExG4HbookP2DummyManager_h 1
|
||||
|
||||
#include "G4VP2Manager.hh"
|
||||
|
||||
namespace tools {
|
||||
namespace histo {
|
||||
class h3d;
|
||||
}
|
||||
}
|
||||
|
||||
/// Manager class for P2 with dummy implementation.
|
||||
///
|
||||
/// It will just issue warnings.
|
||||
|
||||
class ExG4HbookP2DummyManager : public G4VP2Manager
|
||||
{
|
||||
public:
|
||||
ExG4HbookP2DummyManager(const G4AnalysisManagerState& state);
|
||||
virtual ~ExG4HbookP2DummyManager();
|
||||
|
||||
protected:
|
||||
// Virtual functions from base class
|
||||
//
|
||||
|
||||
// Methods to create histograms
|
||||
//
|
||||
virtual G4int CreateP2(const G4String& name, const G4String& title,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
G4double zmin = 0, G4double zmax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear");
|
||||
|
||||
virtual G4int CreateP2(const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
G4double zmin = 0, G4double zmax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none");
|
||||
|
||||
virtual G4bool SetP2(G4int id,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
G4double zmin = 0, G4double zmax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none",
|
||||
const G4String& xbinScheme = "linear",
|
||||
const G4String& ybinScheme = "linear");
|
||||
|
||||
virtual G4bool SetP2(G4int id,
|
||||
const std::vector<G4double>& xedges,
|
||||
const std::vector<G4double>& yedges,
|
||||
G4double zmin = 0, G4double zmax = 0,
|
||||
const G4String& xunitName = "none",
|
||||
const G4String& yunitName = "none",
|
||||
const G4String& zunitName = "none",
|
||||
const G4String& xfcnName = "none",
|
||||
const G4String& yfcnName = "none",
|
||||
const G4String& zfcnName = "none");
|
||||
|
||||
virtual G4bool ScaleP2(G4int id, G4double factor);
|
||||
|
||||
// Method to fill histograms
|
||||
//
|
||||
virtual G4bool FillP2(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0);
|
||||
|
||||
|
||||
// Methods to manipulate histograms
|
||||
//
|
||||
|
||||
// Access methods
|
||||
virtual G4int GetP2Id(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Access to P2 parameters
|
||||
virtual G4int GetP2Nxbins(G4int id) const;
|
||||
virtual G4double GetP2Xmin(G4int id) const;
|
||||
virtual G4double GetP2Xmax(G4int id) const;
|
||||
virtual G4double GetP2XWidth(G4int id) const;
|
||||
virtual G4int GetP2Nybins(G4int id) const;
|
||||
virtual G4double GetP2Ymin(G4int id) const;
|
||||
virtual G4double GetP2Ymax(G4int id) const;
|
||||
virtual G4double GetP2YWidth(G4int id) const;
|
||||
virtual G4double GetP2Zmin(G4int id) const;
|
||||
virtual G4double GetP2Zmax(G4int id) const;
|
||||
|
||||
// Setters for attributes for plotting
|
||||
virtual G4bool SetP2Title(G4int id, const G4String& title);
|
||||
virtual G4bool SetP2XAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetP2YAxisTitle(G4int id, const G4String& title);
|
||||
virtual G4bool SetP2ZAxisTitle(G4int id, const G4String& title);
|
||||
|
||||
// Access attributes for plotting
|
||||
virtual G4String GetP2Title(G4int id) const;
|
||||
virtual G4String GetP2XAxisTitle(G4int id) const;
|
||||
virtual G4String GetP2YAxisTitle(G4int id) const;
|
||||
virtual G4String GetP2ZAxisTitle(G4int id) const;
|
||||
|
||||
// Write data on ASCII file
|
||||
virtual G4bool WriteOnAscii(std::ofstream& output);
|
||||
|
||||
private:
|
||||
// methods
|
||||
void ExceptionForProfiles(const G4String& functionName);
|
||||
void ExceptionForProfilesConst(const G4String& functionName) const;
|
||||
|
||||
// data members
|
||||
G4bool fWarn;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/g4hbook.hh
|
||||
/// \brief Definition of the G4Hbook analysis typedefs
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef g4hbook_h
|
||||
#define g4hbook_h
|
||||
|
||||
#include "g4hbook_defs.hh"
|
||||
|
||||
using namespace G4Hbook;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/include/g4hbook_defs.hh
|
||||
/// \brief Definition of the G4Hbook analysis typedefs
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef g4hbook_defs_h
|
||||
#define g4hbook_defs_h
|
||||
|
||||
#include <tools/hbook/h1>
|
||||
#include <tools/hbook/h2>
|
||||
#include <tools/hbook/wntuple>
|
||||
#include "ExG4HbookAnalysisManager.hh"
|
||||
|
||||
namespace G4Hbook {
|
||||
|
||||
// H1 types
|
||||
typedef tools::hbook::h1 G4AnaH1; // keep for backward compatibility
|
||||
typedef tools::hbook::h1 G4H1;
|
||||
typedef std::vector<tools::hbook::h1*>::iterator G4H1Iterator;
|
||||
typedef std::vector<tools::hbook::h1*>::const_iterator G4H1ConstIterator;
|
||||
|
||||
// H2 types
|
||||
typedef tools::hbook::h2 G4AnaH2; // keep for backward compatibility
|
||||
typedef tools::hbook::h2 G4H2;
|
||||
typedef std::vector<tools::hbook::h2*>::iterator G4H2Iterator;
|
||||
typedef std::vector<tools::hbook::h2*>::const_iterator G4H2ConstIterator;
|
||||
|
||||
// Ntuple types
|
||||
typedef tools::hbook::wntuple G4Ntuple;
|
||||
typedef std::vector<tools::hbook::wntuple*>::iterator G4NtupleIterator;
|
||||
typedef std::vector<tools::hbook::wntuple*>::const_iterator G4NtupleConstIterator;
|
||||
|
||||
// Managers
|
||||
typedef ExG4HbookAnalysisManager G4AnalysisManager;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/src/ExG4HbookAnalysisManager.cc
|
||||
/// \brief Implementation of the ExG4HbookAnalysisManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#include "ExG4HbookAnalysisManager.hh"
|
||||
#include "ExG4HbookFileManager.hh"
|
||||
#include "ExG4HbookH1Manager.hh"
|
||||
#include "ExG4HbookH2Manager.hh"
|
||||
#include "ExG4HbookH3DummyManager.hh"
|
||||
#include "ExG4HbookP1Manager.hh"
|
||||
#include "ExG4HbookP2DummyManager.hh"
|
||||
#include "ExG4HbookNtupleManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
extern "C" int setpawc();
|
||||
extern "C" int setntuc();
|
||||
|
||||
ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::fgInstance = 0;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Create(G4bool /*isMaster*/)
|
||||
{
|
||||
if ( fgInstance == 0 ) {
|
||||
fgInstance = new ExG4HbookAnalysisManager();
|
||||
}
|
||||
|
||||
return fgInstance;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookAnalysisManager* ExG4HbookAnalysisManager::Instance()
|
||||
{
|
||||
if ( fgInstance == 0 ) {
|
||||
fgInstance = new ExG4HbookAnalysisManager();
|
||||
}
|
||||
|
||||
return fgInstance;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()
|
||||
: G4VAnalysisManager("Hbook", true),
|
||||
fH1Manager(0),
|
||||
fH2Manager(0),
|
||||
fH3Manager(0),
|
||||
fP1Manager(0),
|
||||
fP2Manager(0),
|
||||
fNtupleManager(0),
|
||||
fFileManager(0)
|
||||
{
|
||||
if ( G4Threading::IsWorkerThread() ) {
|
||||
// Hbook output is not supported in MT mode
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "G4HbookAnalysisManager is not supported in multi-threading mode.";
|
||||
G4Exception("ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
|
||||
"Analysis_F002", FatalException, description);
|
||||
}
|
||||
|
||||
if ( fgInstance ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "G4HbookAnalysisManager already exists."
|
||||
<< "Cannot create another instance.";
|
||||
G4Exception("ExG4HbookAnalysisManager::ExG4HbookAnalysisManager()",
|
||||
"Analysis_F001", FatalException, description);
|
||||
}
|
||||
|
||||
fgInstance = this;
|
||||
|
||||
// Create managers
|
||||
fH1Manager = new ExG4HbookH1Manager(fState);
|
||||
fH2Manager = new ExG4HbookH2Manager(fState);
|
||||
fH3Manager = new ExG4HbookH3DummyManager(fState);
|
||||
fP1Manager = new ExG4HbookP1Manager(fState);
|
||||
fP2Manager = new ExG4HbookP2DummyManager(fState);
|
||||
fNtupleManager = new ExG4HbookNtupleManager(fState);
|
||||
fFileManager = new ExG4HbookFileManager(fState);
|
||||
|
||||
// Set managers to base class
|
||||
SetH1Manager(fH1Manager);
|
||||
SetH2Manager(fH2Manager);
|
||||
SetH3Manager(fH3Manager);
|
||||
SetP1Manager(fP1Manager);
|
||||
SetP2Manager(fP2Manager);
|
||||
SetNtupleManager(fNtupleManager);
|
||||
SetFileManager(fFileManager);
|
||||
|
||||
// Set file manager to component managers
|
||||
fH1Manager->SetFileManager(fFileManager);
|
||||
fH2Manager->SetFileManager(fFileManager);
|
||||
fP1Manager->SetFileManager(fFileManager);
|
||||
fNtupleManager->SetFileManager(fFileManager);
|
||||
|
||||
// Initialize HBOOK :
|
||||
tools::hbook::CHLIMIT(setpawc());
|
||||
setntuc(); //for ntuple.
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookAnalysisManager::~ExG4HbookAnalysisManager()
|
||||
{
|
||||
fgInstance = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookAnalysisManager::Reset()
|
||||
{
|
||||
// Reset histograms and ntuple
|
||||
|
||||
fH1Manager->Reset();
|
||||
fH2Manager->Reset();
|
||||
fP1Manager->Reset();
|
||||
fNtupleManager->Reset();
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookAnalysisManager::OpenFileImpl(const G4String& fileName)
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
G4bool result = fFileManager->SetFileName(fileName);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4String name = fFileManager->GetFullFileName();
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("open", "analysis file", name);
|
||||
#endif
|
||||
|
||||
// Open file
|
||||
result = fFileManager->OpenFile(fileName);
|
||||
finalResult = finalResult && result;
|
||||
|
||||
// Create h1 histrograms
|
||||
fH1Manager->CreateH1sFromBooking();
|
||||
|
||||
// Create h2 histrograms if any is booked
|
||||
fH2Manager->CreateH2sFromBooking();
|
||||
|
||||
// Create p1 profiles if any is booked
|
||||
fP1Manager->CreateP1sFromBooking();
|
||||
|
||||
// Create ntuples if they are booked
|
||||
fNtupleManager->CreateNtuplesFromBooking();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("open", "analysis file", name);
|
||||
#endif
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookAnalysisManager::WriteImpl()
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
|
||||
G4bool result = fFileManager->WriteFile();
|
||||
finalResult = finalResult && result;
|
||||
|
||||
// Write ASCII if activated
|
||||
if ( IsAscii() ) {
|
||||
result = WriteAscii(fFileManager->GetFileName());
|
||||
finalResult = finalResult && result;
|
||||
}
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookAnalysisManager::CloseFileImpl()
|
||||
{
|
||||
G4bool finalResult = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("close", "file", fFileManager->GetFullFileName());
|
||||
#endif
|
||||
|
||||
// reset data
|
||||
Reset();
|
||||
|
||||
// close file
|
||||
G4bool result = fFileManager->CloseFile();
|
||||
finalResult = finalResult && result;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("close", "file", fFileManager->GetFullFileName(), result);
|
||||
#endif
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// \file hbook/src/ExG4HbookBaseHnManager.cc
|
||||
/// \brief Implementation of the ExG4HbookBaseHnManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "ExG4HbookBaseHnManager.hh"
|
||||
|
||||
// static data
|
||||
|
||||
const G4int ExG4HbookBaseHnManager::kX = 0;
|
||||
const G4int ExG4HbookBaseHnManager::kY = 1;
|
||||
const G4int ExG4HbookBaseHnManager::kZ = 2;
|
||||
|
||||
//
|
||||
// Constructors, destructor
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookBaseHnManager::ExG4HbookBaseHnManager(const G4String& hnType)
|
||||
: fHnType(hnType)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookBaseHnManager::~ExG4HbookBaseHnManager()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookBaseHnManager::GetNbins(const tools::hbook::axis& axis) const
|
||||
{
|
||||
return axis.bins();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookBaseHnManager::GetMin(const tools::hbook::axis& axis) const
|
||||
{
|
||||
// Returns min data value
|
||||
|
||||
return axis.lower_edge();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookBaseHnManager::GetMax(const tools::hbook::axis& axis) const
|
||||
{
|
||||
// Returns max data value
|
||||
|
||||
return axis.upper_edge();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookBaseHnManager::GetWidth(const tools::hbook::axis& axis) const
|
||||
{
|
||||
G4int nbins = axis.bins();
|
||||
if ( ! nbins ) {
|
||||
G4String functionName = "ExG4HbookBaseHnManager::Get";
|
||||
functionName += fHnType;
|
||||
functionName += "Width";
|
||||
G4ExceptionDescription description;
|
||||
description << " nbins = 0 (for " << fHnType << ").";
|
||||
G4Exception(functionName, "Analysis_W014", JustWarning, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ( axis.upper_edge() - axis.lower_edge() )/nbins;
|
||||
}
|
||||
|
||||
/*
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookBaseHnManager::SetTitle(G4HbookBaseHisto& baseHisto,
|
||||
const G4String& title)
|
||||
{
|
||||
return baseHisto.set_title(title);
|
||||
}
|
||||
*/
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookBaseHnManager::SetAxisTitle(G4HbookBaseHisto& baseHisto,
|
||||
G4int dimension, const G4String& title)
|
||||
{
|
||||
if ( dimension == 0 ) {
|
||||
baseHisto.add_annotation(tools::hbook::key_axis_x_title(), title);
|
||||
}
|
||||
else if ( dimension == 1 ) {
|
||||
baseHisto.add_annotation(tools::hbook::key_axis_y_title(), title);
|
||||
}
|
||||
else if ( dimension == 2 ) {
|
||||
baseHisto.add_annotation(tools::hbook::key_axis_z_title(), title);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookBaseHnManager::GetTitle(const G4HbookBaseHisto& baseHisto) const
|
||||
{
|
||||
return baseHisto.title();
|
||||
}
|
||||
*/
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookBaseHnManager::GetAxisTitle(const G4HbookBaseHisto& baseHisto,
|
||||
G4int dimension) const
|
||||
{
|
||||
G4String title;
|
||||
G4bool result = false;
|
||||
if ( dimension == 0 ) {
|
||||
result = baseHisto.annotation(tools::hbook::key_axis_x_title(), title);
|
||||
}
|
||||
else if ( dimension == 1 ) {
|
||||
result = baseHisto.annotation(tools::hbook::key_axis_y_title(), title);
|
||||
}
|
||||
else if ( dimension == 2 ) {
|
||||
result = baseHisto.annotation(tools::hbook::key_axis_z_title(), title);
|
||||
}
|
||||
|
||||
if ( ! result ) {
|
||||
G4String axes("xyz");
|
||||
G4String axis = axes(dimension, 1);
|
||||
G4String functionName = "ExG4HbookBaseHnManager::Get";
|
||||
functionName += fHnType;
|
||||
functionName += axis;
|
||||
functionName += "Title";
|
||||
G4ExceptionDescription description;
|
||||
description << " Failed to get " << axis << " axis " << fHnType << " title.";
|
||||
G4Exception(functionName, "Analysis_W014", JustWarning, description);
|
||||
return "";
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/src/ExG4HbookFileManager.cc
|
||||
/// \brief Implementation of the ExG4HbookFileManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#include "ExG4HbookFileManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
const G4String ExG4HbookFileManager::fgkDefaultNtupleDirectoryName = "ntuple";
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookFileManager::ExG4HbookFileManager(const G4AnalysisManagerState& state)
|
||||
: G4VFileManager(state),
|
||||
fFile(0)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookFileManager::~ExG4HbookFileManager()
|
||||
{
|
||||
delete fFile;
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookFileManager::OpenFile(const G4String& fileName)
|
||||
{
|
||||
// Keep file name
|
||||
fFileName = fileName;
|
||||
G4String name = GetFullFileName();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("open", "analysis file", name);
|
||||
#endif
|
||||
|
||||
// delete a previous file if it exists
|
||||
if ( fFile ) delete fFile;
|
||||
|
||||
tools::hbook::CHCDIR("//PAWC"," ");
|
||||
|
||||
unsigned int unit = 1;
|
||||
fFile = new tools::hbook::wfile(std::cout, name, unit);
|
||||
if ( ! fFile->is_valid() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "Cannot open file " << fileName;
|
||||
G4Exception("G4HbookAnalysisManager::OpenFile()",
|
||||
"Analysis_W001", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
// At this point, in HBOOK, we should have :
|
||||
// - created a //LUN1 directory attached to the file
|
||||
// - created a //PAWC/LUN1 in memory
|
||||
// - be in the directory //PAWC/LUN1.
|
||||
|
||||
// create an "histo" HBOOK directory both in memory and in the file :
|
||||
if ( fHistoDirectoryName != "" ) {
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
tools::hbook::CHMDIR(fHistoDirectoryName.data()," ");
|
||||
tools::hbook::CHCDIR("//LUN1"," ");
|
||||
tools::hbook::CHMDIR(fHistoDirectoryName.data()," ");
|
||||
}
|
||||
// the five upper lines could have been done with :
|
||||
//fFile->cd_home();
|
||||
//fFile->mkcd("histo");
|
||||
|
||||
fLockFileName = true;
|
||||
fLockHistoDirectoryName = true;
|
||||
fLockNtupleDirectoryName = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("open", "analysis file", name);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookFileManager::WriteFile()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("write", "file", GetFullFileName());
|
||||
#endif
|
||||
|
||||
// Return to //PAWC/LUN1 :
|
||||
//tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
G4bool result = fFile->write();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL1() )
|
||||
fState.GetVerboseL1()->Message("write", "file", GetFullFileName(), result);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookFileManager::CloseFile()
|
||||
{
|
||||
// close file
|
||||
G4bool result = fFile->close();
|
||||
fLockFileName = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookFileManager::CreateNtupleDirectory()
|
||||
{
|
||||
// Create an "ntuple" directory both in memory and in the file
|
||||
|
||||
static G4bool isDone = false;
|
||||
|
||||
// Do not create directory more than once
|
||||
if (isDone) return;
|
||||
|
||||
fFile->cd_home(); //go under //PAWC/LUN1
|
||||
if ( fNtupleDirectoryName == "" )
|
||||
fFile->mkcd(fgkDefaultNtupleDirectoryName.data());
|
||||
else
|
||||
fFile->mkcd(fNtupleDirectoryName.data());
|
||||
fLockNtupleDirectoryName = true;
|
||||
isDone = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,865 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/src/ExG4HbookH1Manager.cc
|
||||
/// \brief Implementation of the ExG4HbookH1Manager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#include "ExG4HbookH1Manager.hh"
|
||||
#include "ExG4HbookFileManager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH1Manager::ExG4HbookH1Manager(const G4AnalysisManagerState& state)
|
||||
: G4VH1Manager(state),
|
||||
fBaseToolsManager("H1"),
|
||||
fFileManager(0),
|
||||
fH1HbookIdOffset(-1),
|
||||
fH1Vector(),
|
||||
fH1BookingVector(),
|
||||
fH1NameIdMap()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH1Manager::~ExG4HbookH1Manager()
|
||||
{
|
||||
// Delete h1
|
||||
Reset();
|
||||
|
||||
// Delete h1 booking
|
||||
std::vector<h1_booking*>::iterator it;
|
||||
for ( it = fH1BookingVector.begin(); it != fH1BookingVector.end(); it++ ) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// utility functions
|
||||
//
|
||||
|
||||
namespace {
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ConvertToFloat(const std::vector<G4double>& doubleVector,
|
||||
std::vector<float>& floatVector)
|
||||
{
|
||||
for (G4int i=0; i<G4int(doubleVector.size()); ++i)
|
||||
floatVector.push_back((float)doubleVector[i]);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void UpdateH1Information(G4HnInformation* hnInformation,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
G4HnDimensionInformation* information
|
||||
= hnInformation->GetHnDimensionInformation(G4HnInformation::kX);
|
||||
information->fUnitName = unitName;
|
||||
information->fFcnName = fcnName;
|
||||
information->fUnit = unit;
|
||||
information->fFcn = fcn;
|
||||
information->fBinScheme = binScheme;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
h1_booking* CreateH1Booking(const G4String& title,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
|
||||
h1_booking* h1Booking = 0;
|
||||
if ( binScheme != kLogBinScheme ) {
|
||||
if ( binScheme == kUserBinScheme ) {
|
||||
// This should never happen, but let's make sure about it
|
||||
// by issuing a warning
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " User binning scheme setting was ignored." << G4endl
|
||||
<< " Linear binning will be applied with given (nbins, xmin, xmax) values";
|
||||
G4Exception("ExG4HbookH1Manager::CreateH1",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
h1Booking = new h1_booking(nbins, fcn(xmin/unit), fcn(xmax/unit));
|
||||
// h1_booking object is deleted in destructor
|
||||
}
|
||||
else {
|
||||
// Compute edges
|
||||
std::vector<G4double> edges;
|
||||
ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
|
||||
h1Booking = new h1_booking(edges);
|
||||
// h1_booking object is deleted in destructor
|
||||
}
|
||||
|
||||
h1Booking->fTitle = title;
|
||||
UpdateTitle(h1Booking->fTitle, unitName, fcnName);
|
||||
|
||||
return h1Booking;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
h1_booking* CreateH1Booking(const G4String& title,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
|
||||
// Apply function
|
||||
std::vector<G4double> newEdges;
|
||||
ComputeEdges(edges, unit, fcn, newEdges);
|
||||
|
||||
h1_booking* h1Booking = new h1_booking(newEdges);
|
||||
// h1_booking object is deleted in destructor
|
||||
|
||||
h1Booking->fTitle = title;
|
||||
UpdateTitle(h1Booking->fTitle, unitName, fcnName);
|
||||
|
||||
return h1Booking;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void UpdateH1Booking(h1_booking* h1Booking,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
const G4String& binSchemeName)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
G4BinScheme binScheme = GetBinScheme(binSchemeName);
|
||||
|
||||
if ( binScheme != kLogBinScheme ) {
|
||||
if ( binScheme == kUserBinScheme ) {
|
||||
// This should never happen, but let's make sure about it
|
||||
// by issuing a warning
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " User binning scheme setting was ignored." << G4endl
|
||||
<< " Linear binning will be applied with given (nbins, xmin, xmax) values";
|
||||
G4Exception("ExG4HbookH1Manager::SetH1",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
h1Booking->fNbins = nbins;
|
||||
h1Booking->fXmin = fcn(xmin/unit);
|
||||
h1Booking->fXmax = fcn(xmax/unit);
|
||||
}
|
||||
else {
|
||||
// Compute edges
|
||||
ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, h1Booking->fEdges);
|
||||
}
|
||||
|
||||
UpdateTitle(h1Booking->fTitle, unitName, fcnName);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void UpdateH1Booking(h1_booking* h1Booking,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
|
||||
// Apply function
|
||||
ComputeEdges(edges, unit, fcn, h1Booking->fEdges);
|
||||
|
||||
UpdateTitle(h1Booking->fTitle, unitName, fcnName);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ConfigureHbookH1(tools::hbook::h1* h1,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme)
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
|
||||
if ( binScheme != kLogBinScheme ) {
|
||||
if ( binScheme == kUserBinScheme ) {
|
||||
// This should never happen, but let's make sure about it
|
||||
// by issuing a warning
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " User binning scheme setting was ignored." << G4endl
|
||||
<< " Linear binning will be applied with given (nbins, xmin, xmax) values";
|
||||
G4Exception("ExG4HbookH1Manager::SetH1",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
h1->configure(nbins, fcn(xmin/unit), fcn(xmax/unit));
|
||||
}
|
||||
else {
|
||||
// Compute bins
|
||||
std::vector<G4double> edges;
|
||||
ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
|
||||
// Convert to float
|
||||
std::vector<float> fedges;
|
||||
ConvertToFloat(edges, fedges);
|
||||
|
||||
h1->configure(fedges);
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ConfigureHbookH1(tools::hbook::h1* h1,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName)
|
||||
{
|
||||
// Apply function to edges
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
std::vector<G4double> newEdges;
|
||||
ComputeEdges(edges, unit, fcn, newEdges);
|
||||
|
||||
// Convert to float
|
||||
std::vector<float> newFEdges;
|
||||
ConvertToFloat(newEdges, newFEdges);
|
||||
|
||||
h1->configure(newFEdges);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH1Manager::SetH1HbookIdOffset()
|
||||
{
|
||||
// Set fH1HbookIdOffset if needed
|
||||
|
||||
if ( fH1HbookIdOffset == -1 ) {
|
||||
if ( fFirstId > 0 )
|
||||
fH1HbookIdOffset = 0;
|
||||
else
|
||||
fH1HbookIdOffset = 1;
|
||||
|
||||
if ( fH1HbookIdOffset > 0 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "H1 will be defined in HBOOK with ID = G4_firstHistoId + 1";
|
||||
G4Exception("ExG4HbookH1Manager::SetH1HbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH1Manager::AddH1Information(const G4String& name,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme) const
|
||||
{
|
||||
G4double unit = GetUnitValue(unitName);
|
||||
G4Fcn fcn = GetFunction(fcnName);
|
||||
fHnManager->AddH1Information(name, unitName, fcnName, unit, fcn, binScheme);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::CreateH1FromBooking(h1_booking* h1Booking,
|
||||
G4bool chDir)
|
||||
{
|
||||
// Create h1 from h1_booking.
|
||||
|
||||
if ( chDir ) {
|
||||
// Go to histograms directory if defined
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
G4String histoPath = "//PAWC/LUN1/";
|
||||
histoPath.append(fFileManager->GetHistoDirectoryName().data());
|
||||
tools::hbook::CHCDIR(histoPath.data()," ");
|
||||
}
|
||||
}
|
||||
|
||||
G4int index = fH1Vector.size();
|
||||
G4int id = index + fFirstId;
|
||||
G4HnInformation*
|
||||
info = fHnManager->GetHnInformation(id, "CreateH1FromBooking");
|
||||
// Hbook index
|
||||
G4int hbookIndex = fH1HbookIdOffset + index + fFirstId;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("create from booking", "h1", info->GetName());
|
||||
#endif
|
||||
|
||||
// Create h1
|
||||
tools::hbook::h1* h1 = 0;
|
||||
if ( ! h1Booking->fEdges.size() ) {
|
||||
h1 = new tools::hbook::h1(
|
||||
hbookIndex, h1Booking->fTitle,
|
||||
h1Booking->fNbins, h1Booking->fXmin, h1Booking->fXmax);
|
||||
}
|
||||
else {
|
||||
// Convert to float
|
||||
std::vector<float> newEdges;
|
||||
ConvertToFloat(h1Booking->fEdges, newEdges);
|
||||
|
||||
h1 = new tools::hbook::h1(hbookIndex, h1Booking->fTitle, newEdges);
|
||||
}
|
||||
|
||||
fH1Vector.push_back(h1);
|
||||
|
||||
if ( chDir ) {
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
// Return to //PAWC/LUN1 :
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " name : " << info->GetName() << " hbook index : " << hbookIndex;
|
||||
fState.GetVerboseL3()->Message("create from booking", "h1", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::RegisterH1Booking(const G4String& name,
|
||||
h1_booking* h1Booking)
|
||||
{
|
||||
// Register h1
|
||||
G4int index = fH1BookingVector.size();
|
||||
fH1BookingVector.push_back(h1Booking);
|
||||
fH1NameIdMap[name] = index + fFirstId;
|
||||
|
||||
// Lock id
|
||||
fLockFirstId = true;
|
||||
|
||||
return index + fFirstId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH1Manager::BeginCreateH1(const G4String& name)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("create", "H1", name);
|
||||
#endif
|
||||
|
||||
// Set fH1HbookIdOffset if needed
|
||||
SetH1HbookIdOffset();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::FinishCreateH1(
|
||||
const G4String& name, h1_booking* h1Booking,
|
||||
const G4String& unitName, const G4String& fcnName,
|
||||
G4BinScheme binScheme)
|
||||
{
|
||||
// Register h1 booking
|
||||
G4int id = RegisterH1Booking(name, h1Booking);
|
||||
|
||||
// Save H1 information
|
||||
AddH1Information(name, unitName, fcnName, binScheme);
|
||||
|
||||
// Create h1 if the file is open
|
||||
if ( fFileManager->IsFile() ) {
|
||||
CreateH1FromBooking(h1Booking);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4int hbookIndex = fH1HbookIdOffset + id;
|
||||
G4ExceptionDescription description;
|
||||
description << " name : " << name << " hbook index : " << hbookIndex;
|
||||
fState.GetVerboseL2()->Message("create", "H1", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::BeginSetH1(
|
||||
G4int id,
|
||||
h1_booking* h1Booking,
|
||||
G4HnInformation* info)
|
||||
{
|
||||
h1Booking = GetH1Booking(id, false);
|
||||
if ( ! h1Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH1()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
info = fHnManager->GetHnInformation(id,"SetH1");
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("configure", "H1", info->GetName());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::FinishSetH1(
|
||||
G4int id,
|
||||
G4HnInformation* info,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
G4BinScheme binScheme)
|
||||
{
|
||||
// Update information
|
||||
UpdateH1Information(info, unitName, fcnName, binScheme);
|
||||
|
||||
// Set activation
|
||||
fHnManager->SetActivation(id, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH1Manager::CreateH1sFromBooking()
|
||||
{
|
||||
// Create all h1 from h1_booking.
|
||||
|
||||
// Do nothing if any h1 histogram already exists
|
||||
// or no h1 histograms are booked
|
||||
if ( fH1Vector.size() || ( fH1BookingVector.size() == 0 ) ) return;
|
||||
|
||||
// Go to histograms directory if defined
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
G4String histoPath = "//PAWC/LUN1/";
|
||||
histoPath.append(fFileManager->GetHistoDirectoryName().data());
|
||||
tools::hbook::CHCDIR(histoPath.data()," ");
|
||||
}
|
||||
|
||||
// Create histograms
|
||||
std::vector<h1_booking*>::const_iterator it;
|
||||
for ( it = fH1BookingVector.begin(); it != fH1BookingVector.end(); ++it) {
|
||||
CreateH1FromBooking(*it, false);
|
||||
}
|
||||
|
||||
// Return backi from histograms directory if defined
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
// Return to //PAWC/LUN1 :
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH1Manager::Reset()
|
||||
{
|
||||
// Reset histograms and ntuple
|
||||
|
||||
// Delete histograms
|
||||
std::vector<tools::hbook::h1*>::iterator it;
|
||||
for (it = fH1Vector.begin(); it != fH1Vector.end(); it++ ) {
|
||||
delete *it;
|
||||
}
|
||||
|
||||
// Clear vectors
|
||||
fH1Vector.clear();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
h1_booking* ExG4HbookH1Manager::GetH1Booking(G4int id, G4bool warn) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fH1BookingVector.size()) ) {
|
||||
if ( warn) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histo " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetH1Booking()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fH1BookingVector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::WriteOnAscii(std::ofstream& output)
|
||||
{
|
||||
// Write selected objects on ASCII file
|
||||
// (Only H1 implemented by now)
|
||||
// According to the implementation by Michel Maire, originally in
|
||||
// extended examples.
|
||||
|
||||
// h1 histograms
|
||||
for ( G4int i=0; i<G4int(fH1Vector.size()); ++i ) {
|
||||
G4int id = i + fFirstId;
|
||||
G4HnInformation* info
|
||||
= fHnManager->GetHnInformation(id, "WriteOnAscii");
|
||||
// skip writing if activation is enabled and H1 is inactivated
|
||||
if ( ! info->GetAscii() ) continue;
|
||||
tools::hbook::h1* h1 = fH1Vector[i];
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() )
|
||||
fState.GetVerboseL3()->Message("write on ascii", "h1", info->GetName());
|
||||
#endif
|
||||
|
||||
output << "\n 1D histogram " << id << ": " << h1->title()
|
||||
<< "\n \n \t X \t\t Y" << G4endl;
|
||||
|
||||
for (G4int j=0; j< G4int(h1->axis().bins()); ++j) {
|
||||
output << " " << j << "\t"
|
||||
<< h1->axis().bin_center(j) << "\t"
|
||||
<< h1->bin_height(j) << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::h1* ExG4HbookH1Manager::GetH1InFunction(G4int id,
|
||||
G4String functionName, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fH1Vector.size()) ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "ExG4HbookH1Manager::";
|
||||
inFunction += functionName;
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Do not return histogram if inactive
|
||||
if ( fState.GetIsActivation() && onlyIfActive && ( ! fHnManager->GetActivation(id) ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fH1Vector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::CreateH1(
|
||||
const G4String& name, const G4String& title,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName, const G4String& fcnName,
|
||||
const G4String& binSchemeName)
|
||||
{
|
||||
BeginCreateH1(name);
|
||||
|
||||
G4BinScheme binScheme = GetBinScheme(binSchemeName);
|
||||
|
||||
// Create h1 booking
|
||||
h1_booking* h1Booking
|
||||
= CreateH1Booking(title, nbins, xmin, xmax, unitName, fcnName, binScheme);
|
||||
|
||||
return FinishCreateH1(name, h1Booking, unitName, fcnName, binScheme);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::CreateH1(
|
||||
const G4String& name, const G4String& title,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName)
|
||||
{
|
||||
BeginCreateH1(name);
|
||||
|
||||
// Create h1 booking
|
||||
h1_booking* h1Booking
|
||||
= CreateH1Booking(title, edges, unitName, fcnName);
|
||||
|
||||
return FinishCreateH1(name, h1Booking, unitName, fcnName, kUserBinScheme);
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1(G4int id,
|
||||
G4int nbins, G4double xmin, G4double xmax,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName,
|
||||
const G4String& binSchemeName)
|
||||
{
|
||||
h1_booking* h1Booking = 0;
|
||||
G4HnInformation* info = 0;
|
||||
|
||||
if ( ! BeginSetH1(id, h1Booking, info) ) return false;
|
||||
|
||||
G4BinScheme binScheme = GetBinScheme(binSchemeName);
|
||||
|
||||
// Update H1 booking
|
||||
UpdateH1Booking(h1Booking,
|
||||
nbins, xmin, xmax, unitName, fcnName, binScheme);
|
||||
|
||||
// Re-configure histogram if it was already defined
|
||||
if ( fH1Vector.size() ) {
|
||||
tools::hbook::h1* h1 = GetH1(id);
|
||||
ConfigureHbookH1(h1, nbins, xmin, xmax, unitName, fcnName, binScheme);
|
||||
}
|
||||
|
||||
return FinishSetH1(id, info, unitName, fcnName, binScheme);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1(G4int id,
|
||||
const std::vector<G4double>& edges,
|
||||
const G4String& unitName,
|
||||
const G4String& fcnName)
|
||||
{
|
||||
h1_booking* h1Booking = 0;
|
||||
G4HnInformation* info = 0;
|
||||
|
||||
if ( ! BeginSetH1(id, h1Booking, info) ) return false;
|
||||
|
||||
// Update H1 booking
|
||||
UpdateH1Booking(h1Booking, edges, unitName, fcnName);
|
||||
|
||||
// Re-configure histogram if it was already defined
|
||||
if ( fH1Vector.size() ) {
|
||||
tools::hbook::h1* h1 = GetH1(id);
|
||||
ConfigureHbookH1(h1, edges, unitName, fcnName);
|
||||
}
|
||||
|
||||
return
|
||||
FinishSetH1(id, info, unitName, fcnName, kUserBinScheme);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::ScaleH1(G4int id, G4double factor)
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "ScaleH1", false, false);
|
||||
if ( ! h1 ) return false;
|
||||
|
||||
return h1->scale(factor);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::FillH1(G4int id, G4double value, G4double weight)
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "FillH1", true, false);
|
||||
if ( ! h1 ) return false;
|
||||
|
||||
if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
|
||||
//G4cout << "Skipping FillH1 for " << id << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
G4HnDimensionInformation* info
|
||||
= fHnManager->GetHnDimensionInformation(id, G4HnInformation::kX, "FillH1");
|
||||
h1->fill(info->fFcn(value/info->fUnit), weight);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " id " << id << " value " << value
|
||||
<< " fcn(value/unit) " << info->fFcn(value/info->fUnit)
|
||||
<< " weight " << weight;
|
||||
fState.GetVerboseL4()->Message("fill", "H1", description);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::h1* ExG4HbookH1Manager::GetH1(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return GetH1InFunction(id, "GetH1", warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::GetH1Id(const G4String& name, G4bool warn) const
|
||||
{
|
||||
std::map<G4String, G4int>::const_iterator it = fH1NameIdMap.find(name);
|
||||
if ( it == fH1NameIdMap.end() ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "ExG4HbookH1Manager::GetH1Id";
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << name << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH1Manager::GetH1Nbins(G4int id) const
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1Nbins");
|
||||
if ( ! h1 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetNbins(h1->axis());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH1Manager::GetH1Xmin(G4int id) const
|
||||
{
|
||||
// Returns xmin value with applied unit and histogram function
|
||||
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1Xmin");
|
||||
if ( ! h1 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMin(h1->axis());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH1Manager::GetH1Xmax(G4int id) const
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1Xmax");
|
||||
if ( ! h1 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMax(h1->axis());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH1Manager::GetH1Width(G4int id) const
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1XWidth", true, false);
|
||||
if ( ! h1 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetWidth(h1->axis());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1Title(G4int id, const G4String& title)
|
||||
{
|
||||
h1_booking* h1Booking = GetH1Booking(id, false);
|
||||
if ( ! h1Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH1Title()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
h1Booking->fTitle = title;
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1XAxisTitle(G4int id, const G4String& title)
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "SetH1XAxisTitle");
|
||||
if ( ! h1 ) return false;
|
||||
|
||||
return fBaseToolsManager.SetAxisTitle(*h1, ExG4HbookBaseHnManager::kX, title);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1YAxisTitle(G4int id, const G4String& title)
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "SetH1YAxisTitle");
|
||||
if ( ! h1 ) return false;
|
||||
|
||||
return fBaseToolsManager.SetAxisTitle(*h1, ExG4HbookBaseHnManager::kY, title);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH1Manager::GetH1Title(G4int id) const
|
||||
{
|
||||
h1_booking* h1Booking = GetH1Booking(id, false);
|
||||
if ( ! h1Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetH1Title()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return "";
|
||||
}
|
||||
|
||||
return h1Booking->fTitle;
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH1Manager::GetH1XAxisTitle(G4int id) const
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1XAxisTitle");
|
||||
if ( ! h1 ) return "";
|
||||
|
||||
return fBaseToolsManager.GetAxisTitle(*h1, ExG4HbookBaseHnManager::kX);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH1Manager::GetH1YAxisTitle(G4int id) const
|
||||
{
|
||||
tools::hbook::h1* h1 = GetH1InFunction(id, "GetH1YAxisTitle");
|
||||
if ( ! h1 ) return "";
|
||||
|
||||
return fBaseToolsManager.GetAxisTitle(*h1, ExG4HbookBaseHnManager::kY);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH1Manager::SetH1HbookIdOffset(G4int offset)
|
||||
{
|
||||
if ( fH1Vector.size() ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set H1HbookIdOffset as some H1 histogramms already exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH1HbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( fFirstId + offset < 1 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "The first histogram HBOOK id must be >= 1.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH1HbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fH1HbookIdOffset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,676 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/src/ExG4HbookH2Manager.cc
|
||||
/// \brief Implementation of the ExG4HbookH2Manager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#include "ExG4HbookH2Manager.hh"
|
||||
#include "ExG4HbookFileManager.hh"
|
||||
#include "G4HnManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
const G4int ExG4HbookH2Manager::fgkDefaultH2HbookIdOffset = 100;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH2Manager::ExG4HbookH2Manager(const G4AnalysisManagerState& state)
|
||||
: G4VH2Manager(state),
|
||||
fBaseToolsManager("H2"),
|
||||
fFileManager(0),
|
||||
fH2HbookIdOffset(-1),
|
||||
fH2Vector(),
|
||||
fH2BookingVector(),
|
||||
fH2NameIdMap()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH2Manager::~ExG4HbookH2Manager()
|
||||
{
|
||||
// Delete h2
|
||||
Reset();
|
||||
|
||||
// Delete h2 booking
|
||||
std::vector<h2_booking*>::iterator it2;
|
||||
for ( it2 = fH2BookingVector.begin(); it2 != fH2BookingVector.end(); it2++ ) {
|
||||
delete *it2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH2Manager::SetH2HbookIdOffset()
|
||||
{
|
||||
// Set fH2HbookIdOffset if needed
|
||||
|
||||
if ( fH2HbookIdOffset == -1 ) {
|
||||
if ( fFirstId > 0 )
|
||||
fH2HbookIdOffset = 0;
|
||||
else
|
||||
fH2HbookIdOffset = 1;
|
||||
|
||||
if ( fH2HbookIdOffset > 0 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "H2 will be defined in HBOOK with ID = G4_firstHistoId + 1";
|
||||
G4Exception("ExG4HbookH2Manager::SetH1HbookIdOffset",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH2Manager::CreateH2sFromBooking()
|
||||
{
|
||||
// Create h2 from h2_booking.
|
||||
|
||||
// Do nothing if any h2 histogram already exists
|
||||
// or no h2 histograms are booked
|
||||
if ( fH2Vector.size() || ( fH2BookingVector.size() == 0 ) ) return;
|
||||
|
||||
// Go to histograms directory
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
G4String histoPath = "//PAWC/LUN1/";
|
||||
histoPath.append(fFileManager->GetHistoDirectoryName().data());
|
||||
tools::hbook::CHCDIR(histoPath.data()," ");
|
||||
}
|
||||
|
||||
// Create histograms
|
||||
G4int index = 0;
|
||||
std::vector<h2_booking*>::const_iterator it;
|
||||
for ( it = fH2BookingVector.begin(); it != fH2BookingVector.end(); ++it) {
|
||||
// Get information
|
||||
G4int id = index + fFirstId;
|
||||
G4HnInformation* info = fHnManager->GetHnInformation(id, "CreateH2FromBooking");
|
||||
// Hbook index
|
||||
G4int hbookIndex = fH2HbookIdOffset + index + fFirstId;
|
||||
++index;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() )
|
||||
fState.GetVerboseL3()->Message("create from booking", "h2", info->GetName());
|
||||
#endif
|
||||
|
||||
// Create h2
|
||||
tools::hbook::h2* h2
|
||||
= new tools::hbook::h2(hbookIndex, (*it)->fTitle,
|
||||
(*it)->fNxbins, (*it)->fXmin, (*it)->fXmax,
|
||||
(*it)->fNybins, (*it)->fYmin, (*it)->fYmax);
|
||||
fH2Vector.push_back(h2);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " name : " << info->GetName() << " hbook index : " << hbookIndex;
|
||||
fState.GetVerboseL3()->Message("create from booking", "h2", description);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
// Return to //PAWC/LUN1 :
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH2Manager::Reset()
|
||||
{
|
||||
// Reset histograms and ntuple
|
||||
|
||||
// Delete histograms
|
||||
std::vector<tools::hbook::h2*>::iterator it2;
|
||||
for (it2 = fH2Vector.begin(); it2 != fH2Vector.end(); it2++ ) {
|
||||
delete *it2;
|
||||
}
|
||||
|
||||
// Clear vectors
|
||||
fH2Vector.clear();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
h2_booking* ExG4HbookH2Manager::GetH2Booking(G4int id, G4bool warn) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fH2BookingVector.size()) ) {
|
||||
if ( warn) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histo " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetH2Booking()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fH2BookingVector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::WriteOnAscii(std::ofstream& /*output*/)
|
||||
{
|
||||
// Write selected objects on ASCII file
|
||||
// According to the implementation by Michel Maire, originally in
|
||||
// extended examples.
|
||||
// Not yet available for H2
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::h2* ExG4HbookH2Manager::GetH2InFunction(G4int id,
|
||||
G4String functionName, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fH2Vector.size()) ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "ExG4HbookH2Manager::";
|
||||
inFunction += functionName;
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Do not return histogram if inactive
|
||||
if ( fState.GetIsActivation() && onlyIfActive && ( ! fHnManager->GetActivation(id) ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fH2Vector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH2Manager::CreateH2(const G4String& name, const G4String& title,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
const G4String& xunitName, const G4String& yunitName,
|
||||
const G4String& xfcnName, const G4String& yfcnName,
|
||||
const G4String& xbinSchemeName,
|
||||
const G4String& ybinSchemeName)
|
||||
|
||||
{
|
||||
// HBook does not support user defined binning for H2
|
||||
if ( xbinSchemeName != "linear" || ybinSchemeName != "linear" ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Logarithimc binning is not supported for H2.";
|
||||
G4Exception("ExG4HbookH2Manager::CreateH2",
|
||||
"Analysis_F015", FatalException, description);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("create", "H2", name);
|
||||
#endif
|
||||
|
||||
// Create h2 booking & information
|
||||
G4int index = fH2BookingVector.size();
|
||||
G4double xunit = GetUnitValue(xunitName);
|
||||
G4double yunit = GetUnitValue(yunitName);
|
||||
G4Fcn xfcn = GetFunction(xfcnName);
|
||||
G4Fcn yfcn = GetFunction(yfcnName);
|
||||
G4BinScheme xbinScheme = GetBinScheme(xbinSchemeName);
|
||||
G4BinScheme ybinScheme = GetBinScheme(ybinSchemeName);
|
||||
G4String newTitle(title);
|
||||
UpdateTitle(newTitle, xunitName, xfcnName);
|
||||
UpdateTitle(newTitle, yunitName, yfcnName);
|
||||
|
||||
h2_booking* h2Booking = new h2_booking(nxbins, xfcn(xmin), xfcn(xmax),
|
||||
nybins, yfcn(ymin), yfcn(ymax));
|
||||
// h2_booking object is deleted in destructor
|
||||
h2Booking->fTitle = newTitle;
|
||||
fH2BookingVector.push_back(h2Booking);
|
||||
fHnManager
|
||||
->AddH2Information(name, xunitName, yunitName, xfcnName, yfcnName,
|
||||
xunit, yunit, xfcn, yfcn, xbinScheme, ybinScheme);
|
||||
|
||||
// Set fH1HbookIdOffset if needed
|
||||
SetH2HbookIdOffset();
|
||||
|
||||
// Hbook index
|
||||
G4int hbookIndex = fH2HbookIdOffset + index + fFirstId;
|
||||
|
||||
// Create h2 if the file is open
|
||||
if ( fFileManager->IsFile() ) {
|
||||
// Go to histograms directory
|
||||
G4String histoPath = "//PAWC/LUN1/";
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
histoPath.append(fFileManager->GetHistoDirectoryName().data());
|
||||
}
|
||||
tools::hbook::CHCDIR(histoPath.data()," ");
|
||||
|
||||
// Create histogram
|
||||
tools::hbook::h2* h2
|
||||
= new tools::hbook::h2(hbookIndex, title,
|
||||
nxbins, xfcn(xmin), xfcn(xmax),
|
||||
nybins, yfcn(ymin), yfcn(ymax));
|
||||
// h2 objects are deleted when closing a file.
|
||||
fH2Vector.push_back(h2);
|
||||
|
||||
// Return to //PAWC/LUN1
|
||||
if ( fFileManager->GetHistoDirectoryName() != "" ) {
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
}
|
||||
}
|
||||
|
||||
fLockFirstId = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " name : " << name << " hbook index : " << hbookIndex;
|
||||
fState.GetVerboseL2()->Message("create", "H2", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
fH2NameIdMap[name] = index + fFirstId;
|
||||
return index + fFirstId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH2Manager::CreateH2(const G4String& /*name*/, const G4String& /*title*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
const G4String& /*xunitName*/, const G4String& /*yunitName*/,
|
||||
const G4String& /*xfcnName*/, const G4String& /*yfcnName*/)
|
||||
{
|
||||
// HBook does not support user defined binning for H2
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "User defined binning is not supported for H2.";
|
||||
G4Exception("ExG4HbookH2Manager::CreateH2",
|
||||
"Analysis_F015", FatalException, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2(G4int id,
|
||||
G4int nxbins, G4double xmin, G4double xmax,
|
||||
G4int nybins, G4double ymin, G4double ymax,
|
||||
const G4String& xunitName, const G4String& yunitName,
|
||||
const G4String& xfcnName, const G4String& yfcnName,
|
||||
const G4String& xbinScheme, const G4String& ybinScheme)
|
||||
{
|
||||
// HBook does not support user defined binning for H2
|
||||
if ( xbinScheme != "linear" || ybinScheme != "linear" ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Logarithimc binning is not supported for H2.";
|
||||
G4Exception("ExG4HbookH2Manager::CreateH2",
|
||||
"Analysis_F015", FatalException, description);
|
||||
}
|
||||
|
||||
h2_booking* h2Booking = GetH2Booking(id, false);
|
||||
if ( ! h2Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH2()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
G4HnInformation* hnInfo = fHnManager->GetHnInformation(id, "SetH2");
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("configure", "H2", hnInfo->GetName());
|
||||
#endif
|
||||
|
||||
// Keep new parameters in booking
|
||||
G4double xunit = GetUnitValue(xunitName);
|
||||
G4double yunit = GetUnitValue(yunitName);
|
||||
G4Fcn xfcn = GetFunction(xfcnName);
|
||||
G4Fcn yfcn = GetFunction(yfcnName);
|
||||
|
||||
h2Booking->fNxbins = nxbins;
|
||||
h2Booking->fXmin = xfcn(xmin/xunit);
|
||||
h2Booking->fXmax = xfcn(xmax/xunit);
|
||||
h2Booking->fNybins = nybins;
|
||||
h2Booking->fYmin = yfcn(ymin/yunit);
|
||||
h2Booking->fYmax = yfcn(ymax/yunit);
|
||||
|
||||
// Keep new parameters in information
|
||||
G4HnDimensionInformation* xInfo
|
||||
= hnInfo->GetHnDimensionInformation(G4HnInformation::kX);
|
||||
xInfo->fUnitName = xunitName;
|
||||
xInfo->fFcnName = xfcnName;
|
||||
xInfo->fUnit = xunit;
|
||||
xInfo->fFcn = xfcn;
|
||||
|
||||
G4HnDimensionInformation* yInfo
|
||||
= hnInfo->GetHnDimensionInformation(G4HnInformation::kY);
|
||||
yInfo->fUnitName = yunitName;
|
||||
yInfo->fFcnName = yfcnName;
|
||||
yInfo->fUnit = yunit;
|
||||
yInfo->fFcn = yfcn;
|
||||
fHnManager->SetActivation(id, true);
|
||||
|
||||
G4String newTitle(h2Booking->fTitle);
|
||||
UpdateTitle(newTitle, xunitName, xfcnName);
|
||||
UpdateTitle(newTitle, yunitName, yfcnName);
|
||||
h2Booking->fTitle = newTitle;
|
||||
|
||||
// Re-configure histogram if it was already defined
|
||||
if ( fH2Vector.size() ) {
|
||||
tools::hbook::h2* h2 = GetH2(id);
|
||||
h2->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
|
||||
nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2(G4int /*id*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
const G4String& /*xunitName*/, const G4String& /*yunitName*/,
|
||||
const G4String& /*xfcnName*/, const G4String& /*yfcnName*/)
|
||||
{
|
||||
// HBook does not support user defined binning for H2
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "User defined binning is not supported for H2.";
|
||||
G4Exception("ExG4HbookH2Manager::CreateH2",
|
||||
"Analysis_F015", FatalException, description);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::ScaleH2(G4int id, G4double factor)
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "ScaleH2", false, false);
|
||||
if ( ! h2 ) return false;
|
||||
|
||||
return h2->scale(factor);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::FillH2(G4int id,
|
||||
G4double xvalue, G4double yvalue,
|
||||
G4double weight)
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "FillH2", true, false);
|
||||
if ( ! h2 ) return false;
|
||||
|
||||
if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) return false;
|
||||
|
||||
G4HnDimensionInformation* xInfo
|
||||
= fHnManager->GetHnDimensionInformation(id, G4HnInformation::kX, "FillH2");
|
||||
G4HnDimensionInformation* yInfo
|
||||
= fHnManager->GetHnDimensionInformation(id, G4HnInformation::kY, "FillH2");
|
||||
h2->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
|
||||
yInfo->fFcn(yvalue/yInfo->fUnit), weight);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " id " << id
|
||||
<< " xvalue " << xvalue
|
||||
<< " xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
|
||||
<< " yvalue " << yvalue
|
||||
<< " yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
|
||||
<< " weight " << weight;
|
||||
fState.GetVerboseL4()->Message("fill", "H2", description);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::h2* ExG4HbookH2Manager::GetH2(G4int id, G4bool warn,
|
||||
G4bool onlyIfActive) const
|
||||
{
|
||||
return GetH2InFunction(id, "GetH2", warn, onlyIfActive);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH2Manager::GetH2Id(const G4String& name, G4bool warn) const
|
||||
{
|
||||
std::map<G4String, G4int>::const_iterator it = fH2NameIdMap.find(name);
|
||||
if ( it == fH2NameIdMap.end() ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "ExG4HbookH2Manager::GetH2Id";
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << name << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH2Manager::GetH2Nxbins(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2NXbins");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetNbins(h2->axis_x());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2Xmin(G4int id) const
|
||||
{
|
||||
// Returns xmin value with applied unit and histogram function
|
||||
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2Xmin");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMin(h2->axis_x());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2Xmax(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2Xmax");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMin(h2->axis_x());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2XWidth(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2XWidth", true, false);
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetWidth(h2->axis_x());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH2Manager::GetH2Nybins(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2NYbins");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetNbins(h2->axis_y());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2Ymin(G4int id) const
|
||||
{
|
||||
// Returns xmin value with applied unit and histogram function
|
||||
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2Ymin");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMin(h2->axis_y());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2Ymax(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2Ymax");
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetMax(h2->axis_y());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH2Manager::GetH2YWidth(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2YWidth", true, false);
|
||||
if ( ! h2 ) return 0;
|
||||
|
||||
return fBaseToolsManager.GetWidth(h2->axis_y());
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2Title(G4int id, const G4String& title)
|
||||
{
|
||||
h2_booking* h2Booking = GetH2Booking(id, false);
|
||||
if ( ! h2Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH2Title()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
h2Booking->fTitle = title;
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2XAxisTitle(G4int id, const G4String& title)
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "SetH2XAxisTitle");
|
||||
if ( ! h2 ) return false;
|
||||
|
||||
return fBaseToolsManager.SetAxisTitle(*h2, ExG4HbookBaseHnManager::kX, title);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2YAxisTitle(G4int id, const G4String& title)
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "SetH2YAxisTitle");
|
||||
if ( ! h2 ) return false;
|
||||
|
||||
return fBaseToolsManager.SetAxisTitle(*h2, ExG4HbookBaseHnManager::kY, title);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2ZAxisTitle(G4int id, const G4String& title)
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "SetH2ZAxisTitle");
|
||||
if ( ! h2 ) return false;
|
||||
|
||||
return fBaseToolsManager.SetAxisTitle(*h2, ExG4HbookBaseHnManager::kZ, title);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH2Manager::GetH2Title(G4int id) const
|
||||
{
|
||||
h2_booking* h2Booking = GetH2Booking(id, false);
|
||||
if ( ! h2Booking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "histogram " << id << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetH2Title()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return "";
|
||||
}
|
||||
|
||||
return h2Booking->fTitle;
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH2Manager::GetH2XAxisTitle(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2XAxisTitle");
|
||||
if ( ! h2 ) return "";
|
||||
|
||||
return fBaseToolsManager.GetAxisTitle(*h2, ExG4HbookBaseHnManager::kX);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH2Manager::GetH2YAxisTitle(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2YAxisTitle");
|
||||
if ( ! h2 ) return "";
|
||||
|
||||
return fBaseToolsManager.GetAxisTitle(*h2, ExG4HbookBaseHnManager::kY);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH2Manager::GetH2ZAxisTitle(G4int id) const
|
||||
{
|
||||
tools::hbook::h2* h2 = GetH2InFunction(id, "GetH2ZAxisTitle");
|
||||
if ( ! h2 ) return "";
|
||||
|
||||
return fBaseToolsManager.GetAxisTitle(*h2, ExG4HbookBaseHnManager::kZ);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH2Manager::SetH2HbookIdOffset(G4int offset)
|
||||
{
|
||||
if ( fH2Vector.size() ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set H2HbookIdOffset as some H2 histogramms already exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH2HbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( fFirstId + offset < 1 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "The first histogram HBOOK id must be >= 1.";
|
||||
G4Exception("G4HbookAnalysisManager::SetH1HbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fH2HbookIdOffset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,331 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// \file hbook/src/ExG4HbookH3DummyManager.cc
|
||||
/// \brief Implementation of the ExG4HbookH3DummyManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "ExG4HbookH3DummyManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH3DummyManager::ExG4HbookH3DummyManager(
|
||||
const G4AnalysisManagerState& state)
|
||||
: G4VH3Manager(state)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookH3DummyManager::~ExG4HbookH3DummyManager()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH3DummyManager::ExceptionForHistograms(
|
||||
const G4String& functionName)
|
||||
{
|
||||
if ( ! fWarn ) return;
|
||||
|
||||
ExceptionForHistogramsConst(functionName);
|
||||
fWarn = false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookH3DummyManager::ExceptionForHistogramsConst(
|
||||
const G4String& functionName) const
|
||||
{
|
||||
G4String inFunction = "G4";
|
||||
inFunction += fState.GetType();
|
||||
inFunction += "AnalysisManager::";
|
||||
inFunction += functionName;
|
||||
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Histograms are not supported." ;
|
||||
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::CreateH3(const G4String& /*name*/,
|
||||
const G4String& /*title*/,
|
||||
G4int /*nxbins*/,
|
||||
G4double /*xmin*/, G4double /*xmax*/,
|
||||
G4int /*nybins*/,
|
||||
G4double /*ymin*/, G4double /*ymax*/,
|
||||
G4int /*nzbins*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/,
|
||||
const G4String& /*xbinScheme*/,
|
||||
const G4String& /*ybinScheme*/,
|
||||
const G4String& /*zbinScheme*/)
|
||||
{
|
||||
ExceptionForHistograms("CreateH3");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::CreateH3(const G4String& /*name*/,
|
||||
const G4String& /*title*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
const std::vector<G4double>& /*zedges*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/)
|
||||
|
||||
{
|
||||
ExceptionForHistograms("CreateH3");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3(G4int /*id*/,
|
||||
G4int /*nxbins*/,
|
||||
G4double /*xmin*/, G4double /*xmax*/,
|
||||
G4int /*nybins*/,
|
||||
G4double /*ymin*/, G4double /*ymax*/,
|
||||
G4int /*nzbins*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/,
|
||||
const G4String& /*xbinScheme*/,
|
||||
const G4String& /*ybinScheme*/,
|
||||
const G4String& /*zbinScheme*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3(G4int /*id*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
const std::vector<G4double>& /*zedges*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::ScaleH3(G4int /*id*/, G4double /*factor*/)
|
||||
{
|
||||
ExceptionForHistograms("ScaleH3");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::FillH3(G4int /*id*/,
|
||||
G4double /*xvalue*/, G4double /*yvalue*/,
|
||||
G4double /*zvalue*/,
|
||||
G4double /*weight*/)
|
||||
{
|
||||
ExceptionForHistograms("FillH3");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::GetH3Id(const G4String& /*name*/, G4bool /*warn*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Id");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::GetH3Nxbins(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Nxbins");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Xmin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Xmin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Xmax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Xmax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3XWidth(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3XWidth");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::GetH3Nybins(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Nybins");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Ymin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Ymax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Ymax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3YWidth(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3YWidth");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookH3DummyManager::GetH3Nzbins(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Nzbins");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Zmin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Zmin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3Zmax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Zmax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookH3DummyManager::GetH3ZWidth(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3ZWidth");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3Title(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3Title");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3XAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3XAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3YAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3YAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::SetH3ZAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForHistograms("SetH3ZAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH3DummyManager::GetH3Title(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3Title");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH3DummyManager::GetH3XAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3XAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH3DummyManager::GetH3YAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3YAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookH3DummyManager::GetH3ZAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForHistogramsConst("GetH3ZAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookH3DummyManager::WriteOnAscii(std::ofstream& /*output*/)
|
||||
{
|
||||
ExceptionForHistograms("WriteOnAscii");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,780 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file hbook/src/ExG4HbookNtupleManager.cc
|
||||
/// \brief Implementation of the ExG4HbookNtupleManager class
|
||||
|
||||
// Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
|
||||
#include "ExG4HbookNtupleManager.hh"
|
||||
#include "ExG4HbookFileManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "G4AnalysisUtilities.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace G4Analysis;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookNtupleManager::ExG4HbookNtupleManager(const G4AnalysisManagerState& state)
|
||||
: G4VNtupleManager(state),
|
||||
fNtupleHbookIdOffset(-1),
|
||||
fNtupleDescriptionVector(),
|
||||
fNtupleVector()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookNtupleManager::~ExG4HbookNtupleManager()
|
||||
{
|
||||
// Reset();
|
||||
|
||||
std::vector<ExG4HbookNtupleDescription*>::iterator it;
|
||||
for (it = fNtupleDescriptionVector.begin(); it != fNtupleDescriptionVector.end(); it++ ) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookNtupleManager::SetNtupleHbookIdOffset()
|
||||
{
|
||||
// Set fH1HbookIdOffset if needed
|
||||
|
||||
if ( fNtupleHbookIdOffset == -1 ) {
|
||||
if ( fFirstId > 0 )
|
||||
fNtupleHbookIdOffset = 0;
|
||||
else
|
||||
fNtupleHbookIdOffset = 1;
|
||||
|
||||
if ( fNtupleHbookIdOffset > 0 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "Ntuple will be defined in HBOOK with ID = G4_firstNtupleId + 1";
|
||||
G4Exception("ExG4HbookNtupleManager::SetNtupleHbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookNtupleManager::CreateNtuplesFromBooking()
|
||||
{
|
||||
// Create ntuple from ntuple_booking.
|
||||
|
||||
if ( ! fNtupleDescriptionVector.size() ) return;
|
||||
|
||||
// Set fNtupleHbookIdOffset if needed
|
||||
SetNtupleHbookIdOffset();
|
||||
|
||||
G4int index = 0;
|
||||
std::vector<ExG4HbookNtupleDescription*>::iterator itn;
|
||||
for (itn = fNtupleDescriptionVector.begin(); itn != fNtupleDescriptionVector.end(); itn++ ) {
|
||||
|
||||
tools::ntuple_booking* ntupleBooking = (*itn)->fNtupleBooking;
|
||||
if ( ! ntupleBooking ) continue;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()
|
||||
->Message("create from booking", "ntuple", ntupleBooking->name());
|
||||
#endif
|
||||
|
||||
// Create an "ntuple" directory both in memory and in the file
|
||||
fFileManager->CreateNtupleDirectory();
|
||||
G4int hbookIndex = fNtupleHbookIdOffset + index + fFirstId;
|
||||
++index;
|
||||
|
||||
// We should be under //PAWC/LUN1/ntuple
|
||||
(*itn)->fNtuple
|
||||
= new tools::hbook::wntuple(hbookIndex, G4cout, *ntupleBooking);
|
||||
fNtupleVector.push_back((*itn)->fNtuple);
|
||||
|
||||
if ( ntupleBooking->columns().size() ) {
|
||||
// store ntuple columns in local maps
|
||||
const std::vector<tools::column_booking>& columns
|
||||
= ntupleBooking->columns();
|
||||
std::vector<tools::column_booking>::const_iterator it;
|
||||
G4int counter = 0;
|
||||
for ( it = columns.begin(); it!=columns.end(); ++it) {
|
||||
if ( it->cls_id() == tools::_cid(int(0) ) ) {
|
||||
(*itn)->fNtupleIColumnMap[counter++]
|
||||
= (*itn)->fNtuple->find_column<int>(it->name());
|
||||
}
|
||||
else if( it->cls_id() == tools::_cid(float(0) ) ) {
|
||||
(*itn)->fNtupleFColumnMap[counter++]
|
||||
= (*itn)->fNtuple->find_column<float>(it->name());
|
||||
}
|
||||
else if(it->cls_id()== tools::_cid(double(0))) {
|
||||
(*itn)->fNtupleDColumnMap[counter++]
|
||||
= (*itn)->fNtuple->find_column<double>(it->name());
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Unsupported column type " << it->name();
|
||||
G4Exception("G4HbookAnalysisManager::CreateNtupleFromBooking()",
|
||||
"Analysis_W002", JustWarning, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
FinishNtuple();
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL3() )
|
||||
fState.GetVerboseL3()
|
||||
->Message("create from booking", "ntuple", ntupleBooking->name());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::wntuple::column<int>*
|
||||
ExG4HbookNtupleManager::GetNtupleIColumn(G4int ntupleId, G4int columnId) const
|
||||
{
|
||||
ExG4HbookNtupleDescription* ntupleDecription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtupleIColumn");
|
||||
if ( ! ntupleDecription ) return 0;
|
||||
|
||||
std::map<G4int, tools::hbook::wntuple::column<int>* >& ntupleIColumnMap
|
||||
= ntupleDecription->fNtupleIColumnMap;
|
||||
std::map<G4int, tools::hbook::wntuple::column<int>* >::const_iterator it
|
||||
= ntupleIColumnMap.find(columnId);
|
||||
if ( it == ntupleIColumnMap.end() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetNtupleIColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::wntuple::column<float>*
|
||||
ExG4HbookNtupleManager::GetNtupleFColumn(G4int ntupleId, G4int columnId) const
|
||||
{
|
||||
ExG4HbookNtupleDescription* ntupleDecription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtupleFColumn");
|
||||
if ( ! ntupleDecription ) return 0;
|
||||
|
||||
std::map<G4int, tools::hbook::wntuple::column<float>* >& ntupleFColumnMap
|
||||
= ntupleDecription->fNtupleFColumnMap;
|
||||
std::map<G4int, tools::hbook::wntuple::column<float>* >::const_iterator it
|
||||
= ntupleFColumnMap.find(columnId);
|
||||
if ( it == ntupleFColumnMap.end() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetNtupleFColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::wntuple::column<double>*
|
||||
ExG4HbookNtupleManager::GetNtupleDColumn(G4int ntupleId, G4int columnId) const
|
||||
{
|
||||
ExG4HbookNtupleDescription* ntupleDecription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtupleDColumn");
|
||||
if ( ! ntupleDecription ) return 0;
|
||||
|
||||
std::map<G4int, tools::hbook::wntuple::column<double>* >& ntupleDColumnMap
|
||||
= ntupleDecription->fNtupleDColumnMap;
|
||||
std::map<G4int, tools::hbook::wntuple::column<double>* >::const_iterator it
|
||||
= ntupleDColumnMap.find(columnId);
|
||||
if ( it == ntupleDColumnMap.end() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::GetNtupleDColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookNtupleManager::Reset()
|
||||
{
|
||||
// Reset ntuple
|
||||
|
||||
std::vector<ExG4HbookNtupleDescription*>::iterator it3;
|
||||
for (it3 = fNtupleDescriptionVector.begin(); it3 != fNtupleDescriptionVector.end(); it3++ ) {
|
||||
delete (*it3)->fNtuple;
|
||||
(*it3)->fNtuple = 0;
|
||||
}
|
||||
fNtupleVector.clear();
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookNtupleDescription* ExG4HbookNtupleManager::GetNtupleInFunction(
|
||||
G4int id,
|
||||
G4String functionName, G4bool warn,
|
||||
G4bool /*onlyIfActive*/) const
|
||||
{
|
||||
G4int index = id - fFirstId;
|
||||
if ( index < 0 || index >= G4int(fNtupleDescriptionVector.size()) ) {
|
||||
if ( warn) {
|
||||
G4String inFunction = "G4HbookAnalysisManager::";
|
||||
inFunction += functionName;
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntuple " << id << " does not exist.";
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fNtupleDescriptionVector[index];
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtuple(const G4String& name,
|
||||
const G4String& title)
|
||||
{
|
||||
// Create an "ntuple" directory both in memory and in the file
|
||||
if ( fFileManager->IsFile() )
|
||||
fFileManager->CreateNtupleDirectory();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()->Message("create", "ntuple", name);
|
||||
#endif
|
||||
|
||||
// Create ntuple description
|
||||
G4int index = fNtupleDescriptionVector.size();
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= new ExG4HbookNtupleDescription();
|
||||
fNtupleDescriptionVector.push_back(ntupleDescription);
|
||||
|
||||
// Create ntuple booking
|
||||
ntupleDescription->fNtupleBooking
|
||||
= new tools::ntuple_booking(name, title);
|
||||
// ntuple booking object is deleted in destructor
|
||||
|
||||
// Set fNtupleHbookIdOffset if needed
|
||||
SetNtupleHbookIdOffset();
|
||||
|
||||
// Create ntuple if the file is open
|
||||
// We should be under //PAWC/LUN1/ntuple
|
||||
if ( fFileManager->IsFile() ) {
|
||||
G4int hbookIndex = fNtupleHbookIdOffset + index + fFirstId;
|
||||
ntupleDescription->fNtuple
|
||||
= new tools::hbook::wntuple(hbookIndex, name);
|
||||
// ntuple object is deleted when closing a file
|
||||
fNtupleVector.push_back(ntupleDescription->fNtuple);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << index + fFirstId;
|
||||
fState.GetVerboseL2()->Message("create", "ntuple", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return index + fFirstId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleIColumn(const G4String& name,
|
||||
std::vector<int>* vector)
|
||||
{
|
||||
G4int ntupleId = fNtupleDescriptionVector.size() + fFirstId - 1;
|
||||
return CreateNtupleIColumn(ntupleId, name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleFColumn(const G4String& name,
|
||||
std::vector<float>* vector)
|
||||
{
|
||||
G4int ntupleId = fNtupleDescriptionVector.size() + fFirstId - 1;
|
||||
return CreateNtupleFColumn(ntupleId, name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleDColumn(const G4String& name,
|
||||
std::vector<double>* vector)
|
||||
{
|
||||
G4int ntupleId = fNtupleDescriptionVector.size() + fFirstId - 1;
|
||||
return CreateNtupleDColumn(ntupleId, name, vector);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleSColumn(const G4String& name)
|
||||
{
|
||||
G4int ntupleId = fNtupleDescriptionVector.size() + fFirstId - 1;
|
||||
return CreateNtupleSColumn(ntupleId, name);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookNtupleManager::FinishNtuple()
|
||||
{
|
||||
G4int ntupleId = fNtupleDescriptionVector.size() + fFirstId - 1;
|
||||
FinishNtuple(ntupleId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleIColumn(G4int ntupleId,
|
||||
const G4String& name,
|
||||
std::vector<int>* vector)
|
||||
{
|
||||
// Vector columns are not supported in HBOOK
|
||||
if ( vector ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Vector columns are not supported in HBOOK.";
|
||||
G4Exception("(ExG4HbookNtupleManager::CreateNtupleIColumn)",
|
||||
"Analysis_W002", FatalException, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("create", "ntuple I column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "CreateNtupleIColumn");
|
||||
tools::ntuple_booking* ntupleBooking
|
||||
= ntupleDescription->fNtupleBooking;
|
||||
|
||||
if ( ! ntupleBooking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Ntuple " << ntupleId << " has to be created first. ";
|
||||
G4Exception("G4HbookAnalysisManager::CreateNtupleIColumn()",
|
||||
"Analysis_W002", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
// Save column info in booking
|
||||
G4int index = ntupleBooking->columns().size();
|
||||
ntupleBooking->add_column<int>(name);
|
||||
|
||||
// Create column if ntuple already exists
|
||||
if ( ntupleDescription->fNtuple ) {
|
||||
tools::hbook::wntuple::column<int>* column
|
||||
= ntupleDescription->fNtuple->create_column<int>(name);
|
||||
ntupleDescription->fNtupleIColumnMap[index] = column;
|
||||
}
|
||||
|
||||
fLockFirstNtupleColumnId = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL2()->Message("create", "ntuple I column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return index + fFirstNtupleColumnId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleFColumn(G4int ntupleId,
|
||||
const G4String& name,
|
||||
std::vector<float>* vector)
|
||||
{
|
||||
// Vector columns are not supported in HBOOK
|
||||
if ( vector ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Vector columns are not supported in HBOOK.";
|
||||
G4Exception("(ExG4HbookNtupleManager::CreateNtupleFColumn)",
|
||||
"Analysis_W002", FatalException, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("create", "ntuple F column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "CreateNtupleFColumn");
|
||||
tools::ntuple_booking* ntupleBooking
|
||||
= ntupleDescription->fNtupleBooking;
|
||||
|
||||
if ( ! ntupleBooking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Ntuple " << ntupleId << " has to be created first. ";
|
||||
G4Exception("G4HbookAnalysisManager::CreateNtupleFColumn()",
|
||||
"Analysis_W002", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
// Save column info in booking
|
||||
G4int index = ntupleBooking->columns().size();
|
||||
ntupleBooking->add_column<float>(name);
|
||||
|
||||
// Create column if ntuple already exists
|
||||
if ( ntupleDescription->fNtuple ) {
|
||||
tools::hbook::wntuple::column<float>* column
|
||||
= ntupleDescription->fNtuple->create_column<float>(name);
|
||||
ntupleDescription->fNtupleFColumnMap[index] = column;
|
||||
}
|
||||
|
||||
fLockFirstNtupleColumnId = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL2()->Message("create", "ntuple F column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return index + fFirstNtupleColumnId;
|
||||
}
|
||||
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleDColumn(G4int ntupleId,
|
||||
const G4String& name,
|
||||
std::vector<double>* vector)
|
||||
{
|
||||
// Vector columns are not supported in HBOOK
|
||||
if ( vector ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Vector columns are not supported in HBOOK.";
|
||||
G4Exception("(ExG4HbookNtupleManager::CreateNtupleDColumn)",
|
||||
"Analysis_W002", FatalException, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("create", "ntuple D column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "CreateNtupleDColumn");
|
||||
tools::ntuple_booking* ntupleBooking
|
||||
= ntupleDescription->fNtupleBooking;
|
||||
|
||||
if ( ! ntupleBooking ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Ntuple " << ntupleId << " has to be created first. ";
|
||||
G4Exception("G4HbookAnalysisManager::CreateNtupleDColumn()",
|
||||
"Analysis_W002", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
// Save column info in booking
|
||||
G4int index = ntupleBooking->columns().size();
|
||||
ntupleBooking->add_column<double>(name);
|
||||
|
||||
// Create column if ntuple already exists
|
||||
if ( ntupleDescription->fNtuple ) {
|
||||
tools::hbook::wntuple::column<double>* column
|
||||
= ntupleDescription->fNtuple->create_column<double>(name);
|
||||
ntupleDescription->fNtupleDColumnMap[index] = column;
|
||||
}
|
||||
|
||||
fLockFirstNtupleColumnId = true;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << name << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL2()->Message("create", "ntuple D column", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
return index + fFirstNtupleColumnId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookNtupleManager::CreateNtupleSColumn(G4int /*ntupleId*/,
|
||||
const G4String& /*name*/)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Columns of string type are not supported in HBOOK.";
|
||||
G4Exception("(ExG4HbookNtupleManager::CreateNtupleDColumn)",
|
||||
"Analysis_W002", FatalException, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookNtupleManager::FinishNtuple(G4int ntupleId)
|
||||
{
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "CreateNtupleDColumn");
|
||||
tools::hbook::wntuple* ntuple = ntupleDescription->fNtuple;
|
||||
|
||||
if ( ! ntuple ) return;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() )
|
||||
fState.GetVerboseL4()
|
||||
->Message("finish", "ntuple", ntupleDescription->fNtupleBooking->name());
|
||||
#endif
|
||||
|
||||
// Return to //PAWC/LUN1 :
|
||||
tools::hbook::CHCDIR("//PAWC/LUN1"," ");
|
||||
|
||||
//fNtuple->add_row_beg();
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL2() )
|
||||
fState.GetVerboseL2()
|
||||
->Message("finish", "ntuple", ntupleDescription->fNtupleBooking->name());
|
||||
#endif
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleIColumn(G4int columnId, G4int value)
|
||||
{
|
||||
return FillNtupleIColumn(fFirstId, columnId, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleFColumn(G4int columnId, G4float value)
|
||||
{
|
||||
return FillNtupleFColumn(fFirstId, columnId, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleDColumn(G4int columnId, G4double value)
|
||||
{
|
||||
return FillNtupleDColumn(fFirstId, columnId, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleSColumn(G4int columnId,
|
||||
const G4String& value)
|
||||
{
|
||||
return FillNtupleSColumn(fFirstId, columnId, value);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::AddNtupleRow()
|
||||
{
|
||||
return AddNtupleRow(fFirstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleIColumn(
|
||||
G4int ntupleId, G4int columnId,
|
||||
G4int value)
|
||||
{
|
||||
tools::hbook::wntuple::column<int>* column
|
||||
= GetNtupleIColumn(ntupleId, columnId);
|
||||
if ( ! column ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::FillNtupleIColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " value " << value;
|
||||
fState.GetVerboseL4()->Message("fill", "ntuple I column", description);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleFColumn(
|
||||
G4int ntupleId, G4int columnId,
|
||||
G4float value)
|
||||
{
|
||||
tools::hbook::wntuple::column<float>* column
|
||||
= GetNtupleFColumn(ntupleId, columnId);
|
||||
if ( ! column ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::FillNtupleFColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " value " << value;
|
||||
fState.GetVerboseL4()->Message("fill", "ntuple F column", description);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleDColumn(
|
||||
G4int ntupleId, G4int columnId,
|
||||
G4double value)
|
||||
{
|
||||
tools::hbook::wntuple::column<double>* column
|
||||
= GetNtupleDColumn(ntupleId, columnId);
|
||||
if ( ! column ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "ntupleId " << ntupleId
|
||||
<< "column " << columnId << " does not exist.";
|
||||
G4Exception("G4HbookAnalysisManager::FillNtupleDColumn()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
column->fill(value);
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId
|
||||
<< " columnId " << columnId << " value " << value;
|
||||
fState.GetVerboseL4()->Message("fill", "ntuple D column", description);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::FillNtupleSColumn(
|
||||
G4int /*ntupleId*/, G4int /*columnId*/,
|
||||
const G4String& /*value*/)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Columns of string type are not supported in HBOOK.";
|
||||
G4Exception("(ExG4HbookNtupleManager::FillNtupleSColumn)",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return kInvalidId;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::AddNtupleRow(G4int ntupleId)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("add", "ntuple row", description);
|
||||
}
|
||||
#endif
|
||||
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "AddNtupleRow");
|
||||
|
||||
if ( ! ntupleDescription || ! ntupleDescription->fNtuple ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << " ntupleId " << ntupleId
|
||||
<< " does not exist. ";
|
||||
G4Exception("G4HbookAnalysisManager::AddNtupleRow()",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
ntupleDescription->fNtuple->add_row();
|
||||
#ifdef G4VERBOSE
|
||||
if ( fState.GetVerboseL4() ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " ntupleId " << ntupleId;
|
||||
fState.GetVerboseL4()->Message("add", "ntuple row", description, true);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::wntuple* ExG4HbookNtupleManager::GetNtuple() const
|
||||
{
|
||||
return GetNtuple(fFirstId);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
tools::hbook::wntuple* ExG4HbookNtupleManager::GetNtuple(G4int ntupleId) const
|
||||
{
|
||||
ExG4HbookNtupleDescription* ntupleDescription
|
||||
= GetNtupleInFunction(ntupleId, "GetNtuple");
|
||||
|
||||
return ntupleDescription->fNtuple;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookNtupleManager::SetNtupleHbookIdOffset(G4int offset)
|
||||
{
|
||||
if ( fNtupleDescriptionVector.size() ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< "Cannot set NtupleHbookIdOffset as some ntuples already exist.";
|
||||
G4Exception("G4HbookAnalysisManager::SetNtupleHbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( fFirstId + offset < 1 ) {
|
||||
G4ExceptionDescription description;
|
||||
description << "The first ntuple HBOOK id must be >= 1.";
|
||||
G4Exception("G4HbookAnalysisManager::SetNtupleHbookIdOffset()",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return false;
|
||||
}
|
||||
|
||||
fNtupleHbookIdOffset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,314 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// \file hbook/src/ExG4HbookP2DummyManager.cc
|
||||
/// \brief Implementation of the ExG4HbookP2DummyManager class
|
||||
\
|
||||
// Author: Ivana Hrivnacova, 03/11/2014 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "ExG4HbookP2DummyManager.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookP2DummyManager::ExG4HbookP2DummyManager(
|
||||
const G4AnalysisManagerState& state)
|
||||
: G4VP2Manager(state),
|
||||
fWarn(true)
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4HbookP2DummyManager::~ExG4HbookP2DummyManager()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// private methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookP2DummyManager::ExceptionForProfiles(
|
||||
const G4String& functionName)
|
||||
{
|
||||
if ( ! fWarn ) return;
|
||||
|
||||
ExceptionForProfilesConst(functionName);
|
||||
fWarn = false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4HbookP2DummyManager::ExceptionForProfilesConst(
|
||||
const G4String& functionName) const
|
||||
{
|
||||
G4String inFunction = "G4";
|
||||
inFunction += fState.GetType();
|
||||
inFunction += "AnalysisManager::";
|
||||
inFunction += functionName;
|
||||
|
||||
G4ExceptionDescription description;
|
||||
description << " "
|
||||
<< "Profiles are not supported." ;
|
||||
|
||||
G4Exception(inFunction, "Analysis_W011", JustWarning, description);
|
||||
}
|
||||
|
||||
//
|
||||
// protected methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookP2DummyManager::CreateP2(const G4String& /*name*/,
|
||||
const G4String& /*title*/,
|
||||
G4int /*nxbins*/,
|
||||
G4double /*xmin*/, G4double /*xmax*/,
|
||||
G4int /*nybins*/,
|
||||
G4double /*ymin*/, G4double /*ymax*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/,
|
||||
const G4String& /*xbinScheme*/,
|
||||
const G4String& /*ybinScheme*/)
|
||||
{
|
||||
ExceptionForProfiles("CreateP2");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookP2DummyManager::CreateP2(const G4String& /*name*/,
|
||||
const G4String& /*title*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/)
|
||||
|
||||
{
|
||||
ExceptionForProfiles("CreateP2");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2(G4int /*id*/,
|
||||
G4int /*nxbins*/,
|
||||
G4double /*xmin*/, G4double /*xmax*/,
|
||||
G4int /*nybins*/,
|
||||
G4double /*ymin*/, G4double /*ymax*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/,
|
||||
const G4String& /*xbinScheme*/,
|
||||
const G4String& /*ybinScheme*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2(G4int /*id*/,
|
||||
const std::vector<G4double>& /*xedges*/,
|
||||
const std::vector<G4double>& /*yedges*/,
|
||||
G4double /*zmin*/, G4double /*zmax*/,
|
||||
const G4String& /*xunitName*/,
|
||||
const G4String& /*yunitName*/,
|
||||
const G4String& /*zunitName*/,
|
||||
const G4String& /*xfcnName*/,
|
||||
const G4String& /*yfcnName*/,
|
||||
const G4String& /*zfcnName*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::ScaleP2(G4int /*id*/, G4double /*factor*/)
|
||||
{
|
||||
ExceptionForProfiles("ScaleP2");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::FillP2(G4int /*id*/,
|
||||
G4double /*xvalue*/, G4double /*yvalue*/,
|
||||
G4double /*zvalue*/,
|
||||
G4double /*weight*/)
|
||||
{
|
||||
ExceptionForProfiles("FillP2");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookP2DummyManager::GetP2Id(const G4String& /*name*/, G4bool /*warn*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Id");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookP2DummyManager::GetP2Nxbins(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Nxbins");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Xmin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Xmin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Xmax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Xmax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2XWidth(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2XWidth");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4int ExG4HbookP2DummyManager::GetP2Nybins(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Nybins");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Ymin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Ymax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Ymax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2YWidth(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2YWidth");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Zmin(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Zmin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4double ExG4HbookP2DummyManager::GetP2Zmax(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Zmax");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2Title(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2Title");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2XAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2XAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2YAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2YAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::SetP2ZAxisTitle(G4int /*id*/, const G4String& /*title*/)
|
||||
{
|
||||
ExceptionForProfiles("SetP2ZAxisTitle");
|
||||
return false;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookP2DummyManager::GetP2Title(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2Title");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookP2DummyManager::GetP2XAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2XAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookP2DummyManager::GetP2YAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2YAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4String ExG4HbookP2DummyManager::GetP2ZAxisTitle(G4int /*id*/) const
|
||||
{
|
||||
ExceptionForProfilesConst("GetP2ZAxisTitle");
|
||||
return "";
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4bool ExG4HbookP2DummyManager::WriteOnAscii(std::ofstream& /*output*/)
|
||||
{
|
||||
ExceptionForProfiles("WriteOnAscii");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
*
|
||||
* ********************************************************************
|
||||
* * License and Disclaimer *
|
||||
* * *
|
||||
* * The Geant4 software is copyright of the Copyright Holders of *
|
||||
* * the Geant4 Collaboration. It is provided under the terms and *
|
||||
* * conditions of the Geant4 Software License, included in the file *
|
||||
* * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
* * include a list of copyright holders. *
|
||||
* * *
|
||||
* * Neither the authors of this software system, nor their employing *
|
||||
* * institutes,nor the agencies providing financial support for this *
|
||||
* * work make any representation or warranty, express or implied, *
|
||||
* * regarding this software system or assume any liability for its *
|
||||
* * use. Please see the license in the file LICENSE and URL above *
|
||||
* * for the full disclaimer and the limitation of liability. *
|
||||
* * *
|
||||
* * This code implementation is the result of the scientific and *
|
||||
* * technical work of the GEANT4 collaboration. *
|
||||
* * By using, copying, modifying or distributing the software (or *
|
||||
* * any work based on the software) you agree to acknowledge its *
|
||||
* * use in resulting scientific publications, and indicate your *
|
||||
* * acceptance of all terms of the Geant4 Software license. *
|
||||
* ********************************************************************
|
||||
*
|
||||
SUBROUTINE OCLOSE(IUNIT)
|
||||
IMPLICIT NONE
|
||||
INTEGER IUNIT
|
||||
CLOSE(IUNIT)
|
||||
RETURN
|
||||
END
|
||||
@@ -0,0 +1,34 @@
|
||||
*
|
||||
* ********************************************************************
|
||||
* * License and Disclaimer *
|
||||
* * *
|
||||
* * The Geant4 software is copyright of the Copyright Holders of *
|
||||
* * the Geant4 Collaboration. It is provided under the terms and *
|
||||
* * conditions of the Geant4 Software License, included in the file *
|
||||
* * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
* * include a list of copyright holders. *
|
||||
* * *
|
||||
* * Neither the authors of this software system, nor their employing *
|
||||
* * institutes,nor the agencies providing financial support for this *
|
||||
* * work make any representation or warranty, express or implied, *
|
||||
* * regarding this software system or assume any liability for its *
|
||||
* * use. Please see the license in the file LICENSE and URL above *
|
||||
* * for the full disclaimer and the limitation of liability. *
|
||||
* * *
|
||||
* * This code implementation is the result of the scientific and *
|
||||
* * technical work of the GEANT4 collaboration. *
|
||||
* * By using, copying, modifying or distributing the software (or *
|
||||
* * any work based on the software) you agree to acknowledge its *
|
||||
* * use in resulting scientific publications, and indicate your *
|
||||
* * acceptance of all terms of the Geant4 Software license. *
|
||||
* ********************************************************************
|
||||
*
|
||||
INTEGER*4 FUNCTION SETNTUC()
|
||||
INTEGER NNTUC
|
||||
PARAMETER (NNTUC = 200)
|
||||
INTEGER*4 NVAR,P
|
||||
COMMON /NTUC/ NVAR,P(NNTUC)
|
||||
NVAR = 0
|
||||
SETNTUC = NNTUC
|
||||
RETURN
|
||||
END
|
||||
@@ -0,0 +1,35 @@
|
||||
*
|
||||
* ********************************************************************
|
||||
* * License and Disclaimer *
|
||||
* * *
|
||||
* * The Geant4 software is copyright of the Copyright Holders of *
|
||||
* * the Geant4 Collaboration. It is provided under the terms and *
|
||||
* * conditions of the Geant4 Software License, included in the file *
|
||||
* * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
* * include a list of copyright holders. *
|
||||
* * *
|
||||
* * Neither the authors of this software system, nor their employing *
|
||||
* * institutes,nor the agencies providing financial support for this *
|
||||
* * work make any representation or warranty, express or implied, *
|
||||
* * regarding this software system or assume any liability for its *
|
||||
* * use. Please see the license in the file LICENSE and URL above *
|
||||
* * for the full disclaimer and the limitation of liability. *
|
||||
* * *
|
||||
* * This code implementation is the result of the scientific and *
|
||||
* * technical work of the GEANT4 collaboration. *
|
||||
* * By using, copying, modifying or distributing the software (or *
|
||||
* * any work based on the software) you agree to acknowledge its *
|
||||
* * use in resulting scientific publications, and indicate your *
|
||||
* * acceptance of all terms of the Geant4 Software license. *
|
||||
* ********************************************************************
|
||||
*
|
||||
INTEGER*4 FUNCTION SETPAWC()
|
||||
INTEGER NPAWC
|
||||
PARAMETER (NPAWC = 1000000)
|
||||
INTEGER P
|
||||
COMMON /PAWC/ P(NPAWC)
|
||||
INTEGER IQUEST
|
||||
COMMON/QUEST/IQUEST(100)
|
||||
SETPAWC = NPAWC
|
||||
RETURN
|
||||
END
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file common/analysis/testAnalysis.cc
|
||||
/// \brief Test program for the analysis common classes
|
||||
|
||||
#ifdef G4_USE_HBOOK
|
||||
#include "ExG4HbookAnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
// test program which only instantiates classes defined in
|
||||
// examples/extended/common/analysis
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef G4_USE_HBOOK
|
||||
ExG4HbookAnalysisManager* hbookManager = ExG4HbookAnalysisManager::Instance();
|
||||
delete hbookManager;
|
||||
|
||||
hbookManager = ExG4HbookAnalysisManager::Instance();
|
||||
delete hbookManager;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
$Id: History 85989 2014-11-06 15:40:05Z gcosmo $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
analysis/shared History file
|
||||
----------------------------
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
06-11-14 I. Hrivnacova (analysisShared-V10-00-01)
|
||||
- Moved scripts from upper directory in shared
|
||||
|
||||
05-11-14 I. Hrivnacova (analysisShared-V10-00-00)
|
||||
- Tagged version which will be included in AnaEx0N examples
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file ActionInitialization.hh
|
||||
/// \brief Definition of the ActionInitialization class
|
||||
|
||||
#ifndef ActionInitialization_h
|
||||
#define ActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
|
||||
/// Action initialization class.
|
||||
///
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
ActionInitialization(DetectorConstruction* detector);
|
||||
virtual ~ActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/DetectorConstruction.hh
|
||||
/// \brief Definition of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Box;
|
||||
class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
class DetectorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
DetectorConstruction();
|
||||
virtual ~DetectorConstruction();
|
||||
|
||||
public:
|
||||
|
||||
void SetAbsorberMaterial (G4String);
|
||||
void SetAbsorberThickness(G4double);
|
||||
|
||||
void SetGapMaterial (G4String);
|
||||
void SetGapThickness(G4double);
|
||||
|
||||
void SetCalorSizeYZ(G4double);
|
||||
void SetNbOfLayers (G4int);
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
public:
|
||||
|
||||
void PrintCalorParameters();
|
||||
|
||||
G4double GetWorldSizeX() {return fWorldSizeX;};
|
||||
G4double GetWorldSizeYZ() {return fWorldSizeYZ;};
|
||||
|
||||
G4double GetCalorThickness() {return fCalorThickness;};
|
||||
G4double GetCalorSizeYZ() {return fCalorSizeYZ;};
|
||||
|
||||
G4int GetNbOfLayers() {return fNbOfLayers;};
|
||||
|
||||
G4Material* GetAbsorberMaterial() {return fAbsorberMaterial;};
|
||||
G4double GetAbsorberThickness() {return fAbsorberThickness;};
|
||||
|
||||
G4Material* GetGapMaterial() {return fGapMaterial;};
|
||||
G4double GetGapThickness() {return fGapThickness;};
|
||||
|
||||
const G4VPhysicalVolume* GetphysiWorld() {return fPhysiWorld;};
|
||||
const G4VPhysicalVolume* GetAbsorber() {return fPhysiAbsorber;};
|
||||
const G4VPhysicalVolume* GetGap() {return fPhysiGap;};
|
||||
|
||||
private:
|
||||
|
||||
G4Material* fAbsorberMaterial;
|
||||
G4double fAbsorberThickness;
|
||||
|
||||
G4Material* fGapMaterial;
|
||||
G4double fGapThickness;
|
||||
|
||||
G4int fNbOfLayers;
|
||||
G4double fLayerThickness;
|
||||
|
||||
G4double fCalorSizeYZ;
|
||||
G4double fCalorThickness;
|
||||
|
||||
G4Material* fDefaultMaterial;
|
||||
G4double fWorldSizeYZ;
|
||||
G4double fWorldSizeX;
|
||||
|
||||
G4Box* fSolidWorld; //pointer to the solid World
|
||||
G4LogicalVolume* fLogicWorld; //pointer to the logical World
|
||||
G4VPhysicalVolume* fPhysiWorld; //pointer to the physical World
|
||||
|
||||
G4Box* fSolidCalor; //pointer to the solid Calor
|
||||
G4LogicalVolume* fLogicCalor; //pointer to the logical Calor
|
||||
G4VPhysicalVolume* fPhysiCalor; //pointer to the physical Calor
|
||||
|
||||
G4Box* fSolidLayer; //pointer to the solid Layer
|
||||
G4LogicalVolume* fLogicLayer; //pointer to the logical Layer
|
||||
G4VPhysicalVolume* fPhysiLayer; //pointer to the physical Layer
|
||||
|
||||
G4Box* fSolidAbsorber; //pointer to the solid Absorber
|
||||
G4LogicalVolume* fLogicAbsorber; //pointer to the logical Absorber
|
||||
G4VPhysicalVolume* fPhysiAbsorber; //pointer to the physical Absorber
|
||||
|
||||
G4Box* fSolidGap; //pointer to the solid Gap
|
||||
G4LogicalVolume* fLogicGap; //pointer to the logical Gap
|
||||
G4VPhysicalVolume* fPhysiGap; //pointer to the physical Gap
|
||||
|
||||
DetectorMessenger* fDetectorMessenger; //pointer to the Messenger
|
||||
|
||||
private:
|
||||
|
||||
void DefineMaterials();
|
||||
void ComputeCalorParameters();
|
||||
G4VPhysicalVolume* ConstructCalorimeter();
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void DetectorConstruction::ComputeCalorParameters()
|
||||
{
|
||||
// Compute derived parameters of the calorimeter
|
||||
fLayerThickness = fAbsorberThickness + fGapThickness;
|
||||
fCalorThickness = fNbOfLayers*fLayerThickness;
|
||||
|
||||
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/DetectorMessenger.hh
|
||||
/// \brief Definition of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef DetectorMessenger_h
|
||||
#define DetectorMessenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
DetectorMessenger(DetectorConstruction* );
|
||||
virtual ~DetectorMessenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
|
||||
G4UIdirectory* fN03Dir;
|
||||
G4UIdirectory* fDetDir;
|
||||
G4UIcmdWithAString* fAbsMaterCmd;
|
||||
G4UIcmdWithAString* fGapMaterCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fAbsThickCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fGapThickCmd;
|
||||
G4UIcmdWithADoubleAndUnit* fSizeYZCmd;
|
||||
G4UIcmdWithAnInteger* fNbLayersCmd;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/EventAction.hh
|
||||
/// \brief Definition of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef EventAction_h
|
||||
#define EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class RunAction;
|
||||
class HistoManager;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
EventAction(RunAction*, HistoManager*);
|
||||
virtual ~EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event*);
|
||||
virtual void EndOfEventAction(const G4Event*);
|
||||
|
||||
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
|
||||
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
|
||||
|
||||
private:
|
||||
RunAction* fRunAct;
|
||||
HistoManager* fHistoManager;
|
||||
|
||||
G4double fEnergyAbs, fEnergyGap;
|
||||
G4double fTrackLAbs, fTrackLGap;
|
||||
|
||||
G4int fPrintModulo;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef PrimaryGeneratorAction_h
|
||||
#define PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class DetectorConstruction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction(DetectorConstruction*);
|
||||
virtual ~PrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun; //pointer a to G4 class
|
||||
DetectorConstruction* fDetector; //pointer to the geometry
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/RunAction.hh
|
||||
/// \brief Definition of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef RunAction_h
|
||||
#define RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4Run;
|
||||
class HistoManager;
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
RunAction(HistoManager*);
|
||||
virtual ~RunAction();
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
|
||||
void fillPerEvent(G4double, G4double, G4double, G4double);
|
||||
|
||||
private:
|
||||
HistoManager* fHistoManager;
|
||||
|
||||
G4double fSumEAbs, fSum2EAbs;
|
||||
G4double fSumEGap, fSum2EGap;
|
||||
|
||||
G4double fSumLAbs, fSum2LAbs;
|
||||
G4double fSumLGap, fSum2LGap;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/include/SteppingAction.hh
|
||||
/// \brief Definition of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.hh 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef SteppingAction_h
|
||||
#define SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
class EventAction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
SteppingAction(DetectorConstruction*, EventAction*);
|
||||
virtual ~SteppingAction();
|
||||
|
||||
virtual void UserSteppingAction(const G4Step*);
|
||||
|
||||
private:
|
||||
DetectorConstruction* fDetector;
|
||||
EventAction* fEventAction;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
$Id: History 85773 2014-11-05 11:31:15Z ihrivnac $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
analysis/scripts History file
|
||||
----------------------------
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
05-11-14 I. Hrivnacova (analysisScripts-V10-00-00)
|
||||
- Tagged version which will be included in AnaEx0N examples
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to remove classes copied from shared directory into include and src
|
||||
# via copy_files.sh
|
||||
#
|
||||
# By I. Hrivnacova, IPN Orsay
|
||||
|
||||
DIRNAME=$1
|
||||
|
||||
for FILE in `ls $DIRNAME/include`; do
|
||||
rm -f include/$FILE
|
||||
done
|
||||
for FILE in `ls $DIRNAME/src`; do
|
||||
rm -f src/$FILE
|
||||
done
|
||||
|
||||
echo "... clean_files.sh from $1 finished"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to copy classes from shared directory into include and src
|
||||
# as it is required by GNUmake build.
|
||||
# Usage: copy_files.sh directoryName
|
||||
#
|
||||
# By I. Hrivnacova, IPN Orsay
|
||||
|
||||
DIRNAME=$1
|
||||
|
||||
cp -rp $DIRNAME/include/* include
|
||||
cp -rp $DIRNAME/src/* src
|
||||
|
||||
echo "... copy_files.sh from $1 finished"
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetector(detector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
SetUserAction(new RunAction(histo));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
//
|
||||
SetUserAction(new PrimaryGeneratorAction(fDetector));
|
||||
|
||||
RunAction* runAction = new RunAction(histo);
|
||||
SetUserAction(runAction);
|
||||
|
||||
EventAction* eventAction = new EventAction(runAction, histo);
|
||||
SetUserAction(eventAction);
|
||||
|
||||
SteppingAction* steppingAction = new SteppingAction(fDetector, eventAction);
|
||||
SetUserAction(steppingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,340 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.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"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:G4VUserDetectorConstruction(),
|
||||
fAbsorberMaterial(0),fGapMaterial(0),fDefaultMaterial(0),
|
||||
fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
|
||||
fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
|
||||
fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
|
||||
fSolidAbsorber(0),fLogicAbsorber(0),fPhysiAbsorber(0),
|
||||
fSolidGap (0),fLogicGap (0),fPhysiGap (0),
|
||||
fDetectorMessenger(0)
|
||||
{
|
||||
// default parameter values of the calorimeter
|
||||
fAbsorberThickness = 10.*mm;
|
||||
fGapThickness = 5.*mm;
|
||||
fNbOfLayers = 10;
|
||||
fCalorSizeYZ = 10.*cm;
|
||||
ComputeCalorParameters();
|
||||
|
||||
// materials
|
||||
DefineMaterials();
|
||||
SetAbsorberMaterial("G4_Pb");
|
||||
SetGapMaterial("G4_lAr");
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{ delete fDetectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
return ConstructCalorimeter();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// use G4-NIST materials data base
|
||||
//
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
fDefaultMaterial = man->FindOrBuildMaterial("G4_Galactic");
|
||||
man->FindOrBuildMaterial("G4_Pb");
|
||||
man->FindOrBuildMaterial("G4_lAr");
|
||||
|
||||
// print table
|
||||
//
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
{
|
||||
|
||||
// Clean old geometry, if any
|
||||
//
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// complete the Calor parameters definition
|
||||
ComputeCalorParameters();
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
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
|
||||
|
||||
fPhysiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicWorld, //its logical volume
|
||||
"World", //its name
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
fSolidCalor=0; fLogicCalor=0; fPhysiCalor=0;
|
||||
fSolidLayer=0; fLogicLayer=0; fPhysiLayer=0;
|
||||
|
||||
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
|
||||
|
||||
fPhysiCalor = new G4PVPlacement(0, //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
|
||||
|
||||
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
|
||||
else
|
||||
fPhysiLayer = new G4PVPlacement(0, //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=0; fLogicAbsorber=0; fPhysiAbsorber=0;
|
||||
|
||||
if (fAbsorberThickness > 0.)
|
||||
{ fSolidAbsorber = new G4Box("Absorber", //its name
|
||||
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
|
||||
|
||||
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
|
||||
fAbsorberMaterial, //its material
|
||||
fAbsorberMaterial->GetName());//name
|
||||
|
||||
fPhysiAbsorber = new G4PVPlacement(0, //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=0; fLogicGap=0; fPhysiGap=0;
|
||||
|
||||
if (fGapThickness > 0.)
|
||||
{ fSolidGap = new G4Box("Gap",
|
||||
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
|
||||
|
||||
fLogicGap = new G4LogicalVolume(fSolidGap,
|
||||
fGapMaterial,
|
||||
fGapMaterial->GetName());
|
||||
|
||||
fPhysiGap = new G4PVPlacement(0, //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();
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
fLogicWorld->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
return fPhysiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::PrintCalorParameters()
|
||||
{
|
||||
G4cout << "\n------------------------------------------------------------"
|
||||
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
|
||||
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
|
||||
<< " + "
|
||||
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
|
||||
<< "\n------------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fAbsorberMaterial = pttoMaterial;
|
||||
if ( fLogicAbsorber )
|
||||
{
|
||||
fLogicAbsorber->SetMaterial(fAbsorberMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetGapMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fGapMaterial = pttoMaterial;
|
||||
if ( fLogicGap )
|
||||
{
|
||||
fLogicGap->SetMaterial(fGapMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
{
|
||||
// change Absorber thickness and recompute the calorimeter parameters
|
||||
fAbsorberThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetGapThickness(G4double val)
|
||||
{
|
||||
// change Gap thickness and recompute the calorimeter parameters
|
||||
fGapThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size and recompute the calorimeter parameters
|
||||
fCalorSizeYZ = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetNbOfLayers(G4int val)
|
||||
{
|
||||
fNbOfLayers = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
|
||||
: G4UImessenger(),
|
||||
fDetector(Det),
|
||||
fN03Dir(0),
|
||||
fDetDir(0),
|
||||
fAbsMaterCmd(0),
|
||||
fGapMaterCmd(0),
|
||||
fAbsThickCmd(0),
|
||||
fGapThickCmd(0),
|
||||
fSizeYZCmd(0),
|
||||
fNbLayersCmd(0)
|
||||
{
|
||||
fN03Dir = new G4UIdirectory("/N03/");
|
||||
fN03Dir->SetGuidance("UI commands of this example");
|
||||
|
||||
G4bool broadcast = false;
|
||||
fDetDir = new G4UIdirectory("/N03/det/",broadcast);
|
||||
fDetDir->SetGuidance("detector control");
|
||||
|
||||
fAbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
|
||||
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
|
||||
fAbsMaterCmd->SetParameterName("choice",false);
|
||||
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fGapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
|
||||
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
|
||||
fGapMaterCmd->SetParameterName("choice",false);
|
||||
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
|
||||
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
|
||||
fAbsThickCmd->SetParameterName("Size",false);
|
||||
fAbsThickCmd->SetRange("Size>=0.");
|
||||
fAbsThickCmd->SetUnitCategory("Length");
|
||||
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
|
||||
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
|
||||
fGapThickCmd->SetParameterName("Size",false);
|
||||
fGapThickCmd->SetRange("Size>=0.");
|
||||
fGapThickCmd->SetUnitCategory("Length");
|
||||
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
|
||||
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
|
||||
fSizeYZCmd->SetParameterName("Size",false);
|
||||
fSizeYZCmd->SetRange("Size>0.");
|
||||
fSizeYZCmd->SetUnitCategory("Length");
|
||||
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fNbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
|
||||
fNbLayersCmd->SetGuidance("Set number of layers.");
|
||||
fNbLayersCmd->SetParameterName("NbLayers",false);
|
||||
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
|
||||
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fNbLayersCmd;
|
||||
delete fAbsMaterCmd; delete fGapMaterCmd;
|
||||
delete fAbsThickCmd; delete fGapThickCmd;
|
||||
delete fSizeYZCmd;
|
||||
delete fDetDir;
|
||||
delete fN03Dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == fAbsMaterCmd )
|
||||
{ fDetector->SetAbsorberMaterial(newValue);}
|
||||
|
||||
if( command == fGapMaterCmd )
|
||||
{ fDetector->SetGapMaterial(newValue);}
|
||||
|
||||
if( command == fAbsThickCmd )
|
||||
{ fDetector->SetAbsorberThickness(fAbsThickCmd
|
||||
->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fGapThickCmd )
|
||||
{ fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fSizeYZCmd )
|
||||
{ fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fNbLayersCmd )
|
||||
{ fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: EventAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* run, HistoManager* histo)
|
||||
:G4UserEventAction(),
|
||||
fRunAct(run),fHistoManager(histo),
|
||||
fEnergyAbs(0.), fEnergyGap(0.),
|
||||
fTrackLAbs(0.), fTrackLGap(0.),
|
||||
fPrintModulo(0)
|
||||
{
|
||||
fPrintModulo = 100; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
|
||||
|
||||
// initialisation per event
|
||||
fEnergyAbs = fEnergyGap = 0.;
|
||||
fTrackLAbs = fTrackLGap = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
//accumulates statistic
|
||||
//
|
||||
fRunAct->fillPerEvent(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
|
||||
|
||||
//fill histograms
|
||||
//
|
||||
fHistoManager->FillHisto(1, fEnergyAbs);
|
||||
fHistoManager->FillHisto(2, fEnergyGap);
|
||||
fHistoManager->FillHisto(3, fTrackLAbs);
|
||||
fHistoManager->FillHisto(4, fTrackLGap);
|
||||
|
||||
//fill ntuple
|
||||
//
|
||||
fHistoManager->FillNtuple(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0),
|
||||
fDetector(DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: RunAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(HistoManager* histo)
|
||||
: G4UserRunAction(),
|
||||
fHistoManager(histo),
|
||||
fSumEAbs(0.), fSum2EAbs(0.),
|
||||
fSumEGap(0.), fSum2EGap(0.),
|
||||
fSumLAbs(0.), fSum2LAbs(0.),
|
||||
fSumLGap(0.), fSum2LGap(0.)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
//initialize cumulative quantities
|
||||
//
|
||||
fSumEAbs = fSum2EAbs =fSumEGap = fSum2EGap = 0.;
|
||||
fSumLAbs = fSum2LAbs =fSumLGap = fSum2LGap = 0.;
|
||||
|
||||
//histograms
|
||||
//
|
||||
fHistoManager->book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::fillPerEvent(G4double EAbs, G4double EGap,
|
||||
G4double LAbs, G4double LGap)
|
||||
{
|
||||
//accumulate statistic
|
||||
//
|
||||
fSumEAbs += EAbs; fSum2EAbs += EAbs*EAbs;
|
||||
fSumEGap += EGap; fSum2EGap += EGap*EGap;
|
||||
|
||||
fSumLAbs += LAbs; fSum2LAbs += LAbs*LAbs;
|
||||
fSumLGap += LGap; fSum2LGap += LGap*LGap;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
if (NbOfEvents == 0) return;
|
||||
|
||||
//compute statistics: mean and rms
|
||||
//
|
||||
fSumEAbs /= NbOfEvents; fSum2EAbs /= NbOfEvents;
|
||||
G4double rmsEAbs = fSum2EAbs - fSumEAbs*fSumEAbs;
|
||||
if (rmsEAbs >0.) rmsEAbs = std::sqrt(rmsEAbs); else rmsEAbs = 0.;
|
||||
|
||||
fSumEGap /= NbOfEvents; fSum2EGap /= NbOfEvents;
|
||||
G4double rmsEGap = fSum2EGap - fSumEGap*fSumEGap;
|
||||
if (rmsEGap >0.) rmsEGap = std::sqrt(rmsEGap); else rmsEGap = 0.;
|
||||
|
||||
fSumLAbs /= NbOfEvents; fSum2LAbs /= NbOfEvents;
|
||||
G4double rmsLAbs = fSum2LAbs - fSumLAbs*fSumLAbs;
|
||||
if (rmsLAbs >0.) rmsLAbs = std::sqrt(rmsLAbs); else rmsLAbs = 0.;
|
||||
|
||||
fSumLGap /= NbOfEvents; fSum2LGap /= NbOfEvents;
|
||||
G4double rmsLGap = fSum2LGap - fSumLGap*fSumLGap;
|
||||
if (rmsLGap >0.) rmsLGap = std::sqrt(rmsLGap); else rmsLGap = 0.;
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< "\n--------------------End of Run------------------------------\n"
|
||||
<< "\n mean Energy in Absorber : " << G4BestUnit(fSumEAbs,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
|
||||
<< "\n mean Energy in Gap : " << G4BestUnit(fSumEGap,"Energy")
|
||||
<< " +- " << G4BestUnit(rmsEGap,"Energy")
|
||||
<< G4endl;
|
||||
|
||||
G4cout
|
||||
<< "\n mean trackLength in Absorber : " << G4BestUnit(fSumLAbs,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLAbs,"Length")
|
||||
<< "\n mean trackLength in Gap : " << G4BestUnit(fSumLGap,"Length")
|
||||
<< " +- " << G4BestUnit(rmsLGap,"Length")
|
||||
<< "\n------------------------------------------------------------\n"
|
||||
<< G4endl;
|
||||
|
||||
//save histograms
|
||||
//
|
||||
fHistoManager->PrintStatistic();
|
||||
fHistoManager->save();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file analysis/shared/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.cc 85901 2014-11-06 08:40:31Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(DetectorConstruction* det,
|
||||
EventAction* evt)
|
||||
: G4UserSteppingAction(),
|
||||
fDetector(det), fEventAction(evt)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::~SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
// get volume of the current step
|
||||
G4VPhysicalVolume* volume
|
||||
= aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
// collect energy and track length step by step
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if (volume == fDetector->GetAbsorber()) fEventAction->AddAbs(edep,stepl);
|
||||
if (volume == fDetector->GetGap()) fEventAction->AddGap(edep,stepl);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user