Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -19,6 +19,12 @@ This example shows how to do "track and energy smearing" in Geant4,
|
||||
in order to have a very fast simulation based on assumed detector
|
||||
resolutions.
|
||||
|
||||
\link ExamplePar03 Par03 \endlink
|
||||
|
||||
This example demonstrates how to create multiple energy deposits
|
||||
from the fast simulation model and store it alongside deposits created
|
||||
in full/detailed simulation.
|
||||
|
||||
\link Examples_gflash gflash \endlink
|
||||
|
||||
Set of examples demonstrating the use of the GFLASH parameterisation library.
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
#---Adding all parameterisations examples subdirectories explicitly
|
||||
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
|
||||
find_package(Geant4)
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
add_subdirectory(gflash)
|
||||
add_subdirectory(Par01)
|
||||
add_subdirectory(Par03)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Par02 example requires Geant4 build with gdml
|
||||
|
||||
@@ -16,6 +16,15 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Nov 11th, 2020 B. Morgan (exParameterisations-V10-06-01)
|
||||
- Migration to G4RunManagerFactory.
|
||||
|
||||
Nov 3rd, 2020 B. Morgan (exParameterisations-V10-06-00)
|
||||
- Support same CMake version range as core Geant4
|
||||
|
||||
Oct 5th, 2020 A. Zaborowska (exParameterisations-V10-06-00)
|
||||
- Add new Par03 example
|
||||
|
||||
Nov 28th, 2019 I. Hrivnacova (exParameterisations-V10-05-01)
|
||||
--------------------
|
||||
- Updated category README files for reorganization of gflash examples.
|
||||
@@ -39,9 +48,9 @@ Dec 13th, 2012 I. Hrivnacova (exParameterisations-V09-06-00)
|
||||
Sep 24th, 2012 I. Hrivnacova (exParameterisations-V09-05-00)
|
||||
--------------------
|
||||
- Updated CMakeLists.txt:
|
||||
adding visualization, copying macros, install target and comment lines
|
||||
adding visualization, copying macros, install target and comment lines
|
||||
- Added explicit includes of G4SystemOfUnits.hh and G4PhysicalConstants.hh
|
||||
- Replaced tabulators with space characters
|
||||
- Replaced tabulators with space characters
|
||||
|
||||
Nov 4th, 2005 J.Weng (exparam-V07-01-01)
|
||||
--------------------
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(Par01)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -14,6 +14,9 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
10-11-2020 B. Morgan (expar01-V10-06-00)
|
||||
- Migration to G4RunManagerFactory.
|
||||
|
||||
17-05-2018 J.Allison (expar01-V10-04-00)
|
||||
- Add #include "G4Types.hh"
|
||||
- Remove G4UI_USE and G4VIS_USE.
|
||||
@@ -204,7 +207,7 @@ June 17, 2000 John Allison (exampleN05-V01-01-00)
|
||||
11 December 1998 M. Verderi
|
||||
- fix made in ExN05CalorimeterSD to allow several instanciations of this class.
|
||||
The problem was a static variable (HCID) used in EndOfEventAction which made
|
||||
confusion to get the hits collection. HCID is now put as private (non static!)
|
||||
confusion to get the hits collection. HCID is now put as private (non static!)
|
||||
member of the class.
|
||||
- the example.in/.out are updated accordingly
|
||||
|
||||
@@ -239,8 +242,8 @@ June 17, 2000 John Allison (exampleN05-V01-01-00)
|
||||
- Modified ExN05PhysicsList to register above processes.
|
||||
- Modified ExN05DetectorConstruction to attach Userlimits to crystal.
|
||||
- Added ExN05DetectorMessenger to switch on/off UserLimits.
|
||||
- Modified exampleN05.in
|
||||
|
||||
- Modified exampleN05.in
|
||||
|
||||
|
||||
9th August 1998 John Allison
|
||||
- Changed G4UIterminal to G4UIGAG.
|
||||
@@ -289,7 +292,7 @@ a private navigator, rather than the one for tracking.
|
||||
May 07, 98 M. Verderi
|
||||
|
||||
- First commit (many improvements needed):
|
||||
- main() coded in exampleN05.cc
|
||||
- main() coded in exampleN05.cc
|
||||
- include:
|
||||
MyCalorimeterHit.hh
|
||||
MyCalorimeterHitsCollection.hh
|
||||
@@ -298,7 +301,7 @@ May 07, 98 M. Verderi
|
||||
MyEMCShower.hh
|
||||
MyEnergySpot.hh
|
||||
MyEventAction.hh
|
||||
MyEventActionMessenger.hh
|
||||
MyEventActionMessenger.hh
|
||||
MyPhysicsList.hh
|
||||
MyPiModel.hh
|
||||
MyPrimaryGeneratorAction.hh
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// Geant4 - examplePar01
|
||||
// --------------------------------------------------------------
|
||||
@@ -53,11 +53,7 @@
|
||||
#include "G4FastSimulationPhysics.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// -- Action initialization (includes the primary generator action:
|
||||
@@ -80,18 +76,8 @@ int main(int argc, char** argv)
|
||||
//-------------------------------
|
||||
// Initialization of Run manager
|
||||
//-------------------------------
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(4);
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing MT run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing sequential run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------
|
||||
// -- Detector/mass geometry and parallel geometry(ies):
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(Par02)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -14,6 +14,9 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
10-11-20 B. Morgan (expar02-V10-06-00)
|
||||
- Migration to G4RunManagerFactory.
|
||||
|
||||
28-11-19 I. Hrivnacova (expar02-V10-05-00)
|
||||
- Fixed Doxygen warning
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - examplePar02
|
||||
// --------------------------------------------------------------
|
||||
@@ -42,11 +42,7 @@
|
||||
#include "G4Types.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
#include "Par02DetectorConstruction.hh"
|
||||
#include "Par02PhysicsList.hh"
|
||||
@@ -66,23 +62,13 @@ int main( int argc, char** argv ) {
|
||||
//-------------------------------
|
||||
// Initialization of Run manager
|
||||
//-------------------------------
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager* runManager = new G4MTRunManager;
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(4);
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing MT run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#else
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing sequential run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#endif
|
||||
|
||||
// Detector/mass geometry:
|
||||
G4VUserDetectorConstruction* detector = new Par02DetectorConstruction();
|
||||
runManager->SetUserInitialization( detector );
|
||||
|
||||
|
||||
// PhysicsList (including G4FastSimulationManagerProcess)
|
||||
G4VUserPhysicsList* physicsList = new Par02PhysicsList;
|
||||
runManager->SetUserInitialization( physicsList );
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
|
||||
|
||||
############################################
|
||||
!!! WARNING - FPE detection is activated !!!
|
||||
############################################
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-10-06-ref-06 (26-June-2020)
|
||||
Geant4 version Name: geant4-10-07-ref-00 (4-December-2020)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -12,9 +13,6 @@
|
||||
WWW : http://geant4.org/
|
||||
**************************************************************
|
||||
|
||||
+-------------------------------------------------------+
|
||||
| Constructing sequential run manager |
|
||||
+-------------------------------------------------------+
|
||||
G4GDML: Reading 'Par02FullDetector.gdml'...
|
||||
G4GDML: Reading definitions...
|
||||
G4GDML: Reading materials...
|
||||
@@ -31,31 +29,28 @@ hcal !!!
|
||||
|
||||
hcal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
hcal !!!
|
||||
|
||||
hcal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
tracker !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
|
||||
ecal !!!
|
||||
Warning : Region <MuonEndCap_1> does not have specific production cuts,
|
||||
Warning : Region <MuonForward_3> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_2> does not have specific production cuts,
|
||||
Warning : Region <MuonForward_4> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_3> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_4> does not have specific production cuts,
|
||||
Warning : Region <MuonForward_5> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_5> does not have specific production cuts,
|
||||
@@ -70,18 +65,21 @@ Default cuts are used for this region.
|
||||
Warning : Region <MuonForward_2> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonForward_3> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonForward_4> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonForward_5> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonForward_6> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_1> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_2> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_3> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Warning : Region <MuonEndCap_4> does not have specific production cuts,
|
||||
even though it appears in the current tracking world.
|
||||
Default cuts are used for this region.
|
||||
Instantiating Visualization Manager.......
|
||||
Visualization Manager instantiating with verbosity "warnings (3)"...
|
||||
Visualization Manager initialising...
|
||||
@@ -97,10 +95,12 @@ Registered graphics systems are:
|
||||
VRML1FILE (VRML1FILE)
|
||||
VRML2FILE (VRML2FILE)
|
||||
gMocrenFile (gMocrenFile)
|
||||
OpenGLImmediateXm (OGLIXm, OGLI)
|
||||
OpenGLStoredXm (OGLSXm, OGL, OGLS)
|
||||
OpenGLImmediateX (OGLIX, OGLIXm_FALLBACK)
|
||||
OpenGLStoredX (OGLSX, OGLSXm_FALLBACK)
|
||||
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...
|
||||
@@ -137,7 +137,8 @@ Some /vis commands (optionally) take a string to specify colour.
|
||||
Magnetic field is active, fieldValue = (0 0 1 T ).
|
||||
G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model.
|
||||
See commands in /vis/modeling/trajectories/ for other options.
|
||||
... open Root analysis file : DefaultOutput.root - done
|
||||
... create file : DefaultOutput.root - done
|
||||
... open analysis file : DefaultOutput.root - done
|
||||
________Tracker model triggered _________
|
||||
________Tracker model triggered _________
|
||||
________Tracker model triggered _________
|
||||
@@ -1138,7 +1139,10 @@ See commands in /vis/modeling/trajectories/ for other options.
|
||||
________Tracker model triggered _________
|
||||
________Tracker model triggered _________
|
||||
________Tracker model triggered _________
|
||||
... write Root file : DefaultOutput.root - done
|
||||
... close Root file : DefaultOutput.root - done
|
||||
... write file : DefaultOutput.root - done
|
||||
... close file : DefaultOutput.root - done
|
||||
0 events have been kept for refreshing and/or reviewing.
|
||||
"/vis/reviewKeptEvents" to review them one by one.
|
||||
"/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild" to see them accumulated.
|
||||
Graphics systems deleted.
|
||||
Visualization Manager deleting...
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
///\file "parameterisations/Par03/.README.txt"
|
||||
///\brief Example Par03 README page
|
||||
|
||||
/*! \page ExamplePar03 Example Par03
|
||||
|
||||
This example demonstrates how to use G4FastSimHitMaker helper class
|
||||
to create multiple energy deposits from the fast simulation model.
|
||||
|
||||
It requires sensitive detector class to inherit from both base classes:
|
||||
- G4VSensitiveDetector: for processing of detailed/non-fast simulation hits
|
||||
- G4VFastSimSensitiveDetector: for processing of fast sim (G4FastSim) hits
|
||||
Hits are placed in the same hit collection, so they can be used to
|
||||
compare between the full and the fast simulation.
|
||||
|
||||
The geometry used in the example is a homogeneous cylinder of lead, with
|
||||
3D readout geometry (cylindrical). Analysis of energy deposits is done
|
||||
in the event action.
|
||||
|
||||
\section Par03_s1 Detector description
|
||||
|
||||
The detector is a homogeneous cylinder of lead. It is segmented along
|
||||
z, R and phi to create a readout geometry in the cylindrical coordinates.
|
||||
|
||||
Fast simulation is attached to the region of the detector.
|
||||
|
||||
|
||||
\section Par03_s2 Sensitive detector
|
||||
|
||||
Sensitive detector inherits from both base classes:
|
||||
- G4VSensitiveDetector: for processing of detailed/non-fast simulation hits
|
||||
- G4VFastSimSensitiveDetector: for processing of fast sim (G4FastSim) hits.
|
||||
Hits are placed in the same hit collection, with a different flag to distinguish
|
||||
between those originated in the full simulation, and those from the fast
|
||||
simulation.
|
||||
During visualisation, hits are represented as volumes of different colour:
|
||||
green for full simulation and red for fast simulation.
|
||||
|
||||
\section Par03_s3 Primary generation
|
||||
|
||||
Particle gun is used as a primary generator. The direction of particles is along
|
||||
the axis of symmetry of the detector (cylinder). It is positioned 10 cm in front
|
||||
of the entrance to the detector. 10 GeV electron is used by default. Those values
|
||||
can be changed using /gun/ UI commands.
|
||||
|
||||
\section Par03_s4 Physics List
|
||||
|
||||
FTFP_BERT modular physics list is used. On top of it, fast simulation physics
|
||||
is registered for selected particles (electrons, positrons, and photons).
|
||||
|
||||
|
||||
\section Par03_s5 User actions
|
||||
|
||||
- Par03RunAction : run action used for initialization and termination
|
||||
of the run. Histograms for analysis of shower development
|
||||
in the detector are created.
|
||||
|
||||
- Par03EventAction : event action used for initialization and termination
|
||||
of the event. Analysis of shower development is performed
|
||||
on event-by-event basis.
|
||||
|
||||
\section Par03_s6 Output
|
||||
|
||||
The execution of the program (examplePar03) produces an output with histograms.
|
||||
|
||||
The macro file examplePar03.in specifies three runs. Each run is made of 100
|
||||
events, for single 10 GeV electron beams. The first run is executed with fast
|
||||
simulation model activated with defualt parameters. The second run executes fast
|
||||
simulation with modified parameters. For the third run the fast simulation model
|
||||
is disactivated.
|
||||
Three output files are produced: two with shower development from the fast
|
||||
simulation (with different parameters), and from the full simulation.
|
||||
|
||||
\section Par03_s7 How to build and run the example
|
||||
|
||||
- Compile and link to generate the executable (in your CMAKE build directory):
|
||||
\verbatim
|
||||
% cmake <PAR03_SOURCE>
|
||||
% make
|
||||
\endverbatim
|
||||
|
||||
- Execute the application (in batch mode):
|
||||
\verbatim
|
||||
% ./examplePar03 -m examplePar03.in
|
||||
\endverbatim
|
||||
which produces three root files: Par03_fastsim_100events.root,
|
||||
Par03_fastsimModified_100events.root, and Par03_fullsim_100events.root.
|
||||
|
||||
- Execute the application (in interactive mode):
|
||||
\verbatim
|
||||
% ./examplePar03
|
||||
\endverbatim
|
||||
which allows to visualize hits.
|
||||
|
||||
\section Par03_s8 UI commands
|
||||
|
||||
UI commands useful in this example:
|
||||
|
||||
- activation/disactivation of the fast simulation model:
|
||||
\verbatim
|
||||
/param/ActivateModel model
|
||||
/param/InActivateModel model
|
||||
\endverbatim
|
||||
|
||||
- particle gun commands
|
||||
\verbatim
|
||||
/gun/particle e+
|
||||
/gun/energy 50 GeV
|
||||
/gun/direction 0 0.2 1
|
||||
/gun/position 0 0 0
|
||||
\endverbatim
|
||||
|
||||
UI commands defined in this example:
|
||||
- detector settings
|
||||
\verbatim
|
||||
/Par03/detector/print
|
||||
/Par03/detector/setDetectorRadius 10 cm
|
||||
/Par03/detector/setDetectorLength 30 cm
|
||||
/Par03/detector/setDetectorMaterial G4_Pb
|
||||
/Par03/detector/setNbOfLayers 100
|
||||
/Par03/detector/setNbOfPhiCells 20
|
||||
/Par03/detector/setNbOfRhoCells 100
|
||||
\endverbatim
|
||||
|
||||
- fast simulation settings
|
||||
\verbatim
|
||||
/Par03/fastSim/print
|
||||
/Par03/fastSim/transverseProfile/sigma 20 mm
|
||||
/Par03/fastSim/longitudinalProfile/beta 0.6
|
||||
/Par03/fastSim/longitudinalProfile/alpha 2.
|
||||
/Par03/fastSim/longitudinalProfile/maxDepth 20
|
||||
/Par03/fastSim/numberOfHits 500
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,67 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(Par03)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, activating all available UI and Vis drivers by default
|
||||
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
|
||||
# to build a batch mode only executable
|
||||
#
|
||||
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
|
||||
if(WITH_GEANT4_UIVIS)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
else()
|
||||
find_package(Geant4 REQUIRED)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# 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)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(examplePar03 examplePar03.cc ${sources} ${headers})
|
||||
target_link_libraries(examplePar03 ${Geant4_LIBRARIES} )
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build Par02. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(Par03_SCRIPTS
|
||||
examplePar03.in vis.mac
|
||||
)
|
||||
|
||||
foreach(_script ${Par03_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(Par03 DEPENDS examplePar03)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS examplePar03 DESTINATION bin)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# --------------------------------
|
||||
# GNUmakefile for examples module.
|
||||
# --------------------------------
|
||||
|
||||
name := examplePar03
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
@@ -0,0 +1,25 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example Par03 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-Nov-20 I. Hrivnacova (expar03-V10-06-02)
|
||||
- Added missing README for Doxygen
|
||||
- Fixed section numbering in README
|
||||
|
||||
26-Oct-20 A. Zaborowska (expar03-V10-06-01)
|
||||
- Fix errors from Windows build
|
||||
|
||||
06-Oct-20 A. Zaborowska (expar03-V10-06-00)
|
||||
- Create Par03 example
|
||||
@@ -0,0 +1,130 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example Par03
|
||||
-------------
|
||||
|
||||
This example demonstrates how to use G4FastSimHitMaker helper class
|
||||
to create multiple energy deposits from the fast simulation model.
|
||||
|
||||
It requires sensitive detector class to inherit from both base classes:
|
||||
- G4VSensitiveDetector: for processing of detailed/non-fast simulation hits
|
||||
- G4VFastSimSensitiveDetector: for processing of fast sim (G4FastSim) hits
|
||||
Hits are placed in the same hit collection, so they can be used to
|
||||
compare between the full and the fast simulation.
|
||||
|
||||
The geometry used in the example is a homogeneous cylinder of lead, with
|
||||
3D readout geometry (cylindrical). Analysis of energy deposits is done
|
||||
in the event action.
|
||||
|
||||
1. Detector description
|
||||
-----------------------
|
||||
|
||||
The detector is a homogeneous cylinder of lead. It is segmented along
|
||||
z, R and phi to create a readout geometry in the cylindrical coordinates.
|
||||
|
||||
Fast simulation is attached to the region of the detector.
|
||||
|
||||
|
||||
2. Sensitive detector
|
||||
-----------------------
|
||||
|
||||
Sensitive detector inherits from both base classes:
|
||||
- G4VSensitiveDetector: for processing of detailed/non-fast simulation hits
|
||||
- G4VFastSimSensitiveDetector: for processing of fast sim (G4FastSim) hits.
|
||||
Hits are placed in the same hit collection, with a different flag to distinguish
|
||||
between those originated in the full simulation, and those from the fast
|
||||
simulation.
|
||||
During visualisation, hits are represented as volumes of different colour:
|
||||
green for full simulation and red for fast simulation.
|
||||
|
||||
3. Primary generation
|
||||
---------------------
|
||||
|
||||
Particle gun is used as a primary generator. The direction of particles is along
|
||||
the axis of symmetry of the detector (cylinder). It is positioned 10 cm in front
|
||||
of the entrance to the detector. 10 GeV electron is used by default. Those values
|
||||
can be changed using /gun/ UI commands.
|
||||
|
||||
4. Physics List
|
||||
---------------
|
||||
|
||||
FTFP_BERT modular physics list is used. On top of it, fast simulation physics
|
||||
is registered for selected particles (electrons, positrons, and photons).
|
||||
|
||||
|
||||
5. User actions
|
||||
----------------------------------------------------------
|
||||
|
||||
- Par03RunAction : run action used for initialization and termination
|
||||
of the run. Histograms for analysis of shower development
|
||||
in the detector are created.
|
||||
|
||||
- Par03EventAction : event action used for initialization and termination
|
||||
of the event. Analysis of shower development is performed
|
||||
on event-by-event basis.
|
||||
|
||||
6. Output
|
||||
---------
|
||||
|
||||
The execution of the program (examplePar03) produces an output with histograms.
|
||||
|
||||
The macro file examplePar03.in specifies three runs. Each run is made of 100
|
||||
events, for single 10 GeV electron beams. The first run is executed with fast
|
||||
simulation model activated with defualt parameters. The second run executes fast
|
||||
simulation with modified parameters. For the third run the fast simulation model
|
||||
is disactivated.
|
||||
Three output files are produced: two with shower development from the fast
|
||||
simulation (with different parameters), and from the full simulation.
|
||||
|
||||
7. How to build and run the example
|
||||
-----------------------------------
|
||||
|
||||
- Compile and link to generate the executable (in your CMAKE build directory):
|
||||
% cmake <PAR03_SOURCE>
|
||||
% make
|
||||
|
||||
- Execute the application (in batch mode):
|
||||
% ./examplePar03 -m examplePar03.in
|
||||
which produces three root files: Par03_fastsim_100events.root,
|
||||
Par03_fastsimModified_100events.root, and Par03_fullsim_100events.root.
|
||||
|
||||
- Execute the application (in interactive mode):
|
||||
% ./examplePar03
|
||||
which allows to visualize hits.
|
||||
|
||||
8. UI commands
|
||||
--------------
|
||||
|
||||
UI commands useful in this example:
|
||||
|
||||
- activation/disactivation of the fast simulation model:
|
||||
/param/ActivateModel model
|
||||
/param/InActivateModel model
|
||||
|
||||
- particle gun commands
|
||||
/gun/particle e+
|
||||
/gun/energy 50 GeV
|
||||
/gun/direction 0 0.2 1
|
||||
/gun/position 0 0 0
|
||||
|
||||
UI commands defined in this example:
|
||||
- detector settings
|
||||
/Par03/detector/print
|
||||
/Par03/detector/setDetectorRadius 10 cm
|
||||
/Par03/detector/setDetectorLength 30 cm
|
||||
/Par03/detector/setDetectorMaterial G4_Pb
|
||||
/Par03/detector/setNbOfLayers 100
|
||||
/Par03/detector/setNbOfPhiCells 20
|
||||
/Par03/detector/setNbOfRhoCells 100
|
||||
|
||||
- fast simulation settings
|
||||
/Par03/fastSim/print
|
||||
/Par03/fastSim/transverseProfile/sigma 20 mm
|
||||
/Par03/fastSim/longitudinalProfile/beta 0.6
|
||||
/Par03/fastSim/longitudinalProfile/alpha 2.
|
||||
/Par03/fastSim/longitudinalProfile/maxDepth 20
|
||||
/Par03/fastSim/numberOfHits 500
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - examplePar03
|
||||
// --------------------------------------------------------------
|
||||
// Comments
|
||||
//
|
||||
// Example of a main program demonstrating multiple energy deposition
|
||||
// from fast simulation model.
|
||||
//
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
#include "Par03DetectorConstruction.hh"
|
||||
#include "Par03ActionInitialisation.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "G4HadronicProcessStore.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
#include "G4FastSimulationPhysics.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include <sstream>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Macro name from arguments
|
||||
G4String batchMacroName;
|
||||
G4bool useInteractiveMode = true;
|
||||
G4String helpMsg(
|
||||
"Usage: " + G4String(argv[0]) +
|
||||
" [option(s)] \n No additional arguments triggers an interactive mode "
|
||||
"executing vis.mac macro. \n Options:\n\t-h\t\tdisplay this help "
|
||||
"message\n\t-m MACRO\ttriggers a batch mode executing MACRO\n");
|
||||
for(G4int i = 1; i < argc; ++i)
|
||||
{
|
||||
G4String argument(argv[i]);
|
||||
if(argument == "-h" || argument == "--help")
|
||||
{
|
||||
G4cout << helpMsg << G4endl;
|
||||
return 0;
|
||||
}
|
||||
else if(argument == "-m")
|
||||
{
|
||||
batchMacroName = G4String(argv[i + 1]);
|
||||
useInteractiveMode = false;
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("main", "Unknown argument", FatalErrorInArgument,
|
||||
("Unknown argument passed to " + G4String(argv[0]) + " : " +
|
||||
argument + "\n" + helpMsg)
|
||||
.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization of default Run manager
|
||||
auto* runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
|
||||
// Detector geometry:
|
||||
auto detector = new Par03DetectorConstruction();
|
||||
runManager->SetUserInitialization(detector);
|
||||
|
||||
// Physics list
|
||||
auto physicsList = new FTFP_BERT();
|
||||
// Add fast simulation physics
|
||||
auto fastSimulationPhysics = new G4FastSimulationPhysics();
|
||||
fastSimulationPhysics->BeVerbose();
|
||||
fastSimulationPhysics->ActivateFastSimulation("e-");
|
||||
fastSimulationPhysics->ActivateFastSimulation("e+");
|
||||
fastSimulationPhysics->ActivateFastSimulation("gamma");
|
||||
physicsList->RegisterPhysics(fastSimulationPhysics);
|
||||
// reduce verbosity of physics lists
|
||||
G4EmParameters::Instance()->SetVerbose(0);
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
G4HadronicProcessStore::Instance()->SetVerbose(0);
|
||||
|
||||
//-------------------------------
|
||||
// UserAction classes
|
||||
//-------------------------------
|
||||
runManager->SetUserInitialization(new Par03ActionInitialisation(detector));
|
||||
|
||||
//----------------
|
||||
// Visualization:
|
||||
//----------------
|
||||
G4cout << "Instantiating Visualization Manager......." << G4endl;
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if(useInteractiveMode)
|
||||
{
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command + batchMacroName);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
# examplePar03.in
|
||||
#
|
||||
|
||||
# setup detector dimensions
|
||||
/Par03/detector/setDetectorRadius 10 cm
|
||||
/Par03/detector/setDetectorLength 30 cm
|
||||
/Par03/detector/setDetectorMaterial G4_Pb
|
||||
/Par03/detector/setNbOfLayers 100
|
||||
/Par03/detector/setNbOfPhiCells 20
|
||||
/Par03/detector/setNbOfRhoCells 100
|
||||
/Par03/detector/print
|
||||
|
||||
# initialize
|
||||
/run/initialize
|
||||
|
||||
/gun/energy 10 GeV
|
||||
/gun/position 0 0 0
|
||||
|
||||
# run 100 events with parametrised simulation
|
||||
# by default all created models are active
|
||||
#/param/ActivateModel model
|
||||
/analysis/setFileName Par03_fastsim_100events.root
|
||||
/run/beamOn 100
|
||||
|
||||
# run 100 events with modified parametrisation
|
||||
/Par03/fastSim/print
|
||||
/Par03/fastSim/transverseProfile/sigma 20 mm
|
||||
/Par03/fastSim/longitudinalProfile/beta 0.6
|
||||
/Par03/fastSim/longitudinalProfile/alpha 2.
|
||||
/Par03/fastSim/longitudinalProfile/maxDepth 20
|
||||
/Par03/fastSim/numberOfHits 500
|
||||
/analysis/setFileName Par03_fastsimModified_100events.root
|
||||
/run/beamOn 100
|
||||
|
||||
# run 100 events with full (detailed) simulation
|
||||
/param/InActivateModel model
|
||||
/analysis/setFileName Par03_fullsim_100events.root
|
||||
/run/beamOn 100
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03ACTIONINITIALISATION_HH
|
||||
#define PAR03ACTIONINITIALISATION_HH
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
class Par03DetectorConstruction;
|
||||
|
||||
/**
|
||||
* @brief Initialization of user actions.
|
||||
*
|
||||
* Initialises the primary generator, and user actions (event, run) to perform
|
||||
* analysis and store histograms.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03ActionInitialisation : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
Par03ActionInitialisation(Par03DetectorConstruction* aDetector);
|
||||
~Par03ActionInitialisation();
|
||||
/// Create all user actions.
|
||||
virtual void Build() const final;
|
||||
/// Create run action in the master thread to allow analysis merging.
|
||||
virtual void BuildForMaster() const final;
|
||||
|
||||
private:
|
||||
/// Pointer to detector to be passed to event and run actions in order to
|
||||
/// retrieve detector dimensions
|
||||
Par03DetectorConstruction* fDetector;
|
||||
};
|
||||
|
||||
#endif /* PAR03ACTIONINITIALISATION_HH */
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03DETECTORCONSTRUCTION_H
|
||||
#define PAR03DETECTORCONSTRUCTION_H
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Material.hh"
|
||||
|
||||
class Par03DetectorMessenger;
|
||||
class G4LogicalVolume;
|
||||
|
||||
/**
|
||||
* @brief Detector construction.
|
||||
*
|
||||
* Creates a cylindrical detector, with cylinder axis along Z-axis. It is placed
|
||||
* in the world volume so that its bases are located at z=0 and z=Length.
|
||||
* Dimensions of the detector (Radius and Length) and material can be set using
|
||||
* the UI commands.
|
||||
* Readout geometry of the detector is created, and can be set by UI commands.
|
||||
* Cells are created along z-axis, azimuthal angle, and radius (cylindrical
|
||||
* segmentation).
|
||||
* Sensitive detector Par03SensitiveDetector is attached to the
|
||||
* cell volume.
|
||||
* Region for the detector is created as an envelope of the fast simulation.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
Par03DetectorConstruction();
|
||||
virtual ~Par03DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct() final;
|
||||
virtual void ConstructSDandField() final;
|
||||
|
||||
// Set radius of the cylindrical detector
|
||||
void SetRadius(G4double aRadius);
|
||||
// Get radius of the cylindrical detector
|
||||
inline G4double GetRadius() const { return fDetectorRadius; };
|
||||
// Set length of the cylindrical detector (along z-axis)
|
||||
void SetLength(G4double aLength);
|
||||
// Get length of the cylindrical detector (along z-axis)
|
||||
inline G4double GetLength() const { return fDetectorLength; };
|
||||
// Set material of the detector (from NIST materials)
|
||||
void SetMaterial(const G4String& aMaterial);
|
||||
// Get name of the material of the detector
|
||||
inline G4String GetMaterial() const { return fDetectorMaterial->GetName(); };
|
||||
|
||||
// Set number of readout cells along z-axis
|
||||
inline void SetNbOfLayers(G4int aNumber) { fNbOfLayers = aNumber; };
|
||||
// Get number of readout cells along z-axis
|
||||
inline G4int GetNbOfLayers() const { return fNbOfLayers; };
|
||||
// Set number of readout cells along radius of cylinder
|
||||
inline void SetNbOfRhoCells(G4int aNumber) { fNbOfRhoCells = aNumber; };
|
||||
// Get number of readout cells along radius of cylinder
|
||||
inline G4int GetNbOfRhoCells() const { return fNbOfRhoCells; };
|
||||
// Set number of readout cells in azimuthal angle
|
||||
inline void SetNbOfPhiCells(G4int aNumber) { fNbOfPhiCells = aNumber; };
|
||||
// Get number of readout cells in azimuthal angle
|
||||
inline G4int GetNbOfPhiCells() const { return fNbOfPhiCells; };
|
||||
|
||||
// Print detector information
|
||||
void Print() const;
|
||||
|
||||
private:
|
||||
/// Messenger that allows to modify geometry
|
||||
Par03DetectorMessenger* fDetectorMessenger;
|
||||
/// Logical volume of replicated cell
|
||||
G4LogicalVolume* fLogicCell = nullptr;
|
||||
/// World size (in each X, Y, Z dimension)
|
||||
G4double fWorldSize = 10 * m;
|
||||
/// Radius of the cylindrical detector
|
||||
G4double fDetectorRadius = 10 * cm;
|
||||
/// Length of the cylindrical detector (along z axis)
|
||||
G4double fDetectorLength = 30 * cm;
|
||||
/// Material of the detector
|
||||
G4Material* fDetectorMaterial = nullptr;
|
||||
/// Number of layers = slices along z axis
|
||||
G4int fNbOfLayers = 10;
|
||||
/// Number of cells along radius
|
||||
G4int fNbOfRhoCells = 10;
|
||||
/// Number of cells in azimuthal angle
|
||||
G4int fNbOfPhiCells = 10;
|
||||
};
|
||||
|
||||
#endif /* PAR03DETECTORCONSTRUCTION_H */
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#ifndef PAR03DETECTORMESSENGER_H
|
||||
#define PAR03DETECTORMESSENGER_H
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class Par03DetectorConstruction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
/**
|
||||
* @brief Detector messenger.
|
||||
*
|
||||
* Provides UI commands to setup detector and readout geometry (prior to
|
||||
* initialization). Radius, length, and material of the detector, as well as
|
||||
* segmentation of the readout geometry can be changed.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03DetectorMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
Par03DetectorMessenger(Par03DetectorConstruction*);
|
||||
~Par03DetectorMessenger();
|
||||
|
||||
/// Invokes appropriate methods based on the typed command
|
||||
virtual void SetNewValue(G4UIcommand*, G4String) final;
|
||||
/// Retrieves the current settings
|
||||
virtual G4String GetCurrentValue(G4UIcommand*) final;
|
||||
|
||||
private:
|
||||
/// Detector construction to setup
|
||||
Par03DetectorConstruction* fDetector = nullptr;
|
||||
/// Command to set the directory common to all messengers in this example
|
||||
/// /Par03
|
||||
G4UIdirectory* fExampleDir = nullptr;
|
||||
/// Command to set the directory for detector settings /Par03/detector
|
||||
G4UIdirectory* fDetectorDir = nullptr;
|
||||
/// Command printing current settings
|
||||
G4UIcmdWithoutParameter* fPrintCmd;
|
||||
/// Command to set the detector radius
|
||||
G4UIcmdWithADoubleAndUnit* fDetectorRadiusCmd = nullptr;
|
||||
/// Command to set the detector length
|
||||
G4UIcmdWithADoubleAndUnit* fDetectorLengthCmd = nullptr;
|
||||
/// Command to set the detector material
|
||||
G4UIcmdWithAString* fDetectorMaterialCmd = nullptr;
|
||||
/// Command to set the number of layers
|
||||
G4UIcmdWithAnInteger* fNbLayersCmd = nullptr;
|
||||
/// Command to set the number of radial cells
|
||||
G4UIcmdWithAnInteger* fNbRhoCellsCmd = nullptr;
|
||||
/// Command to set the number of cells in azimuthal angle
|
||||
G4UIcmdWithAnInteger* fNbPhiCellsCmd = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03EMSHOWERMESSENGER_HH
|
||||
#define PAR03EMSHOWERMESSENGER_HH
|
||||
|
||||
class Par03EMShowerModel;
|
||||
class G4UIcommand;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithADouble;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAnInteger;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
/**
|
||||
* @brief Messenger for the example fast simulation model.
|
||||
*
|
||||
* Allows to set the parameters of the Par03EMShowerModel: parameters of the
|
||||
* distributions used in the parametrisation, number of created (same) energy
|
||||
* deposits, as well as the maximum depth of an EM shower.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03EMShowerMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
Par03EMShowerMessenger(Par03EMShowerModel* aModel);
|
||||
~Par03EMShowerMessenger();
|
||||
|
||||
public:
|
||||
/// Invokes appropriate methods based on the typed command
|
||||
virtual void SetNewValue(G4UIcommand* aCommand, G4String aNewValues) final;
|
||||
/// Retrieves the current settings
|
||||
virtual G4String GetCurrentValue(G4UIcommand* aCommand) final;
|
||||
|
||||
private:
|
||||
/// Model to setup
|
||||
Par03EMShowerModel* fModel;
|
||||
/// Command to set the up a directory for model settings /Par03/fastSim
|
||||
G4UIdirectory* fDirectory;
|
||||
/// Command printing current settings
|
||||
G4UIcmdWithoutParameter* fPrintCmd;
|
||||
/// Command to set the sigma parameter of the Gaussian distribution describing
|
||||
/// the transverse profile
|
||||
G4UIcmdWithADoubleAndUnit* fSigmaCmd;
|
||||
/// Command to set the alpha parameter of the Gamma distribution describing
|
||||
/// the longitudinal profile
|
||||
G4UIcmdWithADouble* fAlphaCmd;
|
||||
/// Command to set the beta parameter of the Gamma distribution describing the
|
||||
/// longitudinal profile
|
||||
G4UIcmdWithADouble* fBetaCmd;
|
||||
/// Command to set the number of (same energy) deposits to be created by
|
||||
/// fast simulation
|
||||
G4UIcmdWithAnInteger* fNbOfHitsCmd;
|
||||
/// Command to set the maximum shower depth
|
||||
G4UIcmdWithADouble* fLongMaxDepthCmd;
|
||||
};
|
||||
|
||||
#endif /* PAR03EMSHOWERMESSENGER_HH */
|
||||
@@ -0,0 +1,167 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03EMSHOWERMODEL_HH
|
||||
#define PAR03EMSHOWERMODEL_HH
|
||||
|
||||
#include "G4VFastSimulationModel.hh"
|
||||
|
||||
class Par03EMShowerMessenger;
|
||||
class G4FastSimHitMaker;
|
||||
|
||||
/**
|
||||
* @brief Example fast simulation model for EM showers.
|
||||
*
|
||||
* Parametrisation of electrons, positrons, and gammas. It is triggered if those
|
||||
* particles enter the detector so that there is sufficient length for the
|
||||
* shower development (max depth, controlled by the UI command).
|
||||
*
|
||||
* Parametrisation is based on the PDG chapter on the electromagnetic cascades
|
||||
* (chapter 33.5). Longitudinal profile of the shower is described with Gamma
|
||||
* distribution, with beta parameter on average equal to 0.5 (default value,
|
||||
* Fig. 33.21), and alpha parameter calcluated from the incident particle energy
|
||||
* and material of the detector (critical energy) following Eq.(33.36).
|
||||
*
|
||||
* Transverse profile is in this model approximated by the Gaussian
|
||||
* distribution, with the mean along the shower axis (incident particle momentum
|
||||
* direction) and the standard deviation calculated from the detector material
|
||||
* (Moliere radius). This assumes that EM shower is in 90% contained within a
|
||||
* cylinder of radius equal to Moliere radius, and that area below Gaussian
|
||||
* distribution from `mean-1.645 sigma` to `mean+1.645 sigma` is also equal to
|
||||
* 90% of total distribution.
|
||||
*
|
||||
* Parameters of both distributions (alpha, beta for Gamma, sigma for Gaussian)
|
||||
* can be overwritten by UI commands.
|
||||
*
|
||||
* Parametrisation creates N hits of same energy (N can be set by UI command),
|
||||
* using rejection sampling to generate position along shower axis from Gamma
|
||||
* distribution, and then sampling from uniform and Gaussian distributions to
|
||||
* sample phi and radius, respectively. Created hits are deposited in the
|
||||
* detector using its readout geometry, using the helper class G4FastSimHitMaker
|
||||
* that locates the volume, and calls appropriate sensitive detector class.
|
||||
*
|
||||
* PDG Chapter 33:
|
||||
* https://pdg.lbl.gov/2019/reviews/rpp2018-rev-passage-particles-matter.pdf
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03EMShowerModel : public G4VFastSimulationModel
|
||||
{
|
||||
public:
|
||||
Par03EMShowerModel(G4String, G4Region*);
|
||||
Par03EMShowerModel(G4String);
|
||||
~Par03EMShowerModel();
|
||||
|
||||
/// There are no kinematics constraints. True is returned.
|
||||
virtual G4bool ModelTrigger(const G4FastTrack&) final;
|
||||
/// Model is applicable to electrons, positrons, and photons.
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition&) final;
|
||||
/// Take particle out of the full simulation (kill it at the entrance
|
||||
/// depositing all the energy). Calculate energy deposited in the detector
|
||||
/// according to Gamma distribution (along the particle direction) and
|
||||
/// Gaussian distribution in the transverse direction. Mean of the Gaussian is
|
||||
/// centred on the shower axis. Create energy deposits on a cylindrical mesh.
|
||||
/// Parameters of the mesh (size, number of cells) and of the distributions
|
||||
/// (alpha, beta for Gamma, sigma for Gaussian) can be set with UI commands.
|
||||
virtual void DoIt(const G4FastTrack&, G4FastStep&) final;
|
||||
|
||||
/// Print current settings.
|
||||
void Print() const;
|
||||
/// Set standard deviation of a Gaussian distribution that describes the
|
||||
/// transverse shower profile.
|
||||
inline void SetSigma(const G4double aSigma) { fSigma = aSigma; };
|
||||
/// Get standard deviation of a Gaussian distribution that describes the
|
||||
/// transverse shower profile.
|
||||
inline G4double GetSigma() const { return fSigma; };
|
||||
/// Set alpha parameter of a Gamma distribution that describes the
|
||||
/// longitudinal shower profile.
|
||||
inline void SetAlpha(const G4double aAlpha) { fAlpha = aAlpha; };
|
||||
/// Get alpha parameter of a Gamma distribution that describes the
|
||||
/// longitudinal shower profile.
|
||||
inline G4double GetAlpha() const { return fAlpha; };
|
||||
/// Set beta parameter of a Gamma distribution that describes the longitudinal
|
||||
/// shower profile.
|
||||
inline void SetBeta(const G4double aBeta) { fBeta = aBeta; };
|
||||
/// Get beta parameter of a Gamma distribution that describes the longitudinal
|
||||
/// shower profile.
|
||||
inline G4double GetBeta() const { return fBeta; };
|
||||
/// Set number of (same energy) hits created in the parametrisation.
|
||||
inline void SetNbOfHits(const G4int aNumber) { fNbOfHits = aNumber; };
|
||||
/// Get number of (same energy) hits created in the parametrisation.s
|
||||
inline G4int GetNbOfHits() const { return fNbOfHits; };
|
||||
/// Set maximum depth of shower created in fast simulation. It is expressed in
|
||||
/// units of radiaton length.
|
||||
inline void SetLongMaxDepth(const G4double aDepth)
|
||||
{
|
||||
fLongMaxDepth = aDepth;
|
||||
};
|
||||
/// Get maximum depth of shower created in fast simulation. It is expressed in
|
||||
/// units of radiaton length.
|
||||
inline G4double GetLongMaxDepth() const { return fLongMaxDepth; };
|
||||
|
||||
private:
|
||||
/// Gamma distribution
|
||||
inline G4double gamma(G4double x, G4double alpha, G4double beta)
|
||||
{
|
||||
return (std::pow(beta, alpha) / std::tgamma(alpha) * std::pow(x, alpha - 1) *
|
||||
std::exp(-beta * x));
|
||||
}
|
||||
/// Gaussian distribution
|
||||
inline G4double gaussian(G4double x, G4double sigma = 1, G4double x0 = 0)
|
||||
{
|
||||
G4double tmp = (x - x0) / sigma;
|
||||
return (1.0 / (std::sqrt(2 * CLHEP::pi) * sigma)) * std::exp(-tmp * tmp / 2);
|
||||
}
|
||||
|
||||
private:
|
||||
/// Messenger for configuration
|
||||
Par03EMShowerMessenger* fMessenger;
|
||||
/// Helper class for creation of hits within the sensitive detector
|
||||
std::unique_ptr<G4FastSimHitMaker> fHitMaker;
|
||||
/// Standard deviation of the Gaussian distribution
|
||||
/// Can be changed with UI command `/Par03/fastSim/transverseProfile/sigma
|
||||
/// <sigma>`
|
||||
/// If sigma is smaller than 0, it will be estimated from the detector
|
||||
/// material (Moliere radius).
|
||||
G4double fSigma = -1;
|
||||
/// Alpha parameter of the Gamma distribution
|
||||
/// Can be changed with UI command `/Par03/fastSim/longitudunalProfile/alpha
|
||||
/// <alpha>`
|
||||
/// If alpha is smaller than 0, it will be estimated from particle energy and
|
||||
/// the detector material.
|
||||
G4double fAlpha = -1;
|
||||
/// Beta parameter of the Gamma distribution
|
||||
/// Can be changed with UI command `/Par03/fastSim/longitudinalProfile/beta
|
||||
/// <beta>`
|
||||
G4double fBeta = 0.5;
|
||||
/// Number of (same energy) hits created by the parametrisation. Can be
|
||||
/// changed with UI command `/Par03/fastSim/numberOfHits <number>`
|
||||
G4int fNbOfHits = 100;
|
||||
/// Maximum depth of a shower created in fast simulation.
|
||||
/// It is expressed in units of radiation length. Can be changed with UI
|
||||
/// command `/Par03/fastSim/longitudinalProfile/maxDepth <depth>`
|
||||
G4double fLongMaxDepth = 30;
|
||||
};
|
||||
#endif /* PAR03EMSHOWERMODEL_HH */
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03EVENTACTION_HH
|
||||
#define PAR03EVENTACTION_HH
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "G4Timer.hh"
|
||||
|
||||
class Par03DetectorConstruction;
|
||||
|
||||
/**
|
||||
* @brief Event action class for hits' analysis.
|
||||
*
|
||||
* Analysis of single-particle events and developed showers in the detector.
|
||||
* At the end of the event basic variables are calculated and saved in the
|
||||
* histograms.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
Par03EventAction(Par03DetectorConstruction* aDetector);
|
||||
virtual ~Par03EventAction();
|
||||
|
||||
/// Timer is started
|
||||
virtual void BeginOfEventAction(const G4Event* aEvent) final;
|
||||
/// Hits collection is retrieved, analysed, and histograms are filled.
|
||||
virtual void EndOfEventAction(const G4Event* aEvent) final;
|
||||
|
||||
private:
|
||||
/// ID of a hit collection to analyse
|
||||
G4int fHitCollectionID;
|
||||
/// Timer measurement
|
||||
G4Timer fTimer;
|
||||
/// Pointer to detector construction to retrieve (once) the detector
|
||||
/// dimensions
|
||||
Par03DetectorConstruction* fDetector;
|
||||
/// Size of cell along Z axis
|
||||
G4double fCellSizeZ = 0;
|
||||
/// Size of cell along radius of cylinder
|
||||
G4double fCellSizeRho = 0;
|
||||
};
|
||||
|
||||
#endif /* PAR03EVENTACTION_HH */
|
||||
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03HIT_HH
|
||||
#define PAR03HIT_HH
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AttDef;
|
||||
class G4AttValue;
|
||||
class G4LogicalVolume;
|
||||
|
||||
/**
|
||||
* @brief Hit class to store energy deposited in the sensitive detector.
|
||||
*
|
||||
* Hit class registers position and energy deposited within the sensitive
|
||||
* detector. Cell ID is stored using identifiers of readout segmentation (z,
|
||||
* phi, rho). Additionally, pointer to cell logical volume, its position and
|
||||
* rotation are saved for visualisation purposes. Time allows to filter hits in
|
||||
* visualisation. Type of hit allows to distinguish between hits originating
|
||||
* from full simulation (type 0) and fast simulation (type 1).
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03Hit : public G4VHit
|
||||
{
|
||||
public:
|
||||
Par03Hit();
|
||||
Par03Hit(const Par03Hit& aRight);
|
||||
virtual ~Par03Hit();
|
||||
|
||||
const Par03Hit& operator=(const Par03Hit& aRight);
|
||||
int operator==(const Par03Hit& aRight) const;
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void* aHit);
|
||||
/// Visualise hits. If pointer to the logical volume was set, cell shape is
|
||||
/// drawn taking into account proper radial position (taken from fRhoId)
|
||||
virtual void Draw();
|
||||
/// Retrieve atributes' names in order to allow filtering
|
||||
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
|
||||
/// Create attributes for the visualisation.
|
||||
virtual std::vector<G4AttValue>* CreateAttValues() const;
|
||||
/// Print hit properties.
|
||||
virtual void Print();
|
||||
/// Set position
|
||||
inline void SetPos(G4ThreeVector aXYZ) { fPos = aXYZ; }
|
||||
/// Get position
|
||||
inline G4ThreeVector GetPos() const { return fPos; }
|
||||
/// Set rotation
|
||||
inline void SetRot(G4RotationMatrix aXYZ) { fRot = aXYZ; }
|
||||
/// Get rotation
|
||||
inline G4RotationMatrix GetRot() const { return fRot; }
|
||||
/// Set energy
|
||||
inline void SetEdep(G4double aEdep) { fEdep = aEdep; }
|
||||
/// Add energy to previous value
|
||||
inline void AddEdep(G4double aEdep) { fEdep += aEdep; }
|
||||
/// Get energy
|
||||
inline G4double GetEdep() const { return fEdep; }
|
||||
/// Set Z id of the cell in the readout segmentation
|
||||
inline void SetZid(G4int aZ) { fZId = aZ; }
|
||||
/// Get Z id of the cell in the readout segmentation
|
||||
inline G4int GetZid() const { return fZId; }
|
||||
/// Set Rho id of the cell in the readout segmentation
|
||||
inline void SetRhoId(G4int aRho) { fRhoId = aRho; }
|
||||
/// Get rho id of the cell in the readout segmentation
|
||||
inline G4int GetRhoId() const { return fRhoId; }
|
||||
/// Set phi id of the cell in the readout segmentation
|
||||
inline void SetPhiId(G4int aPhi) { fPhiId = aPhi; }
|
||||
/// Get phi id of the cell in the readout segmentation
|
||||
inline G4int GetPhiId() const { return fPhiId; }
|
||||
/// Set time
|
||||
inline void SetTime(G4double aTime) { fTime = aTime; }
|
||||
/// Get time
|
||||
inline G4double GetTime() const { return fTime; }
|
||||
/// Set type (0 = full sim, 1 = fast sim)
|
||||
inline void SetType(G4int aType) { fType = aType; }
|
||||
/// Get type (0 = full sim, 1 = fast sim)
|
||||
inline G4int GetType() const { return fType; }
|
||||
// Set pointer to cell logical volume
|
||||
inline void SetLogV(G4LogicalVolume* aLogVol) { fLogVol = aLogVol; }
|
||||
// Get pointer to cell logical volume
|
||||
inline const G4LogicalVolume* GetLogVol() { return fLogVol; }
|
||||
|
||||
public:
|
||||
/// Energy deposit
|
||||
G4double fEdep = 0;
|
||||
/// Z ID of readout cell
|
||||
G4int fZId = -1;
|
||||
/// Rho ID of readout cell
|
||||
G4int fRhoId = -1;
|
||||
/// Phi ID of readout cell
|
||||
G4int fPhiId = -1;
|
||||
/// Position
|
||||
G4ThreeVector fPos;
|
||||
/// Rotation
|
||||
G4RotationMatrix fRot;
|
||||
/// Time
|
||||
G4double fTime = -1;
|
||||
/// Type: 0 = full sim, 1 = fast sim
|
||||
G4int fType = -1;
|
||||
/// Pointer to logical volume for visualisation
|
||||
G4LogicalVolume* fLogVol = nullptr;
|
||||
};
|
||||
|
||||
typedef G4THitsCollection<Par03Hit> Par03HitsCollection;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<Par03Hit>* Par03HitAllocator;
|
||||
|
||||
inline void* Par03Hit::operator new(size_t)
|
||||
{
|
||||
if(!Par03HitAllocator)
|
||||
Par03HitAllocator = new G4Allocator<Par03Hit>;
|
||||
return (void*) Par03HitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void Par03Hit::operator delete(void* aHit)
|
||||
{
|
||||
Par03HitAllocator->FreeSingle((Par03Hit*) aHit);
|
||||
}
|
||||
|
||||
#endif /* PAR03HIT_HH */
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03PRIMARYGENERATORACTION_HH
|
||||
#define PAR03PRIMARYGENERATORACTION_HH
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
/**
|
||||
* @brief Generator of particles
|
||||
*
|
||||
* Creates single particle events using a particle gun. Particle gun can be
|
||||
* configured using UI commands /gun/.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
Par03PrimaryGeneratorAction();
|
||||
virtual ~Par03PrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event*) final;
|
||||
|
||||
private:
|
||||
/// Particle gun
|
||||
G4ParticleGun* fParticleGun;
|
||||
};
|
||||
|
||||
#endif /* PAR03PRIMARYGENERATORACTION_HH */
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03RUNACTION_HH
|
||||
#define PAR03RUNACTION_HH
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
class G4Run;
|
||||
class Par03DetectorConstruction;
|
||||
|
||||
/**
|
||||
* @brief Run action
|
||||
*
|
||||
* Create analysis file and define control histograms for showers in detectors.
|
||||
* Histograms are configured taking into account the dimensions of the detector
|
||||
* (and number of readout cells).
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
/// Constructor. Defines the histograms.
|
||||
Par03RunAction(Par03DetectorConstruction* aDetector);
|
||||
virtual ~Par03RunAction();
|
||||
|
||||
/// Open the file for the analysis
|
||||
virtual void BeginOfRunAction(const G4Run*) final;
|
||||
/// Write and close the file
|
||||
virtual void EndOfRunAction(const G4Run*) final;
|
||||
|
||||
private:
|
||||
/// Pointer to detector construction to retrieve the detector dimensions to
|
||||
/// setup the histograms
|
||||
Par03DetectorConstruction* fDetector;
|
||||
};
|
||||
|
||||
#endif /* PAR03RUNACTION_HH */
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef PAR03SENSITIVEDETECTOR_HH
|
||||
#define PAR03SENSITIVEDETECTOR_HH
|
||||
|
||||
#include "Par03Hit.hh"
|
||||
|
||||
#include "G4VFastSimSensitiveDetector.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
/**
|
||||
* @brief Sensitive detector.
|
||||
*
|
||||
* Describes how to store the energy deposited within the detector.
|
||||
* It derives from two classes: G4VSensitiveDetector and
|
||||
* G4VFastSimSensitiveDetector. Addition of G4VFastSimSensitiveDetector is
|
||||
* necessary in order to handle the energy deposits from the fast simulation.
|
||||
*
|
||||
* Two ProcessHits() methods are introduced to handle energy deposited from full
|
||||
* (detailed) simulation, and from fast simulation. The common part is handled
|
||||
* by RetrieveAdnSetupHit() method.
|
||||
*
|
||||
*/
|
||||
|
||||
class Par03SensitiveDetector
|
||||
: public G4VSensitiveDetector
|
||||
, public G4VFastSimSensitiveDetector
|
||||
{
|
||||
public:
|
||||
Par03SensitiveDetector(G4String aName);
|
||||
Par03SensitiveDetector(G4String aName, G4int aNumLayers, G4int aNumPhi,
|
||||
G4int aNumRho);
|
||||
virtual ~Par03SensitiveDetector();
|
||||
/// Create hit collection
|
||||
virtual void Initialize(G4HCofThisEvent* HCE) final;
|
||||
/// Process energy deposit from the full simulation.
|
||||
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* aROhist) final;
|
||||
/// Process energy deposit from the fast simulation.
|
||||
virtual G4bool ProcessHits(const G4FastHit* aHit, const G4FastTrack* aTrack,
|
||||
G4TouchableHistory* aROhist) final;
|
||||
/// Process energy deposit - common part for full and fast simulation
|
||||
/// It is invoked from ProcessHits() methods, and sets basic hit properties
|
||||
/// (position, etc.), common for hit from fast and full simulation.
|
||||
Par03Hit* RetrieveAndSetupHit(G4TouchableHistory* aTouchable);
|
||||
|
||||
private:
|
||||
/// Collection of hits
|
||||
Par03HitsCollection* fHitsCollection = nullptr;
|
||||
/// ID of collection of hits
|
||||
G4int fHitCollectionID = -1;
|
||||
/// Number of readout cells along z axis
|
||||
G4int fCellNoZ = 10;
|
||||
/// Number of readout cells along radius of cylinder
|
||||
G4int fCellNoRho = 10;
|
||||
/// Number of readout cells along azimuthal angle
|
||||
G4int fCellNoPhi = 10;
|
||||
};
|
||||
|
||||
#endif /* PAR03SENSITIVEDETECTOR_HH */
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03ActionInitialisation.hh"
|
||||
#include "Par03PrimaryGeneratorAction.hh"
|
||||
#include "Par03EventAction.hh"
|
||||
#include "Par03RunAction.hh"
|
||||
|
||||
Par03ActionInitialisation::Par03ActionInitialisation(
|
||||
Par03DetectorConstruction* aDetector)
|
||||
: G4VUserActionInitialization()
|
||||
, fDetector(aDetector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03ActionInitialisation::~Par03ActionInitialisation() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03ActionInitialisation::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new Par03RunAction(fDetector));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03ActionInitialisation::Build() const
|
||||
{
|
||||
SetUserAction(new Par03PrimaryGeneratorAction());
|
||||
SetUserAction(new Par03EventAction(fDetector));
|
||||
SetUserAction(new Par03RunAction(fDetector));
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03DetectorConstruction.hh"
|
||||
#include "Par03DetectorMessenger.hh"
|
||||
#include "Par03SensitiveDetector.hh"
|
||||
#include "Par03EMShowerModel.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03DetectorConstruction::Par03DetectorConstruction()
|
||||
: G4VUserDetectorConstruction()
|
||||
{
|
||||
fDetectorMessenger = new Par03DetectorMessenger(this);
|
||||
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
fDetectorMaterial = nistManager->FindOrBuildMaterial("G4_Fe");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03DetectorConstruction::~Par03DetectorConstruction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* Par03DetectorConstruction::Construct()
|
||||
{
|
||||
//--------- Material definition ---------
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
//--------- Derived dimensions ---------
|
||||
G4double full2Pi = 2. * CLHEP::pi * rad;
|
||||
G4double layerThickness = fDetectorLength / fNbOfLayers;
|
||||
G4double cellPhi = full2Pi / fNbOfPhiCells;
|
||||
G4double cellDR = fDetectorRadius / fNbOfRhoCells;
|
||||
|
||||
//--------- World ---------
|
||||
auto fSolidWorld = new G4Box("World", // name
|
||||
fWorldSize / 2., // half-width in X
|
||||
fWorldSize / 2., // half-width in Y
|
||||
fWorldSize / 2.); // half-width in Z
|
||||
auto fLogicWorld = new G4LogicalVolume(fSolidWorld, // solid
|
||||
air, // material
|
||||
"World"); // name
|
||||
auto fPhysicWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
fLogicWorld, // logical volume
|
||||
"World", // name
|
||||
0, // mother volume
|
||||
false, // not used
|
||||
999, // copy number
|
||||
true); // copy number
|
||||
|
||||
//--------- Detector envelope ---------
|
||||
auto fSolidDetector = new G4Tubs("Detector", // name
|
||||
0, // inner radius
|
||||
fDetectorRadius, // outer radius
|
||||
fDetectorLength / 2., // half-width in Z
|
||||
0, // start angle
|
||||
full2Pi); // delta angle
|
||||
auto fLogicDetector = new G4LogicalVolume(fSolidDetector, // solid
|
||||
fDetectorMaterial, // material
|
||||
"Detector"); // name
|
||||
new G4PVPlacement(
|
||||
0, // no rotation
|
||||
G4ThreeVector(0, 0,
|
||||
fDetectorLength / 2), // detector face starts at (0,0,0)
|
||||
fLogicDetector, // logical volume
|
||||
"Detector", // name
|
||||
fLogicWorld, // mother volume
|
||||
false, // not used
|
||||
99, // copy number
|
||||
true); // check overlaps
|
||||
|
||||
// Region for fast simulation
|
||||
auto detectorRegion = new G4Region("DetectorRegion");
|
||||
detectorRegion->AddRootLogicalVolume(fLogicDetector);
|
||||
|
||||
//--------- Readout geometry ---------
|
||||
// Layers (along z)
|
||||
auto fSolidLayer = new G4Tubs("Layer", // name
|
||||
0, // inner radius
|
||||
fDetectorRadius, // outer radius
|
||||
layerThickness / 2., // half-width in Z
|
||||
0, // start angle
|
||||
full2Pi); // delta angle
|
||||
auto fLogicLayer = new G4LogicalVolume(fSolidLayer, // solid
|
||||
air, // material
|
||||
"Layer"); // name
|
||||
if(fNbOfLayers > 1)
|
||||
new G4PVReplica("Layer", // name
|
||||
fLogicLayer, // logical volume
|
||||
fLogicDetector, // mother volume
|
||||
kZAxis, // axis of replication
|
||||
fNbOfLayers, // number of replicas
|
||||
layerThickness); // width of single replica
|
||||
else
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // place at centre of mother volume
|
||||
fLogicLayer, // logical volume
|
||||
"Layer", // name
|
||||
fLogicDetector, // mother volume
|
||||
false, // not used
|
||||
0, // copy number
|
||||
true); // check overlaps
|
||||
|
||||
// Layer segment (division in phi)
|
||||
auto fSolidRow = new G4Tubs("Row", // name
|
||||
0, // inner radius
|
||||
fDetectorRadius, // outer radius
|
||||
layerThickness / 2., // half-width in Z
|
||||
0, // start angle
|
||||
cellPhi); // delta angle
|
||||
|
||||
auto fLogicRow = new G4LogicalVolume(fSolidRow, // solid
|
||||
air, // material
|
||||
"Segment"); // name
|
||||
if(fNbOfPhiCells > 1)
|
||||
new G4PVReplica("Segment", // name
|
||||
fLogicRow, // logical volume
|
||||
fLogicLayer, // mother volume
|
||||
kPhi, // axis of replication
|
||||
fNbOfPhiCells, // number of replicas
|
||||
cellPhi); // width of single replica
|
||||
else
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // place at centre of mother volume
|
||||
fLogicRow, // logical volume
|
||||
"Row", // name
|
||||
fLogicLayer, // mother volume
|
||||
false, // not used
|
||||
0, // copy number
|
||||
true); // check overlaps
|
||||
|
||||
// Final cells (segment slices in radius)
|
||||
// No volume can be placed inside a radial replication
|
||||
auto fSolidCell = new G4Tubs("Cell", // name
|
||||
0, // inner radius
|
||||
cellDR, // outer radius
|
||||
layerThickness / 2., // half-width in Z
|
||||
0, // start angle
|
||||
cellPhi); // delta angle
|
||||
|
||||
fLogicCell = new G4LogicalVolume(fSolidCell, // solid
|
||||
fDetectorMaterial, // material
|
||||
"Cell"); // name
|
||||
if(fNbOfRhoCells > 1)
|
||||
new G4PVReplica("Cell", // name
|
||||
fLogicCell, // logical volume
|
||||
fLogicRow, // mother volume
|
||||
kRho, // axis of replication
|
||||
fNbOfRhoCells, // number of replicas
|
||||
cellDR); // width of single replica
|
||||
else
|
||||
new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // place at centre of mother volume
|
||||
fLogicCell, // logical volume
|
||||
"Cell", // name
|
||||
fLogicRow, // mother volume
|
||||
false, // not used
|
||||
0, // copy number
|
||||
true); // check overlaps
|
||||
|
||||
//--------- Visualisation settings ---------
|
||||
fLogicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
fLogicLayer->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
fLogicRow->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
G4VisAttributes attribs;
|
||||
attribs.SetColour(G4Colour(0, 0, 1, 0.3));
|
||||
attribs.SetForceSolid(true);
|
||||
fLogicCell->SetVisAttributes(attribs);
|
||||
|
||||
Print();
|
||||
return fPhysicWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
Par03SensitiveDetector* caloSD = new Par03SensitiveDetector(
|
||||
"sensitiveDetector", fNbOfLayers, fNbOfPhiCells, fNbOfRhoCells);
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(caloSD);
|
||||
SetSensitiveDetector(fLogicCell, caloSD);
|
||||
|
||||
auto detectorRegion =
|
||||
G4RegionStore::GetInstance()->GetRegion("DetectorRegion");
|
||||
new Par03EMShowerModel("model", detectorRegion);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorConstruction::Print() const
|
||||
{
|
||||
G4cout << "\n------------------------------------------------------"
|
||||
<< "\n--- Detector material:\t" << fDetectorMaterial->GetName()
|
||||
<< "\n--- Detector length:\t" << G4BestUnit(fDetectorLength, "Length")
|
||||
<< "\n--- Detector radius:\t" << G4BestUnit(fDetectorRadius, "Length")
|
||||
<< "\n--- Number of layers:\t" << fNbOfLayers
|
||||
<< "\n--- Number of R-cells:\t" << fNbOfRhoCells
|
||||
<< "\n--- Number of phi-cells:\t" << fNbOfPhiCells << G4endl;
|
||||
G4cout << "-----------------------------------------------------" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorConstruction::SetMaterial(const G4String& aName)
|
||||
{
|
||||
// search material by its name
|
||||
G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial(aName);
|
||||
if(material)
|
||||
fDetectorMaterial = material;
|
||||
else
|
||||
G4Exception("Par03DetectorConstruction::SetMaterial()", "InvalidSetup",
|
||||
FatalException, ("Unknown material name: " + aName).c_str());
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorConstruction::SetRadius(G4double aRadius)
|
||||
{
|
||||
// check if fits within world volume
|
||||
if(aRadius >= fWorldSize / 2.)
|
||||
G4Exception("Par03DetectorConstruction::SetRadius()", "InvalidSetup",
|
||||
FatalException,
|
||||
("Detector radius cannot be larger than the world size (" +
|
||||
G4String(G4BestUnit(fWorldSize / 2., "Length")) + ")")
|
||||
.c_str());
|
||||
fDetectorRadius = aRadius;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorConstruction::SetLength(G4double aLength)
|
||||
{
|
||||
// check if fits within world volume
|
||||
if(aLength >= fWorldSize / 2.)
|
||||
G4Exception("Par03DetectorConstruction::SetLength()", "InvalidSetup",
|
||||
FatalException,
|
||||
("Detector length cannot be larger than the world size (" +
|
||||
G4String(G4BestUnit(fWorldSize / 2., "Length")) + ")")
|
||||
.c_str());
|
||||
fDetectorLength = aLength;
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03DetectorMessenger.hh"
|
||||
#include "Par03DetectorConstruction.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03DetectorMessenger::Par03DetectorMessenger(
|
||||
Par03DetectorConstruction* aDetector)
|
||||
: G4UImessenger()
|
||||
, fDetector(aDetector)
|
||||
{
|
||||
fExampleDir = new G4UIdirectory("/Par03/");
|
||||
fExampleDir->SetGuidance("UI commands specific to this example");
|
||||
|
||||
fDetectorDir = new G4UIdirectory("/Par03/detector/");
|
||||
fDetectorDir->SetGuidance("Detector construction UI commands");
|
||||
|
||||
fPrintCmd = new G4UIcmdWithoutParameter("/Par03/detector/print", this);
|
||||
fPrintCmd->SetGuidance("Print current settings.");
|
||||
|
||||
fDetectorRadiusCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/Par03/detector/setDetectorRadius", this);
|
||||
fDetectorRadiusCmd->SetGuidance(
|
||||
"Set tranverse size of the detector (cylinder radius)");
|
||||
fDetectorRadiusCmd->SetParameterName("Size", false);
|
||||
fDetectorRadiusCmd->SetRange("Size>0.");
|
||||
fDetectorRadiusCmd->SetUnitCategory("Length");
|
||||
fDetectorRadiusCmd->AvailableForStates(G4State_PreInit);
|
||||
fDetectorRadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fDetectorLengthCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/Par03/detector/setDetectorLength", this);
|
||||
fDetectorLengthCmd->SetGuidance(
|
||||
"Set length of the detector (cylinder length)");
|
||||
fDetectorLengthCmd->SetParameterName("Size", false);
|
||||
fDetectorLengthCmd->SetRange("Size>0.");
|
||||
fDetectorLengthCmd->SetUnitCategory("Length");
|
||||
fDetectorLengthCmd->AvailableForStates(G4State_PreInit);
|
||||
fDetectorLengthCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fDetectorMaterialCmd =
|
||||
new G4UIcmdWithAString("/Par03/detector/setDetectorMaterial", this);
|
||||
fDetectorMaterialCmd->SetGuidance("Material of the detector.");
|
||||
fDetectorMaterialCmd->SetParameterName("Name", false);
|
||||
fDetectorMaterialCmd->AvailableForStates(G4State_PreInit);
|
||||
fDetectorMaterialCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fNbLayersCmd =
|
||||
new G4UIcmdWithAnInteger("/Par03/detector/setNbOfLayers", this);
|
||||
fNbLayersCmd->SetGuidance("Set number of layers.");
|
||||
fNbLayersCmd->SetParameterName("NbLayers", false);
|
||||
fNbLayersCmd->SetRange("NbLayers>0");
|
||||
fNbLayersCmd->AvailableForStates(G4State_PreInit);
|
||||
fNbLayersCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fNbRhoCellsCmd =
|
||||
new G4UIcmdWithAnInteger("/Par03/detector/setNbOfRhoCells", this);
|
||||
fNbRhoCellsCmd->SetGuidance("Set number of cells along radius.");
|
||||
fNbRhoCellsCmd->SetParameterName("NbRhoCells", false);
|
||||
fNbRhoCellsCmd->SetRange("NbRhoCells>0");
|
||||
fNbRhoCellsCmd->AvailableForStates(G4State_PreInit);
|
||||
fNbRhoCellsCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fNbPhiCellsCmd =
|
||||
new G4UIcmdWithAnInteger("/Par03/detector/setNbOfPhiCells", this);
|
||||
fNbPhiCellsCmd->SetGuidance("Set number of cells in azimuthal angle.");
|
||||
fNbPhiCellsCmd->SetParameterName("NbPhiCells", false);
|
||||
fNbPhiCellsCmd->SetRange("NbPhiCells>0");
|
||||
fNbPhiCellsCmd->AvailableForStates(G4State_PreInit);
|
||||
fNbPhiCellsCmd->SetToBeBroadcasted(false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03DetectorMessenger::~Par03DetectorMessenger()
|
||||
{
|
||||
delete fPrintCmd;
|
||||
delete fDetectorRadiusCmd;
|
||||
delete fDetectorLengthCmd;
|
||||
delete fDetectorMaterialCmd;
|
||||
delete fNbLayersCmd;
|
||||
delete fNbRhoCellsCmd;
|
||||
delete fNbPhiCellsCmd;
|
||||
delete fDetectorDir;
|
||||
delete fExampleDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03DetectorMessenger::SetNewValue(G4UIcommand* aCommand,
|
||||
G4String aNewValue)
|
||||
{
|
||||
if(aCommand == fPrintCmd)
|
||||
{
|
||||
fDetector->Print();
|
||||
}
|
||||
else if(aCommand == fDetectorRadiusCmd)
|
||||
{
|
||||
fDetector->SetRadius(fDetectorRadiusCmd->GetNewDoubleValue(aNewValue));
|
||||
}
|
||||
else if(aCommand == fDetectorLengthCmd)
|
||||
{
|
||||
fDetector->SetLength(fDetectorRadiusCmd->GetNewDoubleValue(aNewValue));
|
||||
}
|
||||
else if(aCommand == fDetectorMaterialCmd)
|
||||
{
|
||||
fDetector->SetMaterial(aNewValue);
|
||||
}
|
||||
else if(aCommand == fNbLayersCmd)
|
||||
{
|
||||
fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(aNewValue));
|
||||
}
|
||||
else if(aCommand == fNbRhoCellsCmd)
|
||||
{
|
||||
fDetector->SetNbOfRhoCells(fNbRhoCellsCmd->GetNewIntValue(aNewValue));
|
||||
}
|
||||
else if(aCommand == fNbPhiCellsCmd)
|
||||
{
|
||||
fDetector->SetNbOfPhiCells(fNbPhiCellsCmd->GetNewIntValue(aNewValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4String Par03DetectorMessenger::GetCurrentValue(G4UIcommand* aCommand)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if(aCommand == fDetectorRadiusCmd)
|
||||
{
|
||||
cv = fDetectorRadiusCmd->ConvertToString(fDetector->GetRadius(), "mm");
|
||||
}
|
||||
else if(aCommand == fDetectorLengthCmd)
|
||||
{
|
||||
cv = fDetectorLengthCmd->ConvertToString(fDetector->GetLength(), "mm");
|
||||
}
|
||||
else if(aCommand == fDetectorMaterialCmd)
|
||||
{
|
||||
cv = fDetector->GetMaterial();
|
||||
}
|
||||
else if(aCommand == fNbLayersCmd)
|
||||
{
|
||||
cv = fNbLayersCmd->ConvertToString(fDetector->GetNbOfLayers());
|
||||
}
|
||||
else if(aCommand == fNbPhiCellsCmd)
|
||||
{
|
||||
cv = fNbPhiCellsCmd->ConvertToString(fDetector->GetNbOfPhiCells());
|
||||
}
|
||||
else if(aCommand == fNbRhoCellsCmd)
|
||||
{
|
||||
cv = fNbRhoCellsCmd->ConvertToString(fDetector->GetNbOfRhoCells());
|
||||
}
|
||||
return cv;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03EMShowerModel.hh"
|
||||
#include "Par03EMShowerMessenger.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
Par03EMShowerMessenger::Par03EMShowerMessenger(Par03EMShowerModel* aModel)
|
||||
: fModel(aModel)
|
||||
{
|
||||
fDirectory = new G4UIdirectory("/Par03/fastSim/");
|
||||
fDirectory->SetGuidance(
|
||||
"Set mesh parameters for the example fast sim model.");
|
||||
|
||||
fPrintCmd = new G4UIcmdWithoutParameter("/Par03/fastSim/print", this);
|
||||
fPrintCmd->SetGuidance("Print current settings.");
|
||||
|
||||
fSigmaCmd = new G4UIcmdWithADoubleAndUnit(
|
||||
"/Par03/fastSim/transverseProfile/sigma", this);
|
||||
fSigmaCmd->SetGuidance("Set sigma parameter of 2D Gaussian distribution.");
|
||||
fSigmaCmd->SetParameterName("Sigma", false);
|
||||
fSigmaCmd->SetUnitCategory("Length");
|
||||
|
||||
fAlphaCmd =
|
||||
new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/alpha", this);
|
||||
fAlphaCmd->SetGuidance("Set alpha parameter of Gamma distribution.");
|
||||
fAlphaCmd->SetParameterName("Alpha", false);
|
||||
|
||||
fBetaCmd =
|
||||
new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/beta", this);
|
||||
fBetaCmd->SetGuidance("Set beta parameter of Gamma distribution.");
|
||||
fBetaCmd->SetParameterName("Beta", false);
|
||||
|
||||
fNbOfHitsCmd = new G4UIcmdWithAnInteger("/Par03/fastSim/numberOfHits", this);
|
||||
fNbOfHitsCmd->SetGuidance(
|
||||
"Set number of (same energy) energy deposits created in fast simulation. "
|
||||
"Those deposits will be scored in the detector according to the readout of "
|
||||
"the sensitive detector.");
|
||||
fNbOfHitsCmd->SetParameterName("Number", false);
|
||||
|
||||
fLongMaxDepthCmd =
|
||||
new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/maxDepth", this);
|
||||
fLongMaxDepthCmd->SetGuidance(
|
||||
"Set maximum shower depth used in parametrisation.");
|
||||
fLongMaxDepthCmd->SetGuidance("Expressed in units of radiation length.");
|
||||
fLongMaxDepthCmd->SetParameterName("Depth", false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03EMShowerMessenger::~Par03EMShowerMessenger()
|
||||
{
|
||||
delete fPrintCmd;
|
||||
delete fSigmaCmd;
|
||||
delete fAlphaCmd;
|
||||
delete fBetaCmd;
|
||||
delete fNbOfHitsCmd;
|
||||
delete fLongMaxDepthCmd;
|
||||
delete fDirectory;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03EMShowerMessenger::SetNewValue(G4UIcommand* aCommand,
|
||||
G4String aNewValues)
|
||||
{
|
||||
if(aCommand == fPrintCmd)
|
||||
{
|
||||
fModel->Print();
|
||||
}
|
||||
else if(aCommand == fSigmaCmd)
|
||||
{
|
||||
fModel->SetSigma(fSigmaCmd->GetNewDoubleValue(aNewValues));
|
||||
}
|
||||
else if(aCommand == fAlphaCmd)
|
||||
{
|
||||
fModel->SetAlpha(fAlphaCmd->GetNewDoubleValue(aNewValues));
|
||||
}
|
||||
else if(aCommand == fBetaCmd)
|
||||
{
|
||||
fModel->SetBeta(fBetaCmd->GetNewDoubleValue(aNewValues));
|
||||
}
|
||||
else if(aCommand == fNbOfHitsCmd)
|
||||
{
|
||||
fModel->SetNbOfHits(fNbOfHitsCmd->GetNewIntValue(aNewValues));
|
||||
}
|
||||
else if(aCommand == fLongMaxDepthCmd)
|
||||
{
|
||||
fModel->SetLongMaxDepth(fLongMaxDepthCmd->GetNewDoubleValue(aNewValues));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4String Par03EMShowerMessenger::GetCurrentValue(G4UIcommand* aCommand)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if(aCommand == fSigmaCmd)
|
||||
{
|
||||
cv = fSigmaCmd->ConvertToString(fModel->GetSigma());
|
||||
}
|
||||
else if(aCommand == fAlphaCmd)
|
||||
{
|
||||
cv = fAlphaCmd->ConvertToString(fModel->GetAlpha());
|
||||
}
|
||||
else if(aCommand == fBetaCmd)
|
||||
{
|
||||
cv = fBetaCmd->ConvertToString(fModel->GetBeta());
|
||||
}
|
||||
else if(aCommand == fNbOfHitsCmd)
|
||||
{
|
||||
cv = fNbOfHitsCmd->ConvertToString(fModel->GetNbOfHits());
|
||||
}
|
||||
else if(aCommand == fLongMaxDepthCmd)
|
||||
{
|
||||
cv = fLongMaxDepthCmd->ConvertToString(fModel->GetLongMaxDepth());
|
||||
}
|
||||
return cv;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03EMShowerModel.hh"
|
||||
#include "Par03EMShowerMessenger.hh"
|
||||
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4FastHit.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4FastSimHitMaker.hh"
|
||||
|
||||
Par03EMShowerModel::Par03EMShowerModel(G4String aModelName, G4Region* aEnvelope)
|
||||
: G4VFastSimulationModel(aModelName, aEnvelope)
|
||||
, fMessenger(new Par03EMShowerMessenger(this))
|
||||
, fHitMaker(new G4FastSimHitMaker)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03EMShowerModel::Par03EMShowerModel(G4String aModelName)
|
||||
: G4VFastSimulationModel(aModelName)
|
||||
, fMessenger(new Par03EMShowerMessenger(this))
|
||||
, fHitMaker(new G4FastSimHitMaker)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03EMShowerModel::~Par03EMShowerModel() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par03EMShowerModel::IsApplicable(
|
||||
const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return &aParticleType == G4Electron::ElectronDefinition() ||
|
||||
&aParticleType == G4Positron::PositronDefinition() ||
|
||||
&aParticleType == G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par03EMShowerModel::ModelTrigger(const G4FastTrack& aFastTrack)
|
||||
{
|
||||
// Check energy
|
||||
if(aFastTrack.GetPrimaryTrack()->GetKineticEnergy() < 1 * GeV)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Check length of detector
|
||||
// Calculate depth of the detector along shower axis to verify if shower
|
||||
// will fit inside. Required max shower depth is defined by fLongMaxDepth, and
|
||||
// can be changed with UI command `/Par03/fastSim/longitudinalProfile/maxDepth
|
||||
G4double X0 = aFastTrack.GetPrimaryTrack()->GetMaterial()->GetRadlen();
|
||||
auto particleDirection = aFastTrack.GetPrimaryTrackLocalDirection();
|
||||
auto particlePosition = aFastTrack.GetPrimaryTrackLocalPosition();
|
||||
G4double detectorDepthInMM = aFastTrack.GetEnvelopeSolid()->DistanceToOut(
|
||||
particlePosition, particleDirection);
|
||||
G4double detectorDepthInX0 = detectorDepthInMM / X0;
|
||||
// check if detector depth is sufficient to create showers
|
||||
if(detectorDepthInX0 < fLongMaxDepth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03EMShowerModel::DoIt(const G4FastTrack& aFastTrack,
|
||||
G4FastStep& aFastStep)
|
||||
{
|
||||
// Remove particle from further processing by G4
|
||||
aFastStep.KillPrimaryTrack();
|
||||
aFastStep.SetPrimaryTrackPathLength(0.0);
|
||||
G4double energy = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
|
||||
// No need to create any deposit, it will be handled by this model (and
|
||||
// G4FastSimHitMaker that will call the sensitive detector)
|
||||
aFastStep.SetTotalEnergyDeposited(0);
|
||||
auto particlePosition = aFastTrack.GetPrimaryTrackLocalPosition();
|
||||
auto particleDirection = aFastTrack.GetPrimaryTrackLocalDirection();
|
||||
|
||||
// Calculate how to create energy deposits
|
||||
// Following PDG 33.5 chapter
|
||||
// material calculation assumes homogeneous detector (true for Par03 example)
|
||||
auto material = aFastTrack.GetPrimaryTrack()->GetMaterial();
|
||||
G4double materialX0 = material->GetRadlen();
|
||||
G4double materialZ = material->GetZ();
|
||||
// EC estimation follows PDG fit to solids in Fig. 33.14 (rms 2.2%)
|
||||
G4double materialEc = 610 * MeV / (materialZ + 1.24);
|
||||
// RM estimation follows PDG Eq. (33.37) (rms 2.2%)
|
||||
G4double materialRM = 21.2052 * MeV * materialX0 / materialEc;
|
||||
G4double particleY = energy / materialEc;
|
||||
// Estimate shower maximum and alpha parameter of Gamma distribution
|
||||
// that describes the longitudinal profile (PDG Eq. (33.35))
|
||||
// unless alpha is specified by UI command
|
||||
if(fAlpha < 0)
|
||||
{
|
||||
// from PDG Eq. (33.36)
|
||||
G4double particleTmax = std::log(particleY);
|
||||
if(aFastTrack.GetPrimaryTrack()->GetParticleDefinition() ==
|
||||
G4Gamma::GammaDefinition())
|
||||
{
|
||||
particleTmax += 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
particleTmax -= 0.5;
|
||||
}
|
||||
fAlpha = particleTmax * fBeta + 1;
|
||||
}
|
||||
// Unless sigma of Gaussian distribution describing the transverse profile
|
||||
// is specified by UI command, use value calculated from Moliere Radius
|
||||
if(fSigma < 0)
|
||||
{
|
||||
// 90% of shower is contained within 1 * R_M
|
||||
// 1.645 * std dev of Gaussian contains 90%
|
||||
fSigma = materialRM / 1.645;
|
||||
}
|
||||
|
||||
// Calculate rotation matrix along the particle momentum direction
|
||||
// It will rotate the shower axes to match the incoming particle direction
|
||||
G4RotationMatrix rotMatrix = G4RotationMatrix();
|
||||
double particleTheta = particleDirection.theta();
|
||||
double particlePhi = particleDirection.phi();
|
||||
double epsilon = 1e-3;
|
||||
rotMatrix.rotateY(particleTheta);
|
||||
// do not use (random) phi if x==y==0
|
||||
if(!(std::fabs(particleDirection.x()) < epsilon &&
|
||||
std::fabs(particleDirection.y()) < epsilon))
|
||||
rotMatrix.rotateZ(particlePhi);
|
||||
|
||||
// Create hits
|
||||
// First use rejecton sampling to sample from Gamma distribution
|
||||
// then get random numbers from uniform distribution for azimuthal angle, and
|
||||
// from Gaussian for radius
|
||||
G4ThreeVector position;
|
||||
G4double gammaMax = gamma((fAlpha - 1) / fBeta, fAlpha, fBeta);
|
||||
G4int generatedHits = 0;
|
||||
while(generatedHits < fNbOfHits)
|
||||
{
|
||||
G4double random1 = G4UniformRand() * fLongMaxDepth;
|
||||
G4double random2 = G4UniformRand() * gammaMax;
|
||||
if(gamma(random1, fAlpha, fBeta) >= random2)
|
||||
{
|
||||
// Generate corresponding rho (phi) from Gaussian (flat) distribution
|
||||
G4double phiPosition = G4UniformRand() * 2 * CLHEP::pi;
|
||||
G4double rhoPosition = G4RandGauss::shoot(0, fSigma);
|
||||
position = particlePosition +
|
||||
rotMatrix * G4ThreeVector(rhoPosition * std::sin(phiPosition),
|
||||
rhoPosition * std::cos(phiPosition),
|
||||
random1 * materialX0);
|
||||
// Create energy deposit in the detector
|
||||
// This will call appropriate sensitive detector class
|
||||
fHitMaker->make(G4FastHit(position, energy / fNbOfHits), aFastTrack);
|
||||
generatedHits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03EMShowerModel::Print() const
|
||||
{
|
||||
G4cout << "Par03EMShowerModel: " << G4endl;
|
||||
G4cout << "Gaussian distribution (transverse plane): \tmu = 0, sigma = "
|
||||
<< G4BestUnit(fSigma, "Length") << G4endl;
|
||||
if(fSigma < 0)
|
||||
G4cout << "Negative sigma value means that it will be recalculated "
|
||||
"from the value of the Moliere radius of the detector material, "
|
||||
"taking into account that 90% of the area below the Gaussian "
|
||||
"distribution (from mu - 1.645 sigma to mu + 1.645 sigma) "
|
||||
"corresponds to area within 1 Moliere radius."
|
||||
<< G4endl;
|
||||
G4cout << "Gamma distribution (along shower axis): \talpha = " << fAlpha
|
||||
<< ", beta = " << fBeta << ", max depth = " << fLongMaxDepth << " X0"
|
||||
<< G4endl;
|
||||
if(fAlpha < 0)
|
||||
G4cout << "Negative alpha value means that it will be recalculated "
|
||||
"from the critical energy of the detector material, particle "
|
||||
"type, and beta parameter.\n alpha = beta * T_max, where T_max = "
|
||||
"ln(E/E_C) + C\n where E is particle energy, E_C is critical "
|
||||
"energy in the material, and constant C = -0.5 for electrons and "
|
||||
"0.5 for photons (Eq. (33.36) from PDG)."
|
||||
<< G4endl;
|
||||
G4cout << "Number of created energy deposits: " << fNbOfHits << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03EventAction.hh"
|
||||
#include "Par03Hit.hh"
|
||||
#include "Par03DetectorConstruction.hh"
|
||||
#include "g4analysis.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
|
||||
Par03EventAction::Par03EventAction(Par03DetectorConstruction* aDetector)
|
||||
: G4UserEventAction()
|
||||
, fHitCollectionID(-1)
|
||||
, fTimer()
|
||||
, fDetector(aDetector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03EventAction::~Par03EventAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03EventAction::BeginOfEventAction(const G4Event*) { fTimer.Start(); }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03EventAction::EndOfEventAction(const G4Event* aEvent)
|
||||
{
|
||||
fTimer.Stop();
|
||||
// Get hits collection ID (only once)
|
||||
if(fHitCollectionID == -1)
|
||||
{
|
||||
fHitCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("hits");
|
||||
}
|
||||
// Get hits collection
|
||||
auto hitsCollection = static_cast<Par03HitsCollection*>(
|
||||
aEvent->GetHCofThisEvent()->GetHC(fHitCollectionID));
|
||||
|
||||
if(hitsCollection == nullptr)
|
||||
{
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot access hitsCollection ID " << fHitCollectionID;
|
||||
G4Exception("Par03EventAction::GetHitsCollection()", "MyCode0001",
|
||||
FatalException, msg);
|
||||
}
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
// Retrieve only once detector dimensions
|
||||
if(fCellSizeZ == 0)
|
||||
{
|
||||
fCellSizeZ = fDetector->GetLength() / fDetector->GetNbOfLayers();
|
||||
fCellSizeRho = fDetector->GetRadius() / fDetector->GetNbOfRhoCells();
|
||||
}
|
||||
|
||||
// Retrieve information from primary vertex and primary particle
|
||||
// To calculate shower axis and entry point to the detector
|
||||
auto primaryVertex = G4EventManager::GetEventManager()
|
||||
->GetConstCurrentEvent()
|
||||
->GetPrimaryVertex();
|
||||
auto primaryParticle = primaryVertex->GetPrimary(0);
|
||||
G4double primaryEnergy = primaryParticle->GetTotalEnergy();
|
||||
// Estimate from vertex and particle direction the entry point to the detector
|
||||
// Calculate entrance point to the detector located at z = 0
|
||||
auto primaryDirection = primaryParticle->GetMomentumDirection();
|
||||
auto primaryEntrance = primaryVertex->GetPosition() -
|
||||
primaryVertex->GetPosition().z() * primaryDirection;
|
||||
G4double cosDirection = std::cos(primaryDirection.theta());
|
||||
G4double sinDirection = std::sin(primaryDirection.theta());
|
||||
|
||||
// Fill histograms
|
||||
Par03Hit* hit = nullptr;
|
||||
G4double hitEn = 0;
|
||||
G4double totalEnergy = 0;
|
||||
G4int hitZ = -1;
|
||||
G4int hitRho = -1;
|
||||
G4int hitType = -1;
|
||||
G4double tDistance = 0., rDistance = 0.;
|
||||
G4double tFirstMoment = 0., tSecondMoment = 0.;
|
||||
G4double rFirstMoment = 0., rSecondMoment = 0.;
|
||||
for(size_t iHit = 0; iHit < hitsCollection->entries(); iHit++)
|
||||
{
|
||||
hit = static_cast<Par03Hit*>(hitsCollection->GetHit(iHit));
|
||||
hitZ = hit->GetZid();
|
||||
hitRho = hit->GetRhoId();
|
||||
hitEn = hit->GetEdep();
|
||||
hitType = hit->GetType();
|
||||
if(hitEn > 0)
|
||||
{
|
||||
totalEnergy += hitEn;
|
||||
tDistance =
|
||||
hitZ * fCellSizeZ * cosDirection +
|
||||
(hitRho * fCellSizeRho - primaryEntrance.perp()) * sinDirection;
|
||||
rDistance =
|
||||
hitZ * fCellSizeZ * (-sinDirection) +
|
||||
(hitRho * fCellSizeRho - primaryEntrance.perp()) * cosDirection;
|
||||
tFirstMoment += hitEn * tDistance;
|
||||
rFirstMoment += hitEn * rDistance;
|
||||
analysisManager->FillH1(4, tDistance, hitEn);
|
||||
analysisManager->FillH1(5, rDistance, hitEn);
|
||||
analysisManager->FillH1(10, hitType);
|
||||
}
|
||||
}
|
||||
tFirstMoment /= totalEnergy;
|
||||
rFirstMoment /= totalEnergy;
|
||||
analysisManager->FillH1(0, primaryEnergy / GeV);
|
||||
analysisManager->FillH1(1, totalEnergy / GeV);
|
||||
analysisManager->FillH1(2, totalEnergy / primaryEnergy);
|
||||
analysisManager->FillH1(3, fTimer.GetRealElapsed());
|
||||
analysisManager->FillH1(6, tFirstMoment);
|
||||
analysisManager->FillH1(7, rFirstMoment);
|
||||
|
||||
// Second loop over hits to calculate second moments
|
||||
for(size_t iHit = 0; iHit < hitsCollection->entries(); iHit++)
|
||||
{
|
||||
hit = static_cast<Par03Hit*>(hitsCollection->GetHit(iHit));
|
||||
hitEn = hit->GetEdep();
|
||||
hitZ = hit->GetZid();
|
||||
hitRho = hit->GetRhoId();
|
||||
if(hitEn > 0)
|
||||
{
|
||||
tDistance = hitZ * fCellSizeZ * cosDirection +
|
||||
(hitRho * fCellSizeRho - primaryEntrance.r()) * sinDirection;
|
||||
rDistance = hitZ * fCellSizeZ * (-sinDirection) +
|
||||
(hitRho * fCellSizeRho - primaryEntrance.r()) * cosDirection;
|
||||
tSecondMoment += hitEn * std::pow(tDistance - tFirstMoment, 2);
|
||||
rSecondMoment += hitEn * std::pow(rDistance - rFirstMoment, 2);
|
||||
}
|
||||
}
|
||||
tSecondMoment /= totalEnergy;
|
||||
rSecondMoment /= totalEnergy;
|
||||
analysisManager->FillH1(8, tSecondMoment);
|
||||
analysisManager->FillH1(9, rSecondMoment);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03Hit.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<Par03Hit>* Par03HitAllocator;
|
||||
|
||||
Par03Hit::Par03Hit()
|
||||
: G4VHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03Hit::~Par03Hit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03Hit::Par03Hit(const Par03Hit& aRight)
|
||||
: G4VHit()
|
||||
{
|
||||
fEdep = aRight.fEdep;
|
||||
fZId = aRight.fZId;
|
||||
fRhoId = aRight.fRhoId;
|
||||
fPhiId = aRight.fPhiId;
|
||||
fTime = aRight.fTime;
|
||||
fPos = aRight.fPos;
|
||||
fRot = aRight.fRot;
|
||||
fType = aRight.fType;
|
||||
fLogVol = aRight.fLogVol;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const Par03Hit& Par03Hit::operator=(const Par03Hit& aRight)
|
||||
{
|
||||
fEdep = aRight.fEdep;
|
||||
fZId = aRight.fZId;
|
||||
fRhoId = aRight.fRhoId;
|
||||
fPhiId = aRight.fPhiId;
|
||||
fTime = aRight.fTime;
|
||||
fPos = aRight.fPos;
|
||||
fRot = aRight.fRot;
|
||||
fType = aRight.fType;
|
||||
fLogVol = aRight.fLogVol;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int Par03Hit::operator==(const Par03Hit& aRight) const
|
||||
{
|
||||
return (fRhoId == aRight.fRhoId && fPhiId == aRight.fPhiId &&
|
||||
fZId == aRight.fZId);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03Hit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
// Hits can be filtered out in visualisation
|
||||
if(!pVVisManager->FilterHit(*this))
|
||||
return;
|
||||
// Do not draw empty hits
|
||||
if(fEdep < 0)
|
||||
return;
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Transform3D trans(fRot, fPos);
|
||||
G4VisAttributes attribs;
|
||||
// Create default dimensions
|
||||
G4Tubs solid("draw", 0, 1 * cm, 1 * cm, 0, 0.05 * CLHEP::pi);
|
||||
if(fLogVol)
|
||||
{
|
||||
const G4VisAttributes* pVA = fLogVol->GetVisAttributes();
|
||||
if(pVA)
|
||||
attribs = *pVA;
|
||||
// Cannot use directly fLogVol due to rho parametrisation (change of
|
||||
// solid!) Recalculation of radius is needed
|
||||
solid = *dynamic_cast<G4Tubs*>(fLogVol->GetSolid());
|
||||
double dR = solid.GetOuterRadius() - solid.GetInnerRadius();
|
||||
solid.SetInnerRadius(solid.GetInnerRadius() + fRhoId * dR);
|
||||
solid.SetOuterRadius(solid.GetOuterRadius() + fRhoId * dR);
|
||||
}
|
||||
// Set colours depending on type of hit (full/fast sim)
|
||||
G4double colR = fType == 0 ? 0 : 1;
|
||||
G4double colG = fType == 0 ? 1 : 0;
|
||||
G4double colB = 0;
|
||||
G4Colour colour(colR, colG, colB, 0.5);
|
||||
attribs.SetColour(colour);
|
||||
attribs.SetForceSolid(true);
|
||||
pVVisManager->Draw(solid, attribs, trans);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String, G4AttDef>* Par03Hit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store =
|
||||
G4AttDefStore::GetInstance("Par03Hit", isNew);
|
||||
if(isNew)
|
||||
{
|
||||
(*store)["HitType"] =
|
||||
G4AttDef("HitType", "Hit Type", "Physics", "", "G4String");
|
||||
(*store)["Energy"] = G4AttDef("Energy", "Energy Deposited", "Physics",
|
||||
"G4BestUnit", "G4double");
|
||||
(*store)["Time"] =
|
||||
G4AttDef("Time", "Time", "Physics", "G4BestUnit", "G4double");
|
||||
(*store)["Pos"] =
|
||||
G4AttDef("Pos", "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* Par03Hit::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
values->push_back(G4AttValue("HitType", "HadPar03Hit", ""));
|
||||
values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
|
||||
values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
|
||||
return values;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03Hit::Print()
|
||||
{
|
||||
std::cout << "\tHit " << fEdep / MeV << " MeV at " << fPos / cm
|
||||
<< " cm (R,phi,z)= (" << fRhoId << ", " << fPhiId << ", " << fZId
|
||||
<< "), " << fTime << " ns" << std::endl;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
Par03PrimaryGeneratorAction::Par03PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction()
|
||||
, fParticleGun(nullptr)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
// Default particle properties
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle =
|
||||
particleTable->FindParticle(particleName = "e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
|
||||
fParticleGun->SetParticleEnergy(10. * GeV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -10. * cm));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03PrimaryGeneratorAction::~Par03PrimaryGeneratorAction() { delete fParticleGun; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03PrimaryGeneratorAction::GeneratePrimaries(G4Event* aEvent)
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(aEvent);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03RunAction.hh"
|
||||
#include "Par03DetectorConstruction.hh"
|
||||
|
||||
#include "g4analysis.hh"
|
||||
|
||||
Par03RunAction::Par03RunAction(Par03DetectorConstruction* aDetector)
|
||||
: G4UserRunAction()
|
||||
, fDetector(aDetector)
|
||||
{
|
||||
// Create analysis manager
|
||||
G4AnalysisManager* analysisManager = G4Analysis::ManagerInstance("root");
|
||||
// Default filename, can be overriden with /analysis/setFileName
|
||||
analysisManager->SetFileName("Par03Output");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03RunAction::~Par03RunAction() { delete G4AnalysisManager::Instance(); }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03RunAction::BeginOfRunAction(const G4Run*)
|
||||
{
|
||||
// Get detector dimensions
|
||||
G4int cellNumZ = fDetector->GetNbOfLayers();
|
||||
G4int cellNumRho = fDetector->GetNbOfRhoCells();
|
||||
G4double cellSizeZ = fDetector->GetLength() / cellNumZ;
|
||||
G4double cellSizeRho = fDetector->GetRadius() / cellNumRho;
|
||||
// Default max value of energy stored in histogram (in GeV)
|
||||
G4double maxEnergy = 100;
|
||||
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Creating control histograms
|
||||
analysisManager->CreateH1("energyParticle",
|
||||
"Primary energy;E_{MC} (GeV);Entries", 256, 0,
|
||||
1.1 * maxEnergy);
|
||||
analysisManager->CreateH1("energyDeposited",
|
||||
"Deposited energy;E_{MC} (GeV);Entries", 256, 0,
|
||||
1.1 * maxEnergy);
|
||||
analysisManager->CreateH1(
|
||||
"energyRatio",
|
||||
"Ratio of energy deposited to primary;E_{dep} / E_{MC};Entries", 1024, 0,
|
||||
1);
|
||||
analysisManager->CreateH1("time", "Simulation time; time (s);Entries", 2048,
|
||||
0, 30);
|
||||
analysisManager->CreateH1(
|
||||
"longProfile", "Longitudinal profile;t (mm);#LTE#GT (MeV)", cellNumZ,
|
||||
-0.5 * cellSizeZ, (cellNumZ - 0.5) * cellSizeZ);
|
||||
analysisManager->CreateH1(
|
||||
"transProfile", "Transverse profile;r (mm);#LTE#GT (MeV)", cellNumRho,
|
||||
-0.5 * cellSizeRho, (cellNumRho - 0.5) * cellSizeRho);
|
||||
analysisManager->CreateH1(
|
||||
"longFirstMoment",
|
||||
"First moment of longitudinal distribution;#LT#lambda#GT (mm);Entries",
|
||||
1024, -0.5 * cellSizeZ,
|
||||
cellNumZ * cellSizeZ / 2); // arbitrary scaling of max value on axis
|
||||
analysisManager->CreateH1("transFirstMoment",
|
||||
"First moment of transverse distribution;#LTr#GT "
|
||||
"(mm);Entries",
|
||||
1024, -0.5 * cellSizeRho,
|
||||
cellNumRho * cellSizeRho /
|
||||
10); // arbitrary scaling of max value on axis
|
||||
analysisManager->CreateH1(
|
||||
"longSecondMoment",
|
||||
"Second moment of longitudinal distribution;#LT#lambda^{2}#GT "
|
||||
"(mm^{2});Entries",
|
||||
1024, 0,
|
||||
std::pow(cellNumZ * cellSizeZ, 2) /
|
||||
25); // arbitrary scaling of max value on axis
|
||||
analysisManager->CreateH1(
|
||||
"transSecondMoment",
|
||||
"Second moment of transverse distribution;#LTr^{2}#GT (mm^{2});Entries",
|
||||
1024, 0,
|
||||
std::pow(cellNumRho * cellSizeRho, 2) /
|
||||
25); // arbitrary scaling of max value on axis
|
||||
analysisManager->CreateH1(
|
||||
"hitType", "hit type;type (0=full, 1= fast);Entries", 2, -0.5, 1.5);
|
||||
|
||||
// Open an output file
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "Par03SensitiveDetector.hh"
|
||||
#include "Par03Hit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
Par03SensitiveDetector::Par03SensitiveDetector(G4String aName)
|
||||
: G4VSensitiveDetector(aName)
|
||||
{
|
||||
collectionName.insert("hits");
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03SensitiveDetector::Par03SensitiveDetector(G4String aName, G4int aNumLayers,
|
||||
G4int aNumRho, G4int aNumPhi)
|
||||
: G4VSensitiveDetector(aName)
|
||||
, fCellNoZ(aNumLayers)
|
||||
, fCellNoRho(aNumRho)
|
||||
, fCellNoPhi(aNumPhi)
|
||||
{
|
||||
collectionName.insert("hits");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03SensitiveDetector::~Par03SensitiveDetector() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par03SensitiveDetector::Initialize(G4HCofThisEvent* aHCE)
|
||||
{
|
||||
fHitsCollection =
|
||||
new Par03HitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
if(fHitCollectionID < 0)
|
||||
{
|
||||
fHitCollectionID =
|
||||
G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);
|
||||
}
|
||||
aHCE->AddHitsCollection(fHitCollectionID, fHitsCollection);
|
||||
|
||||
// fill calorimeter hits with zero energy deposition
|
||||
for(G4int iphi = 0; iphi < fCellNoPhi; iphi++)
|
||||
for(G4int irho = 0; irho < fCellNoRho; irho++)
|
||||
for(G4int iz = 0; iz < fCellNoZ; iz++)
|
||||
{
|
||||
Par03Hit* hit = new Par03Hit();
|
||||
fHitsCollection->insert(hit);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par03SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(edep == 0.)
|
||||
return true;
|
||||
|
||||
G4TouchableHistory* aTouchable =
|
||||
(G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
auto hit = RetrieveAndSetupHit(aTouchable);
|
||||
|
||||
// Add energy deposit from G4Step
|
||||
hit->AddEdep(edep);
|
||||
|
||||
// Fill time information from G4Step
|
||||
// If it's already filled, choose hit with earliest global time
|
||||
if(hit->GetTime() == -1 ||
|
||||
hit->GetTime() > aStep->GetTrack()->GetGlobalTime())
|
||||
hit->SetTime(aStep->GetTrack()->GetGlobalTime());
|
||||
|
||||
// Set hit type to full simulation (only if hit is not already marked as fast
|
||||
// sim)
|
||||
if(hit->GetType() != 1)
|
||||
hit->SetType(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par03SensitiveDetector::ProcessHits(const G4FastHit* aHit,
|
||||
const G4FastTrack* aTrack,
|
||||
G4TouchableHistory* aTouchable)
|
||||
{
|
||||
G4double edep = aHit->GetEnergy();
|
||||
if(edep == 0.)
|
||||
return true;
|
||||
|
||||
auto hit = RetrieveAndSetupHit(aTouchable);
|
||||
|
||||
// Add energy deposit from G4FastHit
|
||||
hit->AddEdep(edep);
|
||||
|
||||
// Fill time information from G4FastTrack
|
||||
// If it's already filled, choose hit with earliest global time
|
||||
if(hit->GetTime() == -1 ||
|
||||
hit->GetTime() > aTrack->GetPrimaryTrack()->GetGlobalTime())
|
||||
{
|
||||
hit->SetTime(aTrack->GetPrimaryTrack()->GetGlobalTime());
|
||||
}
|
||||
|
||||
// Set hit type to fast simulation (even if hit was already marked as full
|
||||
// sim, overwrite it)
|
||||
hit->SetType(1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par03Hit* Par03SensitiveDetector::RetrieveAndSetupHit(
|
||||
G4TouchableHistory* aTouchable)
|
||||
{
|
||||
G4int rhoNo = aTouchable->GetCopyNumber(0); // cell
|
||||
G4int phiNo = aTouchable->GetCopyNumber(1); // segment
|
||||
G4int zNo = aTouchable->GetCopyNumber(2); // layer
|
||||
|
||||
std::size_t hitID = fCellNoRho * fCellNoZ * phiNo + fCellNoZ * rhoNo + zNo;
|
||||
|
||||
if(hitID >= fHitsCollection->entries())
|
||||
{
|
||||
G4Exception(
|
||||
"Par03SensitiveDetector::RetrieveAndSetupHit()", "InvalidSetup",
|
||||
FatalException,
|
||||
"Size of hit collection in Par03SensitiveDetector is smaller than the "
|
||||
"number of cells created in Par03DetectorConstruction!");
|
||||
}
|
||||
Par03Hit* hit = (*fHitsCollection)[hitID];
|
||||
|
||||
if(hit->GetRhoId() < 0)
|
||||
{
|
||||
hit->SetRhoId(rhoNo);
|
||||
hit->SetPhiId(phiNo);
|
||||
hit->SetZid(zNo);
|
||||
hit->SetLogV(aTouchable->GetVolume(0)->GetLogicalVolume());
|
||||
G4AffineTransform transform = aTouchable->GetHistory()->GetTopTransform();
|
||||
hit->SetRot(transform.NetRotation());
|
||||
transform.Invert();
|
||||
hit->SetPos(transform.NetTranslation());
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# Use default detector dimensions and initialize
|
||||
/run/initialize
|
||||
|
||||
# Use this open statement to create an OpenGL view:
|
||||
/vis/open OGL 600x600-0+0
|
||||
#
|
||||
# Use this open statement to create a .prim file suitable for
|
||||
# viewing in DAWN:
|
||||
#/vis/open DAWNFILE
|
||||
#
|
||||
# Use this open statement to create a .heprep file suitable for
|
||||
# viewing in HepRApp:
|
||||
#/vis/open HepRepFile
|
||||
#
|
||||
# Use this open statement to create a .wrl file suitable for
|
||||
# viewing in a VRML viewer:
|
||||
#/vis/open VRML2FILE
|
||||
#
|
||||
# Disable auto refresh and quieten vis messages whilst scene and
|
||||
# trajectories are established:
|
||||
/vis/viewer/set/autoRefresh false
|
||||
/vis/verbose errors
|
||||
#
|
||||
# Draw geometry:
|
||||
/vis/drawVolume worlds
|
||||
#
|
||||
# Specify view angle:
|
||||
/vis/viewer/set/viewpointThetaPhi -100 0 deg
|
||||
#
|
||||
# Specify zoom value:
|
||||
/vis/viewer/zoom 2
|
||||
#
|
||||
# Specify style (surface or wireframe):
|
||||
#/vis/viewer/set/style wireframe
|
||||
#
|
||||
# Draw coordinate axes:
|
||||
#/vis/scene/add/axes 0 0 0 1 m
|
||||
#
|
||||
# Draw smooth trajectories at end of event, showing trajectory points
|
||||
# as markers 2 pixels wide:
|
||||
#/vis/scene/add/trajectories smooth
|
||||
/vis/scene/add/trajectories
|
||||
/vis/modeling/trajectories/create/drawByCharge
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
|
||||
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
|
||||
#
|
||||
# Draw hits at end of event:
|
||||
/vis/scene/add/hits
|
||||
#
|
||||
# To draw only gammas:
|
||||
#/vis/filtering/trajectories/create/particleFilter
|
||||
#/vis/filtering/trajectories/particleFilter-0/add gamma
|
||||
#
|
||||
# To invert the above, drawing all particles except gammas,
|
||||
# keep the above two lines but also add:
|
||||
#/vis/filtering/trajectories/particleFilter-0/invert true
|
||||
#
|
||||
# Many other options are available with /vis/modeling and /vis/filtering.
|
||||
# For example, to select colour by particle ID:
|
||||
#/vis/modeling/trajectories/create/drawByParticleID
|
||||
#/vis/modeling/trajectories/drawByParticleID-0/set e- blue
|
||||
#
|
||||
# Create an attribute filter to draw only particles with certain (high) momentum
|
||||
/vis/filtering/trajectories/create/attributeFilter
|
||||
# Select attribute "IMag"
|
||||
/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag
|
||||
# Select trajectories with 25 MeV <= IMag < 1000 GeV
|
||||
/vis/filtering/trajectories/attributeFilter-0/addInterval 25 MeV 1000 GeV
|
||||
#
|
||||
# To superimpose all of the events from a given run:
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#
|
||||
# Re-establish auto refreshing and verbosity:
|
||||
/vis/viewer/set/autoRefresh true
|
||||
/vis/verbose warnings
|
||||
#
|
||||
# For file-based drivers, use this to create an empty detector view:
|
||||
#/vis/viewer/flush
|
||||
@@ -19,6 +19,13 @@
|
||||
in order to have a very fast simulation based on assumed detector
|
||||
resolutions.
|
||||
|
||||
Par03
|
||||
-------
|
||||
|
||||
This example demonstrates how to create multiple energy deposits
|
||||
from the fast simulation model and store it alongside deposits created
|
||||
in full/detailed simulation.
|
||||
|
||||
gflash
|
||||
-------
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#---Adding example B2 subdirectories explicitly
|
||||
# and a custom target to for building all example B2 options ----------
|
||||
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
|
||||
add_subdirectory(gflash1)
|
||||
add_subdirectory(gflash2)
|
||||
|
||||
@@ -16,10 +16,13 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
10-Nov-2020 B. Morgan (exgflash-V10-06-00)
|
||||
- Migration to G4RunManagerFactory.
|
||||
|
||||
28-Nov-2019 I. Hrivnacova (exgflash-V10-05-02)
|
||||
- Updated README files:
|
||||
changed text to correspond to a description of a set of examples;
|
||||
fixed formatting in .README.txt
|
||||
fixed formatting in .README.txt
|
||||
- Fixed Doxygen warnings
|
||||
|
||||
25-Nov-2019 I. Semeniouk (exgflash-V10-05-01)
|
||||
@@ -63,7 +66,7 @@ committal in the CVS repository !
|
||||
|
||||
30-Jul-2013, Peter Gumplinger (exgflash-V09-06-02)
|
||||
- fix MAC/clang32 compilation warnings
|
||||
|
||||
|
||||
16-Jul-2013, Marc Verderi (exgflash-V09-06-01)
|
||||
- Migration to MT
|
||||
|
||||
@@ -82,9 +85,9 @@ committal in the CVS repository !
|
||||
create/new Collection before adding it to HCE
|
||||
|
||||
26-January 2010, Gunter Folger (exgflash-V09-04-00)
|
||||
- Finnish correcting namepsace problems on Windows,
|
||||
- Finnish correcting namepsace problems on Windows,
|
||||
removed using namespace, use G4cout,.. and few std::
|
||||
|
||||
|
||||
03-December 2010, Gunter Folger (exgflash-V09-03-04)
|
||||
- Correct use of "using namespace std", needed for Windows VC
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(gflash1)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,19 +29,15 @@
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
|
||||
// G4 includes
|
||||
// G4 includes
|
||||
#include "G4Types.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
// my project
|
||||
// my project
|
||||
#include "ExGflash1DetectorConstruction.hh"
|
||||
#include "ExGflashActionInitialization.hh"
|
||||
|
||||
@@ -54,7 +50,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
{
|
||||
// Instantiate G4UIExecutive if interactive mode
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) {
|
||||
@@ -64,30 +60,18 @@ int main(int argc,char** argv)
|
||||
// timer to see GFlash performance
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
|
||||
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| |"<<G4endl;
|
||||
G4cout<<"| This is an example of Shower |"<<G4endl;
|
||||
G4cout<<"| Parameterization with GFLASH |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
|
||||
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(1);
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing MT run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing sequential run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
runManager->SetUserInitialization(new ExGflash1DetectorConstruction);
|
||||
|
||||
// G4cout<<"# GFlash Example: Physics "<<G4endl;
|
||||
@@ -121,22 +105,22 @@ int main(int argc,char** argv)
|
||||
UImanager->ApplyCommand("/run/verbose 0");
|
||||
runManager->Initialize();
|
||||
UImanager->ApplyCommand("/Step/Verbose 0");
|
||||
|
||||
|
||||
if (ui) // Define UI terminal for interactive mode
|
||||
{
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
{
|
||||
G4String s=*(argv+1);
|
||||
UImanager->ApplyCommand("/control/execute "+s);
|
||||
}
|
||||
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
|
||||
timer.Stop();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
@@ -149,7 +133,7 @@ int main(int argc,char** argv)
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
G4cout << G4endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(gflash2)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,19 +29,15 @@
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
|
||||
// G4 includes
|
||||
// G4 includes
|
||||
#include "G4Types.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
// my project
|
||||
// my project
|
||||
#include "ExGflash2DetectorConstruction.hh"
|
||||
#include "ExGflash2ParallelWorld.hh"
|
||||
#include "ExGflashActionInitialization.hh"
|
||||
@@ -55,7 +51,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
{
|
||||
// Instantiate G4UIExecutive if interactive mode
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) {
|
||||
@@ -65,30 +61,18 @@ int main(int argc,char** argv)
|
||||
// timer to see GFlash performance
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
|
||||
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| |"<<G4endl;
|
||||
G4cout<<"| This is an example of Shower |"<<G4endl;
|
||||
G4cout<<"| Parameterization with GFLASH |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
|
||||
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(1);
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing MT run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing sequential run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
auto detector = new ExGflash2DetectorConstruction();
|
||||
detector->RegisterParallelWorld(new ExGflash2ParallelWorld("parallelWorld"));
|
||||
runManager->SetUserInitialization(detector);
|
||||
@@ -124,22 +108,22 @@ int main(int argc,char** argv)
|
||||
UImanager->ApplyCommand("/run/verbose 0");
|
||||
runManager->Initialize();
|
||||
UImanager->ApplyCommand("/Step/Verbose 0");
|
||||
|
||||
|
||||
if (ui) // Define UI terminal for interactive mode
|
||||
{
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
{
|
||||
G4String s=*(argv+1);
|
||||
UImanager->ApplyCommand("/control/execute "+s);
|
||||
}
|
||||
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
|
||||
timer.Stop();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
@@ -152,7 +136,7 @@ int main(int argc,char** argv)
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
G4cout << G4endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(gflash3)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,19 +29,15 @@
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
|
||||
// G4 includes
|
||||
// G4 includes
|
||||
#include "G4Types.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
// my project
|
||||
// my project
|
||||
#include "ExGflash3DetectorConstruction.hh"
|
||||
#include "ExGflash3ParallelWorld.hh"
|
||||
#include "ExGflashActionInitialization.hh"
|
||||
@@ -56,7 +52,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
{
|
||||
// Instantiate G4UIExecutive if interactive mode
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) {
|
||||
@@ -66,30 +62,18 @@ int main(int argc,char** argv)
|
||||
// timer to see GFlash performance
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
|
||||
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| |"<<G4endl;
|
||||
G4cout<<"| This is an example of Shower |"<<G4endl;
|
||||
G4cout<<"| Parameterization with GFLASH |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
|
||||
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
runManager->SetNumberOfThreads(1);
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing MT run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| Constructing sequential run manager |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
G4cout<<"# GFlash Example: Detector Construction"<<G4endl;
|
||||
auto detector = new ExGflash3DetectorConstruction();
|
||||
detector->RegisterParallelWorld(new ExGflash3ParallelWorld("parallelWorld"));
|
||||
runManager->SetUserInitialization(detector);
|
||||
@@ -126,22 +110,22 @@ int main(int argc,char** argv)
|
||||
UImanager->ApplyCommand("/run/verbose 0");
|
||||
runManager->Initialize();
|
||||
UImanager->ApplyCommand("/Step/Verbose 0");
|
||||
|
||||
|
||||
if (ui) // Define UI terminal for interactive mode
|
||||
{
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
{
|
||||
G4String s=*(argv+1);
|
||||
UImanager->ApplyCommand("/control/execute "+s);
|
||||
}
|
||||
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
|
||||
timer.Stop();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
@@ -154,7 +138,7 @@ int main(int argc,char** argv)
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
G4cout << G4endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(gflasha)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -29,19 +29,15 @@
|
||||
//
|
||||
// Created by Joanna Weng 26.11.2004
|
||||
|
||||
// G4 includes
|
||||
// G4 includes
|
||||
#include "G4Types.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
// my project
|
||||
// my project
|
||||
#include "ExGflashDetectorConstruction.hh"
|
||||
#include "ExGflashActionInitialization.hh"
|
||||
|
||||
@@ -54,7 +50,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
{
|
||||
// Instantiate G4UIExecutive if interactive mode
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( argc == 1 ) {
|
||||
@@ -64,21 +60,15 @@ int main(int argc,char** argv)
|
||||
// timer to see GFlash performance
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
|
||||
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
G4cout<<"| |"<<G4endl;
|
||||
G4cout<<"| This is an example of Shower |"<<G4endl;
|
||||
G4cout<<"| Parameterization with GFLASH |"<<G4endl;
|
||||
G4cout<<"+-------------------------------------------------------+"<<G4endl;
|
||||
|
||||
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
#endif
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
ExGflashDetectorConstruction* detector = new ExGflashDetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
@@ -88,7 +78,7 @@ int main(int argc,char** argv)
|
||||
// -- Create a fast simulation physics constructor, used to augment
|
||||
// -- the above physics list to allow for fast simulation:
|
||||
G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
|
||||
|
||||
|
||||
// -- We now configure the fastSimulationPhysics object.
|
||||
// -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc)
|
||||
// -- is applicable to e+ and e- : we augment the physics list for these
|
||||
@@ -114,22 +104,22 @@ int main(int argc,char** argv)
|
||||
UImanager->ApplyCommand("/run/verbose 0");
|
||||
runManager->Initialize();
|
||||
UImanager->ApplyCommand("/Step/Verbose 0");
|
||||
|
||||
|
||||
if (ui) // Define UI terminal for interactive mode
|
||||
{
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
{
|
||||
G4String s=*(argv+1);
|
||||
UImanager->ApplyCommand("/control/execute "+s);
|
||||
}
|
||||
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
|
||||
timer.Stop();
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
@@ -142,7 +132,7 @@ int main(int argc,char** argv)
|
||||
G4cout << G4endl;
|
||||
G4cout << "******************************************";
|
||||
G4cout << G4endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
10-Nov-2020 B. Morgan (exgflasha-V10-06-00)
|
||||
- Migration to G4RunManagerFactory.
|
||||
|
||||
28-Oct-2019 I. Hrivnacova (exgflasha-V10-05-01)
|
||||
- Fixed formatting in .README.txt and Doxygen warnings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user