Warning, /geant4/examples/extended/eventgenerator/pythia/py8decayer/README.md is written in an unsupported language. File is not indexed.
0001 \page Examplepy8decayer Example py8decayer
0002
0003 This example demonstrates how to outfit Pythia8-based decay features
0004 to those resonances in Geant4 where decay tables are not implemented
0005 by default. In addition, it showns how to replace existing
0006 Geant4 decay tables to such resonances as tau+/- or B+/- with
0007 the Pythia8-based ones.
0008
0009 The complete Pythia8 information, including on download, and documentation
0010 is available from the following site:
0011 https://pythia.org
0012
0013 The original version of this example has been implemented by Julia Yarba
0014 (FNAL, USA)
0015
0016 <hr>
0017
0018 For the complete list of the classes that compose this example please
0019 see later in this document.
0020
0021 Location of example:
0022
0023 examples/extended/eventgenerator/pythia/py8decayer
0024
0025
0026 ## Installation of Pythia8:
0027
0028 NOTE: As of May 2025, pythia8.3.15 is the most current version,
0029 thus it is used in this example.
0030 In general, this example is expected to work with any reasonably modern
0031 pythia8.x.y revision.
0032 In the future, please check updates at Pythia8 site: https://pythia.org
0033
0034 - 1.
0035 ```
0036 cd path/to/your/pythia8/area
0037 ```
0038 - 2. Download desired version of Pythia8 and un-tar it, e.g.
0039 ```
0040 wget https://pythia.org/download/pythia83/pythia8315.tgz
0041 tar xzf pythia8315.tgz
0042 ```
0043
0044 - 3. Build/install Pythia8
0045 ```
0046 cd pythia8315
0047 export CXX=\`which g++\`
0048 ./configure --prefix=$PWD --cxx=$CXX
0049 make
0050 ```
0051 NOTE: By default, Pythia8 (as of 8.3.15) builds with C++11 standards.
0052 If one wants to turn to e.g. C++17 standard, one needs to override flags
0053 via `--cxx-common` argument to configure script.
0054 Alternatively, one can setup `CXX_COMMON` environment variable.
0055 As of pythia8310, the default flags are the following:
0056 `-O2 -std=c++11 -pedantic -W -Wall -Wshadow -fPIC -pthread`. \n
0057 Please note use of `-pthread` which was not among default flags in earlier
0058 releases of Pythia8.
0059 Example of specifying C++17 standards by overriding the default flags via
0060 use of `--cxx_common` argument to configure script:
0061 ```
0062 ./configure --prefix=$PWD --cxx=$CXX \
0063 --cxx-common='-O2 -std=c++17 -pedantic -W -Wall -Wshadow -fPIC -pthread'
0064 ```
0065
0066 - 4. Setup Pythia8_ROOT environment variable to point to the area where Pythia8
0067 is built/installed:
0068 ```
0069 export Pythia8_ROOT=$PWD
0070 ```
0071
0072
0073 ## Building example:
0074
0075 Upon setup of `Pythia8_ROOT` environment variable to point to the area where
0076 Pythia8 package is installed, the pythia/py8decayer example will be
0077 compiled together with several other features of the eventgenerator example.
0078
0079
0080 ## Description of classes:
0081
0082 Py8Decayer class provides implementation of the G4VExternalDecayer interface
0083 with the use of PYTHIA8.
0084 It is reasonably annotated, and demonstrates what features of Pythia8 need
0085 to be activated and/or disactivated in order to make Pythia8 work only in
0086 the decay mode.
0087 It also illustrated how to control several other features of Pythia8, including
0088 some reduction of Pythia8 verbosity (by default, Pythia8 produces quite a large
0089 amount of printouts, thus reducing it could be useful in some cases).
0090 It also shown how to deactivate decays of pi0's by Pythia8 as the idea is to handle
0091 pi0's back to Geant4 for decays.
0092
0093 Last but not least, it shows how to outfit Pythia8 with a custom random engine,
0094 i.e. Py8DecayerEngine.
0095
0096 Py8DecayerEngine class inherits from Pythia8::RndmEngine which in its turns is
0097 provided by the Pythia8 package in order to allow replacing the generator's native
0098 random engine with the one of user's choice.
0099 In this specific case Py8DecayerEngine allows to replace Pythia8 native random engine
0100 with the same engine that Geant4 uses (i.e. CLHEP::RanecuEngine as in this application).
0101 The feature is important for running the example in the MT/Tasking mode.
0102
0103 Py8DecayerPhysics class implements a G4VPhysicsConstructor type of component
0104 with the use of Py8Decayer; this component can later be used with a ddsired
0105 physics list (see main program).
0106 Specifically, in the Py8DecayerPhysics::ConstructProcess() the Py8Decayer is
0107 instantiated and is used to
0108 a) replace existing decay tables of such resonances as tau+/- and B+/-
0109 b) supplement decay features to those resonances in Geant4 where the decay
0110 tables are not implemnted by defaukt
0111
0112 In principle, classes Py8Decayer, Py8DecayerEngine, and Py8DecayerPhysics can be
0113 directly reused with another user application.
0114 Alternatively, they can be used as an inspiration to implement similar, or perhaps
0115 even more extensive Pythia8-based functionalities of user's choice.
0116
0117 Class DetConstruction demostrates how to implement minimalistic detector geometry.
0118
0119 Class SingleParticleGun demonstrates how to implement generaton of the primary
0120 particle.
0121
0122 Class ActionInitialization instantiates and registers to Geant4 kernel all user
0123 action classes; in this case it is SingleParticleGun.
0124
0125
0126 ## Main program:
0127
0128 pythia8_decayer.cc
0129
0130 This application currently uses the default RunManager which is Tasking and is
0131 initialized with 5 threads.
0132 It will then run 5 events, one per thread.
0133 SerialOnly RunManager can also be employed should the user choose so.
0134
0135
0136 ## Executable:
0137
0138 `pythia8_decayer`
0139
0140
0141 ## Execution:
0142
0143 At present, the `pythia8_decayer` executable does not take any input arguments.
0144 Everything, including the choine of primary particle, is hardcoded.
0145 Although in the future some configurability may be added.
0146
0147 As mentioned earlier, it will run 5 single tau events using Pythia8 to decays them.
0148
0149 It should print some Pythia8 event information, including on decays.
0150 Once again, please bear in mind that the decay of pi0's by Pythia8 is disabled
0151 (see Py8Decayer constructor) since the idea is to hand the pi0's back to Geant4
0152 and make Geant4 decay them.
0153
0154
0155 ## Additional notes on the contents of Geant4 and Pythia8 Particle Data Tables (PDT) :
0156
0157 In their default form, PDT's in Geant4 and Pythia8 have a number of differences
0158 that need to be kept in mind.
0159
0160 In the case of the Geant4 py8decayer example those differences are unlikely
0161 to cause any major issues.
0162
0163 But Pythia8 can, in principle, be used within Geant4 in more ways that just
0164 as an external decayer.
0165 Thus, if one is potentially interested in more sophisticated use of Pythia8
0166 in Geant4, one may want to consider whatever differences exist between (default)
0167 Geant4 and Pythia8 PDT's.
0168
0169 Both Geant4 and Pythia8 codes are evolving, and specific numbers may be different
0170 in earlier and/or in future releases.
0171
0172 To be more precise, by default Pythia8.3.10 PDT contains 677 entries, of which
0173 531 particles have an antiparticle (it looks like antiparticles do not make
0174 separate entries in Pythia8 PDT, but the total number of available species
0175 should be considered as 1208).
0176
0177 Geant4 PDT contains 508 entries.
0178
0179 Of those, 239 particles/antiparticles match by Particle ID's (on the Geant4 side
0180 it is explicitly called "PDG encoding" while on Pythia8 side it is just "id").
0181
0182 Many of Pythia8 PDT's entries are not available in Geant4 PDT, e.g. Z or W bosons
0183 are not in Geant4.
0184
0185 Some of the species in the Geant4 PDT do not seem to be in the Pythia8 PDT
0186 (e.g. excited nucleons do not seem to be in the Pythia8 PDT).
0187
0188 Also, there are entries in both PDT's that mean the same particles but are
0189 marked with different ID's.
0190 For example, excited Delta(s) are present in both PDT's but in Geant4 each one
0191 is marked with a 4-digit number as an ID (PDG encoding) while in Pythia8 an ID
0192 for such particle would be a 6-digit number starting with "20" and the last
0193 4 digits would be the same as the Geant4 ID for such particle.
0194
0195 Speaking of the 239 particles that match by ID (PDG ID), there may be further
0196 differences, e.g. by mass, either central value or width, or both (there might be
0197 other aspects but they have not been checked for).
0198
0199 Starting October 2022, checks have been made from time to time for differences
0200 larger that 1 keV in either mass central value or width.
0201
0202 The largest differences have been observed for quarks/diquarks.
0203 It appears that Geant4 sets (at least) masses of quarks as listed in PDG.
0204 For details on default settings for the quark masses in Pythia8 please refer
0205 to the Pythia8 manual:
0206 https://pythia.org/manuals/pythia8315/Welcome.html
0207 See Particles and Decays section, Particle Data subsection.
0208
0209 Beyond quarks/diquarks some differences in mass central values or width have also
0210 been observed, mainly for resonances.
0211 But even for such particles as proton or muon there may be differences on the order
0212 of a few keV (e.g. central value of the proton mass is 938.27 MeV in Pythia8 and
0213 938.272 MeV in Geant4)
0214