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,41 +0,0 @@
///\file "exoticphysics/.README.txt"
///\brief Examples exoticphysics README page
/*! \page Examples_exoticphysics Category "exoticphysics"
Examples in this directory demonstrate exotic physics applications.
Currently, four examples are provided:
\link Examplechanneling channeling \endlink
Channeling examples are dedicated to various coherent effects
in oriented crystals, in particular, channeling, channeling radiation,
coherent bremsstrahlung, coherent pair production etc. as well as their
various applications.
\link Exampledmparticle dmparticle \endlink
This is very preliminary and simplified Geant4 example for light dark matter
(LDM) particles.
\link Examplemonopole monopole \endlink
This example is devoted to the energy deposited by classical magnetic
monopole.
\link Examplephonon phonon \endlink
This example simulates phonons in sub-Kelvin temperature Germanium crystal.
\link Examplesaxs saxs \endlink
The example saxs implements the typical setup of a Small Angle X-ray
Scattering (SAXS) experiment.
\link Exampleucn ucn \endlink
This example simulates the passage of ultra-cold neutrons (UCN) in a
hollow pipe.
*/
+6
View File
@@ -4,6 +4,12 @@ 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-30 I. Hrivnacova (exExoticPhysics-V11-03-00)
- Migration of README pages to Markdown:
- .README.txt replaced with README.md and removed README
- Reviewed and fixed external links, references to code,
improved formatting.
## 2024-10-30 A. Sytov (exExoticPhysics-V11-02-00)
-Updated README related to channeling (added information about
channeling examples instead of old channeling exampled which
@@ -1,42 +1,35 @@
Geant4 extended examples - exotic physics
----------------------------------------------
\page Examples_exoticphysics Category "exoticphysics"
Examples in this directory demonstrate exotic physics applications.
Currently, four examples are provided:
channeling
----------
\ref Examples_channeling
Channeling examples are dedicated to various coherent effects
in oriented crystals, in particular, channeling, channeling radiation,
coherent bremsstrahlung, coherent pair production etc. as well as their
various applications.
dmparticle
---------
\ref Exampledmparticle
This is very preliminary and simplified Geant4 example for light dark matter
(LDM) particles.
monopole
---------
\ref Examplemonopole
This example is devoted to the energy deposited by classical magnetic
monopole.
phonon
------
\ref Examplephonon
This example simulates phonons in sub-Kelvin temperature Germanium crystal.
saxs
----
\ref Examplesaxs
The example saxs implements the typical setup of a Small Angle X-ray
Scattering (SAXS) experiment.
ucn
---
\ref Exampleucn
This example simulates the passage of ultra-cold neutrons (UCN) in a
hollow pipe.
@@ -5,4 +5,5 @@ cmake_minimum_required(VERSION 3.16...3.27)
add_subdirectory(ch0)
add_subdirectory(ch1)
add_subdirectory(ch2)
add_subdirectory(ch3)
add_subdirectory(ch3)
add_subdirectory(ch5)
@@ -4,6 +4,10 @@ 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-10-27 A. Sytov (channelingExamples-V11-03-00)
-added the ch5 example; readme of channeling folder updated
-added the CMakeLists.txt for the channeling examples
## 2024-11-29 I. Hrivnacova (channelingExamples-V11-02-03)
- Fixes Doxygen pages names & links
@@ -1,46 +0,0 @@
Geant4 extended examples - channeling
----------------------------------------------
Examples in this directory are dedicated to various coherent effects
in oriented crystals, in particular, channeling, channeling radiation,
coherent bremsstrahlung, coherent pair production etc. as well as their
various applications.
ch0
-------
This example shows how channeling in bent crystal can be simulated
in Geant4 using G4Channeling process. The example simulates the channeling
of 400 GeV/c protons in bent Si crystal. It has been moved into channeling/ch0
from the channeling folder.
ch1
-------
This example is an easy demonstration of the minimum requirements necessary
to integrate the G4ChannelingFastSimModel and the G4BaierKatkov model
into a project in order to simulate the physics of channeling and
channeling radiation/coherent bremsstrahlung.
ch2
-------
This example is an enhanced version of ch1, providing the user with
the full functionality of both the G4ChannelingFastSimModel and G4BaierKatkov,
with parameters set up via a macro, in order to simulate the physics of
channeling and channeling radiation/coherent bremsstrahlung, and enhanced output.
The example can be exploited for a wide range of cases to study coherent effects in
a straight, bent or periodically bent crystal (crystalline undulator).
ch3
-------
This example is an easy demonstration of the minimum requirements necessary
to integrate the G4CoherentPairProduction process along with G4ChannelingFastSimModel
and G4BaierKatkov into a project in order to simulate the physics of electromagnetic
shower in an oriented crystal. The simulation includes the physics of channeling,
channeling radiation/coherent bremsstrahlung and coherent pair production.
The structure of this example is based on ch1, but with the G4CoherentPairProductionPhysics
process included, as well as different output, a different crystal material, alignment and
geometry parameters, and a photon beam as the incoming source instead of charged particles.
@@ -1,29 +1,25 @@
///\file "exoticphysics/channeling/.README.txt"
///\brief Examples channeling README page
/*! \page Examples Category "channeling"
\page Examples_channeling Category "channeling"
Examples in this directory are dedicated to various coherent effects
in oriented crystals, in particular, channeling, channeling radiation,
coherent bremsstrahlung, coherent pair production etc. as well as their
various applications.
\link Examplech0 ch0 \endlink
\ref Examplech0
This example shows how channeling in bent crystal can be simulated
in Geant4 using G4Channeling process. The example simulates the channeling
of 400 GeV/c protons in bent Si crystal. It has been moved into channeling/ch0
from the channeling folder.
\link Examplech1 ch1 \endlink
\ref Examplech1
This example is an easy demonstration of the minimum requirements necessary
to integrate the G4ChannelingFastSimModel and the G4BaierKatkov model
into a project in order to simulate the physics of channeling and
channeling radiation/coherent bremsstrahlung.
\link Examplech2 ch2 \endlink
\ref Examplech2
This example is an enhanced version of ch1, providing the user with
the full functionality of both the G4ChannelingFastSimModel and G4BaierKatkov,
@@ -32,7 +28,7 @@
The example can be exploited for a wide range of cases to study coherent effects in
a straight, bent or periodically bent crystal (crystalline undulator).
\link Examplech3 ch3 \endlink
\ref Examplech3
This example is an easy demonstration of the minimum requirements necessary
to integrate the G4CoherentPairProduction process along with G4ChannelingFastSimModel
@@ -43,4 +39,9 @@
process included, as well as different output, a different crystal material, alignment and
geometry parameters, and a photon beam as the incoming source instead of charged particles.
*/
\ref Examplech5
Example ch5 is an application for simulating a positron source.
Although the conventional approach based on an amorphous target is possible,
the application is primarily designed to simulate positrons based on oriented crystals.
In the latter case, both the single-crystal and the hybrid scheme can be investigated.
@@ -1,71 +0,0 @@
=================================================================
Channeling effect in Geant4
=================================================================
Enrico Bagli - INFN and University Ferrara (Italy)
bagli@fe.infn.it
This example shows how channeling in bent crystal can be simulated
in Geant4
1.INTRODUCTION
The example simulates the channeling of 400 GeV/c protons in bent
Si crystal. Channeling occurs when particles enter a crystal aligned
with atomic planes or axes. In bent crystals, the particles are
trapped between atomic planes and follow the crystal curvature
being deflected. If the particle direction is tangent to a bent
crystal plane is reflected to the opposite direction with respect
to channeling, i.e., it suffer volume reflection. The example
provides the physical model for planar channeling and volume
reflection in bent crystals.
2.GEOMETRY
The geometry is a bent Si crystal with three Si detectors placed at
-9.998 m, -0.320 m and 10.756 m with respect to the position of
the bent crystal itself. The Si detectors allows to measure
incoming and outgoing angle after the interaction with the Si bent crystal.
The geometry is all under vacuum.
3.PRIMARY EVENT
The primary events are 400 GeV/c protons launched at -10.5 m from the
crystal with 13.36 microrad x 11.25 microrad divergence.
4.PHYSICS
In the example the physics of channeling and volume reflection
has been added to the standard Geant4 physics. The description
of the used model can be found in the paper A model for the
interaction of high-energy particles in straight and bent
crystals implemented in Geant4 by E. Bagli et al., available
online at http://arxiv.org/abs/1403.5819
5.EXECUTION & OUTPUT
The executable must be run from within the source directory of the example
to ensure that it can find the path for crystal data files.
Data files for Si crystal interplanar potential, nuclei and electron density
are stored in a subdirectory named data
Upon execution, the 2009_PLB680_129.mac macro will automatically run the
example with 1000 protons.
Use
/xtal/setBR XXX 0. 0. m
To change crystal bending to XXX meters
Use
/xtal/setSize 1.0 70. XXX mm
To change crystal length to XXX millimeter
Use
/xtal/potfilename data/Si220pl
To select the (110) Si crystal plane of channeling
GPS commands are used for the primary generator.
The output is the ExExhCh.root file with the TTree ExExChTree
has the leaves:
- angXin : incoming particle X angle at the crystal
- angYin : incoming particle Y angle at the crystal
- posXin : hitting X position of the particle at the crystal
- posYin : hitting Y position of the particle at the crystal
- angXout: outgoing particle X angle out of the the crystal
- angYout: outgoing particle Y angle out of the the crystal
@@ -1,8 +1,4 @@
///\file "exoticphysics/channeling/ch0/.README.txt"
///\brief Example ch0 README page
/*! \page Examplech0 Example ch0
\page Examplech0 Example ch0
\author Enrico Bagli - INFN and University Ferrara (Italy) \n
bagli@fe.infn.it
@@ -10,7 +6,7 @@
This example shows how channeling in bent crystal can be simulated
in Geant4
\section channeling_s1 INTRODUCTION
## INTRODUCTION
The example simulates the channeling of 400 GeV/c protons in bent
Si crystal. Channeling occurs when particles enter a crystal aligned
@@ -22,7 +18,7 @@ to channeling, i.e., it suffer volume reflection. The example
provides the physical model for planar channeling and volume
reflection in bent crystals.
\section channeling_s2 GEOMETRY
## GEOMETRY
The geometry is a bent Si crystal with three Si detectors placed at
-9.998 m, -0.320 m and 10.756 m with respect to bent crystal position.
@@ -30,12 +26,12 @@ The Si detectors allows to measure incoming and outgoing angle
after the interaction with the Si bent crystal. The
geometry is all under vacuum.
\section channeling_s3 PRIMARY EVENT
## PRIMARY EVENT
The primary events are 400 GeV/c protons at -1.05 m from the
The primary events are 400 GeV/c protons at -10.5 m from the
crystal with 13.36 microrad x 11.25 microrad divergence.
\section channeling_s4 PHYSICS
## PHYSICS
In the example the physics of channeling and volume reflection
has been added to the standard Geant4 physics. The description
@@ -44,42 +40,38 @@ interaction of high-energy particles in straight and bent
crystals implemented in Geant4 by E. Bagli et al., available
online at http://arxiv.org/abs/1403.5819
\section channeling_s5 EXECUTION & OUTPUT
## EXECUTION & OUTPUT
The executable must be run from within the source directory of the example
to ensure that it can find the path for crystal data files.
Data files for Si crystal interplanar potential, nuclei and electron density
are stored in a named subdirectorydata
are stored in a subdirectory named data
Upon execution, the macro
\verbatim
2009_PLB680_129.mac
\endverbatim
will automatically run the
Upon execution, the macro `2009_PLB680_129.mac` will automatically run the
example with 1000 protons.
Use
\verbatim
```
/xtal/setBR XXX 0. 0. m
\endverbatim
```
To change crystal bending to XXX meters
Use
\verbatim
```
/xtal/setSize 1.0 70. XXX mm
\endverbatim
```
To change crystal length to XXX millimeter
Use
\verbatim
```
/xtal/setEC data/Si220
\endverbatim
```
To select the (110) Si crystal plane of channeling
GPS commands are used for the primary generator.
\subsection channeling_s5_sub1 ExExhCh.root
### ExExhCh.root
The output is the ExExhCh.root file with the TTree ExExChTree
has the leaves:
@@ -88,5 +80,4 @@ has the leaves:
- posXin : hitting X position of the particle at the crystal
- posYin : hitting Y position of the particle at the crystal
- angXout: outgoing particle X angle out of the the crystal
- angYout: outgoing particle Y angle out of the the crystal
*/
- angYout: outgoing particle Y angle out of the the crystal
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file ch0.cc
/// \brief Main program of the channeling/ch0 example
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-03-ref-06 (30-June-2025)
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -30,7 +30,6 @@ You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RT)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
@@ -43,13 +42,12 @@ Registered graphics systems are:
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RTX)
RayTracerQt (RTQt)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG, OGL)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB, TSGZB)
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
@@ -169,7 +167,7 @@ Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 0
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Universal
Use built-in Birks satuaration 0
Use built-in Birks saturation 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 0
@@ -320,7 +318,7 @@ hBrems: for proton XStype:3 SubType=3
hPairProd: for proton XStype:3 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -372,7 +370,7 @@ hBrems: for anti_proton XStype:1 SubType=3
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -399,7 +397,7 @@ hBrems: for kaon+ XStype:1 SubType=3
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -426,7 +424,7 @@ hBrems: for kaon- XStype:1 SubType=3
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -453,7 +451,7 @@ muBrems: for mu+ XStype:1 SubType=3
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -480,7 +478,7 @@ muBrems: for mu- XStype:1 SubType=3
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -507,7 +505,7 @@ hBrems: for pi+ XStype:1 SubType=3
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -534,7 +532,7 @@ hBrems: for pi- XStype:1 SubType=3
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -789,8 +787,8 @@ CoulombScat: for pi- XStype:2 SubType=1 BuildTable=1
Type of pre-compound model 0
Type of pre-compound inverse x-section 1
Pre-compound model active 1
Pre-compound excitation low energy 100 keV
Pre-compound excitation high energy 30 MeV
Pre-compound excitation low energy 0.1 MeV
Pre-compound excitation high energy 15 MeV
Angular generator for pre-compound model 1
Use NeverGoBack option for pre-compound model 0
Use SoftCutOff option for pre-compound model 0
@@ -804,9 +802,8 @@ Type of de-excitation inverse x-section 3
Type of de-excitation factory Evaporation+GEM
Number of de-excitation channels 68
Type of Fermi BreakUp model ModelVI
Min excitation energy 10 eV
Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Min excitation energy 0.01 keV
Min energy per nucleon for multifragmentation 2e+05 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 0
@@ -1852,12 +1849,12 @@ Using
Run terminated.
Run Summary
Number of events processed : 1000
User=32.640000s Real=32.713153s Sys=0.000000s
User=30.290000s Real=30.403408s Sys=0.010000s
... write file : ExExCh.root - done
... close file : ExExCh.root - done
Graphics systems deleted.
Visualization Manager deleting...
================== Deleting memory pools ===================
Number of memory pools allocated: 14 of which, static: 1
Dynamic pools deleted: 13 / Total memory freed: 0.058 MB
Dynamic pools deleted: 13 / Total memory freed: 0.046 MB
============================================================
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef DetectorConstruction_h
# define DetectorConstruction_h 1
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// --------------------------------------------------------------
//
/// \file DetectorConstructionMessenger.hh
/// \brief Definition of the DetectorConstructionMessenger class
#ifndef DetectorConstructionMessenger_h
#define DetectorConstructionMessenger_h 1
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file EventAction.hh
/// \brief Definition of the EventAction class
#ifndef EventAction_h
#define EventAction_h 1
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file G4ChannelingPhysics.hh
/// \brief Definition of the G4ChannelingPhysics class
#ifndef G4ChannelingPhysics_h
#define G4ChannelingPhysics_h 1
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
#ifndef RunAction_h
#define RunAction_h 1
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file SensitiveDetector.hh
/// \brief Definition of the SensitiveDetector class
#ifndef SensitiveDetector_h
#define SensitiveDetector_h 1
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file SensitiveDetectorHit.hh
/// \brief Definition of the SensitiveDetectorHit class
#ifndef SensitiveDetectorHit_h
#define SensitiveDetectorHit_h 1
@@ -22,8 +22,9 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
// --------------------------------------------------------------
//
/// \file StackingAction.hh
/// \brief Definition of the StackingAction class
#ifndef StackingAction_h
#define StackingAction_h 1
@@ -23,7 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file UserActionInitialization.hh
/// \brief Definition of the UserActionInitialization class
#ifndef UserActionInitialization_h
#define UserActionInitialization_h 1
@@ -23,7 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
#include "DetectorConstruction.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstructionMessenger.cc
/// \brief Implementation of the DetectorConstructionMessenger class
#include "DetectorConstructionMessenger.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
#include "EventAction.hh"
@@ -23,9 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file G4ChannelingPhysics.cc
/// \brief Implementation of the G4ChannelingPhysics class
#include "G4ChannelingPhysics.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
#include "PrimaryGeneratorAction.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
#include "RunAction.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SensitiveDetector.cc
/// \brief Implementation of the SensitiveDetector class
#include "SensitiveDetector.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SensitiveDetectorHit.cc
/// \brief Implementation of the SensitiveDetectorHit class
#include "SensitiveDetectorHit.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file StackingAction.cc
/// \brief Implementation of the StackingAction class
#include "StackingAction.hh"
@@ -23,6 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file UserActionInitialization.cc
/// \brief Implementation of the UserActionInitialization class
#include "UserActionInitialization.hh"
@@ -1,46 +0,0 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example ch1
-----------
A. Sytov
INFN Ferrara Division, sytov@fe.infn.it
INTRODUCTION
Example ch1 is an easy demonstration of the minimum requirements necessary
to integrate the G4ChannelingFastSimModel and the G4BaierKatkov model into a project
in order to simulate the physics of channeling and
channeling radiation/coherent bremsstrahlung.
This example serves as a guideline for users on how to add this physics
to their existing Geant4 projects. It includes the minimum necessary options
to incorporate this physics. Specifically, it requires registering
G4FastSimulationPhysics in the main routine and
adding a few lines of code in DetectorConstruction.
DESCRIPTION
The example is based on the following experiments on channeling [1] and
channeling radiation [2] in a bent crystal, carried out at Mainz Mikrotron MAMI with
855 MeV electrons. The experimental validation of G4ChannelingFastSimModel is
described in [3].
This example includes a bent crystal and a detector positioned behind it.
The incoming beam is set up in macro run.mac.
The example does not include any input of the model or geometry parameters
from the macro to keep it as straightforward as possible. The output is recorded
into the file results.root. It consists of
the charged particle distribution at the detector in the x-plane
(the plane of crystal bending and perpendicular to the crystal planes) as well as
the spectrum of photons arriving to the detector. To build these plots, one has to
open this file in root and use x_out->Draw() and Spectrum->Draw() for the coordinates
and the spectrum, respectively.
REFERENCES
[1] A. Mazzolari et al. Phys. Rev. Lett. 112, 135503 (2014).
[2] L. Bandiera et al. Phys. Rev. Lett. 115, 025504 (2015).
[3] A. Sytov et al. Journal of the Korean Physical Society 83, 132139 (2023).
@@ -1,13 +1,9 @@
///\file "exoticphysics/channeling/ch1/.README.txt"
///\brief Example ch1 README page
/*! \page Examplech1 Example ch1
\page Examplech1 Example ch1
\author Alexei Sytov - INFN Ferrara Division (Italy) \n
sytov@fe.infn.it
\section ch1_s1 INTRODUCTION
## INTRODUCTION
Example ch1 is an easy demonstration of the minimum requirements necessary
to integrate the G4ChannelingFastSimModel and the G4BaierKatkov model into a project
in order to simulate the physics of channeling and
@@ -19,7 +15,7 @@ to incorporate this physics. Specifically, it requires registering
G4FastSimulationPhysics in the main routine and
adding a few lines of code in DetectorConstruction.
\section ch1_s2 DESCRIPTION
## DESCRIPTION
The example is based on the following experiments on channeling [1] and
channeling radiation [2] in a bent crystal, carried out at Mainz Mikrotron MAMI with
855 MeV electrons. The experimental validation of G4ChannelingFastSimModel is
@@ -35,22 +31,20 @@ the charged particle distribution at the detector in the x-plane
(the plane of crystal bending and perpendicular to the crystal planes) as well as
the spectrum of photons arriving to the detector. To build these plots, one has to
open this file in root and use
\verbatim
```cpp
x_out->Draw()
\endverbatim
```
and
\verbatim
```cpp
Spectrum->Draw()
\endverbatim
```
for the coordinates and the spectrum, respectively.
\section ch1_s3 REFERENCES
## REFERENCES
-# A. Mazzolari et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.112.135503">Phys. Rev. Lett. 112, 135503 (2014).</a>
-# L. Bandiera et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.115.025504">Phys. Rev. Lett. 115, 025504 (2015).</a>
-# A. Sytov et al. <a href="https://link.springer.com/article/10.1007/s40042-023-00834-6"> Journal of the Korean Physical Society 83, 132139 (2023).</a>
*/
@@ -23,11 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ch1.cc
/// \brief Main program of the ch1 example
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Main program of the channeling/ch1 example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-03-ref-06 (30-June-2025)
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -29,7 +29,6 @@ You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RT)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
@@ -42,13 +41,12 @@ Registered graphics systems are:
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RTX)
RayTracerQt (RTQt)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG, OGL)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB, TSGZB)
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
@@ -158,7 +156,7 @@ Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 0
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Urban
Use built-in Birks satuaration 0
Use built-in Birks saturation 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 0
@@ -295,7 +293,7 @@ hBrems: for proton XStype:1 SubType=3
hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -353,7 +351,7 @@ hBrems: for anti_proton XStype:1 SubType=3
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -385,7 +383,7 @@ hBrems: for kaon+ XStype:1 SubType=3
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -417,7 +415,7 @@ hBrems: for kaon- XStype:1 SubType=3
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -449,7 +447,7 @@ muBrems: for mu+ XStype:1 SubType=3
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -481,7 +479,7 @@ muBrems: for mu- XStype:1 SubType=3
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -513,7 +511,7 @@ hBrems: for pi+ XStype:1 SubType=3
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -545,7 +543,7 @@ hBrems: for pi- XStype:1 SubType=3
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -800,8 +798,8 @@ CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Type of pre-compound model 0
Type of pre-compound inverse x-section 1
Pre-compound model active 1
Pre-compound excitation low energy 100 keV
Pre-compound excitation high energy 30 MeV
Pre-compound excitation low energy 0.1 MeV
Pre-compound excitation high energy 15 MeV
Angular generator for pre-compound model 1
Use NeverGoBack option for pre-compound model 0
Use SoftCutOff option for pre-compound model 0
@@ -815,9 +813,8 @@ Type of de-excitation inverse x-section 3
Type of de-excitation factory Evaporation+GEM
Number of de-excitation channels 68
Type of Fermi BreakUp model ModelVI
Min excitation energy 10 eV
Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Min excitation energy 0.01 keV
Min energy per nucleon for multifragmentation 2e+05 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 0
@@ -932,4 +929,4 @@ Max 2J for sampling of angular correlations 10
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=31.210000s Real=31.469592s Sys=0.050000s
User=29.750000s Real=31.704458s Sys=0.030000s
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
@@ -24,9 +24,7 @@
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
@@ -25,8 +25,6 @@
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
@@ -25,8 +25,6 @@
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
@@ -25,8 +25,6 @@
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
@@ -25,8 +25,6 @@
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
@@ -25,8 +25,6 @@
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "G4Event.hh"
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file SteppingAction.cc
/// \brief Implementation of the SteppingAction class
@@ -1,68 +0,0 @@
///\file "exoticphysics/channeling/ch2/.README.txt"
///\brief Example ch2 README page
/*! \page Examplech2 Example ch2
\author Alexei Sytov, Gianfranco Paternò - INFN Ferrara Division (Italy) \n
sytov@fe.infn.it, paterno@fe.infn.it
\section ch2_s1 INTRODUCTION
Example ch2 is an enhanced version of ch1, providing the user with the full functionality of
both the G4ChannelingFastSimModel and G4BaierKatkov, with parameters set up via a macro,
in order to simulate the physics of channeling and channeling radiation/coherent bremsstrahlung.
The example can be exploited for a wide range of cases to study coherent effects in
a straight, bent or periodically bent crystal (crystalline undulator). Channeling
physics in ch2 is active for protons, ions, muons, pions, electrons and their antiparticles.
Any other charged particle can also be activated.
\section ch2_s2 DESCRIPTION
The setup of the example ch2 is identical to ch1. As ch1, this example includes a bent crystal
and a detector positioned behind it. Like ch1, it is based on the experiments on
channeling [1] and channeling radiation [2] in a bent crystal, carried out at
Mainz Mikrotron MAMI with 855 MeV electrons. The experimental validation of
G4ChannelingFastSimModel is described in [3].
However, since ch2 parameters are fully set up in the macro run.mac, this example
is quite flexible and can be easily adapted for entirely different cases.
A description of all the available options is provided in run.mac.
It includes crystal and detector geometry, activation flags for
G4ChannelingFastSimModel and G4BaierKatkov and various options.
The example also provides detailed descriptions of various options for
G4ChannelingFastSimModel and G4BaierKatkov, which can adjust model parameters
depending on the specific case (see ConstructSDandField in DetectorConstruction).
The front surface of the crystal is placed at z=0 (with z as the beam direction),
while the front position of the detector can be set up via run.mac.
The output is recorded into the file results.root as a set of root ntuples.
These ntuples include:
-# crystal: particles recorded at the crystal entrance,
-# detector: all particles (except photons) recorded at the detector entrance,
-# detector_photons: photons recorded at the detector entrance.
The format of every ntuple includes the following 10 variables (columns):
"eventID", "volume", "x", "y", "angle_x", "angle_y", "Ekin", "particle", "particleID", "parentID"
The variables represent:
-# the event number within the run (column 0),
-# the volume, either the crystal or the detector (column 1),
-# the coordinate (x,y) and the angles (x'=dx/dz, y'=dy/dz) of the impinging particles (columns 2-6),
-# the kinetic energy of the particle (column 7),
-# the particle name (column 8),
-# the particle ID (column 9),
-# the parent ID of the particle (column 10).
To visualize these data, one should either open results.root using root TBrowser or use the python script analysis_ch2.py.
\section ch1_s3 REFERENCES
-# A. Mazzolari et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.112.135503">Phys. Rev. Lett. 112, 135503 (2014).</a>
-# L. Bandiera et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.115.025504">Phys. Rev. Lett. 115, 025504 (2015).</a>
-# A. Sytov et al. <a href="https://link.springer.com/article/10.1007/s40042-023-00834-6"> Journal of the Korean Physical Society 83, 132139 (2023).</a>
*/
@@ -30,6 +30,10 @@ set(TESTch2_SCRIPTS
vis.mac
run.mac
analysis_ch2.py
special_macros/run_Bent_Crystal_Deflection_Radiation.mac
special_macros/run_Bent_Crystal_HE_Deflection.mac
special_macros/run_Radiation.mac
special_macros/run_Positron_Source.mac
)
foreach(_script ${TESTch2_SCRIPTS})
@@ -1,9 +1,19 @@
# Category ch1 History
# Category ch2 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!
## 2025-10-31 Alexei Sytov (ch2-V11-03-01)
- Update of python analysis tools, no change in Geant4 code.
Added a jupyter notebook version of a python script.
## 2025-10-27 Alexei Sytov (ch2-V11-03-00)
- Significant update:
-new macros dedicated to specific applications;
-extended output at the detector;
-scoring of radiation spectrum from the Baier-Katkov method; virtual collimator
was introduced.
## 2024-09-25 Alexei Sytov (ch2-V11-02-00)
- First implementation
@@ -1,68 +0,0 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example ch2
-----------
A. Sytov, G. Paternò
INFN Ferrara Division, sytov@fe.infn.it, paterno@fe.infn.it
INTRODUCTION
Example ch2 is an enhanced version of ch1, providing the user with the full functionality of
both the G4ChannelingFastSimModel and G4BaierKatkov, with parameters set up via a macro,
in order to simulate the physics of channeling and channeling radiation/coherent bremsstrahlung.
The example can be exploited for a wide range of cases to study coherent effects in
a straight, bent or periodically bent crystal (crystalline undulator). Channeling
physics in ch2 is active for protons, ions, muons, pions, electrons and their antiparticles.
Any other charged particle can also be activated.
DESCRIPTION
The setup of the example ch2 is identical to ch1. As ch1, this example includes a bent crystal
and a detector positioned behind it. Like ch1, it is based on the experiments on
channeling [1] and channeling radiation [2] in a bent crystal, carried out at
Mainz Mikrotron MAMI with 855 MeV electrons. The experimental validation of
G4ChannelingFastSimModel is described in [3].
However, since ch2 parameters are fully set up in the macro run.mac, this example
is quite flexible and can be easily adapted for entirely different cases.
A description of all the available options is provided in run.mac.
It includes crystal and detector geometry, activation flags for
G4ChannelingFastSimModel and G4BaierKatkov and various options.
The example also provides detailed descriptions of various options for
G4ChannelingFastSimModel and G4BaierKatkov, which can adjust model parameters
depending on the specific case (see ConstructSDandField in DetectorConstruction).
The front surface of the crystal is placed at z=0 (with z as the beam direction),
while the front position of the detector can be set up via run.mac.
The output is recorded into the file results.root as a set of root ntuples.
These ntuples include:
- crystal: particles recorded at the crystal entrance,
- detector: all particles (except photons) recorded at the detector entrance,
- detector_photons: photons recorded at the detector entrance.
The format of every ntuple includes the following 10 variables (columns):
"eventID", "volume", "x", "y", "angle_x", "angle_y", "Ekin", "particle", "particleID", "parentID"
The variables represent:
- the event number within the run (column 0),
- the volume, either the crystal or the detector (column 1),
- the coordinate (x,y) and the angles (x'=dx/dz, y'=dy/dz) of the impinging particles (columns 2-6),
- the kinetic energy of the particle (column 7),
- the particle name (column 8),
- the particle ID (column 9),
- the parent ID of the particle (column 10).
To visualize these data, one should either open results.root using root TBrowser or use the python script analysis_ch2.py.
REFERENCES
[1] A. Mazzolari et al. Phys. Rev. Lett. 112, 135503 (2014).
[2] L. Bandiera et al. Phys. Rev. Lett. 115, 025504 (2015).
[3] A. Sytov et al. Journal of the Korean Physical Society 83, 132139 (2023).
@@ -0,0 +1,100 @@
\page Examplech2 Example ch2
\author Alexei Sytov, Gianfranco Paternò - INFN Ferrara Division (Italy) \n
sytov@fe.infn.it, paterno@fe.infn.it
## INTRODUCTION
Example ch2 is an enhanced version of ch1, providing the user with the full functionality of
both the G4ChannelingFastSimModel and G4BaierKatkov, with parameters set up via a macro,
in order to simulate the physics of channeling and channeling radiation/coherent bremsstrahlung.
The example can be exploited for a wide range of cases to study coherent effects in
a straight, bent or periodically bent crystal (crystalline undulator). Channeling
physics in ch2 is active for protons, ions, muons, pions, electrons and their antiparticles.
Any other charged particle can also be activated.
The example contains also other setups for specific applications.
## DESCRIPTION
The setup of the example ch2 in run.mac is identical to ch1. As ch1, this example includes a bent crystal
and a detector positioned behind it. Like ch1, it is based on the experiments on
channeling [1] and channeling radiation [2] in a bent crystal, carried out at
Mainz Mikrotron MAMI with 855 MeV electrons. The experimental validation of
G4ChannelingFastSimModel is described in [3].
However, since ch2 parameters are fully set up in the macro run.mac, this example
is quite flexible and can be easily adapted for entirely different cases.
In addition more specific macros were created to supply users with the setups related to the applications.
These macros partially exploit the model defaults to simplify the example. They include:
-# run_Bent_Crystal_Deflection_Radiation.mac - reduced version (some commands setting defaults deleted) of run.mac but with an identical setup.
-# run_Bent_Crystal_HE_Deflection.mac - an example of particle deflection in a bent crystal at high energies.
-# run_Positron_Source.mac - a simplified example of a positron source within a single W target.
-# run_Radiation.mac - an example of a radiation source in a straight crystal.
A description of all the available options is provided in run.mac and partially in other macros.
It includes crystal and detector geometry, activation flags for
G4ChannelingFastSimModel and G4BaierKatkov and various options.
The example also provides detailed descriptions of various options for
G4ChannelingFastSimModel and G4BaierKatkov, which can adjust model parameters
depending on the specific case (see DetectorConstruction::ConstructSDandField()).
The front surface of the crystal is placed at z=0 (with z as the beam direction),
while the front position of the detector can be set up via run.mac.
The output is recorded into the file results.root as a set of root ntuples.
These ntuples include:
-# crystal: particles recorded at the crystal entrance,
-# detector_primaries: primaries recorded at the detector entrance AND passed through the crystal.
-# detector_photons: photons recorded at the detector entrance produced by primaries passed through the crystal.
-# detector_sedondaries: secondaries recorded at the detector entrance produced by primaries passed through the crystal.
-# missed_crystal: all the particles missed the crystal, however, entering the detector, if any.
The format of every ntuple includes the following 10 variables (columns):
- "eventID", "volume", "x", "y", "angle_x", "angle_y", "Ekin", "particle", "particleID", "parentID"
The variables represent:
-# the event number within the run (column 0),
-# the volume, either the crystal or the detector (column 1),
-# the coordinate (x,y) and the angles (x'=dx/dz, y'=dy/dz) of the impinging particles (columns 2-6),
-# the kinetic energy of the particle (column 7),
-# the particle name (column 8),
-# the particle ID (column 9),
-# the parent ID of the particle (column 10).
For convenience for detector_primaries were added four more variables:
-# the incoming angle x at the crystal entrance,
-# the deflection angle x (the difference between the angle at the detector and the incoming angle),
-# the incoming angle y at the crystal entrance,
-# the deflection angle y (the difference between the angle at the detector and the incoming angle).
These four variables are especially useful for the studies of deflection of primary particles.
To visualize these data, one should either open results.root using root TBrowser or use the python script analysis_ch2.py or its identical version in the jupyter notebook format analysis_ch2.ipynb.
The output data also includes the spectrum of photons using the data produced inside the Baier-Katkov method.
This spectrum requires nearly 2 order on magnitude less data, then the collection of gamma produced in Geant4 as secondaries.
It is very useful especially if the goal is to produce only the spectrum of radiation. This spectrum is normalized on the
total radiation emission probability, which is an equivalent to 1/Nprimaries dN_photon/dE_photon normalization.
Moreover, it is possible to set up a round virtual collimator - an angular selection of photons in the Baier-Katkov method.
This is extremely useful for coherent bremsstrahlung simulation.
CAUTION: though the Baier-Katkov spectrum should identically coincide with the spectrum by secondary photons, sometimes
it may be less accurate, since it is updated only after every setNSmallTrajectorySteps (see run.mac). Moreover,
the virtual collimator does not take into account the transverse positions of particles. Therefore, it is recommended
to use the Baier-Katkov spectrum at low statistics for preliminary researches and optimization while the secondaries produced at
high statistics as a final result.
CAUTION: the angular center of virtual collimator coincides with the global z direction.
The spectrum is produced as a text file, containing the photon energies in the first column and the corresponding spectrum value in the second one.
Note, the bins are not equidistant, they are sampled according to the bremsstrahlung spectrum, with the bin size proportional to 1/E_photon.
## REFERENCES
-# A. Mazzolari et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.112.135503">Phys. Rev. Lett. 112, 135503 (2014).</a>
-# L. Bandiera et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.115.025504">Phys. Rev. Lett. 115, 025504 (2015).</a>
-# A. Sytov et al. <a href="https://link.springer.com/article/10.1007/s40042-023-00834-6"> Journal of the Korean Physical Society 83, 132139 (2023).</a>
@@ -0,0 +1,357 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d52f88aa",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Read and plot the simulation results of particle interactions in Oriented Crystals\n",
"# obatined through example ch2, which is baed on G4ChannelingFastSimModel."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c010d890",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import os\n",
"import uproot\n",
"from matplotlib.colors import LogNorm # optional, for log color scaling"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "bf061146",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#################################### INPUT FILE #########################################\n",
"# Set path and filename of the simulation file\n",
"G4_sim_path = \"\"\n",
"root_file = \"results\"\n",
"\n",
"# Set whether to save plots (without displaying them) or just display them\n",
"save_fig = True\n",
"fig_path = G4_sim_path\n",
"#########################################################################################"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "3b298eab",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"rf_content: ['crystal', 'detector_primaries', 'detector_photons', 'detector_secondaries', 'missed_crystal'] \n",
"\n"
]
}
],
"source": [
"# Create directory where to strore the figures if it does not exist\n",
"if fig_path != '' and not os.path.exists(fig_path):\n",
" os.makedirs(fig_path)\n",
" print('created fig_path:', fig_path)\n",
" \n",
"# Open the simulation output root file \n",
"rf = uproot.open(G4_sim_path + root_file + '.root')\n",
"rf_content = [item.split(';')[0] for item in rf.keys()]\n",
"print('rf_content:', rf_content, '\\n')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "599eb756",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Import the scoring ntuples and convert them into pandas dataframes\n",
"branches = [\"eventID\", \"volume\", \"x\", \"y\", \"angle_x\", \"angle_y\", \\\n",
" \"Ekin\" , \"particle\", \"particleID\", \"parentID\"]\n",
"branchesprimary = branches + [\"incoming_angle_x\", \"deflection_angle_x\", \\\n",
" \"incoming_angle_y\", \"deflection_angle_y\"]\n",
"\n",
"df_in = rf['crystal'].arrays(branches, library='pd')\n",
"df_prim = rf['detector_primaries'].arrays(branchesprimary, library='pd')\n",
"df_ph = rf['detector_photons'].arrays(branches, library='pd')\n",
"df_sec = rf['detector_secondaries'].arrays(branches, library='pd')\n",
"df_missed = rf['missed_crystal'].arrays(branches, library='pd')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "07c70dd2",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#########################################################################################\n",
"# Plot angle_x distribution of primaries at the detector after interaction with a crystal\n",
"\n",
"############# INPUT #############\n",
"# Feel free to modify according to your needs\n",
"Nmax = 100000000 #max number of events to elaborate\n",
"\n",
"# Feel free to replace df_prim by df_in, df_ph, df_sec or df_missed\n",
"# Feel free to replace \"angle_x\" by other ntuples from branches and\n",
"# from branchesprimary (for df_prim) \n",
"# ONLY NUMERIC VALUES\n",
"datax = df_prim[\"angle_x\"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)\n",
"\n",
"# Feel free to modify the number of bins and the plot range\n",
"NbinTheta = 100\n",
"rangeTheta = [-1, 2] #mrad\n",
"\n",
"# Set whether to use linear o log scale\n",
"use_log_y = False # set True for LogNorm color scale\n",
"\n",
"# Feel free to modify the names of axes\n",
"plt_xlabel = '$\\\\theta_x$ [mrad]'\n",
"plt_ylabel = 'PDF: 1/N dN/d$\\\\theta_x$ [mrad]$^{-1}$'\n",
"\n",
"# Feel free to modify the filename to save the plot\n",
"filename = 'thetaXdistribution.pdf'\n",
"\n",
"#some plt parameters\n",
"fs = 16\n",
"lw = 2\n",
"#################################\n",
"\n",
"# Create 1D histogram\n",
"thetaXdistrib, thetaEdges = np.histogram(datax.values, \\\n",
" bins=NbinTheta, range=rangeTheta, density=True)\n",
"thetabin = thetaEdges[:-1] + (thetaEdges[1]-thetaEdges[0])*0.5\n",
"plt.figure(figsize=(9, 6))\n",
"plt.grid()\n",
"plt.plot(thetabin, thetaXdistrib, linewidth=lw, alpha=1, label='')\n",
"plt.xlabel(plt_xlabel, fontsize=fs)\n",
"plt.ylabel(plt_ylabel, fontsize=fs)\n",
"\n",
"# Set log scale\n",
"if use_log_y:\n",
" plt.yscale('log',base=2) \n",
"\n",
"# Save the plot or just show it\n",
"if save_fig:\n",
" plt.savefig(fig_path + filename)\n",
" plt.close() "
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c9f9c18a",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"#########################################################################################\n",
"# angle_x_in - angle_x_defl distribution of primaries at the detector after interaction with a crystal\n",
"\n",
"############# INPUT #############\n",
"# Feel free to modify according to your needs\n",
"Nmax = 100000000 #max number of events to elaborate\n",
"\n",
"# Example data (replace these with your real arrays)\n",
"# datatetaxin and datatetadeflx must be the same length\n",
"datatetaxin = df_prim[\"incoming_angle_x\"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)\n",
"datatetadeflx = df_prim[\"deflection_angle_x\"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)\n",
"\n",
"# Feel free to modify the number of bins and the plot range\n",
"NbinTheta = 50\n",
"\n",
"# Feel free to modify the plot range\n",
"xrange = (-0.1, 0.1)\n",
"yrange = (-1, 2)\n",
"\n",
"# Set whether to use linear o log scale\n",
"use_log_color = True # set True for LogNorm color scale\n",
"\n",
"# Feel free to modify the names of axes\n",
"plt_xlabel2 = '$\\\\theta_{x in}$ [mrad]'\n",
"plt_ylabel2 = '$\\\\theta_{x defl}$ [mrad]'\n",
"\n",
"# Feel free to modify the filename to save the plot\n",
"filename2 = 'thetaXin_thetaXdefl.pdf'\n",
"\n",
"#some plt parameters\n",
"fs = 16\n",
"lw = 2\n",
"#################################\n",
"\n",
"# Create 2D histogram\n",
"plt.figure(figsize=(8, 6))\n",
"hist = plt.hist2d(\n",
" datatetaxin,\n",
" datatetadeflx,\n",
" bins=NbinTheta,\n",
" density=True,\n",
" range=[xrange, yrange],\n",
" norm=LogNorm() if use_log_color else None,\n",
" cmap='jet'\n",
")\n",
"\n",
"# Add colorbar (PDF scale)\n",
"cbar = plt.colorbar()\n",
"cbar.set_label('PDF', fontsize=fs)\n",
"\n",
"# Labels and title\n",
"plt.xlabel(plt_xlabel2, fontsize=fs)\n",
"plt.ylabel(plt_ylabel2, fontsize=fs)\n",
"\n",
"# Save the plot or just show it\n",
"if save_fig:\n",
" plt.savefig(fig_path + filename2)\n",
" plt.close() "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3098a395",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"################################################################################################\n",
"# Plot spectrum\n",
"\n",
"############# INPUT #############\n",
"# Feel free to modify the collimator parameters\n",
"apply_collimation = True\n",
"coll_angle = 2.3183 #mrad\n",
"\n",
"# Feel free to modify\n",
"NbinE = 20\n",
"rangeE = [0, 10] #MeV\n",
"\n",
"# path of the spectrum file obtained using all the Bair-Katkov integration photons\n",
"BK_spectrum_file = \"Spectrum.dat\"\n",
"#################################\n",
"\n",
"# Array with photon energies and angles\n",
"Eph = df_ph['Ekin'].values #MeV \n",
"\n",
"Nph = len(Eph)\n",
"print(\"number of emitted photons:\", Nph)\n",
"thetaX_ph = df_ph['angle_x'].values*1e3 #rad -> mrad\n",
"thetaY_ph = df_ph['angle_y'].values*1e3 #rad -> mrad\n",
"\n",
"# Take only the photons inside the collimator acceptance\n",
"theta_ph = np.sqrt(thetaX_ph**2 + thetaY_ph**2) \n",
"if apply_collimation: \n",
" thetaX_ph = thetaX_ph[theta_ph <= coll_angle]\n",
" thetaY_ph = thetaY_ph[theta_ph <= coll_angle]\n",
" Eph = Eph[theta_ph <= coll_angle]\n",
" theta_ph = theta_ph[theta_ph <= coll_angle]\n",
"\n",
"# Calculate the scored photon energy spectrum\n",
"spectrum0, EbinEdges = np.histogram(Eph, bins=NbinE, range=rangeE, density=False)\n",
"Ebin = EbinEdges[:-1] + (EbinEdges[1]-EbinEdges[0])*0.5\n",
"stepx = Ebin[1]-Ebin[0]\n",
"Nprimaries = df_in[\"Ekin\"].size\n",
"\n",
"spectrum = spectrum0 / (Nprimaries*stepx)\n",
"spectral_intensity = Ebin * spectrum\n",
"\n",
"# Statistical uncertainties: sqrt(N)\n",
"spectrum_err = np.sqrt(spectrum0) / (Nprimaries * stepx)\n",
"spectral_intensity_err = Ebin * spectrum_err\n",
"\n",
"# Read the spectrum file obtained using all the Bair-Katkov integration photons\n",
"BK_spectrum = np.loadtxt(G4_sim_path+BK_spectrum_file, dtype='float', comments='#', \\\n",
" delimiter=' ', skiprows=1, unpack=True)\n",
"E_ext = BK_spectrum[0]\n",
"S_ext = BK_spectrum[1]\n",
"\n",
"# Plot the photon energy spectrum\n",
"fig = plt.figure(figsize=(13, 6))\n",
"fs = 16\n",
"lw = 2\n",
"bw = 0.6\n",
"color0 = '#B1B3FB'\n",
"\n",
"plt.subplot(1,2,1)\n",
"plt.bar(Ebin, spectrum, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')\n",
"plt.errorbar(Ebin, spectrum, yerr=spectrum_err, fmt='o', color='k', capsize=3)\n",
"plt.xlim(rangeE)\n",
"plt.plot(E_ext, S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)\n",
"plt.title('Emitted photon spectrum')\n",
"plt.xlabel('E [MeV]', fontsize=fs)\n",
"plt.ylabel('1/N dN/dE', fontsize=fs)\n",
"plt.legend()\n",
"#plt.yscale('log')\n",
"\n",
"plt.subplot(1,2,2)\n",
"plt.bar(Ebin, spectral_intensity, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')\n",
"plt.errorbar(Ebin, spectral_intensity, yerr=spectral_intensity_err, fmt='o', color='k', capsize=3)\n",
"plt.plot(E_ext, E_ext * S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)\n",
"plt.title('Emitted photon spectral intensity')\n",
"plt.xlabel('E [MeV]', fontsize=fs)\n",
"plt.ylabel('1/N dW/dE', fontsize=fs)\n",
"plt.xlim(rangeE)\n",
"plt.legend()\n",
"#plt.yscale('log')\n",
"if save_fig:\n",
" plt.savefig(fig_path + 'spectrum.pdf')\n",
" plt.close() "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7ddc1e1f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -9,27 +9,19 @@ import pandas as pd
import matplotlib.pyplot as plt
import os
import uproot
from matplotlib.colors import LogNorm # optional, for log color scaling
################################### INPUT ############################################
#################################### INPUT FILE #########################################
# Set path and filename of the simulation file
G4_sim_path = ""
root_file = "results"
Nmax = 1e5 #max number of events to elaborate
# Set whether to save plots (without displaying them) or just display them
save_fig = True
fig_path = G4_sim_path
#########################################################################################
apply_collimation = False
coll_angle = 20/8627 #rad
NbinE = 25
rangeE = [0, 10] #MeV
NbinTheta = 100
rangeTheta = [-1, 2] #mrad
######################################################################################
# Create figure directory if it does not exist
# Create directory where to strore the figures if it does not exist
if fig_path != '' and not os.path.exists(fig_path):
os.makedirs(fig_path)
print('created fig_path:', fig_path)
@@ -40,74 +32,206 @@ rf_content = [item.split(';')[0] for item in rf.keys()]
print('rf_content:', rf_content, '\n')
# Import the scoring ntuples and convert them into pandas dataframes
branches = ["eventID", "volume", "x", "y", "angle_x", "angle_y",
branches = ["eventID", "volume", "x", "y", "angle_x", "angle_y", \
"Ekin" , "particle", "particleID", "parentID"]
branchesprimary = branches + ["incoming_angle_x", "deflection_angle_x", \
"incoming_angle_y", "deflection_angle_y"]
df_in = rf['crystal'].arrays(branches, library='pd')
df_out = rf['detector'].arrays(branches, library='pd')
df_prim = rf['detector_primaries'].arrays(branchesprimary, library='pd')
df_ph = rf['detector_photons'].arrays(branches, library='pd')
df_sec = rf['detector_secondaries'].arrays(branches, library='pd')
df_missed = rf['missed_crystal'].arrays(branches, library='pd')
# Define in and out dataframes
df_in_all_primary = df_in[df_in.parentID == 0]
df_out_all_primary = df_out[df_out.parentID == 0]
Nmax = min([int(Nmax), len(df_out_all_primary)])
df_in_primary = df_in_all_primary[:Nmax]
df_out_primary = df_out_all_primary[:Nmax]
#########################################################################################
# Plot angle_x distribution of primaries at the detector after interaction with a crystal
# Select only the columns useful for deflection
df_in_primary_sel = df_in_primary[["eventID", "angle_x", "angle_y"]]
df_out_primary_sel = df_out_primary[["eventID", "angle_x", "angle_y"]]
del df_in_primary, df_out_primary
############# INPUT #############
# Feel free to modify according to your needs
Nmax = 100000000 #max number of events to elaborate
# Feel free to replace df_prim by df_in, df_ph, df_sec or df_missed
# Feel free to replace "angle_x" by other ntuples from branches and
# from branchesprimary (for df_prim)
# ONLY NUMERIC VALUES
datax = df_prim["angle_x"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)
# Feel free to modify the number of bins and the plot range
NbinTheta = 100
rangeTheta = [-1, 2] #mrad
# Set whether to use linear o log scale
use_log_y = False # set True for LogNorm color scale
# Feel free to modify the names of axes
plt_xlabel = '$\\theta_x$ [mrad]'
plt_ylabel = 'PDF: 1/N dN/d$\\theta_x$ [mrad]$^{-1}$'
# Feel free to modify the filename to save the plot
filename = 'thetaXdistribution.pdf'
#some plt parameters
fs = 16
lw = 2
#################################
# Create 1D histogram
thetaXdistrib, thetaEdges = np.histogram(datax.values, \
bins=NbinTheta, range=rangeTheta, density=True)
thetabin = thetaEdges[:-1] + (thetaEdges[1]-thetaEdges[0])*0.5
plt.figure(figsize=(9, 6))
plt.grid()
plt.plot(thetabin, thetaXdistrib, linewidth=lw, alpha=1, label='')
plt.xlabel(plt_xlabel, fontsize=fs)
plt.ylabel(plt_ylabel, fontsize=fs)
# Set log scale
if use_log_y:
plt.yscale('log',base=2)
# Save the plot or just show it
if save_fig:
plt.savefig(fig_path + filename)
plt.close()
#########################################################################################
# angle_x_in - angle_x_defl distribution of primaries at the detector after interaction with a crystal
############# INPUT #############
# Feel free to modify according to your needs
Nmax = 100000000 #max number of events to elaborate
# Example data (replace these with your real arrays)
# datatetaxin and datatetadeflx must be the same length
datatetaxin = df_prim["incoming_angle_x"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)
datatetadeflx = df_prim["deflection_angle_x"][:Nmax]*1.e3 #mrad <= rad (feel free to modify the coefficient)
# Feel free to modify the number of bins and the plot range
NbinTheta = 50
# Feel free to modify the plot range
xrange = (-0.1, 0.1)
yrange = (-1, 2)
# Set whether to use linear o log scale
use_log_color = True # set True for LogNorm color scale
# Feel free to modify the names of axes
plt_xlabel2 = '$\\theta_{x in}$ [mrad]'
plt_ylabel2 = '$\\theta_{x defl}$ [mrad]'
# Feel free to modify the filename to save the plot
filename2 = 'thetaXin_thetaXdefl.pdf'
#some plt parameters
fs = 16
lw = 2
#################################
# Create 2D histogram
plt.figure(figsize=(8, 6))
hist = plt.hist2d(
datatetaxin,
datatetadeflx,
bins=NbinTheta,
density=True,
range=[xrange, yrange],
norm=LogNorm() if use_log_color else None,
cmap='jet'
)
# Add colorbar (PDF scale)
cbar = plt.colorbar()
cbar.set_label('PDF', fontsize=fs)
# Labels and title
plt.xlabel(plt_xlabel2, fontsize=fs)
plt.ylabel(plt_ylabel2, fontsize=fs)
# Save the plot or just show it
if save_fig:
plt.savefig(fig_path + filename2)
plt.close()
################################################################################################
# Plot spectrum
############# INPUT #############
# Feel free to modify the collimator parameters
apply_collimation = True
coll_angle = 2.3183 #mrad
# Feel free to modify
NbinE = 20
rangeE = [0, 10] #MeV
# path of the spectrum file obtained using all the Bair-Katkov integration photons
BK_spectrum_file = "Spectrum.dat"
#################################
# Array with photon energies and angles
Eph = df_ph['Ekin'].values #MeV
Eph = df_ph['Ekin'].values #MeV
Nph = len(Eph)
print("number of emitted photons:", Nph)
thetaX_ph = df_ph['angle_x'].values*1e3 #rad -> mrad
thetaY_ph = df_ph['angle_y'].values*1e3 #rad -> mrad
# Take only the photons inside the collimator acceptance
theta_ph = np.sqrt(thetaX_ph**2 + thetaY_ph**2)
if apply_collimation:
theta_ph = np.sqrt(thetaX_ph**2 + thetaY_ph**2)
if apply_collimation:
thetaX_ph = thetaX_ph[theta_ph <= coll_angle]
thetaY_ph = thetaY_ph[theta_ph <= coll_angle]
Eph = Eph[theta_ph <= coll_angle]
theta_ph = theta_ph[theta_ph <= coll_angle]
# Calculate the scored photon energy spectrum
spectrum, EbinEdges = np.histogram(Eph, bins=NbinE, range=rangeE, density=True)
spectrum0, EbinEdges = np.histogram(Eph, bins=NbinE, range=rangeE, density=False)
Ebin = EbinEdges[:-1] + (EbinEdges[1]-EbinEdges[0])*0.5
stepx = Ebin[1]-Ebin[0]
Nprimaries = df_in["Ekin"].size
spectrum = spectrum0 / (Nprimaries*stepx)
spectral_intensity = Ebin * spectrum
# Statistical uncertainties: sqrt(N)
spectrum_err = np.sqrt(spectrum0) / (Nprimaries * stepx)
spectral_intensity_err = Ebin * spectrum_err
# Read the spectrum file obtained using all the Bair-Katkov integration photons
BK_spectrum = np.loadtxt(G4_sim_path+BK_spectrum_file, dtype='float', comments='#', \
delimiter=' ', skiprows=1, unpack=True)
E_ext = BK_spectrum[0]
S_ext = BK_spectrum[1]
# Plot the photon energy spectrum
fig = plt.figure(figsize=(13, 6))
fs = 16
lw = 2
bw = 0.6
color0 = '#B1B3FB'
plt.subplot(1,2,1)
plt.bar(Ebin, spectrum, width=bw, linewidth=lw, alpha=1, label='')
plt.bar(Ebin, spectrum, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')
plt.errorbar(Ebin, spectrum, yerr=spectrum_err, fmt='o', color='k', capsize=3)
plt.xlim(rangeE)
plt.plot(E_ext, S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)
plt.title('Emitted photon spectrum')
plt.xlabel('E [MeV]', fontsize=fs)
plt.ylabel('1/N$\\times$dN/dE', fontsize=fs)
plt.yscale('log')
plt.ylabel('1/N dN/dE', fontsize=fs)
plt.legend()
#plt.yscale('log')
plt.subplot(1,2,2)
plt.bar(Ebin, spectral_intensity, width=bw, linewidth=lw, alpha=1, label='')
plt.bar(Ebin, spectral_intensity, width=bw, color=color0, linewidth=lw, alpha=1, label='secondary photons')
plt.errorbar(Ebin, spectral_intensity, yerr=spectral_intensity_err, fmt='o', color='k', capsize=3)
plt.plot(E_ext, E_ext * S_ext, 'r-', lw=2.5, label='from '+BK_spectrum_file)
plt.title('Emitted photon spectral intensity')
plt.xlabel('E [MeV]', fontsize=fs)
plt.ylabel('1/N$\\times$dW/dE', fontsize=fs)
plt.yscale('log')
plt.ylabel('1/N dW/dE', fontsize=fs)
plt.xlim(rangeE)
plt.legend()
#plt.yscale('log')
if save_fig:
plt.savefig(fig_path + 'spectrum.jpg')
plt.close()
# Plot angle_x distribution at the detector
thetaXdistrib, thetaEdges = np.histogram(df_out_primary_sel["angle_x"].values*1e3, \
bins=NbinTheta, range=rangeTheta, density=True)
thetabin = thetaEdges[:-1] + (thetaEdges[1]-thetaEdges[0])*0.5
plt.figure(figsize=(9, 6))
plt.plot(thetabin, thetaXdistrib, linewidth=lw, alpha=1, label='')
plt.xlabel('$\\theta_X$ [mrad]', fontsize=fs)
plt.ylabel('1/N$\\times$dN/d$\\theta_X$', fontsize=fs)
if save_fig:
plt.savefig(fig_path + 'thetaXdistribution.jpg')
plt.close()
plt.savefig(fig_path + 'spectrum.pdf')
plt.close()
@@ -23,11 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ch2.cc
/// \brief Main program of the ch2 example
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Main program of the channeling/ch2 example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
@@ -133,9 +130,54 @@ int main(int argc,char** argv)
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
G4int nofEventsTot = runManager->GetNumberOfEventsToBeProcessed();
delete visManager;
delete runManager;
//final output for the spectrum
std::vector<G4double> photonEnergyInSpectrum;
std::vector<G4double> spectrum;
G4bool spectrumWrite = false;
for (G4int ii = 0; ; ++ii)
{
std::string filename = "Spectrum_"+std::to_string(ii)+".dat";
std::ifstream fileN1(filename);
//if no file
if (!fileN1) break;
spectrumWrite = true; //if a temporary file exist => final output will be written
G4int jj = 0;
G4double eph, spec=0.;
while (fileN1 >> eph >> spec)
{
if (ii==0)
{
photonEnergyInSpectrum.push_back(eph);//the same for all the files
spectrum.push_back(spec); //the same data size for all the files
}
else{spectrum[jj++] += spec;} // spectrum accumulation
}
fileN1.close();
std::remove(filename.c_str());
}
std::remove("Spectrum.dat");//delete a previous file if existed
if(spectrumWrite)// if radiation model = false => no spectrum
{
std::ofstream file1;
file1.open("Spectrum.dat");
//CAUTION: spectrum is normalized onto a probability of radiation W, IT IS NOT A PDF
file1 << "# E_photon [MeV]" <<
" dW_rad/dE_photon [MeV^-1]; W_rad - radiation probability" << G4endl;
for(std::size_t i = 0; i<spectrum.size(); i++)
{file1 << photonEnergyInSpectrum[i] << " " << spectrum[i]/nofEventsTot << G4endl;}
file1.close();
}
theTimer->Stop();
G4cout << "Execution terminated" << G4endl;
G4cout << (*theTimer) << G4endl;
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-03-ref-06 (30-June-2025)
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -29,7 +29,6 @@ You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RT)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
@@ -42,13 +41,12 @@ Registered graphics systems are:
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RTX)
RayTracerQt (RTQt)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG, OGL)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB, TSGZB)
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
@@ -102,6 +100,7 @@ Crystal Lattice: (111)
Crystal angleX: 0 rad
Crystal angleY: 0 rad
ActivateRadiationModel: 1
Setting virtual collimator angular radius: 2.3183 mrad
Checking overlaps for volume Detector:0 (G4Box) ... OK!
=======================================================================
@@ -171,7 +170,7 @@ Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 0
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Urban
Use built-in Birks satuaration 0
Use built-in Birks saturation 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 0
@@ -308,7 +307,7 @@ hBrems: for proton XStype:1 SubType=3
hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -366,7 +365,7 @@ hBrems: for anti_proton XStype:1 SubType=3
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -398,7 +397,7 @@ hBrems: for kaon+ XStype:1 SubType=3
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -430,7 +429,7 @@ hBrems: for kaon- XStype:1 SubType=3
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -462,7 +461,7 @@ muBrems: for mu+ XStype:1 SubType=3
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -494,7 +493,7 @@ muBrems: for mu- XStype:1 SubType=3
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -526,7 +525,7 @@ hBrems: for pi+ XStype:1 SubType=3
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -558,7 +557,7 @@ hBrems: for pi- XStype:1 SubType=3
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -813,8 +812,8 @@ CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Type of pre-compound model 0
Type of pre-compound inverse x-section 1
Pre-compound model active 1
Pre-compound excitation low energy 100 keV
Pre-compound excitation high energy 30 MeV
Pre-compound excitation low energy 0.1 MeV
Pre-compound excitation high energy 15 MeV
Angular generator for pre-compound model 1
Use NeverGoBack option for pre-compound model 0
Use SoftCutOff option for pre-compound model 0
@@ -828,9 +827,8 @@ Type of de-excitation inverse x-section 3
Type of de-excitation factory Evaporation+GEM
Number of de-excitation channels 68
Type of Fermi BreakUp model ModelVI
Min excitation energy 10 eV
Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Min excitation energy 0.01 keV
Min energy per nucleon for multifragmentation 2e+05 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 0
@@ -843,106 +841,16 @@ Max 2J for sampling of angular correlations 10
=======================================================================
### Run 0 starts.
--> Event 0 starts.
--> Event 10 starts.
--> Event 20 starts.
--> Event 30 starts.
--> Event 40 starts.
--> Event 50 starts.
--> Event 60 starts.
--> Event 70 starts.
--> Event 80 starts.
--> Event 90 starts.
--> Event 100 starts.
--> Event 110 starts.
--> Event 120 starts.
--> Event 130 starts.
--> Event 140 starts.
--> Event 150 starts.
--> Event 160 starts.
--> Event 170 starts.
--> Event 180 starts.
--> Event 190 starts.
--> Event 200 starts.
--> Event 210 starts.
--> Event 220 starts.
--> Event 230 starts.
--> Event 240 starts.
--> Event 250 starts.
--> Event 260 starts.
--> Event 270 starts.
--> Event 280 starts.
--> Event 290 starts.
--> Event 300 starts.
--> Event 310 starts.
--> Event 320 starts.
--> Event 330 starts.
--> Event 340 starts.
--> Event 350 starts.
--> Event 360 starts.
--> Event 370 starts.
--> Event 380 starts.
--> Event 390 starts.
--> Event 400 starts.
--> Event 410 starts.
--> Event 420 starts.
--> Event 430 starts.
--> Event 440 starts.
--> Event 450 starts.
--> Event 460 starts.
--> Event 470 starts.
--> Event 480 starts.
--> Event 490 starts.
--> Event 500 starts.
--> Event 510 starts.
--> Event 520 starts.
--> Event 530 starts.
--> Event 540 starts.
--> Event 550 starts.
--> Event 560 starts.
--> Event 570 starts.
--> Event 580 starts.
--> Event 590 starts.
--> Event 600 starts.
--> Event 610 starts.
--> Event 620 starts.
--> Event 630 starts.
--> Event 640 starts.
--> Event 650 starts.
--> Event 660 starts.
--> Event 670 starts.
--> Event 680 starts.
--> Event 690 starts.
--> Event 700 starts.
--> Event 710 starts.
--> Event 720 starts.
--> Event 730 starts.
--> Event 740 starts.
--> Event 750 starts.
--> Event 760 starts.
--> Event 770 starts.
--> Event 780 starts.
--> Event 790 starts.
--> Event 800 starts.
--> Event 810 starts.
--> Event 820 starts.
--> Event 830 starts.
--> Event 840 starts.
--> Event 850 starts.
--> Event 860 starts.
--> Event 870 starts.
--> Event 880 starts.
--> Event 890 starts.
--> Event 900 starts.
--> Event 910 starts.
--> Event 920 starts.
--> Event 930 starts.
--> Event 940 starts.
--> Event 950 starts.
--> Event 960 starts.
--> Event 970 starts.
--> Event 980 starts.
--> Event 990 starts.
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=33.020000s Real=33.266887s Sys=0.030000s
User=30.470000s Real=31.238877s Sys=0.050000s
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
@@ -78,7 +76,11 @@ class DetectorConstruction : public G4VUserDetectorConstruction
{fCrystallineUndulatorPhase = val;}
void SetPotentialPath(const G4String& path){fPotentialPath = path;}
void SetCrystalInternalGeometryPath(const G4String& path){fCrystalInternalGeometryPath = path;}
void SetVirtualCollimatorHalfSize(G4double val) {fVirtualCollimatorHalfSize = val;}
void SetMinPhotonEnergy(G4double val) {fMinPhotonEnergy = val;}
void SetMaxBKPhotonEnergyInSpectrum(G4double val) {fMaxPhotonEnergySpectrum = val;}
void SetNBinsSpectrum(G4int val) {fNBinsSpectrum = val;}
void SetSamplingPhotonsNumber(G4int val) {fSamplingPhotonsNumber = val;}
void SetNSmallTrajectorySteps(G4int val) {fNSmallTrajectorySteps = val;}
void SetRadiationAngleFactor(G4double val) {fRadiationAngleFactor = val;}
@@ -134,12 +136,16 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4double fDetectorFrontPosZ = 1*CLHEP::m;
G4String fPotentialPath = "";
G4String fCrystalInternalGeometryPath = "";
G4double fMinPhotonEnergy = 1*CLHEP::MeV; //G4BaierKatkov default value
G4double fMaxPhotonEnergySpectrum = 1*CLHEP::GeV; //G4BaierKatkov default value
G4int fNBinsSpectrum = 110; //G4BaierKatkov default value
G4int fSamplingPhotonsNumber = 150; //G4BaierKatkov default value
G4int fNSmallTrajectorySteps = 10000; //G4BaierKatkov default value
G4double fRadiationAngleFactor = 4; //G4BaierKatkov default value
G4double fVirtualCollimatorHalfSize = 10.; // infinite collimator size
G4double fMinPhotonEnergyAddStat = 1*CLHEP::MeV;
G4double fMaxPhotonEnergyAddStat = 20*CLHEP::MeV;
G4int fTimesPhotonStatistics = 1;
@@ -24,11 +24,7 @@
// ********************************************************************
//
/// \file DetectorConstructionMessenger.hh
/// \brief Description of the DetectorConstruction messenger class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Definition of the DetectorConstructionMessenger class
#ifndef DetectorConstructionMessenger_h
#define DetectorConstructionMessenger_h 1
@@ -79,8 +75,12 @@ private:
G4UIcmdWithADouble* fCrystallineUndulatorPhaseCmd{nullptr};
G4UIcmdWithAString* fPotentialPathCmd{nullptr};
G4UIcmdWithAString* fCrystalInternalGeometryPathCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fVirtualCollimatorHalfSize{nullptr};
G4UIcmdWithADoubleAndUnit* fMinPhotonEnergyCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fMaxPhotonEnergySpectrumCmd{nullptr};
G4UIcmdWithAnInteger* fNBinsSpectrumCmd{nullptr};
G4UIcmdWithAnInteger* fSamplingPhotonsNumberCmd{nullptr};
G4UIcmdWithAnInteger* fNSmallTrajectoryStepsCmd{nullptr};
G4UIcmdWithADouble* fRadiationAngleFactorCmd{nullptr};
@@ -24,9 +24,7 @@
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
@@ -25,8 +25,6 @@
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
@@ -25,8 +25,6 @@
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
@@ -53,6 +51,13 @@ class SteppingAction : public G4UserSteppingAction
// method from the base class
void UserSteppingAction(const G4Step*) override;
private:
//remember the event id of a primary passed through the crystal
G4int eventID_in = -1;
//remember the incoming angles of a primary passed through the crystal
G4double angle_x_in = 0.;
G4double angle_y_in = 0.;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -70,6 +70,15 @@
/crystal/setNSmallTrajectorySteps 10000 # G4BaierKatkov default
/crystal/setRadiationAngleFactor 4. # G4BaierKatkov default
#the following can be changed or commented:
#For scoring purposes only: the maximal energy in the output spectrum from the Baier-Katkov method.
#Note it does not modifies the simulations.
#Note: the minimal energy in the spectrum = the minimal energy defined above.
/crystal/MaxBKPhotonEnergyInSpectrum 1 GeV # G4BaierKatkov default; must be > setMinPhotonEnergy
/crystal/NBinsInSpectrum 110 # G4BaierKatkov default; note these bins are not equidistant.
#Virtual collimator sets the selection of photon angles to be written in the output spectrum
/crystal/setVirtualCollimatorHalfSize 2.3183 mrad #setting the angular radius of virtual collimator
#add statistics of sampling photons in G4BaierKatkov in specific energy range
#use if necessary (usually in the crystalline undulator case):
#CAUTION: this energy range must not be below minimum photon energy
@@ -99,11 +108,11 @@
/gps/ang/rot1 1 0 0
/gps/ang/rot2 0 -1 0
/gps/ang/sigma_x 30.E-6 rad
/gps/ang/sigma_y 30.E-6 rad
/gps/ang/sigma_y 70.E-6 rad
#energy distribution (constant)
/gps/ene/mono 0.855 GeV
#statistics
/run/printProgress 10
/run/printProgress 100
/run/beamOn 1000
@@ -0,0 +1,83 @@
#FOR SIMPLICITY THIS MACRO USES MODEL DEFAULTS;
#TO MODIFY PLEASE REFER run.mac
#AND ADD THE CORRESPONDING OPTIONS TO THIS MACRO
#THE CURRENT PARAMETERS GIVE THE SAME OUTPUT AS run.mac
#(Experiment at Mainz Mikrotron MAMI)
# A. Mazzolari et al. Phys. Rev. Lett. 112, 135503 (2014).
# L. Bandiera et al. Phys. Rev. Lett. 115, 025504 (2015).
# A. Sytov et al. Journal of the Korean Physical Society 83, 132139 (2023)
/random/setSeeds 19577794 424238336
#setting number of cores
/run/numberOfThreads 2
#crystal geometry
#change it as you want
/crystal/setCrystalSize 20. 20. 0.0305 mm
/crystal/setCrystalBendingAngle 0.905 mrad #default is 0
/crystal/setCrystalAngleX 0 mrad #default is 0
/crystal/setCrystalAngleY 0 mrad #default is 0
#crystal lattice parameters
#change it according to the data available in G4CHANNELINGDATA
/crystal/setCrystalMaterial G4_Si # check G4CHANNELINGDATA dataset;
#G4_Ge and G4_Diamond are also available
/crystal/setCrystalLattice (111) # check G4CHANNELINGDATA dataset;
# planes (110) and (100) as well as
# axes <100>, <110> and <111> are also available
#detector parameters
#change it as you want
/crystal/setDetectorSize 10 10 0.03 cm
/crystal/setFrontPositionZ 5973 mm
#G4ChannelingFastSimModel parameters
#change it as you want
/crystal/setChannelingModel true #switch on/off G4ChannelingFastSimModel
/crystal/setRadiationModel true #switch on/off G4BaierKatkov
#(G4ChannelingFastSimModel must be switched on)
#the following can be changed or commented:
#G4BaierKatkov parameters
#(see also comments in ConstructSDandField in DetectorConstruction):
/crystal/setMinPhotonEnergy 1 MeV # G4BaierKatkov default
#the following can be changed or commented:
#For scoring purposes only: the maximal energy in the output spectrum from the Baier-Katkov method.
#Note it does not modifies the simulations.
#Note: the minimal energy in the spectrum = the minimal energy defined above.
/crystal/MaxBKPhotonEnergyInSpectrum 1 GeV # G4BaierKatkov default; must be > setMinPhotonEnergy
/crystal/NBinsInSpectrum 40 # note these bins are not equidistant.
#Virtual collimator sets the selection of photon angles to be written in the output spectrum
/crystal/setVirtualCollimatorHalfSize 2.3183 mrad #setting the angular radius of virtual collimator
/run/initialize
#settings
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
#beam
/gps/particle e- #e+ also work fine
#coordinate distribution (radial Gauss)
/gps/pos/centre 0. 0. -1. cm
/gps/pos/type Beam
/gps/pos/sigma_x 0.07 mm
/gps/pos/sigma_y 0.2 mm
#angular distribution (radial Gauss)
/gps/ang/type beam2d
/gps/ang/rot1 1 0 0
/gps/ang/rot2 0 -1 0
/gps/ang/sigma_x 30.E-6 rad
/gps/ang/sigma_y 70.E-6 rad
#energy distribution (constant)
/gps/ene/mono 0.855 GeV
#statistics
/run/printProgress 1000
/run/beamOn 10000
@@ -0,0 +1,95 @@
#FOR SIMPLICITY THIS MACRO USES MODEL DEFAULTS;
#TO MODIFY PLEASE REFER run.mac
#AND ADD THE CORRESPONDING OPTIONS TO THIS MACRO
#THIS EXAMPLE ALLOWS ONE TO STUDY CHANNELING - PLANAR OR AXIAL;
#VOLUME REFLECTION, MULTIPLE VOLUME REFLECTION IN ONE BENT CRYSTAL etc.
#AND ANY CRYSTAL ORIENTATIONS of TRANSITION BETWEEN THESE EFFECTS.
#THE CURRENT CRYSTAL PARAMETERS ARE TYPICAL FOR
#BEAM DEFLECTION EXPERIMENTS AT HIGH ENERGIES.
#YOU MAY REFER TO VARIOUS PAPERS ABOUT REAL EXPERIMENTS:
#W. Scandale et al. Phys. Lett. B 680, 129132 (2009).
#W. Scandale et al. Phys. Lett. B 682, 274277 (2009).
#R. Rossi et al. NIM B 355, 369373 (2015).
#L. Bandiera et al. Eur. Phys. J. C 76, 80 (2016).
#CAUTION: THIS IS A SIMPLIFIED EXAMPLE. IF YOU NEED
#A REALISTIC RESOLUTION OF ANGLES MEASUREMENT,
#PLEASE MODIFY DetectorConstruction ACCORDINGLY.
#FOR THE RESOLUTION OF INCOMING ANGLES YOU MAY ALSO SET UP
#AN EQUIVALENT INCOMING ANGULAR DIVERGENCE.
#CAUTION: NO CRYSTAL TORSION EFFECTS ARE CONSIDERED.
#CAUTION: HADRONIC PHYSICS IS SWITCHED OFF WHEN
#G4ChannelingFastSimModel IS EXPLOITED.
#IT DOES NOT AFFECT CHANNELING EFFICIENCY FOR A SHORT CRYSTAL,
#NOT EXCEEDING FEW MM LENGTH ALONG THE BEAM DIRECTION.
#THIS MAY HAVE ISSUES FOR LONGER CRYSTALS OR FOR COLLIMATION
#STUDIES. IN THE CASE OF ANY PROBLEMS PLEASE CONTACT THE DEVELOPERS.
/random/setSeeds 19577794 424238336
#setting number of cores
/run/numberOfThreads 2
#change it as you want
/crystal/setCrystalSize 6. 50. 4. mm
/crystal/setCrystalBendingAngle 0.1 mrad #default is 0
/crystal/setCrystalAngleX 0 mrad #default is 0
/crystal/setCrystalAngleY 0 mrad #default is 0
#crystal lattice parameters
#change it according to the data available in G4CHANNELINGDATA
/crystal/setCrystalMaterial G4_Si # check G4CHANNELINGDATA dataset;
# G4_Ge and G4_Diamond are also available
/crystal/setCrystalLattice (110) # check G4CHANNELINGDATA dataset;
# planes (111) and (100) as well as
# axes <100>, <110> and <111> are also available
#detector parameters
#change it as you want
/crystal/setDetectorSize 10 10 0.03 cm
/crystal/setFrontPositionZ 10. m
#G4ChannelingFastSimModel parameters
#change it as you want
/crystal/setChannelingModel true #switch on/off G4ChannelingFastSimModel
/crystal/setRadiationModel false #switch on/off G4BaierKatkov
#(G4ChannelingFastSimModel must be switched on)
/run/initialize
#settings
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
#beam
/gps/particle proton #pi+, pi-, anti_proton, GenericIon, mu+ or mu- are also ok;
#for e+, e- please evaluate, whether you need
#to switch on the radiation model (see above)
#which will accurately simulate radiation energy loss
#but will considerably slow down the code execution.
#coordinate distribution (radial Gauss)
#feel free to change
/gps/pos/centre 0. 0. -1. cm
/gps/pos/type Beam
/gps/pos/sigma_x 0.1 mm
/gps/pos/sigma_y 0.1 mm
#angular distribution (radial Gauss)
#feel free to change
/gps/ang/type beam2d
/gps/ang/rot1 1 0 0
/gps/ang/rot2 0 -1 0
/gps/ang/sigma_x 5.E-6 rad
/gps/ang/sigma_y 5.E-6 rad
#energy distribution (constant)
/gps/ene/mono 200 GeV #feel free to change
#statistics
/run/printProgress 100
/run/beamOn 1000
@@ -0,0 +1,95 @@
#FOR SIMPLICITY THIS MACRO USES MODEL DEFAULTS;
#TO MODIFY PLEASE REFER run.mac
#AND ADD THE CORRESPONDING OPTIONS TO THIS MACRO
#THIS IS A SIMPLIFIED SETUP FOR A CRYSTAL-BASED POSITRON SOURCE
#FOR FUTURE LEPTON COLLIDERS.
#PLEASE REFER THE FOLLOWING PAPERS FOR MORE INFORMATION:
#L. Bandiera et al. Eur. Phys. J. C 82, 699 (2022).
#F. Alharthi et al. NIM A 1075, 170412 (2025).
#CAUTION: NO COHERENT PAIR PRODUCTION IS CONSIDERED,
#FOR THIS, PLEASE REFER TO THE EXAMPLE ch3.
#THIS IS NOT AN ISSUE BELOW 10 GeV FOR W.
#CAUTION: ONLY A SINGLE CRYSTAL TARGET IS CONSIDERED.
#NO DEPOSITED ENERGY IS SCORED. FOR MORE FUNCTIONALITY
#PLEASE REFER TO THE DEDICATED EXAMPLE ch5.
/random/setSeeds 19577794 424238336
#setting number of cores
/run/numberOfThreads 2
#crystal geometry
#change it as you want
/crystal/setCrystalSize 20. 20. 0.5 mm #feel free to increase the crystal thickness
/crystal/setCrystalAngleX 0 mrad #default is 0
/crystal/setCrystalAngleY 0 mrad #default is 0
#crystal lattice parameters
#change it according to the data available in G4CHANNELINGDATA
/crystal/setCrystalMaterial G4_W # check G4CHANNELINGDATA dataset
/crystal/setCrystalLattice <111> # check G4CHANNELINGDATA dataset
#detector parameters
#change it as you want
/crystal/setDetectorSize 10 10 0.03 cm
/crystal/setFrontPositionZ 1000 mm
#G4ChannelingFastSimModel parameters
#change it as you want
/crystal/setChannelingModel true #switch on/off G4ChannelingFastSimModel
/crystal/setRadiationModel true #switch on/off G4BaierKatkov
#(G4ChannelingFastSimModel must be switched on)
#the pass to channeling data if different from the default:
#/crystal/setChannelingDataPath your_path
#the following can be changed or commented:
#the low energy threshold for particle to enter the G4ChannelingFastSimModel:
/crystal/setParticleMinKinEnergy/e+ 500 MeV #to speed up the simulations, please evaluate to change
/crystal/setParticleMinKinEnergy/e- 500 MeV #to speed up the simulations, please evaluate to change
#the following can be changed or commented:
#high angular threshold for particle to enter the G4ChannelingFastSimModel expressed in Lindhard angles:
/crystal/setLindhardAngles/e+ 10. #to speed up the simulations, please evaluate to change
/crystal/setLindhardAngles/e- 10. #to speed up the simulations, please evaluate to change
#the following can be changed or commented:
#G4BaierKatkov parameters
#(see also comments in ConstructSDandField in DetectorConstruction):
/crystal/setMinPhotonEnergy 1 MeV # G4BaierKatkov default
/crystal/setSamplingPhotonsNumber 150 # G4BaierKatkov default
/crystal/setNSmallTrajectorySteps 10000 # G4BaierKatkov default
/crystal/setRadiationAngleFactor 4. # G4BaierKatkov default
/run/initialize
#settings
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
#beam
/gps/particle e-
#coordinate distribution (radial Gauss)
/gps/pos/centre 0. 0. -1. cm
/gps/pos/type Beam
/gps/pos/sigma_x 1. mm
/gps/pos/sigma_y 1. mm
#angular distribution (radial Gauss)
/gps/ang/type beam2d
/gps/ang/rot1 1 0 0
/gps/ang/rot2 0 -1 0
/gps/ang/sigma_x 10.E-6 rad
/gps/ang/sigma_y 10.E-6 rad
#energy distribution (constant)
/gps/ene/mono 6. GeV
#statistics
/run/printProgress 10
/run/beamOn 50
@@ -0,0 +1,110 @@
#FOR SIMPLICITY THIS MACRO USES MODEL DEFAULTS;
#TO MODIFY PLEASE REFER run.mac
#AND ADD THE CORRESPONDING OPTIONS TO THIS MACRO
#THESE PARAMETERS REPRESENT GAMMA RADIATION SOURCE
#SUCH AS AXIAL OR PLANAR CHANNELING RADIATION
#AND COHERENT BREMSSTRAHLUNG:
#B. Ferretti, Il Nuovo Cimento 7, 118134 (1950)
#M.L. Ter-Mikaelian, High-Energy Electromagnetic Processes in Condensed Media,
# Wiley-Interscience, New York, 1972.
#V. N. Baier, V. M. Katkov, V. M. Strakhovenko et al.,
#Electromagnetic Processes At High Energies In Oriented Single
#Crystals, World Scientific Publishing Company, 1998.
#V.G. Baryshevskii, I.Y. Dubovskaya, Sov. Phys. Dokl. 21, 741743 (1976).
/random/setSeeds 19577794 424238336
#setting number of cores
/run/numberOfThreads 2
#crystal geometry
#change it as you want
/crystal/setCrystalSize 20. 20. 0.05 mm
/crystal/setCrystalAngleX 0. mrad #for coherent bremsstrahlung change the angle (usually few mrad would work fine)
/crystal/setCrystalAngleY 0. mrad #default is 0
#crystal lattice parameters
#change it according to the data available in G4CHANNELINGDATA
/crystal/setCrystalMaterial G4_Diamond # check G4CHANNELINGDATA dataset;
# G4_Si and G4_Ge are also available.
# For less monochromatic but more intense
# radiation use G4_W.
/crystal/setCrystalLattice (110) # check G4CHANNELINGDATA dataset;
# planes (110) and (100) as well as
# axes <100>, <110> and <111> are also available
# For G4_W check G4CHANNELINGDATA dataset
# for the availability.
#detector parameters
#change it as you want
/crystal/setDetectorSize 10 10 0.03 cm
/crystal/setFrontPositionZ 1000 mm
#G4ChannelingFastSimModel parameters
#change it as you want
/crystal/setChannelingModel true #switch on/off G4ChannelingFastSimModel
/crystal/setRadiationModel true #switch on/off G4BaierKatkov
#(G4ChannelingFastSimModel must be switched on)
#the following can be changed or commented:
#the low energy threshold for particle to enter the G4ChannelingFastSimModel:
/crystal/setParticleMinKinEnergy/e- 200 MeV # for energies of primaries below 200 MeV
# you may decrease the threshold;
# be careful with the energies
# below 100 MeV where quantum effects
# particle dynamics may become important.
# More information -
# Baier, Katkov, Strakhovenko book (above)
/crystal/setParticleMinKinEnergy/e+ 200 MeV # the same as for e-.
#the following can be changed or commented:
#high angular threshold for particle to enter the G4ChannelingFastSimModel expressed in Lindhard angles:
/crystal/setLindhardAngles/e+ 100. #change if necessary to speed up the simulations
/crystal/setLindhardAngles/e- 100. #change if necessary to speed up the simulations
#the following can be changed or commented:
#G4BaierKatkov parameters
#(see also comments in ConstructSDandField in DetectorConstruction):
/crystal/setMinPhotonEnergy 1 MeV # G4BaierKatkov default
/crystal/setSamplingPhotonsNumber 150 # G4BaierKatkov default
/crystal/setNSmallTrajectorySteps 10000 # G4BaierKatkov default
/crystal/setRadiationAngleFactor 4. # G4BaierKatkov default
#the following can be changed or commented:
#For scoring purposes only: the maximal energy in the output spectrum from the Baier-Katkov method.
#Note it does not modifies the simulations.
#Note: the minimal energy in the spectrum = the minimal energy defined above.
/crystal/MaxBKPhotonEnergyInSpectrum 0.5 GeV # must be > setMinPhotonEnergy
/crystal/NBinsInSpectrum 50 # note these bins are not equidistant.
#Virtual collimator sets the selection of photon angles to be written in the output spectrum
/crystal/setVirtualCollimatorHalfSize 1. mrad #setting the angular radius of virtual collimator
/run/initialize
#settings
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
#beam
/gps/particle e- #e+ also work fine
#coordinate distribution (radial Gauss)
/gps/pos/centre 0. 0. -1. cm
/gps/pos/type Beam
/gps/pos/sigma_x 0.1 mm
/gps/pos/sigma_y 0.1 mm
#angular distribution (radial Gauss)
/gps/ang/type beam2d
/gps/ang/rot1 1 0 0
/gps/ang/rot2 0 -1 0
/gps/ang/sigma_x 50.E-6 rad
/gps/ang/sigma_y 50.E-6 rad
#energy distribution (constant)
/gps/ene/mono 0.5 GeV
#statistics
/run/printProgress 1000
/run/beamOn 10000
@@ -25,8 +25,6 @@
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
@@ -25,8 +25,6 @@
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
@@ -71,8 +69,13 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4Material* world_mat = nist->FindOrBuildMaterial("G4_Galactic");
G4Material* silicon = nist->FindOrBuildMaterial("G4_Si");
//to use a diamond crystal
G4Element* elC = nist->FindOrBuildElement("C");
G4Material* diamond = new G4Material("G4_Diamond", 3.520*CLHEP::g/CLHEP::cm3, 1);
diamond->AddElement(elC, 1);
//World
G4Box* solidWorld = new G4Box("World", 0.2*CLHEP::m, 0.2*CLHEP::m, 10.*CLHEP::m);
G4Box* solidWorld = new G4Box("World", 0.2*CLHEP::m, 0.2*CLHEP::m, 30.*CLHEP::m);
G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, world_mat, "World");
G4VPhysicalVolume* physWorld = new G4PVPlacement
(0, // no rotation
@@ -135,6 +138,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4cout << "Crystal size: " << fCrystalSize.x()/CLHEP::mm
<< "x" << fCrystalSize.y()/CLHEP::mm
<< "x" << fCrystalSize.z()/CLHEP::mm << " mm3" << G4endl;
if (fActivateChannelingModel)
{
G4cout << "G4ChannelingFastSimModel activated" << G4endl;
@@ -144,18 +148,36 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
G4cout << "Crystal angleY: " << fAngleY << " rad" << G4endl;
G4cout << "ActivateRadiationModel: " << fActivateRadiationModel << G4endl;
if (fCrystallineUndulatorAmplitude > DBL_EPSILON &&
fCrystallineUndulatorPeriod > DBL_EPSILON) {
G4cout << "Crystalline undulator activated: " << G4endl;
G4cout << "undulator amplitude: "
<< fCrystallineUndulatorAmplitude/CLHEP::nm
<< " nm" << G4endl;
G4cout << "undulator period: "
<< fCrystallineUndulatorPeriod/CLHEP::mm
<< " mm" << G4endl;
G4cout << "undulator phase: "
<< fCrystallineUndulatorPhase
<< " rad" << G4endl;
if(fVirtualCollimatorHalfSize<CLHEP::halfpi)
{
G4cout << "Setting virtual collimator angular radius: "
<< fVirtualCollimatorHalfSize/CLHEP::mrad << " mrad" << G4endl;
}
else
{
G4cout << "No virtual collimator set." << G4endl;
}
if(fCrystalInternalGeometryPath != "")
{
G4cout << "Reading crystal internal geometry activated: " << G4endl;
G4cout << "reading from the file: " << fCrystalInternalGeometryPath << G4endl;
}
else
{
if (fCrystallineUndulatorAmplitude > DBL_EPSILON &&
fCrystallineUndulatorPeriod > DBL_EPSILON) {
G4cout << "Crystalline undulator activated: " << G4endl;
G4cout << "undulator amplitude: "
<< fCrystallineUndulatorAmplitude/CLHEP::nm
<< " nm" << G4endl;
G4cout << "undulator period: "
<< fCrystallineUndulatorPeriod/CLHEP::mm
<< " mm" << G4endl;
G4cout << "undulator phase: "
<< fCrystallineUndulatorPhase
<< " rad" << G4endl;
}
}
G4cout << G4endl;
@@ -218,16 +240,26 @@ void DetectorConstruction::ConstructSDandField()
//setting bending angle of the crystal planes (default is 0)
channelingModel->GetCrystalData()->SetBendingAngle(fBendingAngle, fLogicCrystal);
//setting crystalline undulator parameters
//NOTE: they are incompatible with a bent crystal
if (fCrystallineUndulatorAmplitude > DBL_EPSILON &&
fCrystallineUndulatorPeriod > DBL_EPSILON)
//reading internal crystal geometry from file has a priority vs its setup from parameters;
//it is used to setup a realistic undulator, but may be used also for a bent crystal geometry
if(fCrystalInternalGeometryPath != "")
{
channelingModel->GetCrystalData()->SetCrystallineUndulatorParameters(
fCrystallineUndulatorAmplitude,
fCrystallineUndulatorPeriod,
fCrystallineUndulatorPhase,
fLogicCrystal);
channelingModel->GetCrystalData()->
SetCrystallineUndulatorParameters(fLogicCrystal,fCrystalInternalGeometryPath);
}
else
{
//setting crystalline undulator parameters
//NOTE: they are incompatible with a bent crystal
if (fCrystallineUndulatorAmplitude > DBL_EPSILON &&
fCrystallineUndulatorPeriod > DBL_EPSILON)
{
channelingModel->GetCrystalData()->SetCrystallineUndulatorParameters(
fCrystallineUndulatorAmplitude,
fCrystallineUndulatorPeriod,
fCrystallineUndulatorPhase,
fLogicCrystal);
}
}
/*
@@ -336,6 +368,35 @@ void DetectorConstruction::ConstructSDandField()
*/
channelingModel->GetRadiationModel()->SetMinPhotonEnergy(fMinPhotonEnergy);
/*
Set the maximal energy in the spectrum to be written into the output file.
Note: the minimal energy written is equal to fMinPhotonEnergy.
Note: unlike the minimal energy, the maximal one is just a scoring parameter,
it does not modify the simulations.
*/
if(fMaxPhotonEnergySpectrum > fMinPhotonEnergy + DBL_EPSILON)
{
channelingModel->GetRadiationModel()->SetMaxPhotonEnergy(fMaxPhotonEnergySpectrum);
}
else
{
G4cout << "Warning: the maximal energy in BK spectrum <= the minimal energy." << G4endl;
G4cout << "The maximal energy is default now." << G4endl;
G4cout << " "<< G4endl;
}
/*
Set the maximal energy in the spectrum to be written into the output file
*/
channelingModel->GetRadiationModel()->SetNBinsSpectrum(fNBinsSpectrum);
/*
Set the angular size of virtual round collimator to accumulate the spectrum the output file
to be written into the output file. Default is infinite => no collimator.
*/
channelingModel->GetRadiationModel()->
SetRoundVirtualCollimator(fVirtualCollimatorHalfSize,-fAngleX,fAngleY);
/*
Set the number of trajectory steps after which the radiation probability
check (whether the probability is below or above of the threshold) is performed;
@@ -24,11 +24,7 @@
// ********************************************************************
//
/// \file DetectorConstructionMessenger.cc
/// \brief Implementation of the DetectorConstruction messenger class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Implementation of the DetectorConstructionMessenger class
#include "DetectorConstructionMessenger.hh"
#include "DetectorConstruction.hh"
@@ -141,6 +137,14 @@ fDetector(det)
fPotentialPathCmd->SetParameterName("channelingDataPath",false);
fPotentialPathCmd->SetDefaultValue("");
fCrystalInternalGeometryPathCmd =
new G4UIcmdWithAString("/crystal/setCrystalInternalGeometryPath",this);
fCrystalInternalGeometryPathCmd->
SetGuidance("Set the path where to find the available data "
"for the crystal internal geometry");
fCrystalInternalGeometryPathCmd->SetParameterName("CrystalInternalGeometryPath",false);
fCrystalInternalGeometryPathCmd->SetDefaultValue("");
fChannelingModelCmd = new G4UIcmdWithABool("/crystal/setChannelingModel", this);
fChannelingModelCmd->SetGuidance("Activate/deactivate G4ChannelingFastSimModel");
fChannelingModelCmd->SetParameterName("ChannelingModel",true);
@@ -151,6 +155,14 @@ fDetector(det)
fRadModelCmd->SetParameterName("ActivateRadiationModel",true);
fRadModelCmd->SetDefaultValue(false);
fVirtualCollimatorHalfSize =
new G4UIcmdWithADoubleAndUnit("/crystal/setVirtualCollimatorHalfSize",this);
fVirtualCollimatorHalfSize->SetGuidance("Set virtual collimator angular half size");
fVirtualCollimatorHalfSize->SetUnitCategory("Angle");
fVirtualCollimatorHalfSize->SetRange("VirtualCollimatorHalfSize > 0");
fVirtualCollimatorHalfSize->SetParameterName("VirtualCollimatorHalfSize",false);
fVirtualCollimatorHalfSize->AvailableForStates(G4State_PreInit,G4State_Idle);
fMinPhotonEnergyCmd =
new G4UIcmdWithADoubleAndUnit("/crystal/setMinPhotonEnergy",this);
fMinPhotonEnergyCmd->
@@ -160,7 +172,29 @@ fDetector(det)
fMinPhotonEnergyCmd->SetUnitCategory("Energy");
fMinPhotonEnergyCmd->SetRange("MinPhotonEnergy > 0");
fMinPhotonEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fMaxPhotonEnergySpectrumCmd =
new G4UIcmdWithADoubleAndUnit("/crystal/MaxBKPhotonEnergyInSpectrum",this);
fMaxPhotonEnergySpectrumCmd->
SetGuidance("Set the high energy threshold for the spectrum of"
"Baier-Katkov pseudophotons to be scored "
"(only scoring, does not influence simulations)");
fMaxPhotonEnergySpectrumCmd->SetParameterName("MaxBKPhotonEnergyInSpectrum",false);
fMaxPhotonEnergySpectrumCmd->SetUnitCategory("Energy");
fMaxPhotonEnergySpectrumCmd->SetRange("MaxBKPhotonEnergyInSpectrum > 0");
fMaxPhotonEnergySpectrumCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNBinsSpectrumCmd =
new G4UIcmdWithAnInteger("/crystal/NBinsInSpectrum",this);
fNBinsSpectrumCmd->
SetGuidance("Set the number of bins written in the spectrum of"
"Baier-Katkov pseudophotons to be scored "
"(only scoring, does not influence simulations)."
"Note: the bins are not equidistant.");
fNBinsSpectrumCmd->SetParameterName("NBinsInSpectrum",false);
fNBinsSpectrumCmd->SetRange("NBinsInSpectrum>1");
fNBinsSpectrumCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSamplingPhotonsNumberCmd =
new G4UIcmdWithAnInteger("/crystal/setSamplingPhotonsNumber",this);
fSamplingPhotonsNumberCmd->
@@ -401,8 +435,12 @@ DetectorConstructionMessenger::~DetectorConstructionMessenger()
delete fDetectorFrontPosZCmd;
delete fPotentialPathCmd;
delete fCrystalInternalGeometryPathCmd;
delete fVirtualCollimatorHalfSize;
delete fMinPhotonEnergyCmd;
delete fMaxPhotonEnergySpectrumCmd;
delete fNBinsSpectrumCmd;
delete fSamplingPhotonsNumberCmd;
delete fNSmallTrajectoryStepsCmd;
delete fRadiationAngleFactorCmd;
@@ -471,10 +509,21 @@ void DetectorConstructionMessenger::SetNewValue(G4UIcommand* command, G4String n
if (command == fPotentialPathCmd)
{fDetector->SetPotentialPath(newValue);}
if (command == fCrystalInternalGeometryPathCmd)
{fDetector->SetCrystalInternalGeometryPath(newValue);}
if (command == fVirtualCollimatorHalfSize)
{fDetector->SetVirtualCollimatorHalfSize(
fVirtualCollimatorHalfSize->GetNewDoubleValue(newValue));}
if (command == fMinPhotonEnergyCmd)
{fDetector->SetMinPhotonEnergy(
fMinPhotonEnergyCmd->GetNewDoubleValue(newValue));}
if (command == fMaxPhotonEnergySpectrumCmd)
{fDetector->SetMaxBKPhotonEnergyInSpectrum(
fMaxPhotonEnergySpectrumCmd->GetNewDoubleValue(newValue));}
if (command == fNBinsSpectrumCmd)
{fDetector->SetNBinsSpectrum(
fNBinsSpectrumCmd->GetNewIntValue(newValue));}
if (command == fSamplingPhotonsNumberCmd)
{fDetector->SetSamplingPhotonsNumber(
fSamplingPhotonsNumberCmd->GetNewIntValue(newValue));}
@@ -25,8 +25,6 @@
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "G4Event.hh"
@@ -23,12 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
#include "RunAction.hh"
#include "G4AnalysisManager.hh"
#include "G4RegionStore.hh"
#include "G4FastSimulationManager.hh"
#include "G4ChannelingFastSimModel.hh"
#include "G4Threading.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
@@ -47,12 +50,21 @@ RunAction::RunAction()
analysisManager->SetNtupleMerging(false);
#endif
//Creating the ntuple to score the deflection of particles and
//the emitted radiation
//Creating the ntuple to score the particles and the emitted radiation
G4String nTupleName[3] =
{"crystal", "detector", "detector_photons"};
for(G4int i=0; i<3; i++)
//ALL "detector_primaries" ENTER THE CRYSTAL; "detector_photons", "detector_secondaries"
//are their daughters.
//CAUTION: if a primary did not cross the crystal,
//this primary and its daughters are written ONLY in missed_crystal
G4String nTupleName[5] =
{"crystal",
"detector_primaries",
"detector_photons",
"detector_secondaries",
"missed_crystal"};
for(G4int i=0; i<5; i++)
{
analysisManager->CreateNtuple(nTupleName[i],nTupleName[i]);
analysisManager->CreateNtupleIColumn("eventID");
@@ -66,6 +78,14 @@ RunAction::RunAction()
analysisManager->CreateNtupleIColumn("particleID");
analysisManager->CreateNtupleIColumn("parentID");
if(i==1)
{
analysisManager->CreateNtupleDColumn("incoming_angle_x");
analysisManager->CreateNtupleDColumn("deflection_angle_x");
analysisManager->CreateNtupleDColumn("incoming_angle_y");
analysisManager->CreateNtupleDColumn("deflection_angle_y");
}
analysisManager->FinishNtuple();
}
}
@@ -78,6 +98,10 @@ void RunAction::BeginOfRunAction(const G4Run*)
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4String fileName = "results.root";
analysisManager->OpenFile(fileName);
//delete the spectrum temporary files if they exist
std::string filename = "Spectrum_"+std::to_string(G4Threading::G4GetThreadId())+".dat";
std::remove(filename.c_str());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -87,6 +111,36 @@ void RunAction::EndOfRunAction(const G4Run*)
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
//getting internal data of G4ChannelingFastSimModel
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4Region* regionCh = regionStore->GetRegion("Crystal");
G4bool someflag=false;
G4ChannelingFastSimModel* channeling =
static_cast<G4ChannelingFastSimModel*>
(regionCh->GetFastSimulationManager()->GetFastSimulationModel("ChannelingModel",
0,someflag));
if (!IsMaster() && channeling->GetIfRadiationModelActive())
{
std::vector<G4double> photonEnergyInSpectrum =
channeling->GetRadiationModel()->GetPhotonEnergyInSpectrum();
std::vector<G4double> spectrum =
channeling->GetRadiationModel()->GetTotalSpectrum();
G4int threadID = G4Threading::G4GetThreadId();
std::ofstream file1;
file1.open("Spectrum_"+std::to_string(threadID)+".dat");
file1 << std::setprecision(16);
for(std::size_t i = 0; i<spectrum.size(); i++)
{file1 << photonEnergyInSpectrum[i] << " " << spectrum[i] << G4endl;}
file1.close();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file SteppingAction.cc
/// \brief Implementation of the SteppingAction class
@@ -104,19 +103,43 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
if(volumeName=="Crystal")
{
iTuple = 0;
//remember values for output at the detector ONLY FOR PRIMARIES
if(particleID == 1)
{
eventID_in = eventID;
angle_x_in = angle_x;
angle_y_in = angle_y;
}
}
else if(volumeName=="Detector")
{
if(particleName=="gamma")
if(eventID_in == eventID) //FOR THE EVENTS WHERE PRIMARIES PASS THE CRYSTAL
{
iTuple = 2;
if(particleName=="gamma")
{
iTuple = 2;
}
else if(particleID == 1) //primaries
{
iTuple = 1;
}
else //secondaries
{
iTuple = 3;
}
}
else
{
iTuple = 1;
iTuple = 4;
}
}
//ALL "detector_primaries" ENTER THE CRYSTAL; "detector_photons", "detector_secondaries"
//are their daughters.
//CAUTION: if a primary did not cross the crystal,
//this primary and its daughters are written ONLY in missed_crystal
//saving result to root
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillNtupleIColumn(iTuple,0,eventID);
@@ -129,6 +152,16 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
analysisManager->FillNtupleSColumn(iTuple,7,particleName);
analysisManager->FillNtupleIColumn(iTuple,8,particleID);
analysisManager->FillNtupleIColumn(iTuple,9,parentID);
//ONLY FOR PRIMARIES PASSED THROUGH THE CRYSTAL
if(iTuple == 1)
{
analysisManager->FillNtupleDColumn(iTuple,10,angle_x_in);
analysisManager->FillNtupleDColumn(iTuple,11,angle_x-angle_x_in);
analysisManager->FillNtupleDColumn(iTuple,12,angle_y_in);
analysisManager->FillNtupleDColumn(iTuple,13,angle_y-angle_y_in);
}
analysisManager->AddNtupleRow(iTuple);
}
}
@@ -1,59 +0,0 @@
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example ch3
-----------
A. Sytov
INFN Ferrara Division, sytov@fe.infn.it
INTRODUCTION
Example ch3 demonstrates the minimum requirements necessary to integrate the
G4CoherentPairProduction process into a project, along with the G4ChannelingFastSimModel
and G4BaierKatkov models, to simulate the physics of electromagnetic showers in
an oriented crystal.
The key concept is the acceleration of electromagnetic processes (both radiation and
pair production) in an oriented crystal, which can significantly reduce the effective
radiation length [1,2]. Potential applications include electron/positron sources for
accelerator experiments, as well as crystalline oriented calorimeters for collider and
space applications [1,2].
This example serves as a guideline for users on how to add this physics
to their existing Geant4 projects. It includes the minimum necessary options
to incorporate this physics. Specifically, it requires registering
G4FastSimulationPhysics and G4CoherentPairProductionPhysics in the main routine and
adding a few lines of code in DetectorConstruction.
All of this physics does not depend on the physics list. In particular, the
process G4CoherentPairProduction simulates only coherent part of pair production in
the crystal volume, while the incoherent one should be simulated with
standard Geant4 processes.
DESCRIPTION
The example simulates high energy photon interaction (typically above 10 GeV) with
an oriented W crystal with <111> crystal axes aligned along the photon beam direction.
The structure of this example is very similar to the example ch1.
ch3 includes a straight W crystal and a detector positioned behind it.
The incoming photon beam is set up in macro run.mac.
One can also use the Geant4 GUI by launching the code without specifying a macro file.
In this case, the visualization setup is automatically loaded through the vis.mac and
init_vis.mac macro files. The initial beam distribution in this setup will be identical
to that in run.mac.
The example does not include any input of the model or geometry parameters
from the macro to keep it as straightforward as possible. The output is recorded
into the file results.root. It consists of the spectrums of e-, e+
and gamma arriving to the detector. To build these plots, one has to
open this file in root and use Spectrum_electrons->Draw(), Spectrum_positrons->Draw()
and Spectrum_gamma->Draw() for e-, e+ and gamma, respectively.
REFERENCES
[1] V. N. Baier, V. M. Katkov, V. M. Strakhovenko, Electromagnetic Processes
at High Energies in Oriented Single Crystals (World Scientific, Singapore, 1998).
[2] L. Bandiera, V.V. Tikhomirov et al. Phys. Rev. Lett. 121, 021603 (2018).
@@ -1,13 +1,9 @@
///\file "exoticphysics/channeling/ch3/.README.txt"
///\brief Example ch3 README page
/*! \page Examplech3 Example ch3
\page Examplech3 Example ch3
\author Alexei Sytov - INFN Ferrara Division (Italy) \n
sytov@fe.infn.it
\section ch3_s1 INTRODUCTION
## INTRODUCTION
Example ch3 demonstrates the minimum requirements necessary to integrate the
G4CoherentPairProduction process into a project, along with the G4ChannelingFastSimModel
and G4BaierKatkov models, to simulate the physics of electromagnetic showers in
@@ -30,7 +26,7 @@ process G4CoherentPairProduction simulates only coherent part of pair production
the crystal volume, while the incoherent one should be simulated with
standard Geant4 processes.
\section ch3_s2 DESCRIPTION
## DESCRIPTION
The example simulates high energy photon interaction (typically above 10 GeV) with
an oriented W crystal with <111> crystal axes aligned along the photon beam direction.
@@ -49,26 +45,24 @@ from the macro to keep it as straightforward as possible. The output is recorded
into the file results.root. It consists of the spectrums of e-, e+
and gamma arriving to the detector. To build these plots, one has to
open this file in root and use
\verbatim
```cpp
Spectrum_electrons->Draw()
\endverbatim
```
\verbatim
```cpp
Spectrum_positrons->Draw()
\endverbatim
```
and
\verbatim
```cpp
Spectrum_gamma->Draw()
\endverbatim
```
for e-, e+ and gamma, respectively.
\section ch3_s3 REFERENCES
## REFERENCES
-# V. N. Baier, V. M. Katkov, V. M. Strakhovenko. <a href="https://www.worldscientific.com/worldscibooks/10.1142/2216?srsltid=AfmBOopiXOyx7OWz8aPSFSC5kIKSJQs6wGF512V05177LJ_xX3mDfA7s#t=aboutBook">Electromagnetic Processes
at High Energies in Oriented Single Crystals (World Scientific, Singapore, 1998).</a>
-# L. Bandiera, V.V. Tikhomirov et al. <a href="https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.121.021603">Phys. Rev. Lett. 121, 021603 (2018).</a>
*/
@@ -23,11 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ch3.cc
/// \brief Main program of the ch3 example
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Main program of the channeling/ch3 example
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-03-ref-06 (30-June-2025)
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -29,7 +29,6 @@ You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RT)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
@@ -42,13 +41,12 @@ Registered graphics systems are:
OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK)
RayTracerX (RTX)
RayTracerQt (RTQt)
Qt3D (Qt3D)
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG, OGL)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB, TSGZB)
You may choose a graphics system (driver) with a parameter of
the command "/vis/open" or "/vis/sceneHandler/create",
or you may omit the driver parameter and choose at run time:
@@ -158,7 +156,7 @@ Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 0
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Urban
Use built-in Birks satuaration 0
Use built-in Birks saturation 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 0
@@ -295,7 +293,7 @@ hBrems: for proton XStype:1 SubType=3
hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -353,7 +351,7 @@ hBrems: for anti_proton XStype:1 SubType=3
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001 from 7.50618 GeV to 100 TeV
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -385,7 +383,7 @@ hBrems: for kaon+ XStype:1 SubType=3
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -417,7 +415,7 @@ hBrems: for kaon- XStype:1 SubType=3
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001 from 3.94942 GeV to 100 TeV
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -449,7 +447,7 @@ muBrems: for mu+ XStype:1 SubType=3
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -481,7 +479,7 @@ muBrems: for mu- XStype:1 SubType=3
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001 from 0.85 GeV to 100 TeV
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -513,7 +511,7 @@ hBrems: for pi+ XStype:1 SubType=3
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -545,7 +543,7 @@ hBrems: for pi- XStype:1 SubType=3
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001 from 1.11656 GeV to 100 TeV
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
@@ -800,8 +798,8 @@ CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Type of pre-compound model 0
Type of pre-compound inverse x-section 1
Pre-compound model active 1
Pre-compound excitation low energy 100 keV
Pre-compound excitation high energy 30 MeV
Pre-compound excitation low energy 0.1 MeV
Pre-compound excitation high energy 15 MeV
Angular generator for pre-compound model 1
Use NeverGoBack option for pre-compound model 0
Use SoftCutOff option for pre-compound model 0
@@ -815,9 +813,8 @@ Type of de-excitation inverse x-section 3
Type of de-excitation factory Evaporation+GEM
Number of de-excitation channels 68
Type of Fermi BreakUp model ModelVI
Min excitation energy 10 eV
Min energy per nucleon for multifragmentation 200 GeV
Limit excitation energy for Fermi BreakUp 20 MeV
Min excitation energy 0.01 keV
Min energy per nucleon for multifragmentation 2e+05 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 0
@@ -932,4 +929,4 @@ Max 2J for sampling of angular correlations 10
Graphics systems deleted.
Visualization Manager deleting...
Execution terminated
User=65.330000s Real=74.053430s Sys=0.140000s
User=63.740000s Real=75.225054s Sys=0.130000s
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
@@ -23,10 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
@@ -24,9 +24,7 @@
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
@@ -25,8 +25,6 @@
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
@@ -25,8 +25,6 @@
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
@@ -25,8 +25,6 @@
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
@@ -25,8 +25,6 @@
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
@@ -25,8 +25,6 @@
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "G4Event.hh"
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file SteppingAction.cc
/// \brief Implementation of the SteppingAction class
@@ -0,0 +1,68 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.21)
project(ch5)
#----------------------------------------------------------------------------
# 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
# Setup include directory for this project
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
file(GLOB_RECURSE macros RELATIVE ${PROJECT_SOURCE_DIR} macros/*.mac)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
add_executable(ch5 ch5.cc ${sources} ${headers})
target_link_libraries(ch5 ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# Copy all macro/scripts to the build directory.
# This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
foreach(_file ${macros})
configure_file(
${PROJECT_SOURCE_DIR}/${_file}
${PROJECT_BINARY_DIR}/${_file}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#add_custom_target(ch5 DEPENDS ch5)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
install(TARGETS ch5 DESTINATION bin)
#----------------------------------------------------------------------------
# Create directiories in the binary path
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/output)
@@ -0,0 +1,9 @@
# Category ch5 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!
## 2025-10-25 Alexei Sytov and Gianfranco Paternò (ch5-V11-03-03)
- First implementation
@@ -0,0 +1,104 @@
\page Examplech5 Example ch5
\author G. Paternò, A. Sytov - INFN Ferrara Division (Italy) \n
paterno@fe.infn.it, sytov@fe.infn.it
### INTRODUCTION
Example ch5 is an application for simulating a positron source.
Although the conventional approach based on an **amorphous target** is possible,
the application is primarily designed to simulate positron sources based on oriented crystals.
In the latter case, both the **single-crystal** and the **hybrid scheme**
can be investigated [[1]](#1).
### DESCRIPTION
One or two main volumes can be present in the setup, depending if the user wants to consider
a conventional/single-oriented-crystal scheme [[2]](#2) or the hybrid scheme [[3]](#3).
In the hybrid scheme, the first volume is an oriented crystal (typically along a crystalline axis)
that serves as a radiator, whereas the second volume is a randomly oriented crystal
(equivalent to an amorphous volume) where the photons emitted by the radiator are converted
into positrons.
The converter can be composed of small spheres (the so called _granular target_ - GT)
so as to reduce the energy deposition and the thermomechanical stress.
In addition, from _one to three scoring screens_ are present to score the particles
leaving or enetering the aformentioned volumes. In particular the scoring screen identified
with number 2 is positioned just downstram of the radiator, while scoring screens 0 and 1
are positioned just upstream and downstream of the converter, respectively.
In a conventional or a single crystal scheme, only the scoring screen 0 is present
and it is automatically positioned just downstream of the single volume positioned.
An **advanced hybrid scheme that includes an ideal bending magnet or a collimator**
to remove the charged particle or limit the number of particles impinging on the converter,
respectively, **can also be considered** [[1]](#1).
Through a set of custom macro commands, the user can define the geometry ad the scoring strategy.
A description of all the available options is provided in _run.mac_ (inside the macros folder).
As an example, the Orientetional Coherent (OC) effects (including radiation) in crystals
(enabled by G4ChannelingFastSimModel), which by deafult are activated, can be deactivated
through the command: `/crystal/setOCeffects false`.
The back surface of the radiator crystal is placed at z=0 (with z as the beam direction),
while the front position of the possible converter can be set up via macro.
Various macros are available to simulate different configurations: run_conventional.mac,
run_single_crystal.mac, run_hybrid.mac, and run_hybrid_granular_target.mac
for a conventional, single oriented crystal and hybrid with solid or granular target,
respectively. The parameters set in these macros come from the study carried out for
the positron source of FCC-ee [[2]](#2).
However, they can be changed to investigate different cases.
The output is recorded into a root file whose name can be set by macro
(default is output/output.root), as a set of ntuples.
The ntuple "scoring_ntuple" is used to score the features of the particles impinging
on the scoring screens. It contains the following variables (columns):
"screenID", "particle", "x", "y", "px", "py", "pz", "t", "eventID"
which represents:
- the screen ID (column 0),
- the particle name (column 1),
- the impinging x,y coordinates in mm (columns 2,3),
- the momentum components (MeV) of the particle (columns 4-6),
- the time of arrival of the particle in ns (column 7),
- the event ID (column 9).
The ntuple "edep_rad" and "edep_conv" are used to store the energy deposited (MeV)
in radiator and converter, respectively, thus they contain simply the variables:
"edep", "eventID"
The ntuple "edep_spheres" is instead used to store the energy deposited (MeV) inside the spheres
of a granular target/converter. It contains the variables:
"volumeID", "edep", "eventID"
where volumeID identify the single sphere inside the target. This ntuple is filled only if the
target is indeed granular (it can be activated through the command /det/setGranularConverter true).
Finally, the ntuple "scoring_ntuple2" is used to score the features of the particles leaving
the radiator or the target/converter. It contains the following variables (columns):
"particle", "x", "y", "z", "px", "py", "pz", "t", "eventID", "trackID"
which represents:
- the particle name (column 0),
- the impinging x,y,z coordinates in mm (columns 1-3),
- the momentum components (MeV) of the particle (columns 4-6),
- the time of arrival of the particle in ns (column 7),
- the event ID (column 8),
- the track ID (column 9).
The three-dimensional distributions of energy deposition in the converter
(radiator if the converter is not present) can be scored through the standard
box mesh scorer defined in the attached macros.
To visualize these data one should use the python notebook analysis_ch5.ipynb.
Once the example is build, an interactive session with the graphic user intergace (GUI)
showing a defualt geometry set through macro geom.mac can be run by simply typing
`./ch5` in a terminal after moving inside the build directory.
### REFERENCES
<a id="1">[1]</a> M. Soldani, et al. NIM A 1058 (2024): 168828 (https://doi.org/10.1016/j.nima.2023.168828).
<a id="2">[2]</a> F. Alharthi et al. NIM A 1075 (2025): 170412 (https://doi.org/10.1016/j.nima.2025.170412).
<a id="3">[3]</a> N. Canale et al. NIM A 1075 (2025): 170342 (https://doi.org/10.1016/j.nima.2025.170342).
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file ch5.cc
/// \brief Main program of the ch5 example
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "G4ScoringManager.hh"
#include "G4AnalysisManager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "FTFP_BERT.hh"
#include "G4FastSimulationPhysics.hh"
#include "G4CoherentPairProductionPhysics.hh"
#include "Randomize.hh"
#include <ctime>
#include "G4Timer.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Get current time
G4Timer* theTimer = new G4Timer();
theTimer->Start();
//Set random number generator
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
G4String option_file = "random.in";
std::ifstream fin(option_file);
long random_seed = 0;
if (fin.is_open()) {
fin >> random_seed;
fin.close();
}
random_seed += time(NULL);
G4cout << "Random seed: " << random_seed << G4endl;
CLHEP::HepRandom::setTheSeed(random_seed);
//Use G4SteppingVerboseWithUnits
G4int precision = 4;
G4SteppingVerbose::UseBestUnit(precision);
//Construct the run manager
int vNumberOfThreads = 1;
if (argc > 2) {
vNumberOfThreads = atoi(argv[2]);
}
auto* runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(vNumberOfThreads);
G4cout << "### Using " << vNumberOfThreads << " threads ###" << G4endl;
//Activate UI-command based scorer
G4ScoringManager* scManager = G4ScoringManager::GetScoringManager();
scManager->SetVerboseLevel(0);
//Set mandatory initialization classes
//Set the Geometry
runManager->SetUserInitialization(new DetectorConstruction);
//Physics list
G4VModularPhysicsList* physicsList = new FTFP_BERT;
// -- Create helper tool used to activate the fast simulation
G4FastSimulationPhysics* fastSimulationPhysics = new G4FastSimulationPhysics();
fastSimulationPhysics->BeVerbose();
// -- activation of fast simulation for particles having fast simulation models
// -- attached in the mass geometry
fastSimulationPhysics->ActivateFastSimulation("e-");
fastSimulationPhysics->ActivateFastSimulation("e+");
fastSimulationPhysics->ActivateFastSimulation("pi-");
fastSimulationPhysics->ActivateFastSimulation("pi+");
fastSimulationPhysics->ActivateFastSimulation("mu-");
fastSimulationPhysics->ActivateFastSimulation("mu+");
fastSimulationPhysics->ActivateFastSimulation("proton");
fastSimulationPhysics->ActivateFastSimulation("anti_proton");
fastSimulationPhysics->ActivateFastSimulation("GenericIon");
// -- Attach the fast simulation physics constructor to the physics list
physicsList->RegisterPhysics(fastSimulationPhysics);
/*
//Coherent pair production model
G4CoherentPairProductionPhysics* coherentPairProductionPhysics =
new G4CoherentPairProductionPhysics();
physicsList->RegisterPhysics(coherentPairProductionPhysics);
*/
physicsList->SetVerboseLevel(1);
runManager->SetUserInitialization(physicsList);
//Set user action classes
runManager->SetUserInitialization(new ActionInitialization());
//Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (argc != 1) {
//Batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
} else {
//Visualization manager
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
//Define UI session for interactive mode
G4UIExecutive* ui = new G4UIExecutive(argc,argv);
UImanager->ApplyCommand("/control/execute macros/init_vis.mac");
if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute macros/gui.mac");
ui->SessionStart();
delete ui;
delete visManager;
}
//Job termination
delete runManager;
theTimer->Stop();
G4cout << "Execution terminated" << G4endl;
G4cout << (*theTimer) << G4endl;
delete theTimer;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,870 @@
Random seed: 1764223862
Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type...
############################################
!!! WARNING - FPE detection is activated !!!
############################################
################################
!!! G4Backtrace is activated !!!
################################
**************************************************************
Geant4 version Name: geant4-11-04-ref-00 (5-December-2025)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/
**************************************************************
### Using 1 threads ###
<<< Geant4 Physics List simulation engine: FTFP_BERT
### DetectorConstruction::Construct() ###
This is a hybrid positron source!
Checking overlaps for volume Crystal:0 (G4Box) ... OK!
Radiator Crystal set!
Crystal material: G4_W
Crystal size: 20x20x2 mm3
RadiatorZ: -1 mm
Checking overlaps for volume Converter:0 (G4Box) ... OK!
RadiatorConverterSepDistance: 500 mm
ConverterZ: 504.03 mm
Converter material: G4_W
Converter size: 100x100x8 mm3
VirtualDetector0Z: 500.025 mm
VirtualDetector1Z: 508.035 mm
VirtualDetector2Z: 0.005 mm
Checking overlaps for volume VirtualDetector0:0 (G4Box) ... OK!
Checking overlaps for volume VirtualDetector1:1 (G4Box) ... OK!
Checking overlaps for volume VirtualDetector2:2 (G4Box) ... OK!
=======================================================================
====== Crystal lattice data ========
=======================================================================
Crystal material: W
Crystal axes: <111>
Oriented Crystal effects set through FastSim model
Crystal bending angle: 0 rad
Crystal Lattice: <111>
Crystal AngleX: 0 rad
Crystal AngleY: 0 rad
fParticleLEth: 1000 MeV
fLindhardAngles: 10
ActivateRadiationModel: 1
G4BaierKatkov model is activated.
SamplingPhotonsNumber: 150
NSmallTrajectorySteps: 10000
fRadiactionAngleFactor: 4
fSinglePhotonRadProbLimit: 0.25
Low Eenergy threshold to emit photons and record their energy: 1 MeV
### End of DetectorConstruction ###
--- G4CoupledTransportation is used
hInelastic FTFP_BERT : threshold between BERT and FTFP is over the interval
for pions : 3 to 6 GeV
for kaons : 3 to 6 GeV
for proton : 3 to 6 GeV
for neutron : 3 to 6 GeV
### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0
GenericIon : fastSimProcess_massGeom[geom:World]
anti_proton : fastSimProcess_massGeom[geom:World]
e+ : fastSimProcess_massGeom[geom:World]
e- : fastSimProcess_massGeom[geom:World]
mu+ : fastSimProcess_massGeom[geom:World]
mu- : fastSimProcess_massGeom[geom:World]
pi+ : fastSimProcess_massGeom[geom:World]
pi- : fastSimProcess_massGeom[geom:World]
proton : fastSimProcess_massGeom[geom:World]
.... G4ScoringMessenger::MeshBinCommand - G4ScoringBox
G4ScoringManager has 1 scoring meshes.
G4ScoringBox : boxMesh1 --- Shape: Box mesh
Size (x, y, z): (5, 5, 0.4) [cm]
# of segments: (401, 401, 33)
displacement: (0, 0, 50.403) [cm]
registered primitve scorers :
0 Edep
.... G4ScoringMessenger::MeshBinCommand - G4ScoringBox
G4ScoringManager has 2 scoring meshes.
G4ScoringBox : boxMesh1 --- Shape: Box mesh
Size (x, y, z): (5, 5, 0.4) [cm]
# of segments: (401, 401, 33)
displacement: (0, 0, 50.403) [cm]
registered primitve scorers :
0 Edep
G4ScoringBox : boxMesh2 --- Shape: Box mesh
Size (x, y, z): (1, 1, 0.1) [cm]
# of segments: (81, 81, 9)
displacement: (0, 0, -0.1) [cm]
registered primitve scorers :
0 Edep
=======================================================================
====== Electromagnetic Physics Parameters ========
=======================================================================
LPM effect enabled 1
Enable creation and use of sampling tables 0
Apply cuts on all EM processes 0
Use combined TransportationWithMsc Disabled
Use general process 1
Enable linear polarisation for gamma 0
Enable photoeffect sampling below K-shell 1
Enable sampling of quantum entanglement 0
X-section factor for integral approach 0.8
Min kinetic energy for tables 100 eV
Max kinetic energy for tables 100 TeV
Number of bins per decade of a table 7
Verbose level 1
Verbose level for worker thread 0
Bremsstrahlung energy threshold above which
primary e+- is added to the list of secondary 100 TeV
Bremsstrahlung energy threshold above which primary
muon/hadron is added to the list of secondary 100 TeV
Positron annihilation at rest model SimplePositronium
Enable 3 gamma annihilation on fly 0
Lowest triplet kinetic energy 1 MeV
Enable sampling of gamma linear polarisation 0
5D gamma conversion model type 0
5D gamma conversion model on isolated ion 0
Use RiGe 5D e+e- pair production model by muons 0
Livermore data directory epics_2017
=======================================================================
====== Ionisation Parameters ========
=======================================================================
Step function for e+- (0.2, 1 mm)
Step function for muons/hadrons (0.2, 0.1 mm)
Step function for light ions (0.2, 0.1 mm)
Step function for general ions (0.2, 0.1 mm)
Lowest e+e- kinetic energy 1 keV
Lowest muon/hadron kinetic energy 1 keV
Use ICRU90 data 0
Fluctuations of dE/dx are enabled 1
Type of fluctuation model for leptons and hadrons Urban
Use built-in Birks saturation 0
Build CSDA range enabled 0
Use cut as a final range enabled 0
Enable angular generator interface 0
Max kinetic energy for CSDA tables 1 GeV
Max kinetic energy for NIEL computation 0 eV
Linear loss limit 0.01
Read data from file for e+e- pair production by mu 0
=======================================================================
====== Multiple Scattering Parameters ========
=======================================================================
Type of msc step limit algorithm for e+- 1
Type of msc step limit algorithm for muons/hadrons 0
Msc lateral displacement for e+- enabled 1
Msc lateral displacement for muons and hadrons 0
Urban msc model lateral displacement alg96 1
Range factor for msc step limit for e+- 0.04
Range factor for msc step limit for muons/hadrons 0.2
Geometry factor for msc step limitation of e+- 2.5
Safety factor for msc step limit for e+- 0.6
Skin parameter for msc step limitation of e+- 1
Lambda limit for msc step limit for e+- 1 mm
Use Mott correction for e- scattering 0
Factor used for dynamic computation of angular
limit between single and multiple scattering 1
Fixed angular limit between single
and multiple scattering 3.1416 rad
Upper energy limit for e+- multiple scattering 100 MeV
Type of electron single scattering model 0
Type of nuclear form-factor 1
Screening factor 1
=======================================================================
phot: for gamma SubType=12 BuildTable=0
LambdaPrime table from 200 keV to 100 TeV in 61 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermorePhElectric : Emin= 0 eV Emax= 100 TeV SauterGavrila Fluo
compt: for gamma SubType=13 BuildTable=1
Lambda table from 100 eV to 1 MeV, 7 bins/decade, spline: 1
LambdaPrime table from 1 MeV to 100 TeV in 56 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
Klein-Nishina : Emin= 0 eV Emax= 100 TeV
conv: for gamma SubType=14 BuildTable=1
Lambda table from 1.022 MeV to 100 TeV, 18 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
BetheHeitlerLPM : Emin= 0 eV Emax= 100 TeV ModifiedTsai
Rayl: for gamma SubType=11 BuildTable=1
Lambda table from 100 eV to 150 keV, 7 bins/decade, spline: 0
LambdaPrime table from 150 keV to 100 TeV in 62 bins
===== EM models for the G4Region DefaultRegionForTheWorld ======
LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator
msc: for e- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
eIoni: for e- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 0 eV Emax= 100 TeV
eBrem: for e- XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
CoulombScat: for e- XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for e+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV
StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm
eIoni: for e+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
MollerBhabha : Emin= 0 eV Emax= 100 TeV
eBrem: for e+ XStype:4 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000
===== EM models for the G4Region DefaultRegionForTheWorld ======
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
===== EM models for the G4Region DefaultRegionForTheWorld ======
eplus2gg : Emin= 0 eV Emax= 100 TeV
CoulombScat: for e+ XStype:1 SubType=1 BuildTable=1
Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 100 MeV Emax= 100 TeV
msc: for proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for proton XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV
hBrems: for proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for GenericIon SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
ionIoni: for GenericIon XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV
msc: for alpha SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
UrbanMsc : Emin= 0 eV Emax= 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
ionIoni: for alpha XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.02
===== EM models for the G4Region DefaultRegionForTheWorld ======
BraggIon : Emin= 0 eV Emax=7.9452 MeV
BetheBloch : Emin=7.9452 MeV Emax= 100 TeV
msc: for anti_proton SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for anti_proton XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 2 MeV
BetheBloch : Emin= 2 MeV Emax= 100 TeV
hBrems: for anti_proton XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for anti_proton XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 17x1001, from 7.50618 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for anti_proton XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for kaon+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=1.05231 MeV
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV
hBrems: for kaon+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for kaon- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for kaon- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=1.05231 MeV
BetheBloch : Emin=1.05231 MeV Emax= 100 TeV
hBrems: for kaon- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for kaon- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 18x1001, from 3.94942 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for kaon- XStype:1 SubType=1 BuildTable=1
Used Lambda table of kaon+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
muIoni: for mu+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax= 200 keV
MuBetheBloch : Emin= 200 keV Emax= 100 TeV
muBrems: for mu+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for mu- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
muIoni: for mu- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax= 200 keV
MuBetheBloch : Emin= 200 keV Emax= 100 TeV
muBrems: for mu- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
muPairProd: for mu- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 21x1001, from 0.85 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for mu- XStype:1 SubType=1 BuildTable=1
Used Lambda table of mu+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi+ SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for pi+ XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
Bragg : Emin= 0 eV Emax=297.505 keV
BetheBloch : Emin=297.505 keV Emax= 100 TeV
hBrems: for pi+ XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi+ XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi+ XStype:1 SubType=1 BuildTable=1
Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
msc: for pi- SubType= 10
===== EM models for the G4Region DefaultRegionForTheWorld ======
WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV
StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm
hIoni: for pi- XStype:3 SubType=2
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
StepFunction=(0.2, 0.1 mm), integ: 3, fluct: 1, linLossLim= 0.01
===== EM models for the G4Region DefaultRegionForTheWorld ======
ICRU73QO : Emin= 0 eV Emax=297.505 keV
BetheBloch : Emin=297.505 keV Emax= 100 TeV
hBrems: for pi- XStype:1 SubType=3
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi
hPairProd: for pi- XStype:1 SubType=4
dE/dx and range tables from 100 eV to 100 TeV in 84 bins
Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1
Sampling table 20x1001, from 1.11656 GeV to 100 TeV
===== EM models for the G4Region DefaultRegionForTheWorld ======
hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi
CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1
Used Lambda table of pi+
ThetaMin(p) < Theta(degree) < 180, pLimit(GeV^1)= 0.139531
===== EM models for the G4Region DefaultRegionForTheWorld ======
eCoulombScattering : Emin= 0 eV Emax= 100 TeV
====================================================================
HADRONIC PROCESSES SUMMARY (verbose level 1)
-----------------------------------------------------------------------
Hadronic Processes for neutron
Process: hadElastic
Model: hElasticCHIPS: 0 eV ---> 100 TeV
Cr_sctns: G4NeutronElasticXS: 0 eV ---> 100 TeV
Process: neutronInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: G4NeutronInelasticXS: 0 eV ---> 100 TeV
Process: nCapture
Model: nRadCapture: 0 eV ---> 100 TeV
Cr_sctns: G4NeutronCaptureXS: 0 eV ---> 100 TeV
Process: nKiller
-----------------------------------------------------------------------
Hadronic Processes for B-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: B-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for D-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: D-Inelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for GenericIon
Process: ionInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
-----------------------------------------------------------------------
Hadronic Processes for He3
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: He3Inelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
-----------------------------------------------------------------------
Hadronic Processes for alpha
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: alphaInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
-----------------------------------------------------------------------
Hadronic Processes for anti_He3
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_He3Inelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_alpha
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_alphaInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_deuteron
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_deuteronInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-------------------------------------------------------------------------
Hadronic Processes for anti_hypertriton
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: anti_lambdaInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_neutron
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
Model: AntiAElastic: 100 MeV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_neutronInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_proton
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100.1 MeV
Model: AntiAElastic: 100 MeV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_protonInelastic
Model: FTFP: 0 eV ---> 100 TeV
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for anti_triton
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n
Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: anti_tritonInelastic
Model: FTFP: 0 eV /n ---> 100 TeV/n
Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV
Process: hFritiofCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for deuteron
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: dInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
-----------------------------------------------------------------------
Hadronic Processes for e+
Process: positronNuclear
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for e-
Process: electronNuclear
Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for gamma
Process: photonNuclear
Model: GammaNPreco: 0 eV ---> 200 MeV
Model: BertiniCascade: 199 MeV ---> 6 GeV
Model: TheoFSGenerator: 3 GeV ---> 100 TeV
Cr_sctns: GammaNuclearXS: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for kaon+
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: kaon+Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for kaon-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: kaon-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for lambda
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: lambdaInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for mu+
Process: muonNuclear
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for mu-
Process: muonNuclear
Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV
Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV
Process: muMinusCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for pi+
Process: hadElastic
Model: hElasticGlauber: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: pi+Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for pi-
Process: hadElastic
Model: hElasticGlauber: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: pi-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for proton
Process: hadElastic
Model: hElasticCHIPS: 0 eV ---> 100 TeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
Process: protonInelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV
-----------------------------------------------------------------------
Hadronic Processes for sigma-
Process: hadElastic
Model: hElasticLHEP: 0 eV ---> 100 TeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: sigma-Inelastic
Model: FTFP: 3 GeV ---> 100 TeV
Model: BertiniCascade: 0 eV ---> 6 GeV
Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV
Process: hBertiniCaptureAtRest
-----------------------------------------------------------------------
Hadronic Processes for triton
Process: hadElastic
Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
Process: tInelastic
Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n
Model: FTFP: 3 GeV/n ---> 100 TeV/n
Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV
=======================================================================
====== Geant4 Native Pre-compound Model Parameters ========
=======================================================================
Type of pre-compound model 0
Type of pre-compound inverse x-section 1
Pre-compound model active 1
Pre-compound excitation low energy 0.1 MeV
Pre-compound excitation high energy 15 MeV
Angular generator for pre-compound model 1
Use NeverGoBack option for pre-compound model 0
Use SoftCutOff option for pre-compound model 0
Use CEM transitions for pre-compound model 1
Use GNASH transitions for pre-compound model 0
Use HETC submodel for pre-compound model 0
=======================================================================
====== Nuclear De-excitation Module Parameters ========
=======================================================================
Type of de-excitation inverse x-section 3
Type of de-excitation factory Evaporation+GEM
Number of de-excitation channels 68
Type of Fermi BreakUp model ModelVI
Min excitation energy 0.01 keV
Min energy per nucleon for multifragmentation 2e+05 MeV
Level density (1/MeV) 0.075
Use simple level density model 1
Use discrete excitation energy of the residual 0
Time limit for long lived isomeres 1 ns
Isomer production flag 1
Internal e- conversion flag 1
Store e- internal conversion data 1
Correlated gamma emission flag 0
Max 2J for sampling of angular correlations 10
=======================================================================
========= Table of registered couples ============================
Index : 0 used in the geometry : Yes
Material : Vacuum
Range cuts : gamma 700 um e- 700 um e+ 700 um proton 700 um
Energy thresholds : gamma 990 eV e- 990 eV e+ 990 eV proton 70 keV
Region(s) which use this couple :
DefaultRegionForTheWorld
Index : 1 used in the geometry : Yes
Material : G4_W
Range cuts : gamma 700 um e- 700 um e+ 700 um proton 700 um
Energy thresholds : gamma 97.7189 keV e- 1.64904 MeV e+ 1.53897 MeV proton 70 keV
Region(s) which use this couple :
DefaultRegionForTheWorld
Crystal
==================================================================
### Run 0 starts.
--------------------Begin of Global Run-----------------------
Number of events to be processed: 10
--------------------------------------------------------------
--> Event 0 starts.
Run terminated.
Run Summary
Number of events processed : 10
User=122.680000s Real=133.614006s Sys=0.060000s
--------------------End of Global Run-----------------------
The run had 10 events
Edep in the Radiator Crystal (made of G4_W): 110.52547 +/- 21.888899 MeV
------------------------------------------------------------
The run consisted of 10 particles
------------------------------------------------------------
================== Deleting memory pools ===================
Number of memory pools allocated: 12 of which, static: 0
Dynamic pools deleted: 12 / Total memory freed: 0.12 MB
============================================================
Execution terminated
User=127.940000s Real=151.226294s Sys=11.020000s
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Action initialization class.
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization() = default;
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,182 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file DetectorConstruction.hh
/// \brief Description of the DetectorConstruction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include <vector>
#include "G4Region.hh"
#include "G4PVPlacement.hh"
#include "DetectorConstructionMessenger.hh"
#include "G4ChannelingFastSimModel.hh"
#define NSpheresMax 10000
class G4VPhysicalVolume;
class G4LogicalVolume;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Detector construction class to define materials and geometry.
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction() override = default;
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
//method to get the scoring volumes
std::vector<G4LogicalVolume*> GetScoringVolume() const {
return fScoringVolume;}
//method to set if it is a hybrid source or not
void SetHybridSource(G4bool val) {fHybridSource = val;}
//methods to set the Crystal (Radiator) features
void SetCrystalMaterial(G4String val) {fCrystalMaterialStr = val;}
void SetCrystalSize(G4ThreeVector val) {fCrystalSize = val;}
void SetCrystalBendingAngle(G4double val) {fBendingAngle = val;}
void SetCrystalLattice(G4String val) {fLattice = val;}
void SetCrystalAngleX(G4double val) {fAngleX = val;}
void SetCrystalAngleY(G4double val) {fAngleY = val;}
G4double GetCrystalZ() const {return fCrystalZ;}
void SetRadiationModel(G4bool val) {fActivateRadiationModel = val;}
void SetOCeffects(G4bool val) {fActivateOCeffects = val;}
G4bool GetOCeffects() const {return fActivateOCeffects;}
G4LogicalVolume* GetCrystalVolume() const {return fCrystalLogic;}
void SetPotentialPath(const G4String path){fPotentialPath = path;}
//method to set/get the Converter (Target) features
void SetRadiatorConverterSepDistance(G4double val) {
fRadiatorConverterSepDistance = val;}
G4double GetRadiatorConverterSepDistance() const {
return fRadiatorConverterSepDistance;}
void SetConverterSize(G4ThreeVector val) {fConverterSize = val;}
void SetConverterMaterial(G4String val) {fConverterMaterialStr = val;}
void SetGranularConverter(G4bool val) {fGranularConverter = val;}
void SetSphereRadius(G4double val) {fSphereRadius = val;}
G4int GetNSpheres() const {return fNSpheres;}
G4LogicalVolume* GetConverterVolume() const {return fConverterLogic;}
//methods to set the Magnetic field features
void SetMagneticField(G4bool val) {fSetMagneticField = val;}
void SetFieldValue(G4double val) {fFieldValue = val;}
void SetFieldRegionLength(G4double val) {fFieldRegionLength = val;}
//methods to set the Collimator features
void SetCollimator(G4bool val) {fSetCollimator = val;}
void SetCollimatorHole(G4String val) {fCollimatorHole = val;}
void SetCollimatorAperture(G4double val) {fCollimatorAperture = val;}
void SetCollimatorThickness(G4double val) {fCollimatorThickness = val;}
void SetCollimatorSide(G4double val) {fCollimatorSide = val;}
void SetRadiatorCollimatorSepDistance(G4double val) {
fRadiatorCollimatorSepDistance = val;}
G4double GetRadiatorCollimatorSepDistance() const {
return fRadiatorCollimatorSepDistance;}
//methods to set/Get the Virtual Detector features
void SetVirtualDetectorSize(G4ThreeVector val) {fVirtualDetectorSize = val;}
std::vector<G4ThreeVector> GetVirtualDetectorPositionVector() const {
return fVirtualDetectorPositionVector;}
//methods to set and get ScoreCrystalExit (27/09/2024)
void SetScoringCrystalExit(G4bool bval) {fScoringCrystalExit = bval;}
G4bool GetScoringCrystalExit() const {return fScoringCrystalExit;}
protected:
std::vector<G4LogicalVolume*> fScoringVolume; //for spheres only
private:
DetectorConstructionMessenger* fMessenger;
G4bool fHybridSource = true;
G4Region* fCrystalRegion{nullptr};
G4LogicalVolume* fCrystalLogic{nullptr};
G4String fCrystalMaterialStr = "W";
G4Material* fCrystalMaterial{nullptr};
G4ThreeVector fCrystalSize = G4ThreeVector(7.*mm, 7.*mm, 2.*mm);
G4double fBendingAngle = 0.e-6; //rad
G4String fLattice = "<111>";
G4double fAngleX = 0.e-6; //rad
G4double fAngleY = 0.e-6; //rad
G4double fCrystalZ = 0.;
G4bool fActivateRadiationModel = true;
G4bool fActivateOCeffects = true;
G4String fPotentialPath = "";
G4double fRadiatorConverterSepDistance = 60.*cm;
G4ThreeVector fConverterSize = G4ThreeVector(199.75*mm, 199.75*mm, 11.6*mm);
G4double fConverterZ = 0.;
G4LogicalVolume* fConverterLogic{nullptr};
G4bool fGranularConverter = false;
G4String fConverterMaterialStr = "W";
G4Material* fConverterMaterial{nullptr};
G4double fSphereRadius = 1.1*mm;
G4LogicalVolume* fSphereLogic[NSpheresMax];
G4int fNSpheres = 0;
G4bool fConverter = true;
G4bool fSetMagneticField = false;
G4double fFieldValue = 100.*tesla;
G4double fFieldRegionLength = 90.*cm;
G4LogicalVolume* fMFlogic{nullptr};
G4bool fSetCollimator = false;
G4double fCollimatorAperture = 2.*mm;
G4String fCollimatorHole = "squared";
G4double fCollimatorThickness = 50.*cm;
G4double fCollimatorSide = 2.5*m;
G4double fRadiatorCollimatorSepDistance = 5.*cm;
G4LogicalVolume* fCollimatorLogic{nullptr};
G4ThreeVector fVirtualDetectorSize = G4ThreeVector(40.*cm, 40.*cm, 0.01*mm);
std::vector<G4ThreeVector> fVirtualDetectorPositionVector;
G4LogicalVolume* fVirtualDetectorLogic0{nullptr};
G4LogicalVolume* fVirtualDetectorLogic1{nullptr};
G4LogicalVolume* fVirtualDetectorLogic2{nullptr};
G4bool fScoringCrystalExit = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file DetectorConstructionMessenger.hh
/// \brief Description of the DetectorConstruction messenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstructionMessenger_h
#define DetectorConstructionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Detector construction messenger class to define custom commands
/// to control the geometry and other settings.
class DetectorConstructionMessenger: public G4UImessenger
{
public:
DetectorConstructionMessenger(DetectorConstruction* mpga);
~DetectorConstructionMessenger();
void SetNewValue(G4UIcommand* command, G4String newValues) override;
private:
DetectorConstruction* fDetector{nullptr};
G4UIcmdWithABool* fHybridSourceCmd{nullptr};
G4UIdirectory* fCmdDir{nullptr};
G4UIcmdWithAString* fCrystalMaterialCmd{nullptr};
G4UIcmdWith3VectorAndUnit* fCrystalSizeCmd{nullptr};
G4UIcmdWithAString* fCrystalLatticeCmd{nullptr};
G4UIcmdWithADouble* fCrystalAngleXCmd{nullptr};
G4UIcmdWithADouble* fCrystalAngleYCmd{nullptr};
G4UIcmdWithADouble* fCrystalBendingAngleCmd{nullptr};
G4UIcmdWithABool* fRadModelCmd{nullptr};
G4UIcmdWithABool* fOCeffectsCmd{nullptr};
G4UIcmdWithAString* fPotentialPathCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fRadiatorConverterSepDistanceCmd{nullptr};
G4UIcmdWith3VectorAndUnit* fConverterSizeCmd{nullptr};
G4UIcmdWithABool* fGranularConverterCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fSphereRadiusCmd{nullptr};
G4UIcmdWithAString* fConverterMaterialCmd{nullptr};
G4UIcmdWithABool* fMagneticFieldCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fFieldValueCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fFieldRegionLengthCmd{nullptr};
G4UIcmdWithABool* fCollimatorCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fCollimatorApertureCmd{nullptr};
G4UIcmdWithAString* fCollimatorHoleCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fCollimatorThicknessCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fCollimatorSideCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fRadiatorCollimatorSepDistanceCmd{nullptr};
G4UIcmdWith3VectorAndUnit* fVirtualDetectorSizeCmd{nullptr};
G4UIcmdWithABool* fScoringCrystalExitCmd{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file EventAction.hh
/// \brief Definition of the EventAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#include <iostream>
#include <fstream>
#include <map>
#include "Run.hh"
#include "G4RunManager.hh"
class RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Event action class. Used to score the energy deposited per event in some
/// important volumes (radiator, converter and spheres of a granluar traget).
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction() override = default;
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
//custom methods
inline void SetVerbose(G4int val) {fVerboseLevel = val;}
inline G4int GetVerbose() const {return fVerboseLevel;}
G4int GetEventID() const {
return G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
}
void AddEdepRad(G4double val) {fEdepRad += val;}
void AddEdepConv(G4double val) {fEdepConv += val;}
void AddEdepInSpheres(G4int, G4double);
private:
G4int fSensitiveDetector_ID = -1;
G4int fVerboseLevel = 0;
G4double fEdepRad = 0.;
G4double fEdepConv = 0.;
G4int fNSpheres = 0.;
std::map<G4int,G4double> fEdepSpheres;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file PrimaryGeneratorAction.hh
/// \brief Description of the PrimaryGeneratorAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "PrimaryGeneratorActionMessenger.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
class G4GeneralParticleSource;
class G4ParticleGun;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// PrimaryGeneratorAction class. We have both the GPS and a Particle Gun.
/// A set of custom commands based on the Particle Gun are defined to better
/// simulate a bunch of particles in a particle accelerator.
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
void GeneratePrimaries(G4Event*) override;
void SetUseGPS(G4bool vBool) {fUseGPS = vBool;};
void SetType(G4String val) {fType = val;}
void SetEnergy(G4double val) {fEnergy = val;}
void SetRelSigmaEnergy(G4double val) {fRelSigmaEnergy = val;}
void SetX(G4double val) {fX = val;}
void SetY(G4double val) {fY = val;}
void SetZ(G4double val) {fZ = val;}
void SetT(G4double val) {fT = val;}
void SetXp(G4double val) {fXp = val;}
void SetYp(G4double val) {fYp = val;}
void SetSigmaX(G4double val) {fSigmaX = val;}
void SetSigmaY(G4double val) {fSigmaY = val;}
void SetSigmaZ(G4double val) {fSigmaZ = val;}
void SetSigmaT(G4double val) {fSigmaT = val;}
void SetSigmaXp(G4double val) {fSigmaXp = val;}
void SetSigmaYp(G4double val) {fSigmaYp = val;}
private:
PrimaryGeneratorActionMessenger* fMessenger{nullptr};
G4GeneralParticleSource* fGPS{nullptr};
G4ParticleGun* fGun{nullptr};
G4bool fUseGPS = false;
G4String fType = "e-";
G4double fEnergy = 2.86*GeV;
G4double fRelSigmaEnergy = 1.e-3;
G4double fX = 0*mm;
G4double fY = 0*mm;
G4double fZ = -30*mm;
G4double fT = 0*ns;
G4double fXp = 0;
G4double fYp = 0;
G4double fSigmaX = 1.*mm;
G4double fSigmaY = 1.*mm;
G4double fSigmaZ = 1.*mm;
G4double fSigmaT = 0.*ns;
G4double fSigmaXp = 1.e-5;
G4double fSigmaYp = 1.e-5;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file PrimaryGeneratorActionMessenger.hh
/// \brief Description of the PrimaryGeneratorActionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorActionMessenger_h
#define PrimaryGeneratorActionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class PrimaryGeneratorAction;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithADouble;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// messenger for PrimaryGenerator class.
class PrimaryGeneratorActionMessenger: public G4UImessenger
{
public:
PrimaryGeneratorActionMessenger(PrimaryGeneratorAction*);
~PrimaryGeneratorActionMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
PrimaryGeneratorAction* fPrimaryGeneratorAction{nullptr};
G4UIcmdWithABool* fUseGPSCmd{nullptr};
G4UIcmdWithAString* fPrimaryTypeCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryEnergyCmd{nullptr};
G4UIcmdWithADouble* fPrimaryRelSigmaEnergyCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryXCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryYCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryZCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryTCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryXpCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimaryYpCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaXCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaYCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaZCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaTCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaXpCmd{nullptr};
G4UIcmdWithADoubleAndUnit* fPrimarySigmaYpCmd{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file Run.hh
/// \brief Description of the Run class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef Run_h
#define Run_h 1
#include "G4Run.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Run class. Used to accumulate Edep and Edep^2 in a given volume (radiator).
class Run : public G4Run
{
public:
Run() = default;
~Run() override = default;
void RecordEvent(const G4Event*) override;
void Merge(const G4Run*) override;
G4double GetEdep() const {return fEdep;}
G4double GetEdep2() const {return fEdep2;}
G4double GoodEvents() const {return fGoodEvents;}
private:
G4int fCollID_edep = -1;
G4double fEdep = 0.;
G4double fEdep2 = 0.;
G4int fGoodEvents = 0;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "RunActionMessenger.hh"
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "globals.hh"
#include <fstream>
#include "G4AnalysisManager.hh"
class G4Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Run action class. Used to define the scoring ntuple and write the results.
class RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
G4Run* GenerateRun() override;
void SetFileName(G4String);
private:
G4String fFileName = "output";
RunActionMessenger* fMessenger{nullptr};
G4AnalysisManager* fAnalysisManager{nullptr};
G4bool fIsFileOpened = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// gpaterno, October 2025
//
/// \file RunActionMessenger.hh
/// \brief Definition of the RunActionMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunActionMessenger_h
#define RunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class RunAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Messenger of Run action class. It is used basically to set the output filename.
class RunActionMessenger: public G4UImessenger
{
public:
RunActionMessenger(RunAction*);
~RunActionMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
RunAction* fRunAction{nullptr};
G4UIcmdWithAString* fSetFileNameCmd{nullptr};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif

Some files were not shown because too many files have changed in this diff Show More