Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
@@ -1,27 +0,0 @@
///\file "eventgenerator/pythia/.README.txt"
///\brief Examples pythia README page
/*! \page Examples_pythia Category "eventgenerator/pythia"
Examples for Pythia-Geant4 interface.
This directory contains examples for using Pythia as Monte Carlo event
generator, interfaced with Geant4, and showing how to implement an external
decayer.
\section pythia_s1 Requirements for external software packages
\subsection PYTHIA
- Tested versions 6.4.28 (decayer6) and 8.3.0.5 (py8decayer)
- URL: https://pythia.org/
\section pythia_s2 Example decayer6
The \link Exampledecayer6 decayer6 \endlink example demonstrates the use
of Pythia6 as an external decayer.
\section pythia_s3 Example py8decayer
The \link Examplepy8decayer py8decayer \endlink example demonstrates the use
of Pythia8 as an external decayer.
*/
@@ -0,0 +1,19 @@
\page Examples_pythia Category "eventgenerator/pythia"
Examples for Pythia-Geant4 interface.
This directory contains examples for using Pythia as Monte Carlo event
generator, interfaced with Geant4, and showing how to implement an external
decayer.
## Requirements for external software packages
- URL: https://pythia.org/
## Example decayer6
The \ref Exampledecayer6 example demonstrates the use
of Pythia6 as an external decayer.
## Example py8decayer
The \ref Examplepy8decayer example demonstrates the use
of Pythia8 as an external decayer.
@@ -29,25 +29,15 @@ find_package(Pythia6 REQUIRED)
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/common/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add common subdirectory and
# - disable building examples in common
# - add a unique prefix to the common library built in this example
#
set (EXAMPLES_COMMON OFF)
set (common_prefix decayer6_)
add_subdirectory(common)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(pythia6_decayer pythia6_decayer.cc ${sources} ${headers})
target_link_libraries(pythia6_decayer ${common_prefix}common ${Geant4_LIBRARIES} Pythia6::Pythia6 )
target_link_libraries(pythia6_decayer ${Geant4_LIBRARIES} Pythia6::Pythia6 )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build decayer6. This is so that we can run the executable directly because it
@@ -4,6 +4,11 @@ See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2025-07-28 I. Hrivnacova (p6decayer-V11-03-00)
- Removed 'common' subdirectory and copied only classes used in this example
(DetectorConstruction, GunPrimaryGeneration) in this example include and src
- Migrated README pages to Markdown
## 2024-04-25 Ben Morgan (p6decayer-V11-02-00)
- Update CMake script to use new Pythia6 setup/build variables
@@ -1,85 +0,0 @@
------------------------------------------------------------
Example of the external decayer implementation with PYTHIA6
-----------------------------------------------------------
The complete PYTHIA6 documentation can be found at:
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
The PYTHIA6 external decayer was originally developed within
the AliRoot framework, by Andreas Morsch (CERN).
The dependence on the ALICE software was taken off
by Christian Holm Christensen,
The dependence on the Root framework and the integration in
the Geant4 framework was done by Ivana Hrivnacova (IPN Orsay).
------------------------------------------------------------
The use of the external decayer is demonstrated with using the
classes from common examples repository, see below their complete list.
The G4Pythia6Decayer class provides the implementation of the
G4VExternalDecayer interface with using PYTHIA6. In order
to be able to use PYTHIA6, which is written in FORTRAN,
a C++ interface class Pythia6 is provided. This class
interfaces only the PYTHIA6 functions relevant to decay.
The G4Pythia6Decayer is instantiated in the P6DExtDecayerPhysics builder,
in the ConstructProcess() function where the external decayer is set
to G4Decay process for all particles.
To demonstrate the decay with external decayer,
the B- meson is defined in ExG4PrimaryGeneratorAction01,
as it has no own decay table defined within Geant4.
With PYTHIA6, it is possible to force a selected decay
type. This selection can be chosen interactively via
the implemented Geant4 UI command:
/pythia6Decayer/forceDecayType decayType
where the available decay types are listed in the EDecayType
enumaration.
The classes Pythia6, G4Pythia6Decayer, G4Pythia6DecayerMessenger
are independent from the example classes and can be reused
in another user application.
Installation:
1. Download the PYTHIA6 source file from the PYTHIA6 download site:
http://www.hepforge.org/downloads/pythia6
2A.) With CMake: Build pythia6 library
For a convenience a CMake file for building Pythia6 library from
the source is provided in
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
Build the pythia6 library following the instructions in this file
and then define the environment variables:
PYTHIA6 the path where pythia6 library is installed
PYTHIA6_VERSION the pythia version
2B.) With GNUmake: Define the environment variables:
PYTHIA6 the path to pythia-versionX.f source code
PYTHIA6_VERSION the pythia version
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
then you have to set:
export PYTHIA6=$HOME
export PYTHIA6_VERSION="6.4.26"
Pythia6 will be then compiled together with example code.
3. Compilation:
Then the example is compiled in a standard way, see examples/README_HowToRun.
Note that with GNUmake build, an additional step 'gmake setup' is
needed before 'gmake'.
Execution:
% pythia6_decayer pythia6_decayer.in
This example uses the following user action classes from the extended examples common
repository available in common subdirectory:
DetectorConstruction
GunPrimaryGeneratorAction
@@ -1,14 +1,10 @@
///\file "eventgenerator/pythia/decayer6/.README.txt"
///\brief Example decayer6 page
/*! \page Exampledecayer6 Example decayer6
\page Exampledecayer6 Example decayer6
This is an example of the external decayer implementation
with PYTHIA6.
The complete PYTHIA6 documentation can be found at:
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
https://pythia.org/
The PYTHIA6 external decayer was originally developed within
the AliRoot framework, by Andreas Morsch (CERN). \n
@@ -39,9 +35,9 @@
With PYTHIA6, it is possible to force a selected decay
type. This selection can be chosen interactively via
the implemented Geant4 UI command:
\verbatim
```
/pythia6Decayer/forceDecayType decayType
\endverbatim
```
where the available decay types are listed in the EDecayType
enumaration.
@@ -50,9 +46,11 @@
in another user application.
Installation:
- 1. Download the PYTHIA6 source file from the PYTHIA6 download site:\n
http://www.hepforge.org/downloads/pythia6
- 1. Download the PYTHIA6 source file from the PYTHIA web site:\n
https://pythia.org/
Note: The last tested version: 6.4.28
- 2A. With CMake: Build pythia6 library
For a convenience a CMake file for building Pythia6 library from
@@ -60,37 +58,37 @@
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
Build the pythia6 library following the instructions in this file
and then define the environment variables:
\verbatim
```
PYTHIA6 the path where pythia6 library is installed
PYTHIA6_VERSION the pythia version
\endverbatim
```
- 2B. With GNUmake: Define the environment variables: \n
\verbatim
```
PYTHIA6 the path to pythia-versionX.f source code
PYTHIA6_VERSION the pythia version
\endverbatim
```
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
e.g. If you download pythia-6.4.28.f.gz and unzip it in $HOME,
then you have to set:
```
export PYTHIA6=$HOME
export PYTHIA6_VERSION="6.4.26"
export PYTHIA6_VERSION="6.4.28"
```
pythia6 will be then compiled together with example code.
- 3. Compilation:\n
Then the example is compiled in a standard way, see \ref README_HowToRun. \n
Then the example is compiled in a standard way, see
[How to build and run an example](../../html/README_HowToRun.html).
Note that with GNUmake build, an additional step 'gmake setup' is
needed before 'gmake'.
- 4. Execution:
\verbatim
% pythia6_decayer pythia6_decayer.in
\endverbatim
```
% ./pythia6_decayer pythia6_decayer.in
```
This example uses the following user action classes from the extended examples common
repository available in common subdirectory:
- DetectorConstruction
- GunPrimaryGeneratorAction
*/
This example uses the following user action classes from the extended examples 'common'
repository:
- Common::DetectorConstruction
- Common::GunPrimaryGeneratorAction
@@ -1,33 +0,0 @@
///\file "common/.README.txt"
///\brief Common classes README page
/*! \page Examples_common Category "common"
This example includes a set of classes independent on each other which
can be reused in "feature" examples demonstrating just a particular feature
or users applications.
It provides the following sets of classes:
- Detector construction classes
- two simple detector construction classes with a messenger
- Physics list classes
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
- Primary generator classes
- two simple primary generator classes (with G4ParticleGun and
G4ParticleGeneralSource)
These classes can be tested with the following programs:
- testCommon.cc - only instantiates all classes
- exampleCommonNoVis.cc - Geant4 application without visualization, that can be run
both interactively or in batch (with the init.mac or run.mac macro)
- exampleCommonNoVis.cc - Geant4 application with visualization, that can be run
both interactively or in batch (with the init_vis.mac or run.mac macro)
Building examples programs can be disabled with the CMake option: -DEXAMPLES_COMMON=OFF.
*/
@@ -1,84 +0,0 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.27)
project(${common_prefix}common)
#----------------------------------------------------------------------------
# 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()
#----------------------------------------------------------------------------
# Option to build examples in addition to test
#
option(COMMON_EXAMPLES "Activate building example executables" ON)
#----------------------------------------------------------------------------
# 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 library
#
add_library(${common_prefix}common ${sources} ${headers})
target_link_libraries(${common_prefix}common ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Add the test executable, and link it to the Geant4 libraries and common library
#
add_executable(${common_prefix}testCommon testCommon.cc )
target_link_libraries(${common_prefix}testCommon ${common_prefix}common ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Optionally, add the example executables, and link it to the Geant4 libraries and common library
#
if(COMMON_EXAMPLES)
add_executable(exampleCommon exampleCommon.cc )
target_link_libraries(exampleCommon ${common_prefix}common ${Geant4_LIBRARIES})
add_executable(exampleCommonNoVis exampleCommonNoVis.cc )
target_link_libraries(exampleCommonNoVis ${common_prefix}common ${Geant4_LIBRARIES})
endif(COMMON_EXAMPLES)
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build detectorConstruction. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(detectorConstruction_SCRIPTS
init.mac init_vis.mac run.mac vis.mac
)
foreach(_script ${detectorConstruction_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
# and the library to 'lib' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS ${common_prefix}testCommon DESTINATION bin)
if (COMMON_EXAMPLES)
install(TARGETS exampleCommon DESTINATION bin)
install(TARGETS exampleCommonNoVis DESTINATION bin)
endif(COMMON_EXAMPLES)
install(TARGETS ${common_prefix}common DESTINATION lib)
@@ -1,36 +0,0 @@
# --------------------------------------------------------------
# GNUmakefile for common repository examples module.
# --------------------------------------------------------------
name := common
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/tracking/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/pii/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/event/include \
-I$(G4BASE)/run/include
CPPFLAGS += -I$(G4INCLUDE)
include $(G4INSTALL)/config/common.gmk
@@ -1,101 +0,0 @@
# Example common History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
## 2022-11-07 I. Hrivnacova (excommon-V11-00-01)
New coding guidelines, added tests:
- Added exampleCommon.cc and exampleCommonNoVis.cc
- Added namespace Common
- Override keywords
- Data members initialization in .hh
- Updated README files
- Removed trailing whitespaces
## 2021-12-10 Ben Morgan (excommon-V11-00-00)
- Change to new Markdown History format
---
# History entries prior to 11.0
24/05/21 B. Morgan (excommon-V10-07-00)
- Bump required CMake version range to 3.12...3.20, matching core Geant4
03/11/20 B. Morgan (excommon-V10-06-00)
- Support same CMake version range as core Geant4
29/09/17 I. Hrivnacova (excommon-V10-03-00,01)
- Removed generic class names prefix (ExG4) and introduced a meaningful one
when appropriate
- Removed event and run action classes which are now obsolete
- Replaced explicit messengers with use of G4GenericMessenger
- C++11 (nullptr, auto)
20/07/16 I. Hrivnacova (excommon-V10-02-01)
- Coding guidelines (redundant empty lines)
04/07/16 I. Hrivnacova (excommon-V10-02-00)
- Fix for Doxygen documentation
09/06/15 I. Hrivnacova (excommon-V10-01-00)
- Added a client-specific prefix to common library and test
to avoid name clashes when building all extended examples at once
06/11/14 I. Hrivnacova (excommon-V10-00-06)
- Fixed CMakeLists.txt for removal of analysis directory
05/11/14 I. Hrivnacova (excommon-V10-00-05)
- Restoring back GNUmakefile (lost with previous update)
05/11/14 I. Hrivnacova (excommon-V10-00-04)
- Moved analysis subdirectory in extended/analysis/AnaEx01/hbook,
as it is not used anywhere else
05/11/14 I. Hrivnacova (excommon-V10-00-03)
- Removed sub-directories with user classes and scripts (now obsolete)
04/11/14 I. Hrivnacova (excommon-V10-00-02)
- Added GNUmakefile in top directory
04/11/14 I. Hrivnacova (excommon-V10-00-01)
- Modifications to facilitate use of common directory via svn:externals:
merging user classes in the top directoy (include and src),
added testCommon.cc for all classes altogether and
added building common library
28/05/14 I. Hrivnacova (excommon-V10-00-00)
- Removed fPrintModulo from ExG4EventAction01
and fSetPrintModuloCmd from ExG4EventAction01Messenger,
now obsolete.
- Fixed long lines, separators in userActions classes
28/02/13 I. Hrivnacova (excommon-V09-06-00)
- When building materials with NistManager
do not set fromIsotopes argument (which was set to false),
as since 9.6 all materials have to be built from isotopes.
Thanks to V. Ivantchenko for pointing at this.
26/09/2012 I. Hrivnacova (excommon-V09-05-02)
- Added/updated CMakeLists.txt files:
adding copying macros, install target, comment lines
and HBOOK external package in analysis
- Added explicit includes of G4SystemOfUnits.hh and G4PhysicalConstants.hh
- Replaced tabulators with space characters
- Updated script for generating CMakeLists.txt files
19/07/2012 I. Hrivnacova (excommon-V09-05-01)
- Fix in the scripts (copying files from shared with an extension)
05/06/2012 I. Hrivnacova (excommon-V09-05-00)
- Updated scripts for copying shared files; the shared files are now
defined in the SharedFilesList.txt file
23/11/2011 I. Hrivnacova (excommon-V09-04-01)
- Addded physicsList directory with a physics list with genatino
and charged geantino
15/11/2011 I. Hrivnacova (excommon-V09-04-00)
- First version of the common classes for the extended examples.
@@ -1,34 +0,0 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Common Classes for Extended Examples
-------------------------------------
This example includes a set of classes independent on each other which
can be reused in "feature" examples demonstrating just a particular feature
or users applications.
It provides the following sets of classes:
- Detector construction classes
- two simple detector construction classes with a messenger
- Physics list classes
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
- Primary generator classes
- two simple primary generator classes (with G4ParticleGun and
G4ParticleGeneralSource)
These classes can be tested with the following programs:
- testCommon.cc - only instantiates all classes
- exampleCommonNoVis.cc - Geant4 application without visualization, that can be run
both interactively or in batch (with the init.mac or run.mac macro)
- exampleCommonNoVis.cc - Geant4 application with visualization, that can be run
both interactively or in batch (with the init_vis.mac or run.mac macro)
Building examples programs can be disabled with the CMake option: -DEXAMPLES_COMMON=OFF.
@@ -1,91 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file exampleCommon.cc
/// \brief Main program of the Common example
#include "DetectorConstruction.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
using namespace Common;
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
// Set mandatory initialization classes
runManager->SetUserInitialization(new DetectorConstruction);
runManager->SetUserInitialization(new GeantinoPhysicsList);
// Set mandatory user action class
runManager->SetUserAction(new GpsPrimaryGeneratorAction);
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
// G4VisManager* visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
if (!ui) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
delete ui;
}
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete visManager;
delete runManager;
}
@@ -1,82 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file exampleCommonNoVis.cc
/// \brief Main program of the Common example without visualization
#include "DetectorConstruction.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
using namespace Common;
int main(int argc, char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = nullptr;
if (argc == 1) {
ui = new G4UIExecutive(argc, argv);
}
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
// Set mandatory initialization classes
runManager->SetUserInitialization(new DetectorConstruction);
runManager->SetUserInitialization(new GeantinoPhysicsList);
// Set mandatory user action class
runManager->SetUserAction(new GpsPrimaryGeneratorAction);
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
if (!ui) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command + fileName);
}
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init.mac");
ui->SessionStart();
delete ui;
}
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete runManager;
}
@@ -1,75 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/include/DetectorConstruction0.hh
/// \brief Definition of the Common::DetectorConstruction0 class
#ifndef DetectorConstruction0_h
#define DetectorConstruction0_h 1
#include "CLHEP/Units/SystemOfUnits.h"
#include "G4ThreeVector.hh"
#include "G4VUserDetectorConstruction.hh"
class G4LogicalVolume;
class G4Material;
class G4GenericMessenger;
namespace Common
{
/// Simple detector construction with only a world volume
class DetectorConstruction0 : public G4VUserDetectorConstruction
{
public:
DetectorConstruction0(const G4String& materialName = "G4_AIR", G4double hx = 50 * CLHEP::cm,
G4double hy = 50 * CLHEP::cm, G4double hz = 50 * CLHEP::cm);
~DetectorConstruction0() override;
public:
// methods from base class
G4VPhysicalVolume* Construct() override;
// set methods
void SetMaterial(const G4String& materialName);
void SetDimensions(G4ThreeVector dimensions);
private:
void DefineCommands();
G4GenericMessenger* fMessenger = nullptr;
G4String fMaterialName;
G4ThreeVector fDimensions;
G4LogicalVolume* fWorldVolume = nullptr;
};
} // namespace Common
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,54 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/include/GeantinoPhysicsList.hh
/// \brief Definition of the Common::GeantinoPhysicsList class
#ifndef GeantinoPhysicsList_h
#define GeantinoPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
namespace Common
{
/// Physics list with geantino and charged geantino only
class GeantinoPhysicsList : public G4VUserPhysicsList
{
public:
GeantinoPhysicsList();
~GeantinoPhysicsList() override;
protected:
// Construct particle and physics process
void ConstructParticle() override;
void ConstructProcess() override;
};
} // namespace Common
#endif
@@ -1,63 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/include/GpsPrimaryGeneratorAction.hh
/// \brief Definition of the Common::GpsPrimaryGeneratorAction class
//
#ifndef GpsPrimaryGeneratorAction_h
#define GpsPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4GeneralParticleSource;
class G4Event;
namespace Common
{
/// \brief The primary generator class with general particle source
///
/// \author I. Hrivnacova; IPN Orsay
class GpsPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GpsPrimaryGeneratorAction();
~GpsPrimaryGeneratorAction() override;
// methods
void GeneratePrimaries(G4Event*) override;
private:
// data members
G4GeneralParticleSource* fGeneralParticleSource = nullptr;
};
} // namespace Common
#endif
@@ -1,13 +0,0 @@
# Macro file for the initialization of example B1
# in interactive session
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
@@ -1,16 +0,0 @@
# Macro file for the initialization of example B1
# in interactive session
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
#
# Visualization setting
/control/execute vis.mac
@@ -1,12 +0,0 @@
# Macro file for example common
#
# To be run preferably in batch
# % ./exampleCommon[NoVis] run.mac
#
#/run/numberOfThreads 4
/run/initialize
#
/control/verbose 2
/run/verbose 2
#
/run/beamOn 10
@@ -1,142 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/src/DetectorConstruction0.cc
/// \brief Implementation of the Common::DetectorConstruction0 class
#include "DetectorConstruction0.hh"
#include "G4Box.hh"
#include "G4GenericMessenger.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4PVPlacement.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction0::DetectorConstruction0(const G4String& materialName, G4double hx, G4double hy,
G4double hz)
: fMaterialName(materialName), fDimensions(hx, hy, hz)
{
DefineCommands();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction0::~DetectorConstruction0()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction0::Construct()
{
// Define materials via NIST manager
//
auto nistManager = G4NistManager::Instance();
auto material = nistManager->FindOrBuildMaterial(fMaterialName);
// World
//
auto sWorld = new G4Box("World", // name
fDimensions.x(), // dimensions (half-lentghs)
fDimensions.y(), fDimensions.z());
fWorldVolume = new G4LogicalVolume(sWorld, // shape
material, // material
"World"); // name
auto pWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
fWorldVolume, // logical volume
"World", // name
0, // mother volume
false, // no boolean operation
0); // copy number
// always return the root volume
//
return pWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction0::SetMaterial(const G4String& materialName)
{
auto nistManager = G4NistManager::Instance();
auto newMaterial = nistManager->FindOrBuildMaterial(materialName);
if (!newMaterial) {
G4cerr << "Material " << materialName << " not found." << G4endl;
G4cerr << "The box material was not changed." << G4endl;
return;
}
if (fWorldVolume) fWorldVolume->SetMaterial(newMaterial);
G4cout << "Material of box changed to " << materialName << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction0::SetDimensions(G4ThreeVector dimensions)
{
/// Set world dimension (in half lengths).
/// This setting has effect only if called in PreInit> phase
fDimensions = dimensions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction0::DefineCommands()
{
// Define /B5/detector command directory using generic messenger class
fMessenger = new G4GenericMessenger(this, "/detector/", "Detector control");
// setMaterial command
auto& setMaterialCmd = fMessenger->DeclareMethod(
"setMaterial", &DetectorConstruction0::SetMaterial, "Set world material name.");
setMaterialCmd.SetParameterName("materialName", false);
setMaterialCmd.SetDefaultValue("G4_AIR");
setMaterialCmd.SetStates(G4State_PreInit);
// setDimensions command
auto& setDimensionsCmd =
fMessenger->DeclareMethodWithUnit("setDimensions", "mm", &DetectorConstruction0::SetDimensions,
"Set world dimensions (in half lentgh).");
setDimensionsCmd.SetParameterName("dimensions", false);
setDimensionsCmd.SetStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
} // namespace Common
@@ -1,70 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/src/GeantinoPhysicsList.cc
/// \brief Implementation of the Common::GeantinoPhysicsList class
#include "GeantinoPhysicsList.hh"
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GeantinoPhysicsList::GeantinoPhysicsList() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GeantinoPhysicsList::~GeantinoPhysicsList() = default;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void GeantinoPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void GeantinoPhysicsList::ConstructProcess()
{
// Define transportation process
AddTransportation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
} // namespace Common
@@ -1,64 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/src/GpsPrimaryGeneratorAction.cc
/// \brief Implementation of the Common::GpsPrimaryGeneratorActionclass
#include "GpsPrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "G4SystemOfUnits.hh"
namespace Common
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GpsPrimaryGeneratorAction::GpsPrimaryGeneratorAction()
{
fGeneralParticleSource = new G4GeneralParticleSource();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GpsPrimaryGeneratorAction::~GpsPrimaryGeneratorAction()
{
delete fGeneralParticleSource;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void GpsPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
fGeneralParticleSource->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
} // namespace Common
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file testCommon.cc
/// \brief Test program for the common classes
#include "DetectorConstruction.hh"
#include "DetectorConstruction0.hh"
#include "FTFP_BERT.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
using namespace Common;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Test program which only instantiates classes defined in
// examples/common
int main()
{
// First construct necessary classes
//
auto runManager = new G4RunManager;
auto physicsList = new FTFP_BERT;
runManager->SetUserInitialization(physicsList);
// Instantiate all detector construction classes
auto detectorConstruction = new DetectorConstruction;
auto detectorConstruction0 = new DetectorConstruction0;
// Instantiate all physics list classes
auto geantinoPhysicsList = new GeantinoPhysicsList();
// Instantiate all primary generator actions classes
auto gpsPrimaryGeneratorAction = new GpsPrimaryGeneratorAction();
auto gunPrimaryGeneratorAction = new GunPrimaryGeneratorAction();
// delete all
delete detectorConstruction;
delete detectorConstruction0;
delete geantinoPhysicsList;
delete gpsPrimaryGeneratorAction;
delete gunPrimaryGeneratorAction;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,106 +0,0 @@
# Macro file for the visualization setting in the initialization phase
# of the B1 example when running in interactive mode
#
# Open a viewer
/vis/open
# This opens the default viewer - see examples/basic/B1/vis.mac for a
# more comprehensive overview of options. Also the documentation.
#
# Use this open statement to create an offscreen file with TSG:
#/vis/open TSG_OFFSCREEN 1200x1200
# See the tsg_offscreen.mac file for more commands to change
# the file format, file name, picture size, etc.
#
# 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
#
# Specify view angle:
/vis/viewer/set/viewpointVector -1 0 0
/vis/viewer/set/lightsVector -1 0 0
#
# Specify style (surface, wireframe, auxiliary edges,...)
/vis/viewer/set/style wireframe
/vis/viewer/set/auxiliaryEdge true
/vis/viewer/set/lineSegmentsPerCircle 100
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/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/default/setDrawStepPts true
# To select or override default colours (note: e+ is blue by default):
#/vis/modeling/trajectories/list
#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
#
# To superimpose all of the events from a given run:
/vis/scene/endOfEventAction accumulate
#
# Decorations
# Name
/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! exampleB1
# or, if your system does not support right-adjustment
#/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1
/vis/set/textLayout # Revert to normal (left adjusted) layout
/vis/set/textColour # Revert to default text colour (blue)
#
# Axes, scale, etc.
/vis/scene/add/scale # Simple scale line
/vis/scene/add/axes # Simple axes: x=red, y=green, z=blue.
/vis/scene/add/eventID # Drawn at end of event
/vis/scene/add/date # Date stamp
/vis/scene/add/logo2D # Simple logo
/vis/scene/add/logo # 3D logo
#
# Frame
/vis/set/colour red
/vis/set/lineWidth 2
/vis/scene/add/frame # Simple frame around the view
/vis/set/colour # Revert to default colour (white)
/vis/set/lineWidth # Revert to default line width (1.)
#
# Attach text to one edge of Shape1, with a small, fixed offset
/vis/scene/add/text 0 6 -4 cm 18 4 4 Shape1
# Attach text to one corner of Shape2, with a small, fixed offset
/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2
#
# To get nice view
# Make the "World" box invisible
/vis/geometry/set/visibility World 0 false
# "Envelope" is transparent blue to represent water
#/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 120 150
#
# 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
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/include/DetectorConstruction.hh
/// \file DetectorConstruction.hh
/// \brief Definition of the Common::DetectorConstruction class
#ifndef DetectorConstruction_h
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/include/EDecayType.hh
/// \brief Definition of the EDecayType enumeration
/// \file EDecayType.hh
/// \brief Definition of the EDecayType class
#ifndef E_DECAY_TYPE_H
#define E_DECAY_TYPE_H
@@ -23,11 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file eventgenerator/pythia/decayer6/include/G4Pythia6Decayer.hh
/// \file G4Pythia6Decayer.hh
/// \brief Definition of the G4Pythia6Decayer class
//
#ifndef G4_PYTHIA6_DECAYER_H
#define G4_PYTHIA6_DECAYER_H
@@ -23,9 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
/// \file eventgenerator/pythia/decayer6/include/G4Pythia6DecayerMessenger.hh
/// \file G4Pythia6DecayerMessenger.hh
/// \brief Definition of the G4Pythia6DecayerMessenger class
#ifndef G4_PYTHIA6_DECAYER_MESSENGER_H
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/include/GunPrimaryGeneratorAction.hh
/// \file GunPrimaryGeneratorAction.hh
/// \brief Definition of the Common::GunPrimaryGeneratorAction class
///
/// \author I. Hrivnacova; IPN Orsay
#ifndef GunPrimaryGeneratorAction_h
#define GunPrimaryGeneratorAction_h 1
@@ -42,10 +43,6 @@ class G4Event;
namespace Common
{
/// \brief The primary generator class with particle gun
///
/// \author I. Hrivnacova; IPN Orsay
class GunPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/include/P6DExtDecayerPhysics.hh
/// \file P6DExtDecayerPhysics.hh
/// \brief Definition of the P6DExtDecayerPhysics class
///
/// \author I. Hrivnacova; IPN Orsay
@@ -23,11 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/include/Pythia6.hh
/// \file Pythia6.hh
/// \brief Definition of the Pythia6 class
//
// ----------------------------------------------------------------------------
// ******************************************************************************
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/pythia6_decayer.cc
/// \brief Main program of the pythia6Decayer example
/// \file pythia6_decayer.cc
/// \brief Main program of the pythia/decayer6 example
#include "DetectorConstruction.hh"
#include "GunPrimaryGeneratorAction.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/src/DetectorConstruction.cc
/// \file DetectorConstruction.cc
/// \brief Implementation of the Common::DetectorConstruction class
#include "DetectorConstruction.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/src/G4Pythia6Decayer.cc
/// \file G4Pythia6Decayer.cc
/// \brief Implementation of the G4Pythia6Decayer class
// ----------------------------------------------------------------------------
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/src/G4Pythia6DecayerMessenger.cc
/// \file G4Pythia6DecayerMessenger.cc
/// \brief Implementation of the G4Pythia6DecayerMessenger class
// ----------------------------------------------------------------------------
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file common/src/GunPrimaryGeneratorAction.cc
/// \file GunPrimaryGeneratorAction.cc
/// \brief Implementation of the Common::GunPrimaryGeneratorAction class
#include "GunPrimaryGeneratorAction.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/src/P6DExtDecayerPhysics.cc
/// \file P6DExtDecayerPhysics.cc
/// \brief Implementation of the P6DExtDecayerPhysics class
///
/// \author I. Hrivnacova; IPN, Orsay
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/decayer6/src/Pythia6.cc
/// \file Pythia6.cc
/// \brief Implementation of the Pythia6 class
// ----------------------------------------------------------------------------
@@ -1,206 +0,0 @@
------------------------------------------------------------
Example of the external decayer implementation with Pythia8
------------------------------------------------------------
This example demonstrates how to outfit Pythia8-based decay features
to those resonances in Geant4 where decay tables are not implemented
by default. In addition, it showns how to replace existing
Geant4 decay tables to such resonances as tau+/- or B+/- with
the Pythia8-based ones.
This example is activated by setting up PYTHIA8 environment variable
to point to the area where Pythia8 is installed.
The complete Pythia8 information, including on download, and documentation
is available from the following site:
https://pythia.org
The original version of this example has been implemented by Julia Yarba
(FNAL, USA)
For the complete list of the classes that compose this example please
see later in this document.
Location of example:
examples/extended/eventgenerator/pythia/py8decayer
Installation of Pythia8:
NOTE: As of May 2025, pythia8.3.15 is the most current version,
thus it is used in this example.
In general, this example is expected to work with any reasonably modern
pythia8.x.y revision.
In the future, please check updates at Pythia8 site: https://pythia.org
1. cd path/to/your/pythia8/area
2. Download desired version of Pythia8 and un-tar it, e.g.
wget https://pythia.org/download/pythia83/pythia8315.tgz
tar xzf pythia8315.tgz
3. Build/install Pythia8
cd pythia8315
export CXX=\`which g++\`
./configure --prefix=$PWD --cxx=$CXX
make
NOTE: By default, Pythia8 (as of 8.3.15) builds with C++11 standards.
If one wants to turn to e.g., C++17 standard (or later), one needs
to override flags via --cxx-common argument to configure script.
Alternatively, one can setup CXX_COMMON environment variable.
As of pythia8315, the default flags are the following:
-O2 -std=c++11 -pedantic -W -Wall -Wshadow -fPIC -pthread
Please note use of -pthread which was not among default flags in earlier
releases of Pythia8.
Example of specifying C++17 standards by overriding the default flags via
use of --cxx_common argument to configure script:
./configure --prefix=$PWD --cxx=$CXX \
--cxx-common='-O2 -std=c++17 -pedantic -W -Wall -Wshadow -fPIC -pthread'
4. Setup Pythia8_ROOT environment variable to point to the area where Pythia8
is built/installed:
export Pythia8_ROOT=$PWD
Building example:
Upon setup of PYTHIA8 environment variable to point to the area where
Pythia8 package is installed, the pythia/py8decayer example will be
compiled together with several other features of the eventgenerator example.
Description of classes:
Py8Decayer class provides implementation of the G4VExternalDecayer interface
with the use of PYTHIA8.
It is reasonably annotated, and demonstrates what features of Pythia8 need
to be activated and/or disactivated in order to make Pythia8 work only in
the decay mode.
It also illustrated how to control several other features of Pythia8, including
some reduction of Pythia8 verbosity (by default, Pythia8 produces quite a large
amount of printouts, thus reducing it could be useful in some cases).
It also shown how to deactivate decays of pi0's by Pythia8 as the idea is to handle
pi0's back to Geant4 for decays.
Last but not least, it shows how to outfit Pythia8 with a custom random engine,
i.e. Py8DecayerEngine.
Py8DecayerEngine class inherits from Pythia8::RndmEngine which in its turns is
provided by the Pythia8 package in order to allow replacing the generator's native
random engine with the one of user's choice.
In this specific case Py8DecayerEngine allows to replace Pythia8 native random engine
with the same engine that Geant4 uses (i.e. CLHEP::RanecuEngine as in this application).
The feature is important for running the example in the MT/Tasking mode.
Py8DecayerPhysics class implements a G4VPhysicsConstructor type of component
with the use of Py8Decayer; this component can later be used with a ddsired
physics list (see main program).
Specifically, in the Py8DecayerPhysics::ConstructProcess() the Py8Decayer is
instantiated and is used to
a) replace existing decay tables of such resonances as tau+/- and B+/-
b) supplement decay features to those resonances in Geant4 where the decay
tables are not implemnted by defaukt
In principle, classes Py8Decayer, Py8DecayerEngine, and Py8DecayerPhysics can be
directly reused with another user application.
Alternatively, they can be used as an inspiration to implement similar, or perhaps
even more extensive Pythia8-based functionalities of user's choice.
Class DetConstruction demostrates how to implement minimalistic detector geometry.
Class SingleParticleGun demonstrates how to implement generaton of the primary
particle.
Class ActionInitialization instantiates and registers to Geant4 kernel all user
action classes; in this case it is SingleParticleGun.
Main program:
pythia8_decayer.cc
This application currently uses the default RunManager which is Tasking and is
initialized with 5 threads.
It will then run 5 events, one per thread.
SerialOnly RunManager can also be employed should the user choose so.
Executable:
pythia8_decayer
Execution:
At present, the pythia8_decayer executable does not take any input arguments.
Everything, including the choine of primary particle, is hardcoded.
Although in the future some configurability may be added.
As mentioned earlier, it will run 5 single tau events using Pythia8 to decays them.
It should print some Pythia8 event information, including on decays.
Once again, please bear in mind that the decay of pi0's by Pythia8 is disabled
(see Py8Decayer constructor) since the idea is to hand the pi0's back to Geant4
and make Geant4 decay them.
Additional notes on the contents of Geant4 and Pythia8 Particle Data Tables (PDT) :
In their default form, PDT's in Geant4 and Pythia8 have a number of differences
that need to be kept in mind.
In the case of the Geant4 py8decayer example those differences are unlikely
to cause any major issues.
But Pythia8 can, in principle, be used within Geant4 in more ways that just
as an external decayer.
Thus, if one is potentially interested in more sophisticated use of Pythia8
in Geant4, one may want to consider whatever differences exist between (default)
Geant4 and Pythia8 PDT's.
Both Geant4 and Pythia8 codes are evolving, and specific numbers may be different
in earlier and/or in future releases.
To be more precise, by default Pythia8.3.10 PDT contains 677 entries, of which
531 particles have an antiparticle (it looks like antiparticles do not make
separate entries in Pythia8 PDT, but the total number of available species
should be considered as 1208).
Geant4 PDT contains 508 entries.
Of those, 239 particles/antiparticles match by Particle ID's (on the Geant4 side
it is explicitly called "PDG encoding" while on Pythia8 side it is just "id").
Many of Pythia8 PDT's entries are not available in Geant4 PDT, e.g. Z or W bosons
are not in Geant4.
Some of the species in the Geant4 PDT do not seem to be in the Pythia8 PDT
(e.g. excited nucleons do not seem to be in the Pythia8 PDT).
Also, there are entries in both PDT's that mean the same particles but are
marked with different ID's.
For example, excited Delta(s) are present in both PDT's but in Geant4 each one
is marked with a 4-digit number as an ID (PDG encoding) while in Pythia8 an ID
for such particle would be a 6-digit number starting with "20" and the last
4 digits would be the same as the Geant4 ID for such particle.
Speaking of the particles that match by ID (PDG ID), there may be further differences,
e.g. by mass, either central value or width, or both (there might be other aspects but
they have not been checked for).
Starting October 2022, checks have been made from time to time for differences
larger that 1 keV in either mass central value or width.
The largest differences have been observed for quarks/diquarks.
It appears that Geant4 sets (at least) masses of quarks as listed in PDG.
For details on default settings for the quark masses in Pythia8 please refer
to the Pythia8 manual:
https://pythia.org/manuals/pythia8315/Welcome.html
See Particles and Decays section, Particle Data subsection.
Beyond quarks/diquarks some differences in mass central values or width have also
been observed, mainly for resonances.
But even for such particles as proton or muon there may be differences on the order
of a few keV (e.g. central value of the proton mass is 938.27 MeV in Pythia8 and
938.272 MeV in Geant4)
@@ -1,8 +1,4 @@
///\file "eventgenerator/pythia/py8decayer/.README.txt"
///\brief Example py8decayer page
/*! \page Examplepy8decayer Example py8decayer
\page Examplepy8decayer Example py8decayer
This example demonstrates how to outfit Pythia8-based decay features
to those resonances in Geant4 where decay tables are not implemented
@@ -35,46 +31,48 @@
pythia8.x.y revision.
In the future, please check updates at Pythia8 site: https://pythia.org
- 1. cd path/to/your/pythia8/area
- 1.
```
cd path/to/your/pythia8/area
```
- 2. Download desired version of Pythia8 and un-tar it, e.g.
\verbatim
```
wget https://pythia.org/download/pythia83/pythia8315.tgz
tar xzf pythia8315.tgz
\endverbatim
```
- 3. Build/install Pythia8
\verbatim
```
cd pythia8315
export CXX=\`which g++\`
./configure --prefix=$PWD --cxx=$CXX
make
\endverbatim
```
NOTE: By default, Pythia8 (as of 8.3.15) builds with C++11 standards.
If one wants to turn to e.g. C++17 standard, one needs to override flags
via --cxx-common argument to configure script.
Alternatively, one can setup CXX_COMMON environment variable.
via `--cxx-common` argument to configure script.
Alternatively, one can setup `CXX_COMMON` environment variable.
As of pythia8310, the default flags are the following:
-O2 -std=c++11 -pedantic -W -Wall -Wshadow -fPIC -pthread
Please note use of -pthread which was not among default flags in earlier
`-O2 -std=c++11 -pedantic -W -Wall -Wshadow -fPIC -pthread`. \n
Please note use of `-pthread` which was not among default flags in earlier
releases of Pythia8.
Example of specifying C++17 standards by overriding the default flags via
use of --cxx_common argument to configure script:
\verbatim
use of `--cxx_common` argument to configure script:
```
./configure --prefix=$PWD --cxx=$CXX \
--cxx-common='-O2 -std=c++17 -pedantic -W -Wall -Wshadow -fPIC -pthread'
\endverbatim
```
- 4. Setup Pythia8_ROOT environment variable to point to the area where Pythia8
is built/installed:
\verbatim
```
export Pythia8_ROOT=$PWD
\endverbatim
```
## Building example:
Upon setup of Pythia8_ROOT environment variable to point to the area where
Upon setup of `Pythia8_ROOT` environment variable to point to the area where
Pythia8 package is installed, the pythia/py8decayer example will be
compiled together with several other features of the eventgenerator example.
@@ -137,12 +135,12 @@ export Pythia8_ROOT=$PWD
## Executable:
pythia8_decayer
`pythia8_decayer`
## Execution:
At present, the pythia8_decayer executable does not take any input arguments.
At present, the `pythia8_decayer` executable does not take any input arguments.
Everything, including the choine of primary particle, is hardcoded.
Although in the future some configurability may be added.
@@ -214,5 +212,3 @@ export Pythia8_ROOT=$PWD
of a few keV (e.g. central value of the proton mass is 938.27 MeV in Pythia8 and
938.272 MeV in Geant4)
*/
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/include/ActionInitialization.hh
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef ActionInitialization_H
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file DetConstruction.hh
/// \brief Definition of the DetConstruction class
///
/// \author J. Yarba; FNAL
///
#ifndef DetConstruction_H
#define DetConstruction_H
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/include/Py8Decayer.hh
/// \file Py8Decayer.hh
/// \brief Definition of the Py8Decayer class
///
/// \author J. Yarba; FNAL
///
#ifndef Py8Decayer_H
#define Py8Decayer_H
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/include/Py8DecayerEngine.hh
/// \file Py8DecayerEngine.hh
/// \brief Definition of the Py8DecayerEngine class
///
/// \author J. Yarba; FNAL
///
#ifndef Py8DecayerEngine_H
#define Py8DecayerEngine_H
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/include/Py8DecayerPhysics
/// \file Py8DecayerPhysics.hh
/// \brief Definition of the Py8DecayerPhysics class
///
/// \author J. Yarba; FNAL
///
#ifndef Py8DecayerPhysics_H
#define Py8DecayerPhysics_H
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/include/SingleParticleGun.hh
/// \file SingleParticleGun.hh
/// \brief Definition of the SingleParticleGun class
///
/// \author J. Yarba; FNAL
///
#ifndef SingleParticleGun_H
#define SingleParticleGun_H
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/py8decayer/pythia8_decayer.cc
/// \brief Main program of the pythia8_decayer example
/// \file pythia8_decayer.cc
/// \brief Main program of the pythia/py8decayer example
#include "ActionInitialization.hh"
#include "DetConstruction.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/src/ActionInitialization.cc
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/src/DetConstruction.cc
/// \file DetConstruction.cc
/// \brief Implementation of the DetConstruction class
///
/// \author J. Yarba; FNAL
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/src/Py8Decayer.cc
/// \brief Implementation of the Py8Decayer class
/// \file Py8Decayer.cc
/// \brief Implementation of the Pythia8::Py8Decayer class
///
/// \author J. Yarba; FNAL
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/src/Py8DecayerPhysics.cc
/// \file Py8DecayerPhysics.cc
/// \brief Implementation of the Py8DecayerPhysics class
///
/// \author J. Yarba; FNAL
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file eventgenerator/pythia/pythia8decayer/src/SingleParticleGun.cc
/// \file SingleParticleGun.cc
/// \brief Implementation of the SingleParticleGun class
///
/// \author J. Yarba; FNAL