Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -4,7 +4,7 @@
############################################
*************************************************************
Geant4 version Name: geant4-10-03-ref-06 (30-June-2017)
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
@@ -56,9 +56,7 @@ End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
Available colours:
black, blue, brown, cyan, gray, green, grey, magenta, red, white, yellow
"/vis/list" to see available colours.
Set file name: exgps
### Run 0 starts.
... open Root analysis file : exgps.root - done
@@ -0,0 +1,134 @@
############################################
!!! WARNING - FPE detection is activated !!!
############################################
*************************************************************
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume
Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter
You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
/run/verbose 1
#
/run/initialize
#
/gunExample/selectGunAction 1
#
/tracking/verbose 1
/run/beamOn 1
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
### Run 0 starts.
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 3, Parent ID = 0
*********************************************************************************************************
Step# X Y Z KineE dEStep StepLeng TrakLeng Volume Process
0 -1.13 mm -1.65 mm 1.39 mm 1 GeV 0 eV 0 fm 0 fm World initStep
1 -9.28 mm -1 cm 1.39 mm 1 GeV 0 eV 1.17 cm 1.17 cm World OutOfWorld
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 2, Parent ID = 0
*********************************************************************************************************
Step# X Y Z KineE dEStep StepLeng TrakLeng Volume Process
0 -1.13 mm -1.65 mm 1.39 mm 1 keV 0 eV 0 fm 0 fm World initStep
1 -4.9 mm -1 cm 1.39 mm 1 keV 0 eV 9.16 mm 9.16 mm World OutOfWorld
*********************************************************************************************************
* G4Track Information: Particle = geantino, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X Y Z KineE dEStep StepLeng TrakLeng Volume Process
0 1.13 mm 1.65 mm 1.39 mm 1 MeV 0 eV 0 fm 0 fm World initStep
1 6.82 mm 1 cm 1.39 mm 1 MeV 0 eV 1.01 cm 1.01 cm World OutOfWorld
Run terminated.
Run Summary
Number of events processed : 1
User=0s Real=0s Sys=0s
#
/tracking/verbose 0
/run/beamOn 5
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
### Run 1 starts.
Run terminated.
Run Summary
Number of events processed : 5
User=0s Real=0s Sys=0s
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.015 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -0,0 +1,96 @@
############################################
!!! WARNING - FPE detection is activated !!!
############################################
*************************************************************
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume
Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter
You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
/run/verbose 1
#
/run/initialize
#
/gunExample/selectGunAction 2
#
/analysis/setFileName run2
Set file name: run2
/analysis/h1/set 1 100 0. 200. keV
#
/run/beamOn 100000
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
### Run 0 starts.
... open Root analysis file : run2.root - done
Run terminated.
Run Summary
Number of events processed : 100000
User=0.2s Real=0.21s Sys=0s
... write Root file : run2.root - done
... close Root file : run2.root - done
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.013 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -0,0 +1,97 @@
############################################
!!! WARNING - FPE detection is activated !!!
############################################
*************************************************************
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume
Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter
You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
/run/verbose 1
#
/run/initialize
#
/gunExample/selectGunAction 3
#
/analysis/setFileName run3
Set file name: run3
/analysis/h1/set 5 110 -1.1 1.1 none
/analysis/h1/set 6 130 -15. 375 deg
#
/run/beamOn 100000
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
### Run 0 starts.
... open Root analysis file : run3.root - done
Run terminated.
Run Summary
Number of events processed : 100000
User=0.23s Real=0.22s Sys=0s
... write Root file : run3.root - done
... close Root file : run3.root - done
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.013 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -0,0 +1,112 @@
############################################
!!! WARNING - FPE detection is activated !!!
############################################
*************************************************************
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...
You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK)
OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK)
OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK)
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RayTracerX)
Registering model factories...
You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume
Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter
You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
/run/verbose 1
#
/run/initialize
#
/gunExample/selectGunAction 4
#
/analysis/setFileName run4
Set file name: run4
/analysis/h1/set 2 100 0. 10. mm
/analysis/h1/set 3 110 -1.1 1.1 none
/analysis/h1/set 4 130 -15. 375 deg
/analysis/h1/set 5 110 -1.1 1.1 none
/analysis/h1/set 6 130 -15. 375 deg
#
/run/printProgress 100000
#
/run/beamOn 1000000
========= Table of registered couples ==============================
Index : 0 used in the geometry : Yes
Material : G4_AIR
Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm
Energy thresholds : gamma -1 MeV e- -1 MeV e+ -1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld
====================================================================
### Run 0 starts.
... open Root analysis file : run4.root - done
--> Event 0 starts.
--> Event 100000 starts.
--> Event 200000 starts.
--> Event 300000 starts.
--> Event 400000 starts.
--> Event 500000 starts.
--> Event 600000 starts.
--> Event 700000 starts.
--> Event 800000 starts.
--> Event 900000 starts.
Run terminated.
Run Summary
Number of events processed : 1000000
User=3.12s Real=3.13s Sys=0s
... write Root file : run4.root - done
... close Root file : run4.root - done
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0
Dynamic pools deleted: 9 / Total memory freed: 0.013 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -89,14 +89,9 @@ PYTHIA6_VERSION the pythia version
% pythia6_decayer pythia6_decayer.in
\endverbatim
This example uses the user action classes from the extended examples common
repository available in common subdirectory, see below their complete list.
- ExG4DetectorConstruction01
- ExG4DetectorConstruction01Messenger
- ExG4PrimaryGeneratorAction01
- ExG4EventAction01
- ExG4EventAction01Messenger
- ExG4RunAction01
- ExG4RunAction01Messenger
This example uses the following user action classes from the extended examples common
repository available in common subdirectory:
- DetectorConstruction
- GunPrimaryGeneratorAction
*/
@@ -53,7 +53,7 @@ target_link_libraries(pythia6_decayer ${common_prefix}common ${Geant4_LIBRARIES}
# relies on these scripts being in the current working directory.
#
set(decayer6_SCRIPTS
init.mac init_vis.mac pythia6_decayer.in pythia6_decayer.out vis.mac
init_vis.mac pythia6_decayer.in pythia6_decayer.out vis.mac
)
foreach(_script ${decayer6_SCRIPTS})
@@ -1,4 +1,4 @@
$Id: History 100687 2016-10-31 11:20:33Z gcosmo $
$Id: History 106393 2017-10-09 09:46:03Z gcosmo $
----------------------------------------------------------------------------
=========================================================
@@ -14,6 +14,11 @@ modifications introduced in the code and keep track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29/09/2017 I.Hrivnacova (p6decayer-V10-03-00,01)
- Updated for changes in common classes
- Updated main (removed G4UI_USE, G4VIS_USE macros, moved initialization
in macros)
24/10/2016 I.Hrivnacova (p6decayer-V10-02-05)
- Do not use svn:extternal in the tag
@@ -1,4 +1,4 @@
$Id: README 100687 2016-10-31 11:20:33Z gcosmo $
$Id: README 106393 2017-10-09 09:46:03Z gcosmo $
------------------------------------------------------------
Example of the external decayer implementation with PYTHIA6
@@ -80,15 +80,7 @@
% pythia6_decayer pythia6_decayer.in
This example uses the user action classes from the extended examples common
repository available in common subdirectory, see below their complete list.
ExG4DetectorConstruction01
ExG4DetectorConstruction01Messenger
ExG4PrimaryGeneratorAction01
ExG4EventAction01
ExG4EventAction01Messenger
ExG4RunAction01
ExG4RunAction01Messenger
This example uses the following user action classes from the extended examples common
repository available in common subdirectory:
DetectorConstruction
GunPrimaryGeneratorAction
@@ -8,21 +8,18 @@
In order to reduce code duplication and to reduce the number of variants of
the code of same kind, we define a set of common classes which
can be reused in "feature" examples demonstrating just a particular feature.
This module is going to be enhanced in future. Currently it provides
This module may be enhanced in future. Currently it provides
the following sets of classes:
- Detector construction classes
- two simple detector construction classes with a messenger
- Physics list classes
- ExG4PhysicsList00 - physics list with geantino and chargedgeantino only
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
- Primary generator classes
- two simple primary generator classes (with G4ParticleGun and
G4ParticleGeneralSource)
- User action classes:
- event action and run action classes with messengers
*/
@@ -15,6 +15,13 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29/09/17 I. Hrivnacova (excommon-V10-03-00,01)
- Removed generic class names prefix (ExG4) and introduced a meaningful one
when appropriate
- Removed event and run action classes which are now obsolete
- Replaced explicit messengers with use of G4GenericMessenger
- C++11 (nullptr, auto)
20/07/16 I. Hrivnacova (excommon-V10-02-01)
- Coding guidelines (redundant empty lines)
@@ -11,20 +11,17 @@ $Id$
In order to reduce code duplication and to reduce the number of variants of
the code of same kind, we define a set of common classes which
can be reused in "feature" examples demonstrating just a particular feature.
This module is going to be enhanced in future. Currently it provides
This module may be enhanced in future. Currently it provides
the following sets of classes:
- Detector construction classes
- two simple detector construction classes with a messenger
- Physics list classes
- ExG4PhysicsList00 - physics list with geantino and chargedgeantino only
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
- Primary generator classes
- two simple primary generator classes (with G4ParticleGun and
G4ParticleGeneralSource)
- User action classes:
- event action and run action classes with messengers
@@ -25,37 +25,33 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction02.hh
/// \brief Definition of the ExG4DetectorConstruction02 class
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef ExG4DetectorConstruction02_h
#define ExG4DetectorConstruction02_h 1
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "ExG4DetectorConstruction02Messenger.hh"
#include "G4ThreeVector.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4LogicalVolume;
class G4Material;
class DetectorMessenger;
class G4GenericMessenger;
/// Simple detector construction with a box volume placed in a world
class ExG4DetectorConstruction02 : public G4VUserDetectorConstruction
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExG4DetectorConstruction02(
DetectorConstruction(
const G4String& boxMaterialName = "G4_AIR",
G4double boxHx = 40*CLHEP::cm,
G4double boxHy = 40*CLHEP::cm,
G4double boxHz = 40*CLHEP::cm,
const G4String& worldMaterialName = "G4_AIR",
G4double worldSizeFactor = 1.25);
~ExG4DetectorConstruction02();
~DetectorConstruction();
public:
// methods from base class
@@ -64,18 +60,19 @@ class ExG4DetectorConstruction02 : public G4VUserDetectorConstruction
// set methods
void SetBoxMaterial(const G4String& materialName);
void SetWorldMaterial(const G4String& materialName);
void SetBoxDimensions(G4double hx, G4double hy, G4double hz);
void SetBoxDimensions(G4ThreeVector dimensions);
void SetWorldSizeFactor(G4double factor);
private:
ExG4DetectorConstruction02Messenger fMessenger;
void DefineCommands();
G4String fBoxMaterialName;
G4String fWorldMaterialName;
G4ThreeVector fBoxDimensions;
G4double fWorldSizeFactor;
G4LogicalVolume* fBoxVolume;
G4LogicalVolume* fWorldVolume;
G4GenericMessenger* fMessenger;
G4String fBoxMaterialName;
G4String fWorldMaterialName;
G4ThreeVector fBoxDimensions;
G4double fWorldSizeFactor;
G4LogicalVolume* fBoxVolume;
G4LogicalVolume* fWorldVolume;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,35 +25,31 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction01.hh
/// \brief Definition of the ExG4DetectorConstruction01 class
/// \file DetectorConstruction0.hh
/// \brief Definition of the DetectorConstruction0 class
#ifndef ExG4DetectorConstruction01_h
#define ExG4DetectorConstruction01_h 1
#ifndef DetectorConstruction0_h
#define DetectorConstruction0_h 1
#include "G4VUserDetectorConstruction.hh"
#include "ExG4DetectorConstruction01Messenger.hh"
#include "G4ThreeVector.hh"
#include "CLHEP/Units/SystemOfUnits.h"
class G4LogicalVolume;
class G4Material;
class DetectorMessenger;
class G4GenericMessenger;
/// Simple detector construction with only a world volume
class ExG4DetectorConstruction01 : public G4VUserDetectorConstruction
class DetectorConstruction0 : public G4VUserDetectorConstruction
{
public:
ExG4DetectorConstruction01(
DetectorConstruction0(
const G4String& materialName = "G4_AIR",
G4double hx = 50*CLHEP::cm,
G4double hy = 50*CLHEP::cm,
G4double hz = 50*CLHEP::cm);
~ExG4DetectorConstruction01();
~DetectorConstruction0();
public:
// methods from base class
@@ -61,14 +57,15 @@ class ExG4DetectorConstruction01 : public G4VUserDetectorConstruction
// set methods
void SetMaterial(const G4String& materialName);
void SetDimensions(G4double hx, G4double hy, G4double hz);
void SetDimensions(G4ThreeVector dimensions);
private:
ExG4DetectorConstruction01Messenger fMessenger;
void DefineCommands();
G4String fMaterialName;
G4ThreeVector fDimensions;
G4LogicalVolume* fWorldVolume;
G4GenericMessenger* fMessenger;
G4String fMaterialName;
G4ThreeVector fDimensions;
G4LogicalVolume* fWorldVolume;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,70 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4DetectorConstruction01Messenger.hh 100687 2016-10-31 11:20:33Z gcosmo $
//
/// \file ExG4DetectorConstruction01Messenger.hh
/// \brief Definition of the ExG4DetectorConstruction01Messenger class
#ifndef ExG4DetectorConstruction01Messenger_h
#define ExG4DetectorConstruction01Messenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class ExG4DetectorConstruction01;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithADouble;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Messenger class that defines commands for ExG4DetectorConstruction01.
///
/// It implements commands:
/// - /ExG4/det/setMaterialName name
/// - /ExG4/det/setDimensions hx hy hz unit
class ExG4DetectorConstruction01Messenger: public G4UImessenger
{
public:
ExG4DetectorConstruction01Messenger(ExG4DetectorConstruction01* );
virtual ~ExG4DetectorConstruction01Messenger();
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
private:
ExG4DetectorConstruction01* fDetectorConstruction;
G4UIdirectory* fTopDirectory;
G4UIdirectory* fDirectory;
G4UIcmdWithAString* fSetMaterialCmd;
G4UIcmdWith3VectorAndUnit* fSetDimensionsCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4DetectorConstruction02Messenger.hh 100687 2016-10-31 11:20:33Z gcosmo $
//
/// \file ExG4DetectorConstruction02Messenger.hh
/// \brief Definition of the ExG4DetectorConstruction02Messenger class
#ifndef ExG4DetectorConstruction02Messenger_h
#define ExG4DetectorConstruction02Messenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class ExG4DetectorConstruction02;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithADouble;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Messenger class that defines commands for ExG4DetectorConstruction02.
///
/// It implements commands:
/// - /ExG4/det/setBoxMaterialName name
/// - /ExG4/det/setWorldMaterialName name
/// - /ExG4/det/setBoxDimensions hx hy hz unit
/// - /ExG4/det/setWorldSizeFactor value
class ExG4DetectorConstruction02Messenger: public G4UImessenger
{
public:
ExG4DetectorConstruction02Messenger(ExG4DetectorConstruction02* );
virtual ~ExG4DetectorConstruction02Messenger();
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
private:
ExG4DetectorConstruction02* fDetectorConstruction;
G4UIdirectory* fTopDirectory;
G4UIdirectory* fDirectory;
G4UIcmdWithAString* fSetBoxMaterialCmd;
G4UIcmdWithAString* fSetWorldMaterialCmd;
G4UIcmdWith3VectorAndUnit* fSetBoxDimensionsCmd;
G4UIcmdWithADouble* fSetWorldSizeFactorCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,82 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01.hh
/// \brief Definition of the ExG4EventAction01 class
#ifndef ExG4EventAction01_h
#define ExG4EventAction01_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "ExG4EventAction01Messenger.hh"
/// Event action class
///
/// It provides:
/// - setting verbose level and event modulo pronting
/// - option to save random number status at the end of event
class ExG4EventAction01 : public G4UserEventAction
{
public:
ExG4EventAction01();
virtual ~ExG4EventAction01();
public:
// methods from base class
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
// set methods
void SetVerboseLevel(G4int level);
void SetSaveRndm(G4bool value);
void SetDrawFlag(G4String value);
private:
// static data members (constants)
static const G4int fgkDefaultVerboseLevel;
static const G4int fgkDefaultPrintModulo;
// data members
ExG4EventAction01Messenger fMessenger;
G4int fVerboseLevel;
G4bool fSaveRndm;
};
// inline functions
inline void ExG4EventAction01::SetVerboseLevel(G4int level) {
fVerboseLevel = level;
}
inline void ExG4EventAction01::SetSaveRndm(G4bool value) {
fSaveRndm = value;
}
#endif
@@ -1,66 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01Messenger.hh
/// \brief Definition of the ExG4EventAction01Messenger class
#ifndef ExG4EventAction01Messenger_h
#define ExG4EventAction01Messenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class ExG4EventAction01;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
/// Messenger class that defines commands for ExG4EventAction01
///
/// It implements commands:
/// - /ExG4/event/verboseLevel level
/// - /ExG4/event/printModulo modulo
/// - /ExG4/event/saveRndm true|false
class ExG4EventAction01Messenger: public G4UImessenger
{
public:
ExG4EventAction01Messenger(ExG4EventAction01* eventAction);
~ExG4EventAction01Messenger();
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
private:
// data members
ExG4EventAction01* fEventAction;
G4UIdirectory* fTopDirectory;
G4UIdirectory* fDirectory;
G4UIcmdWithAnInteger* fSetVerboseLevelCmd;
G4UIcmdWithABool* fSetSaveRndmCmd;
};
#endif //ExG4EventAction01Messenger_h
@@ -1,101 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01.hh
/// \brief Definition of the ExG4RunAction01 class
#ifndef ExG4RunAction01_h
#define ExG4RunAction01_h 1
#include "ExG4RunAction01Messenger.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
/// Run action class
///
/// It provides:
/// - setting verbose level
/// - option to save random number status at begin and end of run
/// - option to read random number from a file at begin of run
/// - option for automatic (time-based) random seeds for each run
class ExG4RunAction01 : public G4UserRunAction
{
public:
ExG4RunAction01();
~ExG4RunAction01();
public:
// methods
virtual void BeginOfRunAction(const G4Run* run);
virtual void EndOfRunAction(const G4Run* run);
// set methods
void SetRndmFileName(const G4String& fileName);
void SetVerboseLevel(G4int level);
void SetSaveRndm(G4bool value);
void SetReadRndm(G4bool value);
void SetAutoSeed(G4bool value);
private:
// static data members
static const G4String fgkDefaultRndmFileName;
// data members
ExG4RunAction01Messenger fMessenger;
G4String fRndmFileName;
G4int fVerboseLevel;
G4bool fSaveRndm;
G4bool fReadRndm;
G4bool fAutoSeed;
};
// inline functions
inline void ExG4RunAction01::SetVerboseLevel(G4int level) {
fVerboseLevel = level;
}
inline void ExG4RunAction01::SetRndmFileName(const G4String& fileName) {
fRndmFileName = fileName;
}
inline void ExG4RunAction01::SetSaveRndm(G4bool value) {
fSaveRndm = value;
}
inline void ExG4RunAction01::SetReadRndm(G4bool value) {
fReadRndm = value;
}
inline void ExG4RunAction01::SetAutoSeed(G4bool value) {
fAutoSeed = value;
}
#endif
@@ -1,75 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01Messenger.hh
/// \brief Definition of the ExG4RunAction01Messenger class
#ifndef ExG4RunAction01Messenger_h
#define ExG4RunAction01Messenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "G4ios.hh"
class ExG4RunAction01;
class G4UIdirectory;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
/// Messenger class that defines commands for ExG4RunAction01
///
/// It implements commands:
/// - /ExG4/run/verboseLevel level
/// - /ExG4/run/saveRndm true|false
/// - /ExG4/run/readRndm true|false
/// - /ExG4/run/rndmFileName fileName
/// - /ExG4/run/autoSeed true|false
class ExG4RunAction01Messenger: public G4UImessenger
{
public:
ExG4RunAction01Messenger(ExG4RunAction01* );
~ExG4RunAction01Messenger();
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
private:
ExG4RunAction01* fRunAction;
G4UIdirectory* fTopDirectory;
G4UIdirectory* fDirectory;
G4UIcmdWithAnInteger* fSetVerboseLevelCmd;
G4UIcmdWithABool* fSetSaveRndmCmd;
G4UIcmdWithABool* fSetReadRndmCmd;
G4UIcmdWithAString* fSetRndmFileNameCmd;
G4UIcmdWithABool* fSetAutoSeedCmd;
};
#endif
@@ -25,21 +25,21 @@
//
// $Id$
//
/// \file ExG4PhysicsList00.hh
/// \brief Definition of the ExG4PhysicsList00 class
/// \file GeantinoPhysicsList.hh
/// \brief Definition of the GeantinoPhysicsList class
#ifndef ExG4PhysicsList00_h
#define ExG4PhysicsList00_h 1
#ifndef GeantinoPhysicsList_h
#define GeantinoPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
/// Physics list with geantino and charged geantino only
class ExG4PhysicsList00: public G4VUserPhysicsList
class GeantinoPhysicsList: public G4VUserPhysicsList
{
public:
ExG4PhysicsList00();
~ExG4PhysicsList00();
GeantinoPhysicsList();
~GeantinoPhysicsList();
protected:
// Construct particle and physics process
@@ -25,15 +25,12 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction02.hh
/// \brief Definition of the ExG4PrimaryGeneratorAction02 class
/// \file GpsPrimaryGeneratorAction.hh
/// \brief Definition of the GpsPrimaryGeneratorActionclass
//
#ifndef ExG4PrimaryGeneratorAction02_h
#define ExG4PrimaryGeneratorAction02_h 1
/// \file ExG4PrimaryGeneratorAction02.hh
/// \brief Definition of the ExG4PrimaryGeneratorAction02 class
#ifndef GpsPrimaryGeneratorAction_h
#define GpsPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
@@ -46,11 +43,11 @@ class G4Event;
///
/// \author I. Hrivnacova; IPN Orsay
class ExG4PrimaryGeneratorAction02 : public G4VUserPrimaryGeneratorAction
class GpsPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
{
public:
ExG4PrimaryGeneratorAction02();
~ExG4PrimaryGeneratorAction02();
GpsPrimaryGeneratorAction();
~GpsPrimaryGeneratorAction();
// methods
virtual void GeneratePrimaries(G4Event*);
@@ -61,7 +58,7 @@ class ExG4PrimaryGeneratorAction02 : public G4VUserPrimaryGeneratorAction
static const G4double fgkDefaultEnergy;
// data members
G4GeneralParticleSource* fGeneralParticleSource; //pointer a to G4 service class
G4GeneralParticleSource* fGeneralParticleSource;
};
#endif
@@ -25,11 +25,11 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction01.hh
/// \brief Definition of the ExG4PrimaryGeneratorAction01 class
/// \file GunPrimaryGeneratorAction.hh
/// \brief Definition of the GunPrimaryGeneratorAction class
#ifndef ExG4PrimaryGeneratorAction01_h
#define ExG4PrimaryGeneratorAction01_h 1
#ifndef GunPrimaryGeneratorAction_h
#define GunPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ThreeVector.hh"
@@ -45,23 +45,22 @@ class G4Event;
///
/// \author I. Hrivnacova; IPN Orsay
class ExG4PrimaryGeneratorAction01 : public G4VUserPrimaryGeneratorAction
class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
ExG4PrimaryGeneratorAction01(
GunPrimaryGeneratorAction(
const G4String& particleName = "geantino",
G4double energy = 1.*CLHEP::MeV,
G4ThreeVector position= G4ThreeVector(0,0,0),
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));
~ExG4PrimaryGeneratorAction01();
~GunPrimaryGeneratorAction();
// methods
virtual void GeneratePrimaries(G4Event*);
private:
// data members
G4ParticleGun* fParticleGun; //pointer a to G4 service class
G4ParticleGun* fParticleGun;
};
#endif
@@ -25,64 +25,62 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction02.cc
/// \brief Implementation of the ExG4DetectorConstruction02 class
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
#include "ExG4DetectorConstruction02.hh"
#include "ExG4DetectorConstruction02Messenger.hh"
#include "DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02::ExG4DetectorConstruction02(
DetectorConstruction::DetectorConstruction(
const G4String& boxMaterialName,
G4double boxHx, G4double boxHy, G4double boxHz,
const G4String& worldMaterialName,
G4double worldSizeFactor)
: G4VUserDetectorConstruction(),
fMessenger(this),
fMessenger(nullptr),
fBoxMaterialName(boxMaterialName),
fWorldMaterialName(worldMaterialName),
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
fWorldSizeFactor(worldSizeFactor),
fBoxVolume(0),
fWorldVolume(0)
fBoxVolume(nullptr),
fWorldVolume(nullptr)
{
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02::~ExG4DetectorConstruction02()
{
DetectorConstruction::~DetectorConstruction()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Define materials via NIST manager
//
G4NistManager* nistManager = G4NistManager::Instance();
auto nistManager = G4NistManager::Instance();
G4Material* worldMaterial
= nistManager->FindOrBuildMaterial(fWorldMaterialName);
G4Material* boxMaterial
= nistManager->FindOrBuildMaterial(fBoxMaterialName);
auto worldMaterial = nistManager->FindOrBuildMaterial(fWorldMaterialName);
auto boxMaterial = nistManager->FindOrBuildMaterial(fBoxMaterialName);
// Geometry parameters
//
G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
// World
//
G4Box* sWorld
auto sWorld
= new G4Box("World", //name
worldDimensions.x(), //dimensions (half-lentghs)
worldDimensions.y(),
@@ -93,7 +91,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
worldMaterial, //material
"World"); //name
G4VPhysicalVolume* pWorld
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
@@ -104,7 +102,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
// Box
//
G4Box* sBox
auto sBox
= new G4Box("Box", //its name
fBoxDimensions.x(), //dimensions (half-lengths)
fBoxDimensions.y(),
@@ -130,13 +128,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
void DetectorConstruction::SetBoxMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -149,13 +145,11 @@ void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
void DetectorConstruction::SetWorldMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -168,18 +162,17 @@ void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetBoxDimensions(
G4double hx, G4double hy, G4double hz)
void DetectorConstruction::SetBoxDimensions(G4ThreeVector dimensions)
{
/// Set box dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fBoxDimensions = G4ThreeVector(hx, hy, hz);
fBoxDimensions = dimensions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
void DetectorConstruction::SetWorldSizeFactor(G4double factor)
{
/// Set the multiplication factor from box dimensions to world dimensions.
/// This setting has effect only if called in PreInit> phase
@@ -188,3 +181,46 @@ void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
// setBoxMaterial command
auto& setBoxMaterialCmd
= fMessenger->DeclareMethod("setBoxMaterial",
&DetectorConstruction::SetBoxMaterial,
"Set box material name.");
setBoxMaterialCmd.SetParameterName("boxMaterialName", false);
setBoxMaterialCmd.SetDefaultValue("G4_AIR");
// setWorldMaterial command
auto& setWorldMaterialCmd
= fMessenger->DeclareMethod("setWorldMaterial",
&DetectorConstruction::SetWorldMaterial,
"Set world material name.");
setWorldMaterialCmd.SetParameterName("worldMaterialName", false);
setWorldMaterialCmd.SetDefaultValue("G4_AIR");
// setBoxDimensions command
auto& setBoxDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setBoxDimensions", "mm",
&DetectorConstruction::SetBoxDimensions,
"Set box dimensions (in half lentgh).");
setBoxDimensionsCmd.SetParameterName("boxDimensions", false);
setBoxDimensionsCmd.SetStates(G4State_PreInit);
// setWorldSizeFactor command
auto& setWorldSizeFactorCmd
= fMessenger->DeclareMethod("setWorldSizeFactor",
&DetectorConstruction::SetWorldSizeFactor,
"Set the multiplication factor from box dimensions to world dimensions.");
setWorldSizeFactorCmd.SetParameterName("worldSizeFactor", false);
setWorldSizeFactorCmd.SetRange("WorldSizeFactor >= 1");
setWorldSizeFactorCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,51 +25,52 @@
//
// $Id$
//
/// \file ExG4DetectorConstruction01.cc
/// \brief Implementation of the ExG4DetectorConstruction01 class
/// \file DetectorConstruction0.cc
/// \brief Implementation of the DetectorConstruction0 class
#include "ExG4DetectorConstruction01.hh"
#include "ExG4DetectorConstruction01Messenger.hh"
#include "DetectorConstruction0.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GenericMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01::ExG4DetectorConstruction01(
DetectorConstruction0::DetectorConstruction0(
const G4String& materialName,
G4double hx, G4double hy, G4double hz)
: G4VUserDetectorConstruction(),
fMessenger(this),
fMessenger(nullptr),
fMaterialName(materialName),
fDimensions(hx, hy, hz),
fWorldVolume(0)
fWorldVolume(nullptr)
{
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01::~ExG4DetectorConstruction01()
{
DetectorConstruction0::~DetectorConstruction0()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
G4VPhysicalVolume* DetectorConstruction0::Construct()
{
// Define materials via NIST manager
//
G4NistManager* nistManager = G4NistManager::Instance();
auto nistManager = G4NistManager::Instance();
G4Material* material
= nistManager->FindOrBuildMaterial(fMaterialName);
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
// World
//
G4Box* sWorld
auto sWorld
= new G4Box("World", //name
fDimensions.x(), //dimensions (half-lentghs)
fDimensions.y(),
@@ -80,7 +81,7 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
material, //material
"World"); //name
G4VPhysicalVolume* pWorld
auto pWorld
= new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fWorldVolume, //logical volume
@@ -96,13 +97,11 @@ G4VPhysicalVolume* ExG4DetectorConstruction01::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
void DetectorConstruction0::SetMaterial(const G4String& materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* newMaterial
= nistManager->FindOrBuildMaterial(materialName);
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if ( ! newMaterial ) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
@@ -115,13 +114,39 @@ void ExG4DetectorConstruction01::SetMaterial(const G4String& materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01::SetDimensions(
G4double hx, G4double hy, G4double hz)
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
{
/// Set world dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fDimensions = G4ThreeVector(hx, hy, hz);
fDimensions = dimensions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction0::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this,
"/detector/",
"Detector control");
// setMaterial command
auto& setMaterialCmd
= fMessenger->DeclareMethod("setMaterial",
&DetectorConstruction0::SetMaterial,
"Set world material name.");
setMaterialCmd.SetParameterName("materialName", false);
setMaterialCmd.SetDefaultValue("G4_AIR");
setMaterialCmd.SetStates(G4State_PreInit);
// setDimensions command
auto& setDimensionsCmd
= fMessenger->DeclareMethodWithUnit("setDimensions", "mm",
&DetectorConstruction0::SetDimensions,
"Set world dimensions (in half lentgh).");
setDimensionsCmd.SetParameterName("dimensions", false);
setDimensionsCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,100 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExG4DetectorConstruction01Messenger.cc 100687 2016-10-31 11:20:33Z gcosmo $
//
/// \file ExG4DetectorConstruction01Messenger.cc
/// \brief Implementation of the ExG4DetectorConstruction01Messenger class
#include "ExG4DetectorConstruction01Messenger.hh"
#include "ExG4DetectorConstruction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01Messenger::ExG4DetectorConstruction01Messenger(
ExG4DetectorConstruction01* detectorConstruction)
: G4UImessenger(),
fDetectorConstruction(detectorConstruction),
fTopDirectory(0),
fDirectory(0),
fSetMaterialCmd(0),
fSetDimensionsCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/det/");
fDirectory->SetGuidance("Detector control");
fSetMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
fSetMaterialCmd->SetGuidance("Select material of the box.");
fSetMaterialCmd->SetParameterName("BoxMaterial", false);
fSetMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetDimensionsCmd
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
fSetDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
fSetDimensionsCmd->SetParameterName(
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
false);
//fSetDimensionsCmd->SetUnitCategory("Length");
fSetDimensionsCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction01Messenger::~ExG4DetectorConstruction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetMaterialCmd;
delete fSetDimensionsCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction01Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == fSetMaterialCmd ) {
fDetectorConstruction->SetMaterial(newValue);
}
else if( command == fSetDimensionsCmd ) {
G4ThreeVector newDimensions
= fSetDimensionsCmd->GetNew3VectorValue(newValue);
fDetectorConstruction
->SetDimensions(
newDimensions.x(), newDimensions.y(), newDimensions.z());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,125 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4DetectorConstruction02Messenger.cc
/// \brief Implementation of the ExG4DetectorConstruction02Messenger class
#include "ExG4DetectorConstruction02Messenger.hh"
#include "ExG4DetectorConstruction02.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02Messenger::ExG4DetectorConstruction02Messenger(
ExG4DetectorConstruction02* detectorConstruction)
: G4UImessenger(),
fDetectorConstruction(detectorConstruction),
fTopDirectory(0),
fDirectory(0),
fSetBoxMaterialCmd(0),
fSetWorldMaterialCmd(0),
fSetBoxDimensionsCmd(0),
fSetWorldSizeFactorCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/det/");
fDirectory->SetGuidance("Detector control");
fSetBoxMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
fSetBoxMaterialCmd->SetGuidance("Select material of the box.");
fSetBoxMaterialCmd->SetParameterName("BoxMaterial", false);
fSetBoxMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetWorldMaterialCmd
= new G4UIcmdWithAString("/ExG4/det/setWorldMaterial",this);
fSetWorldMaterialCmd->SetGuidance("Select material of the world.");
fSetWorldMaterialCmd->SetParameterName("WorldMaterial", false);
fSetWorldMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSetBoxDimensionsCmd
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
fSetBoxDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
fSetBoxDimensionsCmd->SetParameterName(
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
false);
//fSetBoxDimensionsCmd->SetUnitCategory("Length");
fSetBoxDimensionsCmd->AvailableForStates(G4State_PreInit);
fSetWorldSizeFactorCmd
= new G4UIcmdWithADouble("/ExG4/det/setWorldSizeFactor",this);
fSetWorldSizeFactorCmd->SetGuidance(
"Set the multiplication factor from box dimensions to world dimensions.");
fSetWorldSizeFactorCmd->SetParameterName("WorldSizeFactor", false);
fSetWorldSizeFactorCmd->SetRange("WorldSizeFactor >= 1");
fSetWorldSizeFactorCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4DetectorConstruction02Messenger::~ExG4DetectorConstruction02Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetBoxMaterialCmd;
delete fSetWorldMaterialCmd;
delete fSetBoxDimensionsCmd;
delete fSetWorldSizeFactorCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4DetectorConstruction02Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == fSetBoxMaterialCmd ) {
fDetectorConstruction->SetBoxMaterial(newValue);
}
else if( command == fSetWorldMaterialCmd ) {
fDetectorConstruction->SetWorldMaterial(newValue);
}
else if( command == fSetBoxDimensionsCmd ) {
G4ThreeVector newDimensions
= fSetBoxDimensionsCmd->GetNew3VectorValue(newValue);
fDetectorConstruction
->SetBoxDimensions(
newDimensions.x(), newDimensions.y(), newDimensions.z());
}
else if ( command == fSetWorldSizeFactorCmd ) {
fDetectorConstruction
->SetWorldSizeFactor(fSetWorldSizeFactorCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,103 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01.cc
/// \brief Implementation of the ExG4EventAction01 class
#include "ExG4EventAction01.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryContainer.hh"
#include "G4VVisManager.hh"
#include "Randomize.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4int ExG4EventAction01::fgkDefaultVerboseLevel = 1;
const G4int ExG4EventAction01::fgkDefaultPrintModulo = 10000;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01::ExG4EventAction01()
: G4UserEventAction(),
fMessenger(this),
fVerboseLevel(fgkDefaultVerboseLevel),
fSaveRndm(false)
{
/// Standard constructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01::~ExG4EventAction01()
{
/// Destructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01::BeginOfEventAction(const G4Event* event)
{
// Print event info
//
G4int eventNumber = event->GetEventID();
// Print verbose info
//
if ( fVerboseLevel > 1 ) {
G4cout << "<<< Event " << eventNumber << " started." << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01::EndOfEventAction(const G4Event* event)
{
// Print verbose info
//
if ( fVerboseLevel > 1 ) {
G4cout << "<<< Event " << event->GetEventID() << " ended." << G4endl;
}
// Save rndm status
//
if ( fSaveRndm ) {
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
G4int runNumber = run->GetRunID();
G4int eventNumber = event->GetEventID();
std::ostringstream fileName;
fileName << "run" << runNumber << "event" << eventNumber << ".rndm";
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,93 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4EventAction01Messenger.cc
/// \brief Implementation of the ExG4EventAction01Messenger class
#include "ExG4EventAction01Messenger.hh"
#include "ExG4EventAction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithABool.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01Messenger::ExG4EventAction01Messenger(
ExG4EventAction01* eventAction)
: G4UImessenger(),
fEventAction(eventAction),
fTopDirectory(0),
fDirectory(0),
fSetVerboseLevelCmd(0),
fSetSaveRndmCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/event/");
fDirectory->SetGuidance("Event control");
fSetVerboseLevelCmd
= new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
fSetSaveRndmCmd
->SetGuidance("Activate saving random number at endOfEvent.");
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4EventAction01Messenger::~ExG4EventAction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetVerboseLevelCmd;
delete fSetSaveRndmCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4EventAction01Messenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == fSetVerboseLevelCmd) {
fEventAction
->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
}
else if ( command == fSetSaveRndmCmd ) {
fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,129 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01.cc
/// \brief Implementation of the ExG4RunAction01 class
#include "ExG4RunAction01.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
//#include "G4ios.hh"
//#include <iomanip>
#include "Randomize.hh"
const G4String ExG4RunAction01::fgkDefaultRndmFileName = "run0.rndm";
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4RunAction01::ExG4RunAction01()
: G4UserRunAction(),
fMessenger(this),
fRndmFileName(fgkDefaultRndmFileName),
fVerboseLevel(1),
fSaveRndm(false),
fReadRndm(false),
fAutoSeed(false)
{
/// Standard constructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4RunAction01::~ExG4RunAction01()
{
/// Destructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4RunAction01::BeginOfRunAction(const G4Run* run)
{
if ( fVerboseLevel > 0 ) {
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
}
// read Rndm status
if ( fReadRndm ) {
G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
G4Random::restoreEngineStatus(fRndmFileName);
G4Random::showEngineStatus();
}
// automatic (time-based) random seeds for each run
if ( fAutoSeed ) {
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
G4cout << "*******************" << G4endl;
G4cout << "*** AUTOSEED ON ***" << G4endl;
G4cout << "*******************" << G4endl;
long seeds[2];
time_t systime = time(NULL);
seeds[0] = (long) systime;
seeds[1] = (long) (systime*G4UniformRand());
G4Random::setTheSeeds(seeds);
G4Random::showEngineStatus();
}
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << ".rndm";
G4Random::saveEngineStatus(fileName.str().c_str());
G4Random::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4RunAction01::EndOfRunAction(const G4Run* run)
{
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << "end.rndm";
G4Random::saveEngineStatus(fileName.str().c_str());
G4Random::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,122 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file ExG4RunAction01Messenger.cc
/// \brief Implementation of the ExG4RunAction01Messenger class
#include "ExG4RunAction01Messenger.hh"
#include "ExG4RunAction01.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExG4RunAction01Messenger::ExG4RunAction01Messenger(ExG4RunAction01* runAction)
: G4UImessenger(),
fRunAction (runAction),
fTopDirectory(0),
fDirectory(0),
fSetVerboseLevelCmd(0),
fSetSaveRndmCmd(0),
fSetReadRndmCmd(0),
fSetRndmFileNameCmd(0),
fSetAutoSeedCmd(0)
{
fTopDirectory = new G4UIdirectory("/ExG4/");
fTopDirectory->SetGuidance("UI commands of common example classes");
fDirectory = new G4UIdirectory("/ExG4/event/");
fDirectory->SetGuidance("Event control");
fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/run/verboseLevel",this);
fSetVerboseLevelCmd->SetGuidance("Set run verbose level ." );
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/run/saveRndm",this);
fSetSaveRndmCmd
->SetGuidance("Activate saving random number at beginOfRun and endOfRun .");
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
fSetSaveRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetReadRndmCmd = new G4UIcmdWithABool("/ExG4/run/readRndm",this);
fSetReadRndmCmd->SetGuidance("Get rndm status from an external file at beginOfRun.");
fSetReadRndmCmd->SetParameterName("ReadRndm",false);
fSetReadRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetRndmFileNameCmd = new G4UIcmdWithAString("/ExG4/run/rndmFileName",this);
fSetRndmFileNameCmd->SetGuidance("Set rndm file name (to read from).");
fSetRndmFileNameCmd->SetParameterName("RndmFileName",false);
fSetRndmFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSetAutoSeedCmd = new G4UIcmdWithABool("/ExG4/run/autoSeed",this);
fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
fSetAutoSeedCmd->SetGuidance(" false: use command 'random/resetEngineFrom'");
fSetAutoSeedCmd->SetParameterName("AutoSeed",false);
fSetAutoSeedCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExG4RunAction01Messenger::~ExG4RunAction01Messenger()
{
delete fTopDirectory;
delete fDirectory;
delete fSetVerboseLevelCmd;
delete fSetSaveRndmCmd;
delete fSetReadRndmCmd;
delete fSetRndmFileNameCmd;
delete fSetAutoSeedCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExG4RunAction01Messenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if ( command == fSetVerboseLevelCmd ) {
fRunAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValues));
}
else if ( command == fSetSaveRndmCmd ) {
fRunAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValues));
}
else if ( command == fSetReadRndmCmd ) {
fRunAction->SetReadRndm(fSetReadRndmCmd->GetNewBoolValue(newValues));
}
else if (command == fSetRndmFileNameCmd) {
fRunAction->SetRndmFileName(newValues);
}
else if ( command == fSetAutoSeedCmd ) {
fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValues));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -25,27 +25,27 @@
//
// $Id$
//
/// \file ExG4PhysicsList00.cc
/// \brief Implementation of the ExG4PhysicsList00 class
/// \file GeantinoPhysicsList.cc
/// \brief Implementation of the GeantinoPhysicsList class
#include "ExG4PhysicsList00.hh"
#include "GeantinoPhysicsList.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PhysicsList00::ExG4PhysicsList00()
GeantinoPhysicsList::GeantinoPhysicsList()
: G4VUserPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PhysicsList00::~ExG4PhysicsList00()
GeantinoPhysicsList::~GeantinoPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PhysicsList00::ConstructParticle()
void GeantinoPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
@@ -58,7 +58,7 @@ void ExG4PhysicsList00::ConstructParticle()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PhysicsList00::ConstructProcess()
void GeantinoPhysicsList::ConstructProcess()
{
// Define transportation process
@@ -25,37 +25,37 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction02.cc
/// \brief Implementation of the ExG4PrimaryGeneratorAction02 class
/// \file GpsPrimaryGeneratorAction.cc
/// \brief Implementation of the GpsPrimaryGeneratorActionclass
#include "ExG4PrimaryGeneratorAction02.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "G4SystemOfUnits.hh"
const G4String ExG4PrimaryGeneratorAction02::fgkDefaultParticleName = "e-";
const G4double ExG4PrimaryGeneratorAction02::fgkDefaultEnergy = 1*MeV;
const G4String GpsPrimaryGeneratorAction::fgkDefaultParticleName = "e-";
const G4double GpsPrimaryGeneratorAction::fgkDefaultEnergy = 1.*MeV;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction02::ExG4PrimaryGeneratorAction02()
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fGeneralParticleSource(0)
fGeneralParticleSource(nullptr)
{
fGeneralParticleSource = new G4GeneralParticleSource();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction02::~ExG4PrimaryGeneratorAction02()
GpsPrimaryGeneratorAction::~GpsPrimaryGeneratorAction()
{
delete fGeneralParticleSource;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PrimaryGeneratorAction02::GeneratePrimaries(G4Event* anEvent)
void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
@@ -25,10 +25,10 @@
//
// $Id$
//
/// \file ExG4PrimaryGeneratorAction01.cc
/// \brief Implementation of the ExG4PrimaryGeneratorAction01 class
/// \file GunPrimaryGeneratorAction.cc
/// \brief Implementation of the GunPrimaryGeneratorAction class
#include "ExG4PrimaryGeneratorAction01.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
@@ -37,13 +37,13 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
GunPrimaryGeneratorAction::GunPrimaryGeneratorAction(
const G4String& particleName,
G4double energy,
G4ThreeVector position,
G4ThreeVector momentumDirection)
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0)
fParticleGun(nullptr)
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
@@ -60,14 +60,14 @@ ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExG4PrimaryGeneratorAction01::~ExG4PrimaryGeneratorAction01()
GunPrimaryGeneratorAction::~GunPrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExG4PrimaryGeneratorAction01::GeneratePrimaries(G4Event* anEvent)
void GunPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
@@ -29,17 +29,17 @@
/// \file testCommon.cc
/// \brief Test program for the common classes
#include "ExG4DetectorConstruction01.hh"
#include "ExG4DetectorConstruction02.hh"
#include "ExG4PhysicsList00.hh"
#include "ExG4PrimaryGeneratorAction01.hh"
#include "ExG4PrimaryGeneratorAction02.hh"
#include "ExG4EventAction01.hh"
#include "ExG4RunAction01.hh"
#include "DetectorConstruction.hh"
#include "DetectorConstruction0.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "FTFP_BERT.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Test program which only instantiates classes defined in
// examples/common
@@ -47,38 +47,27 @@ int main()
{
// First construct necessary classes
//
G4RunManager * runManager = new G4RunManager;
G4VModularPhysicsList* physicsList = new FTFP_BERT;
auto runManager = new G4RunManager;
auto physicsList = new FTFP_BERT;
runManager->SetUserInitialization(physicsList);
// Instantiate all detector construction classes
ExG4DetectorConstruction01* detectorConstruction01
= new ExG4DetectorConstruction01;
ExG4DetectorConstruction02* detectorConstruction02
= new ExG4DetectorConstruction02;
auto detectorConstruction = new DetectorConstruction;
auto detectorConstruction0 = new DetectorConstruction0;
// Instantiate all physics list classes
ExG4PhysicsList00* physicsList00 = new ExG4PhysicsList00();
auto geantinoPhysicsList = new GeantinoPhysicsList();
// Instantiate all primary generator actions classes
ExG4PrimaryGeneratorAction01* primaryGeneratorAction01
= new ExG4PrimaryGeneratorAction01();
ExG4PrimaryGeneratorAction02* primaryGeneratorAction02
= new ExG4PrimaryGeneratorAction02();
// Instantiate all user actions classes
ExG4EventAction01* eventAction01 = new ExG4EventAction01();
ExG4RunAction01* runAction01 = new ExG4RunAction01();
auto gpsPrimaryGeneratorAction = new GpsPrimaryGeneratorAction();
auto gunPrimaryGeneratorAction = new GunPrimaryGeneratorAction();
// delete all
delete detectorConstruction01;
delete detectorConstruction02;
delete physicsList00;
delete primaryGeneratorAction01;
delete primaryGeneratorAction02;
delete eventAction01;
delete runAction01;
return 0;
delete detectorConstruction;
delete detectorConstruction0;
delete geantinoPhysicsList;
delete gpsPrimaryGeneratorAction;
delete gunPrimaryGeneratorAction;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,8 +0,0 @@
# Macro file for the initialization phase of "pythia6Decayer" example
# when running in interactive mode without visualization
#
# Sets some default verbose
#
/control/verbose 1
/control/saveHistory
/run/verbose 1
@@ -6,6 +6,9 @@
/control/verbose 1
/control/saveHistory
/run/verbose 1
#
# Initialize kernel
/run/initialize
#
# Visualization setting
/control/execute vis.mac
@@ -23,36 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pythia6_decayer.cc 100687 2016-10-31 11:20:33Z gcosmo $
// $Id: pythia6_decayer.cc 106393 2017-10-09 09:46:03Z gcosmo $
//
/// \file eventgenerator/pythia/decayer6/pythia6_decayer.cc
/// \brief Main program of the pythia6Decayer example
#include "P6DExtDecayerPhysics.hh"
#include "ExG4DetectorConstruction01.hh"
#include "ExG4PrimaryGeneratorAction01.hh"
#include "ExG4RunAction01.hh"
#include "ExG4EventAction01.hh"
#include "DetectorConstruction.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4ThreeVector.hh"
#include "QGSP_BERT.hh"
#include "G4ThreeVector.hh"
#include "G4SystemOfUnits.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
#include "Randomize.hh"
int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
// Choose the Random engine
//
G4Random::setTheEngine(new CLHEP::RanecuEngine);
@@ -63,63 +63,48 @@ int main(int argc,char** argv)
// Set mandatory initialization classes
//
runManager->SetUserInitialization(new ExG4DetectorConstruction01);
runManager->SetUserInitialization(new DetectorConstruction);
//
G4VModularPhysicsList* physicsList = new QGSP_BERT;
physicsList->RegisterPhysics(new P6DExtDecayerPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
//
runManager->SetUserAction(
new ExG4PrimaryGeneratorAction01("B-", 50.*MeV));
new GunPrimaryGeneratorAction("B-", 50.*MeV));
// B- meson has not defined decay in Geant4
runManager->SetUserAction(new ExG4RunAction01);
runManager->SetUserAction(new ExG4EventAction01);
runManager->Initialize();
#ifdef G4VIS_USE
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
// G4VisManager* visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
#endif
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (argc!=1) {
// batch mode{
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command+fileName);
}
else { // interactive mode : define UI session
#ifdef G4UI_USE
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
#ifdef G4VIS_USE
UImanager->ApplyCommand("/control/execute init_vis.mac");
#else
UImanager->ApplyCommand("/control/execute init.mac");
#endif
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
delete ui;
#endif
}
#ifdef G4VIS_USE
delete visManager;
#endif
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not
// be deleted in the main() program !
delete visManager;
delete runManager;
return 0;
}
@@ -4,7 +4,7 @@
############################################
*************************************************************
Geant4 version Name: geant4-10-03-ref-06 (30-June-2017)
Geant4 version Name: geant4-10-04-ref-00 (08-December-2017)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
@@ -56,9 +56,7 @@ End of Event User Vis Actions: none
End of Run User Vis Actions: none
Some /vis commands (optionally) take a string to specify colour.
Available colours:
black, blue, brown, cyan, gray, green, grey, magenta, red, white, yellow
"/vis/list" to see available colours.
/run/verbose 1
#
/run/initialize
@@ -91,7 +89,7 @@ Index : 0 used in the geometry : Yes
Run terminated.
Run Summary
Number of events processed : 100000
User=0.42s Real=0.43s Sys=0s
User=0.39s Real=0.39s Sys=0s
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 9 of which, static: 0