Import Geant4 11.0.0 source tree
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
|
||||
///\file "eventgenerator/.README.txt"
|
||||
///\brief Examples eventgenerator README page
|
||||
|
||||
/*! \page Examples_eventgenerator Category "eventgenerator"
|
||||
|
||||
Examples in this directory demonstrate various ways of primary event
|
||||
generation.
|
||||
|
||||
\link ExampleparticleGun particleGun \endlink
|
||||
|
||||
This example demonstrates 4 ways of the usage of G4ParticleGun shooting
|
||||
primary particles in different cases.
|
||||
|
||||
\link Exampleexgps exgps \endlink
|
||||
|
||||
This example demonstrates the usage of G4GeneralParticleSource for generating
|
||||
primary incident particle according to user defined distributions.
|
||||
|
||||
\link ExampleuserPrimaryGenerator userPrimaryGenerator \endlink
|
||||
|
||||
This example shows how to create a primary event including several vertices and
|
||||
several primary particles per vertex.
|
||||
|
||||
\link Examples_HepMC HepMC \endlink
|
||||
|
||||
This directory contains examples for using HepMC as an interface with
|
||||
various Monte Carlo event generators, such as PYTHIA.
|
||||
It also include an example for demonstrating MC truth handling with HepMC.
|
||||
|
||||
\link Examples_pythia pythia \endlink
|
||||
|
||||
This directory contains the following examples:
|
||||
|
||||
a) use of Pythia6 as Monte Carlo event generator, interfaced with Geant4,
|
||||
and showing how to implement an external decayer based on Pythia6.
|
||||
The feature is activated by setting environment variable PYTHIA6 to point
|
||||
to the Pythia6 installation area.
|
||||
For details, please see \link Exampledecayer6 Example decayer6 \endlink.
|
||||
|
||||
b) use of Pythia8 as an external decayer to replace native Geant4 decay
|
||||
tables for such resonances as tau+/- and B+/-, and to supplement Pythia8-based
|
||||
decay tables to those resonances where Geant4 native decay features are not
|
||||
implemented.
|
||||
The feature is activated by setting environment variable PYTHIA8 to point
|
||||
to the Pythia8 installation area.
|
||||
For details, please see \link Examplepy8decayer Example py8decayer \endlink.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
///\file "eventgenerator/HepMC/.README.txt"
|
||||
///\brief Examples HepMC README page
|
||||
|
||||
/*! \page Examples_HepMC Category "eventgenerator/HepMC"
|
||||
|
||||
This directory contains examples for using HepMC as an interface with
|
||||
various Monte Carlo event generators, such as PYTHIA.
|
||||
It also include an example for demonstrating MC truth handling with HepMC.
|
||||
|
||||
\section HepMC_s1 Requirements for external software packages
|
||||
|
||||
\subsection HepMC_sub_s11 HepMC
|
||||
- Tested version : 2.06.09
|
||||
- http://lcgapp.cern.ch/project/simu/HepMC/
|
||||
|
||||
Note: examples were tested only on Linux with gcc.
|
||||
|
||||
\subsection HepMC_sub_s12 PYTHIA
|
||||
- Tested version 6.4.26
|
||||
- URL: http://www.thep.lu.se/~torbjorn/Pythia.html
|
||||
|
||||
|
||||
\section HepMC_s2 Examples HepMCEx01 and HepMCEx02
|
||||
|
||||
\subsection HepMC_sub_s21 class HepMCG4Interface
|
||||
This class is derived from G4VPrimaryGenerator, and is a base class
|
||||
for primary generation via HepMC object.
|
||||
|
||||
protected members:
|
||||
|
||||
- virtual HepMC::GenEvent* GenerateHepMCEvent() \n
|
||||
Implement this method in his/her own concrete class.
|
||||
An empty event will be created in default.
|
||||
|
||||
- void HepMC2G4(const HepMC::GenEvent* hepmcevt, G4Event* g4event) \n
|
||||
service method for conversion from HepMC::GenEvent to G4Event
|
||||
|
||||
- virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const \n
|
||||
We have to take care for the position of primaries because
|
||||
primary vertices outside the world volume give rise to G4Exception.
|
||||
If the default implementation is not adequate, an alternative
|
||||
can be implemented in your own class.
|
||||
|
||||
public members:
|
||||
- virtual void GeneratePrimaryVertex(G4Event* anEvent) \n
|
||||
The default behavior is that a single HepMC event generated by
|
||||
GenerateHepMCEvent() will be converted to G4Event through HepMC2G4().
|
||||
|
||||
\subsection HepMC_sub_s22 class HepMCG4AsciiReader / HepMCG4AsciiReaderMessenger (derived from HepMCG4Interface)
|
||||
This derived class is for reading primary information from
|
||||
an Ascii file generated by HepMC.
|
||||
|
||||
\subsection HepMC_sub_s23 class HepMCG4PythiaInterface / HepMCG4AsciiReaderMessenger (derived from HepMCG4Interface)
|
||||
This derived class is for directly calling PYTHIA functions.
|
||||
Users can set parameters, initialize, generate, and terminate
|
||||
by command line operation.
|
||||
|
||||
\subsection HepMC_sub_s24 Macros in examples
|
||||
|
||||
- hepmc_pygen.in \n
|
||||
process PYTHIA events(H->4mu) generated at every event.
|
||||
|
||||
- hepmc_ascii.in \n
|
||||
read pregenerated events from HepMC Ascii file (data/example_MyPythia.dat).
|
||||
|
||||
\subsection HepMC_sub_s25 Installation
|
||||
|
||||
- 1. Download and install HepMC from: \n
|
||||
http://lcgapp.cern.ch/project/simu/HepMC/ \n
|
||||
and define the environment variable:
|
||||
\verbatim
|
||||
HEPMC_DIR the path to HepMC installation.
|
||||
\endverbatim
|
||||
|
||||
- 2. Download the PYTHIA6 source file from the PYTHIA6 download site:\n
|
||||
http://www.hepforge.org/downloads/pythia6
|
||||
|
||||
- 2A. With CMake: Build pythia6 library
|
||||
|
||||
For a convenience a CMake file for building Pythia6 library from
|
||||
the source is provided in
|
||||
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
|
||||
Build the pythia6 library following the instructions in this file
|
||||
and then define the environment variables:
|
||||
\verbatim
|
||||
PYTHIA6 the path where pythia6 library is installed
|
||||
PYTHIA6_VERSION the pythia version
|
||||
\endverbatim
|
||||
|
||||
- 2B. With GNUmake: Define the environment variables: \n
|
||||
\verbatim
|
||||
PYTHIA6 the path to pythia-versionX.f source code
|
||||
PYTHIA6_VERSION the pythia version
|
||||
\endverbatim
|
||||
|
||||
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
|
||||
then you have to set:
|
||||
export PYTHIA6=$HOME
|
||||
export PYTHIA6_VERSION="6.4.26"
|
||||
|
||||
pythia6 will be then compiled together with example code.
|
||||
|
||||
- 3. Compilation:\n
|
||||
Then the examples are compiled in a standard way, see \ref README_HowToRun.
|
||||
|
||||
\subsection HepMC_sub_s26 Examples
|
||||
|
||||
See more details in \ref ExampleHepMCEx01 and \ref ExampleHepMCEx02.
|
||||
|
||||
\subsection HepMC_sub_s27 Notes
|
||||
|
||||
We attached a sample HepMC Ascii data file, "data/example_MyPythia.dat",
|
||||
which contains 10 PYTHIA events created by "data/example_MyPythia.cxx".
|
||||
|
||||
\section HepMC_s3 Example MCTruth
|
||||
|
||||
Application \link ExampleMCTruth MCTruth \endlink demonstrating handling of Monte-Carlo truth information through the HepMC package.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
///\file "eventgenerator/HepMC/HepMCEx01/.README.txt"
|
||||
///\brief Example HepMCEx01 README page
|
||||
|
||||
/*! \page ExampleHepMCEx01 Example HepMCEx01
|
||||
|
||||
HepMCEx01 is based on Example N04, which has a simplified collider detector
|
||||
geometry. Only part of the primary generator action is replaced with new one.
|
||||
This example demonstrates the following features.
|
||||
|
||||
\section ExampleHepMCEx01_s1 HepMC interface
|
||||
|
||||
ExN04PrimaryGeneratorAction has HepMCG4Interface as the generator.
|
||||
There are two types of generators provided as samples. One generator reads
|
||||
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
|
||||
The other one generates primaries directly invoking PYTHIA routines
|
||||
in every event.
|
||||
|
||||
\section ExampleHepMCEx01_s2 Readout geometry
|
||||
|
||||
ExN04DetectorConstruction defines a simplified collider detecor
|
||||
geometry, tracker made of cylindrical tubes, calorimeter made of
|
||||
cylindrical tubes, and muon trackers made of planes.
|
||||
Cylindrical calorimeter is made of tubes of lead and scintirator
|
||||
without cut in phi nor z direction. Energy deposition in scintirator
|
||||
is accumulated by ExN04CalorimeterSD sensitive detector, which has
|
||||
a readout geometry to find the phi-z cell.
|
||||
|
||||
\section ExampleHepMCEx01_s3 Full set of "ordinary" physics processes
|
||||
|
||||
FTFP_BERT physics list defines almost all of leptons and hadrons which
|
||||
Geant4 has dedicated classes for. Also almost all physics processes
|
||||
Geant4 has are defined.
|
||||
|
||||
\section ExampleHepMCEx01_s4 Event filtering by the stacking mechanism.
|
||||
|
||||
Higgs events in "pythia_event.data" have two lepton pairs produced
|
||||
by the Higgs decay via Z0. At the first stage of each event, only the
|
||||
primary muons are tracked without tracking secondaries. then the number
|
||||
of hits on the muon trackers are examined. At the next stage, only
|
||||
the primary charged particles are tracked only inside the barrel
|
||||
tracking area and the isolation of the primary muons are examined.
|
||||
At the third stage, all particles in the RoI (Region of Interest) along
|
||||
the isolated muons are tracked. All these examinations are applied in
|
||||
ExN04StackingAction.
|
||||
|
||||
\section ExampleHepMCEx01_s5 Installation
|
||||
|
||||
See \ref Examples_HepMC how to build this example.
|
||||
|
||||
\section ExampleHepMCEx01_s6 Execution
|
||||
\verbatim
|
||||
% HepMCEx01 hepmc_pygen.in
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,57 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
HepMCEx01
|
||||
---------
|
||||
|
||||
HepMCEx01 is based on ExampleN04, which has a simplified collider detector
|
||||
geometry. Only part of the primary generator action is replaced with new one.
|
||||
This example demonstrates the following features.
|
||||
|
||||
1. HepMC interface
|
||||
|
||||
ExN04PrimaryGeneratorAction has HepMCG4Interface as the generator.
|
||||
There are two types of generators provided as samples. One generator reads
|
||||
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
|
||||
The other one generates primaries directly invoking PYTHIA routines
|
||||
in every event.
|
||||
|
||||
2. Readout geometry
|
||||
|
||||
ExN04DetectorConstruction defines a simplified collider detecor
|
||||
geometry, tracker made of cylindrical tubes, calorimeter made of
|
||||
cylindrical tubes, and muon trackers made of planes.
|
||||
Cylindrical calorimeter is made of tubes of lead and scintirator
|
||||
without cut in phi nor z direction. Energy deposition in scintirator
|
||||
is accumulated by ExN04CalorimeterSD sensitive detector, which has
|
||||
a readout geometry to find the phi-z cell.
|
||||
|
||||
3. Full set of "ordinary" physics processes
|
||||
|
||||
FTFP_BERT physics list defines almost all of leptons and hadrons which
|
||||
Geant4 has dedicated classes for. Also almost all physics processes
|
||||
Geant4 has are defined.
|
||||
|
||||
4. Event filtering by the stacking mechanism.
|
||||
|
||||
Higgs events in "pythia_event.data" have two lepton pairs produced
|
||||
by the Higgs decay via Z0. At the first stage of each event, only the
|
||||
primary muons are tracked without tracking secondaries. then the number
|
||||
of hits on the muon trackers are examined. At the next stage, only
|
||||
the primary charged particles are tracked only inside the barrel
|
||||
tracking area and the isolation of the primary muons are examined.
|
||||
At the third stage, all particles in the RoI (Region of Interest) along
|
||||
the isolated muons are tracked. All these examinations are applied in
|
||||
ExN04StackingAction.
|
||||
|
||||
5. Installation
|
||||
|
||||
See HepMC/README how to build this example.
|
||||
|
||||
6. Execution
|
||||
|
||||
% HepMCEx01 hepmc_pygen.in
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
///\file "eventgenerator/HepMC/HepMCEx02/.README.txt"
|
||||
///\brief Example HepMCEx02 README page
|
||||
|
||||
/*! \page ExampleHepMCEx02 Example HepMCEx02
|
||||
|
||||
This example demonstrates how to interface primary particles in Geant4
|
||||
with various event generators via the HepMC Monte Carlo event interface.
|
||||
This is another example having the same generator action as HepMCEx01,
|
||||
but much simpler user control.
|
||||
|
||||
\section ExampleHepMCEx02_s1 Primary Generator
|
||||
|
||||
H02PrimaryGeneratorAction has HepMCG4Interface as the generator.
|
||||
There are two types of generators provided as samples. One generator reads
|
||||
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
|
||||
The other one generates primaries directly invoking PYTHIA routines
|
||||
in every event.
|
||||
|
||||
\section ExampleHepMCEx02_s2 Geometry
|
||||
|
||||
A simplified collider-type geometry, which consists of
|
||||
- endcap calorimeter (a set of tubes filled with lead),
|
||||
- barrel calorimeter (tube filled with lead),
|
||||
- barrel muon detector (8 sets of plates filled with Ar),
|
||||
- endcap muon detecror, (a set of tubes filled with Ar) and
|
||||
- uniform magnetic field along the z axis of 3 Tesla at the
|
||||
central region.
|
||||
|
||||
\section ExampleHepMCEx02_s3 Physics List
|
||||
|
||||
FTFP_BERT predefined physics list
|
||||
|
||||
\section ExampleHepMCEx02_s4 User actions
|
||||
|
||||
All particles except muons are killed in the calorimeter section.
|
||||
|
||||
\section ExampleHepMCEx02_s5 Installation
|
||||
|
||||
See \ref Examples_HepMC how to build this example.
|
||||
|
||||
\section ExampleHepMCEx02_s6 Execution
|
||||
\verbatim
|
||||
% HepMCEx02 hepmc_pygen.in
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,48 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
HepMCEx02
|
||||
---------
|
||||
|
||||
This example demonstrates how to interface primary particles in Geant4
|
||||
with various event generators via the HepMC Monte Carlo event interface.
|
||||
This is another example having the same generator action as HepMCEx01,
|
||||
but much simpler user control.
|
||||
|
||||
1. Primary Generator
|
||||
|
||||
H02PrimaryGeneratorAction has HepMCG4Interface as the generator.
|
||||
There are two types of generators provided as samples. One generator reads
|
||||
primary information from a HepMC Ascii file (data/example_MyPythia.dat).
|
||||
The other one generates primaries directly invoking PYTHIA routines
|
||||
in every event.
|
||||
|
||||
2. Geometry
|
||||
|
||||
A simplified collider-type geometry, which consists of
|
||||
- endcap calorimeter (a set of tubes filled with lead),
|
||||
- barrel calorimeter (tube filled with lead),
|
||||
- barrel muon detector (8 sets of plates filled with Ar),
|
||||
- endcap muon detecror, (a set of tubes filled with Ar) and
|
||||
- uniform magnetic field along the z axis of 3 Tesla at the
|
||||
central region.
|
||||
|
||||
3. Physics List
|
||||
|
||||
FTFP_BERT predefined physics list
|
||||
|
||||
4. User actions
|
||||
|
||||
All particles except muons are killed in the calorimeter section.
|
||||
|
||||
5. Installation
|
||||
|
||||
See HepMC/README how to build this example.
|
||||
|
||||
6. Execution
|
||||
|
||||
% HepMCEx02 hepmc_pygen.in
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
|
||||
///\file "eventgenerator/HepMC/MCTruth/.README.txt"
|
||||
///\brief Example MCTruth README page
|
||||
|
||||
/*! \page ExampleMCTruth Example MCTruth
|
||||
|
||||
MCTRUTH using HepMC
|
||||
|
||||
This example demonstrates a mechanism for Monte Carlo truth handling
|
||||
using HepMC as the event record. The user does not interact directly
|
||||
with the HepMC classes but with the MCTruthManager class which takes
|
||||
care with storing all the necessary information about particles,
|
||||
vertices and relations between them. A specialized tracking action is
|
||||
used to test whether given particle is to be stored or not. The
|
||||
decision criteria for storing particle are configurable via the
|
||||
MCTruthConfig class.
|
||||
|
||||
\section ExampleMCTruth_s1 HOW TO BUILD THE EXAMPLE ?
|
||||
|
||||
- if you do not have it yet, install HepMC event record (tested with version 2.06.08)
|
||||
|
||||
- set HEPMC_ROOT_DIR variable to point to the directory where HepMC is installed;
|
||||
if the HepMC is installed in your system directory (/usr/local) you do not need to set anything
|
||||
|
||||
- run the CMake configuration and build mctruthex target in your build directory
|
||||
|
||||
- execute the application:
|
||||
\verbatim
|
||||
% your_binary_directory/mctruthex
|
||||
\endverbatim
|
||||
|
||||
\section ExampleMCTruth_s2 DESCRIPTION OF THE MCTRUTH HANDLING MECHANISM
|
||||
|
||||
The main element of the MC truth handling machinery is the
|
||||
MCTruthManager class. This class is responsible for all the
|
||||
interaction with the HepMC event and does not depend on Geant4. It is
|
||||
a singleton, therefore it is guaranteed to be instanciated only once
|
||||
and the static 'GetInstance' method allows to access it from anywhere
|
||||
in the code. It contains methods like MCTruthManager::NewEvent() to start a new event,
|
||||
MCTruthManager::AddParticle() to add particle to the current event, as well as
|
||||
MCTruthManager::PrintEvent() for the purpose of the debugging. The core of the
|
||||
algorithm which deals with building up the MC truth event tree within
|
||||
the HepMC event is implemented in MCTruthManager::AddParticle() method.
|
||||
|
||||
The MCTruthManager::AddParticle() method is called with the following arguments:
|
||||
four-momentum, production position and 'end' position of the particle,
|
||||
PDG code of the particle, as well as the particle ID (unique identifier,
|
||||
as we will see later, corresponding to Geant4 TrackID) and the ID of
|
||||
the mother. Finally, there is a boolean flag specifying whether the
|
||||
direct mother of the given particle has been stored, or not.
|
||||
|
||||
The first step, which always takes place, is to instanciate a new
|
||||
HepMC::GenParticle with the barcode corresponding to particle ID, as
|
||||
well as to instanciate a new HepMC::GenVertex which will represent the
|
||||
'end' vertex of the particle. The barcode of the 'end vertex' is equal
|
||||
to minus the barcode of the particle.
|
||||
|
||||
We can now distinguish several cases:
|
||||
|
||||
- 1) the particle is a primary in the Geant4 language, i.e. its
|
||||
mother ID is 0
|
||||
\n\n
|
||||
This is the simplest case, we just instanciate a new 'primary'
|
||||
(without any incoming particles) GenVertex, we add to it the
|
||||
particle and we put it all in the event. Additionally we store the
|
||||
ID of the particle in a special vector, where all the IDs of
|
||||
primary particles will be stored, allowing quick access to each of
|
||||
the main 'branches' of the event. We return from the method.
|
||||
|
||||
- 2) the particle is not a primary
|
||||
\n\n
|
||||
We use the 'event->barcode_to_particle(motherID)' method to get the
|
||||
pointer to its mother.
|
||||
\n\n
|
||||
We check if the 'end vertex' of the mother corresponds to the
|
||||
'production vertex' of the particle in question.
|
||||
\n\n
|
||||
- 2.1) If the two vertices do match, we attach the new particle to
|
||||
the 'end vertex' of the mother. We return from the method.
|
||||
\n\n
|
||||
- 2.2) If the two vertices do not match, i.e. the new particle is not
|
||||
a product of the 'end vertex' of the mother particle, we can
|
||||
have two cases:
|
||||
\n\n
|
||||
- 2.2.1) The boolean flag says that the direct mother of the
|
||||
particle has _not_ been stored. This means that the
|
||||
particle has been 'adopted' by one of its ancestors, or
|
||||
in other words, the mother ID of the particle does not
|
||||
correspond to its direct mother (so clearly the
|
||||
vertices cannot match). This for instance could happen
|
||||
if we decided not to store gamma coming from pi0 decay
|
||||
but did decide to store e+/- coming from the gamma
|
||||
conversion (so the gamma between pi0 and e+/- was
|
||||
missing). In such a case we instanciate (or use one of
|
||||
the existing ones, if vertices match) a 'dummy'
|
||||
particle (with pdg = -999999) which then acts as the
|
||||
link between the 'adopted' particle and the
|
||||
(non-direct) mother. In such a way, the navigability up
|
||||
in the event is still possible, but in the same time,
|
||||
we can clearly see that the link is not a direct
|
||||
one. We return from the method.
|
||||
\n\n
|
||||
- 2.2.2) The boolean flag says that direct mother of the
|
||||
particle _has_ been stored. Taking into account that
|
||||
the vertices do not match, it can mean only one
|
||||
thing. The new particle has been produced 'on the
|
||||
flight', i.e. somewhere 'before' the 'end vertex' of
|
||||
the mother. This can be the case, for instace, for
|
||||
delta electrons, bremsstrahlung gammas, etc. In such a
|
||||
situation, we 'split' the mother particle in two
|
||||
particles and create a new vertex from which the
|
||||
secondary will be going out. The complication, however,
|
||||
arises when we have more than one generated 'on the
|
||||
flight' particle attached to the same mother. In such a
|
||||
case, for each secondary we need to locate the right
|
||||
'segment' of the mother particle (i.e. we need to find
|
||||
between which two vertices we need to add a new
|
||||
one). To keep track of those segmentations we introduce
|
||||
a map where each particle ID we map into the number of
|
||||
existing segments (in the normal case one). Each new
|
||||
'segment' gets barcode equal to the barcode of the
|
||||
original particle + N*10000000, where N is the segment
|
||||
number. In such a way, one can easily follow the
|
||||
'segmentation' (if any) of each particle. We return
|
||||
from the method.
|
||||
|
||||
This concludes the description of MCTruthManager. The MCTruthConfig
|
||||
class is a collection of criteria (minimal energy, PDG, creator
|
||||
process, etc) that we want to apply when deciding whether to store or
|
||||
not given particle. These values are used by the
|
||||
'MCTruthTrackingAction' which we describe below. This class can
|
||||
certainly be extended with other members.
|
||||
|
||||
The actual Geant4-dependent part of the MCTruth handling machinery
|
||||
consists of a few 'G4 user actions' as well as an implementation of
|
||||
G4VUserTrackInformation. The later one is, for the moment, used only
|
||||
to store one boolean flag indicating whether the direct mother of the
|
||||
given track has been stored or not.
|
||||
|
||||
The first user action is MCTruthEventAction which is only reponsible
|
||||
for calling MCTruthManager::NewEvent() at the beginning
|
||||
of each event. It can also be used for printing out events for the
|
||||
purpose of debugging.
|
||||
|
||||
The actual 'decision making' concerning which particle to store is
|
||||
done in MCTruthTrackingAction. At the end of each track the method
|
||||
trackToBeStored(track) is called to check for various characteristics
|
||||
of the particle. These, for instance can be energy, particle ID,
|
||||
creator process, etc.
|
||||
|
||||
If the particle satisfies the conditions the
|
||||
MCTruthManager::AddParticle is called and all the
|
||||
procedure described above is performed. The important element here is
|
||||
that the Geant4 TrackID is used as the unique particle ID in
|
||||
MCTruthManager and eventually as the barcode of the
|
||||
HepMC::GenParticle.
|
||||
|
||||
If the particle does not qualify to be stored, there are two actions
|
||||
performed. First the 'ParentID' of the _daughters_ is set to the
|
||||
'ParentID' of the currenly processed particle. In other words, the
|
||||
'ParentID' of the daughters is set to the ID of the last stored
|
||||
particle. Second, the 'directParent' flag from MCTruthTrackInformation
|
||||
of the __daughters__ is set to FALSE. In such a way, one is still able
|
||||
to navigate up in the event (to get the ancestors of the particle),
|
||||
but in the same time, the particle is flagged as 'not having direct
|
||||
parent'.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,165 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
MCTRUTH using HepMC
|
||||
-------------------
|
||||
|
||||
This example demonstrates a mechanism for Monte Carlo truth handling
|
||||
using HepMC as the event record. The user does not interact directly
|
||||
with the HepMC classes but with the MCTruthManager class which takes
|
||||
care with storing all the necessary information about particles,
|
||||
vertices and relations between them. A specialized tracking action is
|
||||
used to test whether given particle is to be stored or not. The
|
||||
decision criteria for storing particle are configurable via the
|
||||
MCTruthConfig class.
|
||||
|
||||
HOW TO BUILD THE EXAMPLE ?
|
||||
|
||||
- if you do not have it yet, install HepMC event record (tested with version 2.06.08)
|
||||
|
||||
- set HEPMC_ROOT_DIR variable to point to the directory where HepMC is installed;
|
||||
if the HepMC is installed in your system directory (/usr/local) you do not need to set anything
|
||||
|
||||
- run the CMake configuration and build mctruthex target in your build directory
|
||||
|
||||
- execute the application:
|
||||
% your_binary_directory/mctruthex
|
||||
|
||||
DESCRIPTION OF THE MCTRUTH HANDLING MECHANISM
|
||||
|
||||
The main element of the MC truth handling machinery is the
|
||||
MCTruthManager class. This class is responsible for all the
|
||||
interaction with the HepMC event and does not depend on Geant4. It is
|
||||
a singleton, therefore it is guaranteed to be instanciated only once
|
||||
and the static 'GetInstance' method allows to access it from anywhere
|
||||
in the code. It contains methods like 'NewEvent' to start a new event,
|
||||
'AddParticle' to add particle to the current event, as well as
|
||||
'PrintEvent' for the purpose of the debugging. The core of the
|
||||
algorithm which deals with building up the MC truth event tree within
|
||||
the HepMC event is implemented in AddParticle method.
|
||||
|
||||
The AddParticle method is called with the following arguments:
|
||||
four-momentum, production position and 'end' position of the particle,
|
||||
PDG code of the particle, as well as the particle ID (unique identifier,
|
||||
as we will see later, corresponding to Geant4 TrackID) and the ID of
|
||||
the mother. Finally, there is a boolean flag specifying whether the
|
||||
direct mother of the given particle has been stored, or not.
|
||||
|
||||
The first step, which always takes place, is to instanciate a new
|
||||
HepMC::GenParticle with the barcode corresponding to particle ID, as
|
||||
well as to instanciate a new HepMC::GenVertex which will represent the
|
||||
'end' vertex of the particle. The barcode of the 'end vertex' is equal
|
||||
to minus the barcode of the particle.
|
||||
|
||||
We can now distinguish several cases:
|
||||
|
||||
1) the particle is a primary in the Geant4 language, i.e. its
|
||||
mother ID is 0
|
||||
|
||||
This is the simplest case, we just instanciate a new 'primary'
|
||||
(without any incoming particles) GenVertex, we add to it the
|
||||
particle and we put it all in the event. Additionally we store the
|
||||
ID of the particle in a special vector, where all the IDs of
|
||||
primary particles will be stored, allowing quick access to each of
|
||||
the main 'branches' of the event. We return from the method.
|
||||
|
||||
2) the particle is not a primary
|
||||
|
||||
We use the 'event->barcode_to_particle(motherID)' method to get the
|
||||
pointer to its mother.
|
||||
|
||||
We check if the 'end vertex' of the mother corresponds to the
|
||||
'production vertex' of the particle in question.
|
||||
|
||||
2.1) If the two vertices do match, we attach the new particle to
|
||||
the 'end vertex' of the mother. We return from the method.
|
||||
|
||||
2.2) If the two vertices do not match, i.e. the new particle is not
|
||||
a product of the 'end vertex' of the mother particle, we can
|
||||
have two cases:
|
||||
|
||||
2.2.1) The boolean flag says that the direct mother of the
|
||||
particle has _not_ been stored. This means that the
|
||||
particle has been 'adopted' by one of its ancestors, or
|
||||
in other words, the mother ID of the particle does not
|
||||
correspond to its direct mother (so clearly the
|
||||
vertices cannot match). This for instance could happen
|
||||
if we decided not to store gamma coming from pi0 decay
|
||||
but did decide to store e+/- coming from the gamma
|
||||
conversion (so the gamma between pi0 and e+/- was
|
||||
missing). In such a case we instanciate (or use one of
|
||||
the existing ones, if vertices match) a 'dummy'
|
||||
particle (with pdg = -999999) which then acts as the
|
||||
link between the 'adopted' particle and the
|
||||
(non-direct) mother. In such a way, the navigability up
|
||||
in the event is still possible, but in the same time,
|
||||
we can clearly see that the link is not a direct
|
||||
one. We return from the method.
|
||||
|
||||
2.2.2) The boolean flag says that direct mother of the
|
||||
particle _has_ been stored. Taking into account that
|
||||
the vertices do not match, it can mean only one
|
||||
thing. The new particle has been produced 'on the
|
||||
flight', i.e. somewhere 'before' the 'end vertex' of
|
||||
the mother. This can be the case, for instace, for
|
||||
delta electrons, bremsstrahlung gammas, etc. In such a
|
||||
situation, we 'split' the mother particle in two
|
||||
particles and create a new vertex from which the
|
||||
secondary will be going out. The complication, however,
|
||||
arises when we have more than one generated 'on the
|
||||
flight' particle attached to the same mother. In such a
|
||||
case, for each secondary we need to locate the right
|
||||
'segment' of the mother particle (i.e. we need to find
|
||||
between which two vertices we need to add a new
|
||||
one). To keep track of those segmentations we introduce
|
||||
a map where each particle ID we map into the number of
|
||||
existing segments (in the normal case one). Each new
|
||||
'segment' gets barcode equal to the barcode of the
|
||||
original particle + N*10000000, where N is the segment
|
||||
number. In such a way, one can easily follow the
|
||||
'segmentation' (if any) of each particle. We return
|
||||
from the method.
|
||||
|
||||
This concludes the description of MCTruthManager. The MCTruthConfig
|
||||
class is a collection of criteria (minimal energy, PDG, creator
|
||||
process, etc) that we want to apply when deciding whether to store or
|
||||
not given particle. These values are used by the
|
||||
'MCTruthTrackingAction' which we describe below. This class can
|
||||
certainly be extended with other members.
|
||||
|
||||
The actual Geant4-dependent part of the MCTruth handling machinery
|
||||
consists of a few 'G4 user actions' as well as an implementation of
|
||||
G4VUserTrackInformation. The later one is, for the moment, used only
|
||||
to store one boolean flag indicating whether the direct mother of the
|
||||
given track has been stored or not.
|
||||
|
||||
The first user action is MCTruthEventAction which is only reponsible
|
||||
for calling MCTruthManager::GetInstance()->NewEvent() at the beginning
|
||||
of each event. It can also be used for printing out events for the
|
||||
purpose of debugging.
|
||||
|
||||
The actual 'decision making' concerning which particle to store is
|
||||
done in MCTruthTrackingAction. At the end of each track the method
|
||||
trackToBeStored(track) is called to check for various characteristics
|
||||
of the particle. These, for instance can be energy, particle ID,
|
||||
creator process, etc.
|
||||
|
||||
If the particle satisfies the conditions the
|
||||
MCTruthManager::GetInstance()->AddParticle is called and all the
|
||||
procedure described above is performed. The important element here is
|
||||
that the Geant4 TrackID is used as the unique particle ID in
|
||||
MCTruthManager and eventually as the barcode of the
|
||||
HepMC::GenParticle.
|
||||
|
||||
If the particle does not qualify to be stored, there are two actions
|
||||
performed. First the 'ParentID' of the _daughters_ is set to the
|
||||
'ParentID' of the currenly processed particle. In other words, the
|
||||
'ParentID' of the daughters is set to the ID of the last stored
|
||||
particle. Second, the 'directParent' flag from MCTruthTrackInformation
|
||||
of the __daughters__ is set to FALSE. In such a way, one is still able
|
||||
to navigate up in the event (to get the ancestors of the particle),
|
||||
but in the same time, the particle is flagged as 'not having direct
|
||||
parent'.
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
Examples for HepMC-Geant4 interface
|
||||
-----------------------------------
|
||||
|
||||
This directory contains examples for using HepMC as an interface with
|
||||
various Monte Carlo event generators, such as PYTHIA.
|
||||
It also include an example for demonstrating MC truth handling with HepMC.
|
||||
|
||||
Requirements for external software packages
|
||||
-------------------------------------------
|
||||
HepMC:
|
||||
Tested version : 2.06.09
|
||||
http://lcgapp.cern.ch/project/simu/HepMC/
|
||||
|
||||
Note: examples were tested only on Linux with gcc.
|
||||
|
||||
PYTHIA
|
||||
Tested version 6.4.26
|
||||
URL: http://www.thep.lu.se/~torbjorn/Pythia.html
|
||||
|
||||
|
||||
Examples HepMCEx01 and HepMCEx02
|
||||
================================
|
||||
|
||||
class HepMCG4Interface
|
||||
This class is derived from G4VPrimaryGenerator, and is a base class
|
||||
for primary generation via HepMC object.
|
||||
|
||||
protected members
|
||||
+ virtual HepMC::GenEvent* GenerateHepMCEvent()
|
||||
Implement this method in his/her own concrete class.
|
||||
An empty event will be created in default.
|
||||
|
||||
+ void HepMC2G4(const HepMC::GenEvent* hepmcevt, G4Event* g4event)
|
||||
service method for conversion from HepMC::GenEvent to G4Event
|
||||
|
||||
+ virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const
|
||||
We have to take care for the position of primaries because
|
||||
primary vertices outside the world volume give rise to G4Exception.
|
||||
If the default implementation is not adequate, an alternative
|
||||
can be implemented in your own class.
|
||||
|
||||
public members
|
||||
+ virtual void GeneratePrimaryVertex(G4Event* anEvent)
|
||||
The default behavior is that a single HepMC event generated by
|
||||
GenerateHepMCEvent() will be converted to G4Event through HepMC2G4().
|
||||
|
||||
class HepMCG4AsciiReader / HepMCG4AsciiReaderMessenger
|
||||
(derived from HepMCG4Interface)
|
||||
This derived class is for reading primary information from
|
||||
an Ascii file generated by HepMC.
|
||||
|
||||
class HepMCG4PythiaInterface / HepMCG4AsciiReaderMessenger
|
||||
(derived from HepMCG4Interface)
|
||||
This derived class is for directly calling PYTHIA functions.
|
||||
Users can set parameters, initialize, generate, and terminate
|
||||
by command line operation.
|
||||
|
||||
Macros in examples
|
||||
-----------------
|
||||
hepmc_pygen.in
|
||||
process PYTHIA events(H->4mu) generated at every event.
|
||||
|
||||
hepmc_ascii.in
|
||||
read pregenerated events from HepMC Ascii file (data/example_MyPythia.dat).
|
||||
|
||||
Installation
|
||||
--------------
|
||||
1. Download and install HepMC from:
|
||||
http://lcgapp.cern.ch/project/simu/HepMC/
|
||||
(Last tested version : 2.06.09)
|
||||
|
||||
and define the environment variable:
|
||||
HEPMC_DIR the path to HepMC installation.
|
||||
|
||||
2. Download the PYTHIA6 source file from the PYTHIA6 download site:
|
||||
http://www.hepforge.org/downloads/pythia6
|
||||
|
||||
A) With CMake: Build pythia6 library
|
||||
|
||||
For a convenience a CMake file for building Pythia6 library from
|
||||
the source is provided in
|
||||
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
|
||||
Build the pythia6 library following the insytructions in this file
|
||||
and then define the environment variables:
|
||||
PYTHIA6 the path where pythia6 library is installed
|
||||
PYTHIA6_VERSION the pythia version
|
||||
|
||||
B) With GNUmake: Define the environment variables
|
||||
|
||||
PYTHIA6 the path to pythia-versionX.f source code
|
||||
PYTHIA6_VERSION the pythia version
|
||||
|
||||
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
|
||||
then you have to set:
|
||||
export PYTHIA6=$HOME
|
||||
export PYTHIA6_VERSION="6.4.26"
|
||||
|
||||
Pythia6 will be then compiled together with example code.
|
||||
|
||||
3. Compilation:
|
||||
Then the examples are compiled in a standard way,
|
||||
see examples/README_HowToRun.
|
||||
|
||||
Examples
|
||||
----------
|
||||
See more details in HepMCEx01/README and HepMCEx02/README.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We attached a sample HepMC Ascii data file, "data/example_MyPythia.dat",
|
||||
which contains 10 PYTHIA events created by "data/example_MyPythia.cxx".
|
||||
|
||||
Example MCTruth
|
||||
===============
|
||||
|
||||
Application demonstrating handling of Monte-Carlo truth information through
|
||||
the HepMC package.
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
Geant4 extended examples - event generator
|
||||
-------------------------------------------
|
||||
|
||||
Examples in this directory demonstrate various ways of primary event
|
||||
generation.
|
||||
|
||||
particleGun
|
||||
------------
|
||||
|
||||
This example demonstrate 4 ways of the usage of G4ParticleGun shooting
|
||||
primary particles in different cases.
|
||||
|
||||
exgps
|
||||
-----
|
||||
|
||||
This example demonstrates the usage of G4GeneralParticleSource for generating
|
||||
primary incident particle according to user defined distributions.
|
||||
|
||||
userPrimaryGenerator
|
||||
--------------------
|
||||
|
||||
This example shows how to create a primary event including several vertices and
|
||||
several primary particles per vertex.
|
||||
|
||||
HepMC
|
||||
------
|
||||
|
||||
This directory contains examples for using HepMC as an interface with
|
||||
various Monte Carlo event generators, such as PYTHIA.
|
||||
It also include an example for demonstrating MC truth handling with HepMC.
|
||||
|
||||
pythia
|
||||
------
|
||||
|
||||
This directory contains the following examples:
|
||||
|
||||
a) use of Pythia6 as Monte Carlo event generator, interfaced with Geant4,
|
||||
and showing how to implement an external decayer based on Pythia6.
|
||||
The feature is activated by setting environment variable PYTHIA6 to point
|
||||
to the Pythia6 installation area.
|
||||
For details, please see pythia/decayer6/README.
|
||||
|
||||
b) use of Pythia8 as an external decayer to replace native Geant4 decay
|
||||
tables for such resonances as tau+/- and B+/-, and to supplement Pythia8-based
|
||||
decay tables to those resonances where Geant4 native decay features are not
|
||||
implemented.
|
||||
The feature is activated by setting environment variable PYTHIA8 to point
|
||||
to the Pythia8 installation area.
|
||||
For details, please see pythia/py8decayer/README.
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
|
||||
///\file "eventgenerator/exgps/.README.txt"
|
||||
///\brief Example exgps README page
|
||||
|
||||
/*! \page Exampleexgps Example exgps
|
||||
|
||||
exgps is created to demonstrate the usage of G4GeneralParticleSource
|
||||
for generating primary particle according to user defined distributions.
|
||||
These range from simple monocromatic point source to complicated mutiple
|
||||
sources with various biasing schemes.
|
||||
|
||||
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
|
||||
/ForApplicationDeveloper/html/ch02s07.html
|
||||
|
||||
|
||||
\section exgps_s1 GEOMETRY
|
||||
|
||||
Simple geometry consists of a "Vacuum" world and, in it, two other components:
|
||||
- An alunimium box : 20 x 20 x 20 cm in size, cerntered at the origin.
|
||||
- A SiO2 sphere (radius 5 cm) is placed at the centre of the aluminium box.
|
||||
|
||||
\section exgps_s2 PHYSICS
|
||||
|
||||
Tranportation process only for all particles.
|
||||
|
||||
\section exgps_s3 EVENT
|
||||
|
||||
The event generator is the G4GeneralParticleSource (GPS). The instantiation of
|
||||
G4GeneralParticleSource is same as that for G4ParticleGun.
|
||||
See the exGPSPrimaryGeneratorAction.cc file for details.
|
||||
|
||||
\section exgps_s4 VISUALIZATION
|
||||
|
||||
Visualisation of the geometry and the tracks is possible with many of the
|
||||
G4 visualisation packages.
|
||||
An example of displaying the geometry and tracks using OGL is given in the
|
||||
macro vis.mac.
|
||||
|
||||
\section exgps_s5 HISTOGRAMS
|
||||
|
||||
This example implements an histo manager which creates histograms and
|
||||
ntuples using Geant4 analysis tools.
|
||||
|
||||
The output file contains 6 histograms and one ntuple:
|
||||
|
||||
histo1D 1: energy spectrum.
|
||||
histo1D 2: vertex: radial distribution dN/dv.
|
||||
histo1D 3: angular distribution: cos(theta).
|
||||
histo1D 4: angular distribution: phi.
|
||||
histo2D 1: vertex position in the X-Y plane.
|
||||
histo2D 2: vertex position in the X-Z plane.
|
||||
histo2D 3: vertex position in the Y-Z plane.
|
||||
histo2D 4: angular distribution: phi-cos(theta).
|
||||
histo2D 5: angular distribution: of phi-theta.
|
||||
|
||||
In the ntuple the following data are recorded for each incident particle:
|
||||
|
||||
Particle ID
|
||||
Incident Position (x,y,z);
|
||||
Incident Angle (theta,phi);
|
||||
Particle weight;
|
||||
|
||||
The histograms are managed by G4AnalysisManager class and its Messenger.
|
||||
The histos can be individually activated with the command :
|
||||
\verbatim
|
||||
/analysis/h1/set id nbBins valMin valMax unit
|
||||
\endverbatim
|
||||
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
\verbatim
|
||||
/analysis/setFileName name (default exgps)
|
||||
\endverbatim
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
|
||||
\section exgps_s6 GETTING STARTED
|
||||
|
||||
- execute exgps in 'batch' mode from macro files
|
||||
\verbatim
|
||||
% exgps exgps.in
|
||||
\endverbatim
|
||||
|
||||
- execute exgps in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% exgps
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
\section exgps_s7 FURTHER EXAMPLES of MACRO FILES
|
||||
|
||||
There are a number of mac files in the ./macros subdirectory, to show the
|
||||
various features of GPS.
|
||||
Please see macros/README file for further informations.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
Extended Example for G4GeneralParticleSource (GPS)
|
||||
--------------------------------------------------
|
||||
|
||||
exgps is created to demonstrate the usage of G4GeneralParticleSource
|
||||
for generating primary particle according to user defined distributions.
|
||||
These range from simple monocromatic point source to complicated mutiple
|
||||
sources with various biasing schemes.
|
||||
|
||||
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
|
||||
/ForApplicationDeveloper/html/ch02s07.html
|
||||
|
||||
|
||||
1 - GEOMETRY
|
||||
|
||||
Simple geometry consists of a "Vacuum" world and, in it, two other components:
|
||||
- An alunimium box : 20 x 20 x 20 cm in size, cerntered at the origin.
|
||||
- A SiO2 sphere (radius 5 cm) is placed at the centre of the aluminium box.
|
||||
|
||||
2 - PHYSICS
|
||||
|
||||
Tranportation process only for all particles.
|
||||
|
||||
3 - EVENT
|
||||
|
||||
The event generator is the G4GeneralParticleSource (GPS). The instantiation of
|
||||
G4GeneralParticleSource is same as that for G4ParticleGun.
|
||||
See the exGPSPrimaryGeneratorAction.cc file for details.
|
||||
|
||||
4 - VISUALIZATION
|
||||
|
||||
Visualisation of the geometry and the tracks is possible with many of the
|
||||
G4 visualisation packages.
|
||||
An example of displaying the geometry and tracks using OGL is given in the
|
||||
macro vis.mac.
|
||||
|
||||
5 - HISTOGRAMS
|
||||
|
||||
This example implements an histo manager which creates histograms and
|
||||
ntuples using Geant4 analysis tools.
|
||||
|
||||
The output file contains 6 histograms and one ntuple:
|
||||
|
||||
histo1D 1: energy spectrum.
|
||||
histo1D 2: vertex: radial distribution dN/dv.
|
||||
histo1D 3: angular distribution: cos(theta).
|
||||
histo1D 4: angular distribution: phi.
|
||||
histo2D 1: vertex position in the X-Y plane.
|
||||
histo2D 2: vertex position in the X-Z plane.
|
||||
histo2D 3: vertex position in the Y-Z plane.
|
||||
histo2D 4: angular distribution: phi-cos(theta).
|
||||
histo2D 5: angular distribution: of phi-theta.
|
||||
|
||||
In the ntuple the following data are recorded for each incident particle:
|
||||
|
||||
Particle ID
|
||||
Incident Position (x,y,z);
|
||||
Incident Angle (theta,phi);
|
||||
Particle weight;
|
||||
|
||||
The histograms are managed by G4AnalysisManager class and its Messenger.
|
||||
The histos can be individually activated with the command :
|
||||
/analysis/h1/set id nbBins valMin valMax unit
|
||||
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
/analysis/setFileName name (default exgps)
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
|
||||
6 - GETTING STARTED
|
||||
|
||||
- execute exgps in 'batch' mode from macro files
|
||||
% exgps exgps.in
|
||||
|
||||
- execute exgps in 'interactive mode' with visualization
|
||||
% exgps
|
||||
....
|
||||
Idle> type your commands
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
7 - FURTHER EXAMPLES of MACRO FILES
|
||||
|
||||
There are a number of mac files in the ./macros subdirectory, to show the
|
||||
various features of GPS.
|
||||
Please see README file there for further informations.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
More info on http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides
|
||||
/ForApplicationDeveloper/html/ch02s07.html
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
test01.mac
|
||||
----------
|
||||
point source, isotropic radiation, monoenergetic
|
||||
|
||||
test02.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, linear energy
|
||||
|
||||
test03.mac
|
||||
----------
|
||||
rectangular plane source, isotropic radiation, power-law energy
|
||||
|
||||
test04.mac
|
||||
----------
|
||||
circular plane source, cosine-law radiation, exponential energy
|
||||
|
||||
test05.mac
|
||||
----------
|
||||
elliptical plane source, isotropic radiation, bremsstrahlung energy
|
||||
|
||||
test06.mac
|
||||
----------
|
||||
spherical surface source, isotropic radiation, black-body energy
|
||||
|
||||
test07.mac
|
||||
----------
|
||||
cylindrical surface source, cosine-law radiation, Cosmic diffuse energy
|
||||
|
||||
test08.mac
|
||||
----------
|
||||
elliptical surface source, isotropic radiation, linear energy
|
||||
|
||||
test09.mac
|
||||
----------
|
||||
parallepiped surface source, isotropic radiation, linear energy
|
||||
|
||||
test10.mac
|
||||
----------
|
||||
spherical volume source, isotropic radiation, linear energy
|
||||
|
||||
test11.mac
|
||||
----------
|
||||
cylindrical volume source, isotropic radiation, power-law energy
|
||||
|
||||
test12.mac
|
||||
----------
|
||||
elliptical volume source, isotropic radiation, power-law energy
|
||||
|
||||
test13.mac
|
||||
----------
|
||||
parallelepiped volume source, cosine-law radiation, exponential energy
|
||||
|
||||
test14.mac
|
||||
----------
|
||||
rotated circular plane source, isotropic radiation, exponential energy
|
||||
|
||||
test15.mac
|
||||
----------
|
||||
rotated surface cylinder source, isotropic radiation, bremsstrahlung energy
|
||||
|
||||
test16.mac
|
||||
----------
|
||||
rotated parallelepiped volume source, isotropic radiation, bremsstrahlung energy
|
||||
|
||||
test17.mac
|
||||
----------
|
||||
confined spherical volume source, isotropic radiation, exponential energy
|
||||
|
||||
test18.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, user-defined energy histogram
|
||||
|
||||
test19.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, arbitrary point-wise energy function
|
||||
with linear interpolation.
|
||||
|
||||
test20.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, arbitrary point-wise energy function
|
||||
with logarithmic interpolation.
|
||||
|
||||
test21.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, arbitrary point-wise energy function
|
||||
with exponential interpolation.
|
||||
|
||||
test22.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation, arbitrary point-wise energy function
|
||||
with spline interpolation.
|
||||
|
||||
test23.mac
|
||||
----------
|
||||
square plane source with x and y biasing, user-defined theta and phi
|
||||
distributions, user-defined EPN energy distribution.
|
||||
|
||||
test24.mac
|
||||
----------
|
||||
spherical volume source with z biasing, isotropic radiation with theta and phi
|
||||
biasing, arbitrary point-wise energy function with linear interpolation.
|
||||
|
||||
test25.mac
|
||||
----------
|
||||
spherical volume source, isotropic radiation with theta and phi biasing,
|
||||
user-defined energy histogram
|
||||
|
||||
test26.mac
|
||||
----------
|
||||
square plane source, cosine-law radiation with lower and upper theta and phi
|
||||
limits, linear energy with biasing.
|
||||
|
||||
test27.mac
|
||||
----------
|
||||
square plane source, user-defined theta, arbitrary point-wise energy function
|
||||
with linear interpolation.
|
||||
|
||||
test28.mac
|
||||
----------
|
||||
particle=ion, square plane source, isotropic radiation, monoenergetic energy.
|
||||
|
||||
test29.mac
|
||||
----------
|
||||
plane source of type annulus, cosine-law radiation, exponential energy
|
||||
|
||||
test30.mac
|
||||
----------
|
||||
rotated 1d beam source, Gaussian beam energy
|
||||
|
||||
test31.mac
|
||||
----------
|
||||
two-beam incidence, i.e. multiple sources with relative intensities.
|
||||
|
||||
test32.mac
|
||||
----------
|
||||
Sphere volume source, with biasing in theta and phi
|
||||
Isotropic directional distribution with theta and phi biasing
|
||||
|
||||
test33.mac
|
||||
----------
|
||||
Focused angular distribution.
|
||||
|
||||
test34.mac
|
||||
----------
|
||||
Two simultaneous sources, both fired at the same time.
|
||||
|
||||
test35.mac
|
||||
----------
|
||||
automatic biasing of the energy distribution sampling, original in power-law
|
||||
|
||||
test36.mac
|
||||
----------
|
||||
automatic biasing of the energy distribution sampling, original in arbitrary
|
||||
data points
|
||||
|
||||
test37.mac
|
||||
----------
|
||||
automatic biasing of the energy distribution sampling, original in exponetial
|
||||
form
|
||||
|
||||
test38.mac
|
||||
----------
|
||||
arbitrary energy distribution, defined using the ascii input file: spectrum.dat
|
||||
@@ -0,0 +1,158 @@
|
||||
|
||||
///\file "eventgenerator/particleGun/.README.txt"
|
||||
///\brief Example ParticleGun README page
|
||||
|
||||
/*! \page ExampleparticleGun Example particleGun
|
||||
|
||||
History:
|
||||
- 10-06-2010 : Makoto Asai - merge into one example
|
||||
- 13-05-2010 : Michel Maire - create as three examples
|
||||
|
||||
This example demonstrates 5 ways of the usage of G4ParticleGun shooting
|
||||
primary particles in different cases. These are
|
||||
-# uniform particle direction in a given solid angle
|
||||
-# Generate several vertices and particles per event
|
||||
-# Show how to sample a tabulated function (eg. energy spectrum)
|
||||
-# Divergent beam in an arbitrary direction
|
||||
-# Shooting primaries in spherical coordinates with rotation matrix.
|
||||
|
||||
These usages can be chosen by a UI command
|
||||
\verbatim
|
||||
/gunExample/selectGunAction actionID
|
||||
\endverbatim
|
||||
where <i>actionID</i> corresponds to above cases.
|
||||
|
||||
\section ParticleGun_s1 Geometry construction
|
||||
|
||||
It is a simple box which represents an 'infinite' homogeneous medium.
|
||||
|
||||
\section ParticleGun_s2 Physics list
|
||||
|
||||
PhysicsList.cc defines only geantino and transportation process.
|
||||
|
||||
\section ParticleGun_s3 Primary generator
|
||||
|
||||
There are 5 concrete primary generator action classes
|
||||
(PrimaryGeneratorActionN, N=0,1,2,3,4) which can be used as an independent sample
|
||||
code.
|
||||
PrimaryGeneratorAction is the class which uses and switches between these
|
||||
5 concrete action classes. Each concrete generator action shoots geantinoes
|
||||
in a distribution decribed below.
|
||||
|
||||
\subsection ParticleGun_sub_s30 0. Uniform particle direction in a given solid angle
|
||||
|
||||
spherical angles (alpha,psi) respective to z axis
|
||||
Histograms 5,6 show momentum direction in master frame.
|
||||
|
||||
\subsection ParticleGun_sub_s31 1. Generate several vertices and particles per event
|
||||
|
||||
- particle 1 : a geantino uniformly randomized on a cylinder surface.
|
||||
- particle 2 and 3 : symetric to particle 1.
|
||||
In addition, time_zero of each event is randomized.
|
||||
|
||||
\subsection ParticleGun_sub_s32 2. Show how to sample a tabulated function (energy spectrum)
|
||||
|
||||
Energy is sampled from a tabulated function defined in InitFunction().
|
||||
The function is assumed positive, linear per segment, continuous.
|
||||
Two sampling methods are illustrated : RejectAccept() and InverseCumul()
|
||||
(see Particle Data book, Monte Carlo techniques).
|
||||
|
||||
Histogram 1 shows generated energy spectrum.
|
||||
|
||||
\subsection ParticleGun_sub_s33 3. Divergent beam in an arbitrary direction with rotation matrix
|
||||
|
||||
A geantino uniformly randomized around a given direction (theta, phi).
|
||||
One wants to limit particle direction uniformly around this direction.
|
||||
First, one generates momentum direction in the master frame (eg. World).
|
||||
AlphaMax = opening angle around z axis.
|
||||
Then one rotates momentum in local frame, using rotateUz() function.
|
||||
RotateUz() transforms uz to newUz. It is composition of two simple rotations:
|
||||
theta around oy, then phi around oz (non commutative). \n
|
||||
See:
|
||||
http://proj-clhep.web.cern.ch/proj-clhep/manual/UserGuide/VectorDefs/node49.html \n
|
||||
Histograms 5,6 show momentum direction in local frame.
|
||||
|
||||
\subsection ParticleGun_sub_s34 4. Shooting primaries in spherical coordinates with rotation matrix
|
||||
|
||||
a geantino uniformly randomized within a spherical shell.
|
||||
|
||||
a) Vertex position
|
||||
One wishes to shoot uniformly within a spherical shell.
|
||||
One works in spherical coordinates. One uses inverse cumulative method with
|
||||
analytical formulae. \n
|
||||
Histograms 2,3,4 demonstrate uniform distribution of vertex position.
|
||||
|
||||
b) Momentum direction
|
||||
One wants to limit particle direction uniformly within (alphaMin, alphaMax).
|
||||
First, one generates momentum direction in the master frame (eg. World).
|
||||
Then, one rotates momentum in vertex_position frame, using rotateUz() function.
|
||||
RotateUz() transforms uz to ur. It is composition of two elementary rotations:
|
||||
theta around oy, then phi around oz (non commutative). \n
|
||||
See:
|
||||
http://proj-clhep.web.cern.ch/proj-clhep/manual/UserGuide/VectorDefs/node49.html \n
|
||||
|
||||
Histograms 5,6 show momentum direction in vertex_position frame.
|
||||
|
||||
\section ParticleGun_s4 Visualisation
|
||||
|
||||
Visualization Manager is set in the main () (see particleGun.cc).
|
||||
Initialisation of the drawing is done via the commands
|
||||
/vis/.. in the macro vis.mac. This macro is automatically read from the main
|
||||
in case of interactive running mode.
|
||||
|
||||
\section ParticleGun_s5 How to start ?
|
||||
|
||||
- Execute particleGun in 'batch' mode from macro files
|
||||
\verbatim
|
||||
% ParticleGun run1.mac
|
||||
\endverbatim
|
||||
|
||||
- Execute particleGun2 in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% particleGun
|
||||
....
|
||||
Idle> ---> type your commands. For instance:
|
||||
Idle> /gunExample/selectGunAction 1
|
||||
Idle> /run/beamOn 10
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
\section ParticleGun_s6 Histograms
|
||||
|
||||
particleGun produces several 1D histograms which are saved as
|
||||
particleGun.root by default.
|
||||
|
||||
- 1 : energy spectrum dN/dE = f(E)
|
||||
- 2 : vertex position: radial distr dN/dv = f(r)
|
||||
- 3 : vertex position: cos(theta)
|
||||
- 4 : vertex position: phi
|
||||
- 5 : particle direction in local frame: cos(alpha)
|
||||
- 6 : particle direction in local frame: psi
|
||||
|
||||
Please note that histogram 1 will be filled only if you use
|
||||
PrimaryGeneratorAction2, histos 5,6 with PrimaryGeneratorAction0 and 3
|
||||
and 2 through 6 will be filled with PrimaryGeneratorAction4.
|
||||
|
||||
The histograms are managed by the HistoManager class and its Messenger.
|
||||
The histos can be individually activated with the command :
|
||||
\verbatim
|
||||
/analysis/h1/set id nbBins valMin valMax unit
|
||||
\endverbatim
|
||||
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
\verbatim
|
||||
/analysis/h1/setFileName name (default particleGun)
|
||||
\endverbatim
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
It is also possible to print selected histograms on an ascii file:
|
||||
\verbatim
|
||||
/analysis/h1/setAscii id
|
||||
\endverbatim
|
||||
All selected histos will be written on a file name.ascii (default gunExample)
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,152 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
ParticleGun
|
||||
-----------
|
||||
|
||||
History:
|
||||
10-06-2010 : Makoto Asai - merge into one example
|
||||
13-05-2010 : Michel Maire - create as three examples
|
||||
|
||||
This example demonstrates 5 ways of the usage of G4ParticleGun shooting
|
||||
primary particles in different cases. These are
|
||||
0) uniform particle direction in a given solid angle
|
||||
1) Generate several vertices and particles per event
|
||||
2) Show how to sample a tabulated function (eg. energy spectrum)
|
||||
3) Divergent beam in an arbitrary direction
|
||||
4) Shooting primaries in spherical coordinates with rotation matrix.
|
||||
These usages can be chosen by a UI command
|
||||
/gunExample/selectGunAction <actionID>
|
||||
where <actionID> corresponds to above cases.
|
||||
|
||||
1- Geometry construction
|
||||
---------------------
|
||||
|
||||
It is a simple box which represents an 'infinite' homogeneous medium.
|
||||
|
||||
2- Physics list
|
||||
------------
|
||||
|
||||
PhysicsList.cc defines only geantino and transportation process.
|
||||
|
||||
3- Primary generator
|
||||
-----------------
|
||||
|
||||
There are 5 concrete primary generator action classes
|
||||
(PrimaryGeneratorActionN, N=0,1,2,3,4) which can be used as an independent sample
|
||||
code.
|
||||
PrimaryGeneratorAction is the class which uses and switches between these
|
||||
5 concrete action classes. Each concrete generator action shoots geantinoes
|
||||
in a distribution decribed below.
|
||||
|
||||
3.0- uniform particle direction in a given solid angle
|
||||
-------------------------------------------------
|
||||
spherical angles (alpha,psi) respective to z axis
|
||||
Histograms 5,6 show momentum direction in master frame.
|
||||
|
||||
3.1- Generate several vertices and particles per event
|
||||
-------------------------------------------------
|
||||
|
||||
particle 1 : a geantino uniformly randomized on a cylinder surface.
|
||||
particle 2 and 3 : symetric to particle 1.
|
||||
In addition, time_zero of each event is randomized.
|
||||
|
||||
3.2- Show how to sample a tabulated function (energy spectrum)
|
||||
---------------------------------------------------------
|
||||
|
||||
Energy is sampled from a tabulated function defined in InitFunction().
|
||||
The function is assumed positive, linear per segment, continuous.
|
||||
Two sampling methods are illustrated : RejectAccept() and InverseCumul()
|
||||
(see Particle Data book, Monte Carlo techniques).
|
||||
Histogram 1 shows generated energy spectrum.
|
||||
|
||||
3.3- Divergent beam in an arbitrary direction with rotation matrix
|
||||
-------------------------------------------------------------
|
||||
|
||||
A geantino uniformly randomized around a given direction (theta, phi).
|
||||
One wants to limit particle direction uniformly around this direction.
|
||||
First, one generates momentum direction in the master frame (eg. World).
|
||||
AlphaMax = opening angle around z axis.
|
||||
Then one rotates momentum in local frame, using rotateUz() function.
|
||||
RotateUz() transforms uz to newUz. It is composition of two simple rotations:
|
||||
theta around oy, then phi around oz (non commutative).
|
||||
http://proj-clhep.web.cern.ch/proj-clhep/manual/UserGuide/VectorDefs/node49.html
|
||||
Histograms 5,6 show momentum direction in local frame.
|
||||
|
||||
3.4- Shooting primaries in spherical coordinates with rotation matrix
|
||||
----------------------------------------------------------------
|
||||
|
||||
a geantino uniformly randomized within a spherical shell.
|
||||
|
||||
a) Vertex position
|
||||
One wishes to shoot uniformly within a spherical shell.
|
||||
One works in spherical coordinates. One uses inverse cumulative method with
|
||||
analytical formulae.
|
||||
Histograms 2,3,4 demonstrate uniform distribution of vertex position.
|
||||
|
||||
b) Momentum direction
|
||||
One wants to limit particle direction uniformly within (alphaMin, alphaMax).
|
||||
First, one generates momentum direction in the master frame (eg. World).
|
||||
Then, one rotates momentum in vertex_position frame, using rotateUz() function.
|
||||
RotateUz() transforms uz to ur. It is composition of two elementary rotations:
|
||||
theta around oy, then phi around oz (non commutative).
|
||||
http://proj-clhep.web.cern.ch/proj-clhep/manual/UserGuide/VectorDefs/node49.html
|
||||
Histograms 5,6 show momentum direction in vertex_position frame.
|
||||
|
||||
4- Visualisation
|
||||
-------------
|
||||
|
||||
Visualization Manager is set in the main().
|
||||
Initialisation of the drawing is done via the commands
|
||||
/vis/.. in the macro vis.mac. This macro is automatically read from the main
|
||||
in case of interactive running mode.
|
||||
|
||||
5- How to start ?
|
||||
--------------
|
||||
|
||||
- execute particleGun in 'batch' mode from macro files
|
||||
% ParticleGun run1.mac
|
||||
|
||||
- execute particleGun2 in 'interactive mode' with visualization
|
||||
% particleGun
|
||||
....
|
||||
Idle> ---> type your commands. For instance:
|
||||
Idle> /gunExample/selectGunAction 1
|
||||
Idle> /run/beamOn 10
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
6- Histograms
|
||||
----------
|
||||
|
||||
particleGun produces several 1D histograms which are saved as
|
||||
particleGun.root by default.
|
||||
|
||||
1 : energy spectrum dN/dE = f(E)
|
||||
2 : vertex position: radial distr dN/dv = f(r)
|
||||
3 : vertex position: cos(theta)
|
||||
4 : vertex position: phi
|
||||
5 : particle direction in local frame: cos(alpha)
|
||||
6 : particle direction in local frame: psi
|
||||
|
||||
Please note that histogram 1 will be filled only if you use
|
||||
PrimaryGeneratorAction2, histos 5,6 with PrimaryGeneratorAction0 and 3
|
||||
and 2 through 6 will be filled with PrimaryGeneratorAction4.
|
||||
|
||||
The histograms are managed by the HistoManager class and its Messenger.
|
||||
The histos can be individually activated with the command :
|
||||
/analysis/h1/set id nbBins valMin valMax unit
|
||||
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
|
||||
|
||||
One can control the name of the histograms file with the command:
|
||||
/analysis/h1/setFileName name (default particleGun)
|
||||
|
||||
It is possible to choose the format of the histogram file : root (default),
|
||||
xml, csv, by using namespace in HistoManager.hh
|
||||
|
||||
It is also possible to print selected histograms on an ascii file:
|
||||
/analysis/h1/setAscii id
|
||||
All selected histos will be written on a file name.ascii (default gunExample)
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
///\file "eventgenerator/pythia/.README.txt"
|
||||
///\brief Examples pythia README page
|
||||
|
||||
/*! \page Examples_pythia Category "eventgenerator/pythia"
|
||||
|
||||
Examples for Pythia-Geant4 interface.
|
||||
|
||||
This directory contains examples for using Pythia as Monte Carlo event
|
||||
generator, interfaced with Geant4, and showing how to implement an external
|
||||
decayer.
|
||||
|
||||
\section pythia_s1 Requirements for external software packages
|
||||
|
||||
\subsection PYTHIA
|
||||
- Tested versions 6.4.28 (decayer6) and 8.3.0.5 (py8decayer)
|
||||
- URL: https://pythia.org/
|
||||
|
||||
\section pythia_s2 Example decayer6
|
||||
The \link Exampledecayer6 decayer6 \endlink example demonstrates the use
|
||||
of Pythia6 as an external decayer.
|
||||
|
||||
\section pythia_s3 Example py8decayer
|
||||
The \link Examplepy8decayer py8decayer \endlink example demonstrates the use
|
||||
of Pythia8 as an external decayer.
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Examples for Pythia-Geant4 interface
|
||||
------------------------------------
|
||||
|
||||
This directory contains examples for using Pythia as Monte Carlo event
|
||||
generator, interfaced with Geant4, and showing how to implement an external
|
||||
decayer.
|
||||
|
||||
Requirements for external software packages
|
||||
-------------------------------------------
|
||||
PYTHIA
|
||||
Tested version 6.4.28
|
||||
URL: http://www.thep.lu.se/~torbjorn/Pythia.html
|
||||
|
||||
Example decayer6
|
||||
This example demonstrates the use of Pythia6 as an external decayer.
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
///\file "eventgenerator/pythia/decayer6/.README.txt"
|
||||
///\brief Example decayer6 page
|
||||
|
||||
/*! \page Exampledecayer6 Example decayer6
|
||||
|
||||
This is an example of the external decayer implementation
|
||||
with PYTHIA6.
|
||||
|
||||
The complete PYTHIA6 documentation can be found at:
|
||||
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
|
||||
|
||||
The PYTHIA6 external decayer was originally developed within
|
||||
the AliRoot framework, by Andreas Morsch (CERN). \n
|
||||
The dependence on the ALICE software was taken off
|
||||
by Christian Holm Christensen. \n
|
||||
The dependence on the Root framework and the integration in
|
||||
the Geant4 framework was done by Ivana Hrivnacova (IPN Orsay).
|
||||
|
||||
<hr>
|
||||
|
||||
The use of the external decayer is demonstrated with using the
|
||||
classes from common examples repository, see below their complete
|
||||
list.
|
||||
|
||||
The G4Pythia6Decayer class provides the implementation of the
|
||||
G4VExternalDecayer interface with using PYTHIA6. In order
|
||||
to be able to use PYTHIA6, which is written in FORTRAN,
|
||||
a C++ interface class Pythia6 is provided. This class
|
||||
interfaces only the PYTHIA6 functions relevant to decay.
|
||||
|
||||
The G4Pythia6Decayer is instantiated in the
|
||||
P6DExtDecayerPhysics::ConstructProcess() function where the external
|
||||
decayer is set to G4Decay process for all particles.
|
||||
To demonstrate the decay with external decayer,
|
||||
the B- meson is defined in ExG4PrimaryGeneratorAction01,
|
||||
as it has no own decay table defined within Geant4.
|
||||
|
||||
With PYTHIA6, it is possible to force a selected decay
|
||||
type. This selection can be chosen interactively via
|
||||
the implemented Geant4 UI command:
|
||||
\verbatim
|
||||
/pythia6Decayer/forceDecayType decayType
|
||||
\endverbatim
|
||||
where the available decay types are listed in the EDecayType
|
||||
enumaration.
|
||||
|
||||
The classes Pythia6, G4Pythia6Decayer, G4Pythia6DecayerMessenger
|
||||
are independent from the example classes and can be reused
|
||||
in another user application.
|
||||
|
||||
Installation:
|
||||
- 1. Download the PYTHIA6 source file from the PYTHIA6 download site:\n
|
||||
http://www.hepforge.org/downloads/pythia6
|
||||
|
||||
- 2A. With CMake: Build pythia6 library
|
||||
|
||||
For a convenience a CMake file for building Pythia6 library from
|
||||
the source is provided in
|
||||
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
|
||||
Build the pythia6 library following the instructions in this file
|
||||
and then define the environment variables:
|
||||
\verbatim
|
||||
PYTHIA6 the path where pythia6 library is installed
|
||||
PYTHIA6_VERSION the pythia version
|
||||
\endverbatim
|
||||
|
||||
- 2B. With GNUmake: Define the environment variables: \n
|
||||
\verbatim
|
||||
PYTHIA6 the path to pythia-versionX.f source code
|
||||
PYTHIA6_VERSION the pythia version
|
||||
\endverbatim
|
||||
|
||||
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
|
||||
then you have to set:
|
||||
export PYTHIA6=$HOME
|
||||
export PYTHIA6_VERSION="6.4.26"
|
||||
|
||||
pythia6 will be then compiled together with example code.
|
||||
|
||||
- 3. Compilation:\n
|
||||
Then the example is compiled in a standard way, see \ref README_HowToRun. \n
|
||||
Note that with GNUmake build, an additional step 'gmake setup' is
|
||||
needed before 'gmake'.
|
||||
|
||||
- 4. Execution:
|
||||
\verbatim
|
||||
% pythia6_decayer pythia6_decayer.in
|
||||
\endverbatim
|
||||
|
||||
This example uses the following user action classes from the extended examples common
|
||||
repository available in common subdirectory:
|
||||
- DetectorConstruction
|
||||
- GunPrimaryGeneratorAction
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,85 @@
|
||||
------------------------------------------------------------
|
||||
|
||||
Example of the external decayer implementation with PYTHIA6
|
||||
-----------------------------------------------------------
|
||||
|
||||
The complete PYTHIA6 documentation can be found at:
|
||||
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
|
||||
|
||||
The PYTHIA6 external decayer was originally developed within
|
||||
the AliRoot framework, by Andreas Morsch (CERN).
|
||||
The dependence on the ALICE software was taken off
|
||||
by Christian Holm Christensen,
|
||||
The dependence on the Root framework and the integration in
|
||||
the Geant4 framework was done by Ivana Hrivnacova (IPN Orsay).
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
The use of the external decayer is demonstrated with using the
|
||||
classes from common examples repository, see below their complete list.
|
||||
|
||||
The G4Pythia6Decayer class provides the implementation of the
|
||||
G4VExternalDecayer interface with using PYTHIA6. In order
|
||||
to be able to use PYTHIA6, which is written in FORTRAN,
|
||||
a C++ interface class Pythia6 is provided. This class
|
||||
interfaces only the PYTHIA6 functions relevant to decay.
|
||||
|
||||
The G4Pythia6Decayer is instantiated in the P6DExtDecayerPhysics builder,
|
||||
in the ConstructProcess() function where the external decayer is set
|
||||
to G4Decay process for all particles.
|
||||
To demonstrate the decay with external decayer,
|
||||
the B- meson is defined in ExG4PrimaryGeneratorAction01,
|
||||
as it has no own decay table defined within Geant4.
|
||||
|
||||
With PYTHIA6, it is possible to force a selected decay
|
||||
type. This selection can be chosen interactively via
|
||||
the implemented Geant4 UI command:
|
||||
|
||||
/pythia6Decayer/forceDecayType decayType
|
||||
|
||||
where the available decay types are listed in the EDecayType
|
||||
enumaration.
|
||||
|
||||
The classes Pythia6, G4Pythia6Decayer, G4Pythia6DecayerMessenger
|
||||
are independent from the example classes and can be reused
|
||||
in another user application.
|
||||
|
||||
Installation:
|
||||
|
||||
1. Download the PYTHIA6 source file from the PYTHIA6 download site:
|
||||
http://www.hepforge.org/downloads/pythia6
|
||||
|
||||
2A.) With CMake: Build pythia6 library
|
||||
|
||||
For a convenience a CMake file for building Pythia6 library from
|
||||
the source is provided in
|
||||
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
|
||||
Build the pythia6 library following the instructions in this file
|
||||
and then define the environment variables:
|
||||
PYTHIA6 the path where pythia6 library is installed
|
||||
PYTHIA6_VERSION the pythia version
|
||||
|
||||
2B.) With GNUmake: Define the environment variables:
|
||||
PYTHIA6 the path to pythia-versionX.f source code
|
||||
PYTHIA6_VERSION the pythia version
|
||||
|
||||
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
|
||||
then you have to set:
|
||||
export PYTHIA6=$HOME
|
||||
export PYTHIA6_VERSION="6.4.26"
|
||||
|
||||
Pythia6 will be then compiled together with example code.
|
||||
|
||||
3. Compilation:
|
||||
Then the example is compiled in a standard way, see examples/README_HowToRun.
|
||||
Note that with GNUmake build, an additional step 'gmake setup' is
|
||||
needed before 'gmake'.
|
||||
|
||||
Execution:
|
||||
|
||||
% pythia6_decayer pythia6_decayer.in
|
||||
|
||||
This example uses the following user action classes from the extended examples common
|
||||
repository available in common subdirectory:
|
||||
DetectorConstruction
|
||||
GunPrimaryGeneratorAction
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
///\file "common/.README.txt"
|
||||
///\brief Common classes README page
|
||||
|
||||
/*! \page Examples_common Category "common"
|
||||
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
- Physics list classes
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Common Classes for Extended Examples
|
||||
-------------------------------------
|
||||
|
||||
In order to reduce code duplication and to reduce the number of variants of
|
||||
the code of same kind, we define a set of common classes which
|
||||
can be reused in "feature" examples demonstrating just a particular feature.
|
||||
This module may be enhanced in future. Currently it provides
|
||||
the following sets of classes:
|
||||
|
||||
- Detector construction classes
|
||||
- two simple detector construction classes with a messenger
|
||||
|
||||
- Physics list classes
|
||||
- GeantinoPhysicsList - physics list with geantino and chargedgeantino only
|
||||
|
||||
- Primary generator classes
|
||||
- two simple primary generator classes (with G4ParticleGun and
|
||||
G4ParticleGeneralSource)
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
|
||||
///\file "eventgenerator/pythia/py8decayer/.README.txt"
|
||||
///\brief Example py8decayer page
|
||||
|
||||
/*! \page Examplepy8decayer Example py8decayer
|
||||
|
||||
This example demonstrates how to outfit Pythia8-based decay features
|
||||
to those resonances in Geant4 where decay tables are not implemented
|
||||
by default. In addition, it showns how to replace existing
|
||||
Geant4 decay tables to such resonances as tau+/- or B+/- with
|
||||
the Pythia8-based ones.
|
||||
|
||||
This example is activated by setting up PYTHIA8 environment variable
|
||||
to point to the area where Pythia8 is installed.
|
||||
|
||||
The complete Pythia8 information, including on download, and documentation
|
||||
is available from the following site:
|
||||
https://pythia.org
|
||||
|
||||
The original version of this example has been implemented by Julia Yarba
|
||||
(FNAL, USA)
|
||||
|
||||
<hr>
|
||||
|
||||
For the complete list of the classes that compose this example please
|
||||
see later in this document.
|
||||
|
||||
Location of example:
|
||||
|
||||
examples/extended/eventgenerator/pythia/py8decayer
|
||||
|
||||
|
||||
Installation of Pythia8:
|
||||
|
||||
NOTE: As of June 2021, pythia8.3.0.5 is the most current version,
|
||||
this it is used in this example.
|
||||
In the future, please check updates at Pythia8 site: https://pythia.org
|
||||
|
||||
- 1. cd path/to/your/pythia8/area
|
||||
|
||||
- 2. Download desired version of Pythia8 and un-tar it, e.g.
|
||||
\verbatim
|
||||
wget http://home.thep.lu.se/~torbjorn/pythia8/pythia8305.tgz
|
||||
tar xzf pythia8305.tgz
|
||||
\endverbatim
|
||||
|
||||
- 3. Build/install Pythia8
|
||||
\verbatim
|
||||
cd pythia8305
|
||||
export CXX=\`which g++\`
|
||||
./configure --prefix=$PWD --cxx=$CXX
|
||||
make
|
||||
\endverbatim
|
||||
NOTE: By default, Pythia8 (as of 8.3.0.5) builds with C++11 standards.
|
||||
If one wants to turn to e.g. C++17 standard, one needs to override flags
|
||||
via --cxx-common argument to configure script.
|
||||
|
||||
4. Setup PYTHIA8 environment variable to point to the area where Pythia8
|
||||
is built/installed:
|
||||
\verbatim
|
||||
export PYTHIA8=$PWD
|
||||
\endverbatim
|
||||
|
||||
Building example:
|
||||
|
||||
Upon setup of PYTHIA8 environment variable to point to the area where
|
||||
Pythia8 package is installed, the pythia/py8decayer example will be
|
||||
compiled together with several other features of the eventgenerator example.
|
||||
|
||||
|
||||
Description of classes:
|
||||
|
||||
Py8Decayer class provides implementation of the G4VExternalDecayer interface
|
||||
with the use of PYTHIA8.
|
||||
It is reasonably annotated, and demonstrates what features of Pythia8 need
|
||||
to be activated and/or disactivated in order to make Pythia8 work only in
|
||||
the decay mode.
|
||||
It also illustrated how to control several other features of Pythia8, including
|
||||
some reduction of Pythia8 verbosity (by default, Pythia8 produces quite a large
|
||||
amount of printouts, thus reducing it could be useful in some cases).
|
||||
Last but not least, it also shown how to deactivate decays of pi0's by Pythia8
|
||||
as the idea is to handle pi0's back to Geant4 for decays.
|
||||
|
||||
Py8DecayerPhysics class implements a G4VPhysicsConstructor type of component
|
||||
with the use of Py8Decayer; this component can later be used with a ddsired
|
||||
physics list (see main program).
|
||||
Specifically, in the Py8DecayerPhysics::ConstructProcess() the Py8Decayer is
|
||||
instantiated and is used to
|
||||
a) replace existing decay tables of such resonances as tau+/- and B+/-
|
||||
b) supplement decay features to those resonances in Geant4 where the decay
|
||||
tables are not implemnted by defaukt
|
||||
|
||||
In principle, classes Py8Decayer and Py8DecayerPhysics can be directly reused with
|
||||
another user application.
|
||||
Alternatively, they can be used as an inspiration to implement similar, or perhaps
|
||||
even more extensive Pythia8-based functionalities of user's choice.
|
||||
|
||||
Class DetConstruction demostrates how to implement minimalistic detector geometry.
|
||||
|
||||
Class SingleParticleGun demonstrates how to implement generaton of the primary
|
||||
particle.
|
||||
|
||||
|
||||
Main program:
|
||||
|
||||
pythia8_decayer.cc
|
||||
|
||||
|
||||
Executable:
|
||||
|
||||
pythia8_decayer
|
||||
|
||||
|
||||
Execution:
|
||||
|
||||
At present, the pythia8_decayer executable does not take any input arguments.
|
||||
Everything, including the choine of primary particle, is hardcoded in the main.
|
||||
Although in the future some configurability may be added.
|
||||
|
||||
By default it'll run 5 single tau events using Pythia8 to decays them.
|
||||
|
||||
It should print some Pythia8 event information, including on decays.
|
||||
Once again, please bear in mind that the decay of pi0's by Pythia8 is disabled
|
||||
(see Py8Decayer constructor) since the idea is to hand the pi0's back to Geant4
|
||||
and make Geant4 decay them.
|
||||
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Example of the external decayer implementation with Pythia8
|
||||
------------------------------------------------------------
|
||||
|
||||
This example demonstrates how to outfit Pythia8-based decay features
|
||||
to those resonances in Geant4 where decay tables are not implemented
|
||||
by default. In addition, it showns how to replace existing
|
||||
Geant4 decay tables to such resonances as tau+/- or B+/- with
|
||||
the Pythia8-based ones.
|
||||
|
||||
This example is activated by setting up PYTHIA8 environment variable
|
||||
to point to the area where Pythia8 is installed.
|
||||
|
||||
The complete Pythia8 information, including on download, and documentation
|
||||
is available from the following site:
|
||||
https://pythia.org
|
||||
|
||||
The original version of this example has been implemented by Julia Yarba
|
||||
(FNAL, USA)
|
||||
|
||||
For the complete list of the classes that compose this example please
|
||||
see later in this document.
|
||||
|
||||
Location of example:
|
||||
|
||||
examples/extended/eventgenerator/pythia/py8decayer
|
||||
|
||||
|
||||
Installation of Pythia8:
|
||||
|
||||
NOTE: As of June 2021, pythia8.3.0.5 is the most current version,
|
||||
this it is used in this example.
|
||||
In the future, please check updates at Pythi8 site: https://pythia.org
|
||||
|
||||
1. cd path/to/your/pythia8/area
|
||||
|
||||
2. Download desired version of Pythia8 and un-tar it, e.g.
|
||||
wget http://home.thep.lu.se/~torbjorn/pythia8/pythia8305.tgz
|
||||
tar xzf pythia8305.tgz
|
||||
|
||||
3. Build/install Pythia8
|
||||
cd pythia8305
|
||||
export CXX=\`which g++\`
|
||||
./configure --prefix=$PWD --cxx=$CXX
|
||||
make
|
||||
NOTE: By default, Pythia8 (as of 8.3.0.5) builds with C++11 standards.
|
||||
If one wants to turn to e.g. C++17 standard, one needs to override flags
|
||||
via --cxx-common argument to configure script.
|
||||
|
||||
4. Setup PYTHIA8 environment variable to point to the area where Pythia8
|
||||
is built/installed:
|
||||
export PYTHIA8=$PWD
|
||||
|
||||
|
||||
Building example:
|
||||
|
||||
Upon setup of PYTHIA8 environment variable to point to the area where
|
||||
Pythia8 package is installed, the pythia/py8decayer example will be
|
||||
compiled together with several other features of the eventgenerator example.
|
||||
|
||||
|
||||
Description of classes:
|
||||
|
||||
Py8Decayer class provides implementation of the G4VExternalDecayer interface
|
||||
with the use of PYTHIA8.
|
||||
It is reasonably annotated, and demonstrates what features of Pythia8 need
|
||||
to be activated and/or disactivated in order to make Pythia8 work only in
|
||||
the decay mode.
|
||||
It also illustrated how to control several other features of Pythia8, including
|
||||
some reduction of Pythia8 verbosity (by default, Pythia8 produces quite a large
|
||||
amount of printouts, thus reducing it could be useful in some cases).
|
||||
Last but not least, it also shown how to deactivate decays of pi0's by Pythia8
|
||||
as the idea is to handle pi0's back to Geant4 for decays.
|
||||
|
||||
Py8DecayerPhysics class implements a G4VPhysicsConstructor type of component
|
||||
with the use of Py8Decayer; this component can later be used with a ddsired
|
||||
physics list (see main program).
|
||||
Specifically, in the Py8DecayerPhysics::ConstructProcess() the Py8Decayer is
|
||||
instantiated and is used to
|
||||
a) replace existing decay tables of such resonances as tau+/- and B+/-
|
||||
b) supplement decay features to those resonances in Geant4 where the decay
|
||||
tables are not implemnted by defaukt
|
||||
|
||||
In principle, classes Py8Decayer and Py8DecayerPhysics can be directly reused with
|
||||
another user application.
|
||||
Alternatively, they can be used as an inspiration to implement similar, or perhaps
|
||||
even more extensive Pythia8-based functionalities of user's choice.
|
||||
|
||||
Class DetConstruction demostrates how to implement minimalistic detector geometry.
|
||||
|
||||
Class SingleParticleGun demonstrates how to implement generaton of the primary
|
||||
particle.
|
||||
|
||||
|
||||
Main program:
|
||||
|
||||
pythia8_decayer.cc
|
||||
|
||||
|
||||
Executable:
|
||||
|
||||
pythia8_decayer
|
||||
|
||||
|
||||
Execution:
|
||||
|
||||
At present, the pythia8_decayer executable does not take any input arguments.
|
||||
Everything, including the choine of primary particle, is hardcoded in the main.
|
||||
Although in the future some configurability may be added.
|
||||
|
||||
By default it'll run 5 single tau events using Pythia8 to decays them.
|
||||
|
||||
It should print some Pythia8 event information, including on decays.
|
||||
Once again, please bear in mind that the decay of pi0's by Pythia8 is disabled
|
||||
(see Py8Decayer constructor) since the idea is to hand the pi0's back to Geant4
|
||||
and make Geant4 decay them.
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
///\file "eventgenerator/userPrimaryGenerator/.README.txt"
|
||||
///\brief Example basic README page
|
||||
|
||||
/*! \page ExampleuserPrimaryGenerator Example userPrimaryGenerator
|
||||
|
||||
The example shows how to create a primary event including several vertices and
|
||||
several primary particles per vertex
|
||||
|
||||
\section userPrimaryGenerator_s1 Geometry construction
|
||||
|
||||
It is a simple box which represents an 'infinite' homogeneous medium.
|
||||
|
||||
\section userPrimaryGenerator_s2 Physics list
|
||||
|
||||
PhysicsList.cc defines only geantino and transportation process.
|
||||
|
||||
\section userPrimaryGenerator_s3 Primary generator : several vertices and particles per event
|
||||
|
||||
vertex A and particle 1 : a geantino uniformly randomized on a cylinder surface.
|
||||
vertex B and particles 2 and 3 : symetric to vertex A.
|
||||
|
||||
\section userPrimaryGenerator_s4 Visualisation
|
||||
|
||||
Visualization Manager is set in the main().
|
||||
Initialisation of the drawing is done via the commands
|
||||
/vis/.. in the macro vis.mac. This macro is automatically read from the main
|
||||
in case of interactive running mode.
|
||||
|
||||
\section userPrimaryGenerator_s5 How to start ?
|
||||
|
||||
- execute userPrimaryGenerator in 'batch' mode from macro files
|
||||
\verbatim
|
||||
% userPrimaryGenerator run1.mac
|
||||
\endverbatim
|
||||
|
||||
- execute userPrimaryGenerator in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% userPrimaryGenerator
|
||||
....
|
||||
Idle> ---> type your commands. For instance:
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,49 @@
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
userPrimaryGenerator
|
||||
--------------------
|
||||
|
||||
The example shows how to create a primary event including several vertices and
|
||||
several primary particles per vertex
|
||||
|
||||
1- Geometry construction
|
||||
---------------------
|
||||
|
||||
It is a simple box which represents an 'infinite' homogeneous medium.
|
||||
|
||||
2- Physics list
|
||||
------------
|
||||
|
||||
PhysicsList.cc defines only geantino and transportation process.
|
||||
|
||||
3- Primary generator : several vertices and particles per event
|
||||
------------------------------------------------------------
|
||||
|
||||
vertex A and particle 1 : a geantino uniformly randomized on a cylinder surface.
|
||||
vertex B and particles 2 and 3 : symetric to vertex A.
|
||||
|
||||
4- Visualisation
|
||||
-------------
|
||||
|
||||
Visualization Manager is set in the main().
|
||||
Initialisation of the drawing is done via the commands
|
||||
/vis/.. in the macro vis.mac. This macro is automatically read from the main
|
||||
in case of interactive running mode.
|
||||
|
||||
5- How to start ?
|
||||
--------------
|
||||
|
||||
- execute basic in 'batch' mode from macro files
|
||||
% basic run1.mac
|
||||
|
||||
- execute basic in 'interactive mode' with visualization
|
||||
% basic
|
||||
....
|
||||
Idle> ---> type your commands. For instance:
|
||||
Idle> /run/beamOn 1
|
||||
....
|
||||
Idle> exit
|
||||
Reference in New Issue
Block a user