The Generator phase of Gauss

This page will be populated with Frequently Asked Questions concerning Gauss in general, for example:

  • external generator libraries available for use in Gauss
  • interface to external generators
  • generator settings

Please feel free to add topics.


If you did not find an answer to you question you can add it here:

Current user-submitted FAQ's can be found here

How to add a new decay file

Follow these instructions before committing a new decay file to the Gen/DecFiles package.

How to test a decay file or study the output of the generator phase of Gauss

Follow these instructions.

How to find the efficiency of generator level cuts applied in the decfile

Follow these instructions.

How can I run Gauss with one of the integrated generators other than Pythia (e.g. BcVegPy) ?

To use non-standard generators, one has to configure Gauss by adding the corresponding generator options. For example, for standard Sim08 settings with BcVegPy, one just adds the corresponding options after those of the eventtype: $GAUSSOPTS/ $DECFILESROOT/options/ $LBBCVEGPYROOT/options/ $GAUSSOPTS/

For the other generators available (Herwig, Hijing, HidValley, ...), replace BcVegPy with the name of the generator in the instructions above. This applies also to the particle guns and MIB (Machine Induced Background) where one uses PGuns and MIB as names of the generators. The list of generators available in Gauss, and the option files needed to use them can be found here.

How do I generate particle guns in Gauss Sim08 ?

Predefined event types exist for particle guns, you can find them in the DecFiles list. They start with the digit 5. Gauss has then to be configured to produce events with the particle gun engine. To do that, add the option file $LBPGUNSROOT/options/ to the list of Gauss option files, as for any other generator: $GAUSSOPTS/  $DECFILESROOT/options/ $LBPGUNSROOT/options/ $GAUSSOPTS/

If you have written your own configuration of the particle gun algorithm and tools, you can pass it instead of the pre-defined event type: $GAUSSOPTS/ $LBPGUNSROOT/options/ $GAUSSOPTS/

How do I generate B particle guns in Gauss, and decay the B with EvtGen

Run Gauss with the following parameters: $GAUSSOPTS/ ./ $LBPGUNSROOT/options/ $GAUSSOPTS/ $GAUSSOPTS/ =

where the file configures the behaviour of the ParticleGun algorithm to generate B decays:

# content of the file
from Configurables import ParticleGun, MomentumRange, FlatNParticles, ToolSvc, EvtGenDecay
from GaudiKernel import SystemOfUnits

pgun = ParticleGun()
pgun.ParticleGunTool = "MomentumRange"
pgun.addTool( MomentumRange , name = "MomentumRange" )

pgun.NumberOfParticlesTool = "FlatNParticles"
pgun.addTool( FlatNParticles , name = "FlatNParticles" )

pgun.MomentumRange.PdgCodes = [ 511 , -511 ]

tsvc = ToolSvc()
tsvc.addTool( EvtGenDecay , name = "EvtGenDecay" )
tsvc.EvtGenDecay.UserDecayFile = "BDecayFile.dec"
pgun.DecayTool = "EvtGenDecay"

pgun.MomentumRange.MomentumMin = 20.0*SystemOfUnits.GeV
pgun.MomentumRange.MomentumMax = 140.0*SystemOfUnits.GeV

EvtGen has to be configured with a decay file (called BDecayFile.dec in this example). Its content is to generate for example $B \to J/\psi K_S$ decays:

# content of the file BDecayFile.dec
Alias      MyJ/psi  J/psi
ChargeConj MyJ/psi  MyJ/psi
Alias      MyKs     K_S0
ChargeConj MyKs     MyKs
Decay B0
  1.000         MyJ/psi   MyKs           SVS;
CDecay anti-B0
Decay MyKs
  1.000         pi+       pi-            PHSP;
Decay MyJ/psi
  1.000         mu+       mu-           VLL;

If EvtGen picks up the right decay file but does not use it, you may need to change B0sig to B0 in your decay file.

If you get an error:

AttributeError: Configurable 'ParticleGun' does not have property 'PileUpTool'
You may need to use a modified copy of $GAUSSOPTS/ See this thread.

I want to generate some events with a given particle in the final state in EvtGen but EvtGen does not know it.

The error message can be for example the following:

ToolSvc.EvtGenDecay       ERROR EvtGen Error from EvtGen 
Unknown particle name:K_1(1400)+ on line 18 

In fact, the name K_1(1400)+ is the generic LHCb name and not the name used internally in EvtGen. The correspondance between LHCb names and EvtGen names is in the particle table, that you can display typing:

SetupProject Gauss

The EvtGen name appears in the 7th column.

How to change Gauss random seeds

See this FAQ.

Why are decay files for special event generation empty (Higgs, top, Z, ...) ?

In this case, Pythia is used to generate the signal particles (Higgs, top, Z, ...) and not EvtGen. Then no special decay file is needed for EvtGen. However, an empty decay file must however be created to contain the nickname, the event type number, the decay descriptor and other informations needed to have the corresponding option file created automatically for Gauss in the DecFiles package.

Where can I find generator level efficiency for the MC11 productions ?

They can be found at location, grouped by event type number and physics working group. If your event type is not listed here, you should ask the MC contact person of your working group to add it to this page.

Running Gauss with the generator phase only, my jobs stopped after around 20k events with Pythia errors

Pythia6 allows a maximum number of errors per job (10). When this number is reached, Pythia itself will terminate the execution. When running only the generator phase with high statistics for signal events, you may end up in this case. You will then have a message of the type:

Error type 4 has occured after 7768259 PYEXEC calls:
(PYSTRF:) caught in infinite loop
Execution will be stopped after listing of last event!

To avoid the problem you can either produce less events per job and submit more jobs with different starting event number, or you can increase the number of errors you allow from Pythia by setting the property

# Allow up to 50 internal errors in Pythia
from Configurables import Generation, PythiaProduction
Generation().SignalRepeatedHadronization.PythiaProduction.Commands += [  "pydat1 mstu 22 50" ]
if you want to increase the number of error to 50 for example.

How can I find the BR of various channels for a given even type comprising more than one final state ?

You can find the decay file used (eg. Bs_JpsiX,mm.dec) to generate a given event type in its options GSDTNUX.opts located in the options subdirectory of DecFiles ($DECFILESROOT corresponding to $LHCBRELEASES/DBASE/Gen/DecFiles/vXrY) .
The decay file contains all decays channels and corresponding Branching Ratios used for the inclusive signal.
In case of completely inclusive samples (eg. minbias, b-inclusive) the list of all allowed decays and BR can be found in DECAY.dec .
Note that while options file are in the options subdirectory of the package, decay files are in the dkfiles subdirectory.

-- GloriaCorti - 08 October 2007

How can I print Generator (HepMC) event record?

There are several ways to print Generator (HepMC) event record.

DumpMC algorithm

The simplest way is to use the native printout embedded into ==HepMC== structure. To print all HepMC information ( all particles for all collisions) one can use the algorithm DumpMC, which prints all nesessary information:
 1000// add the printout algorithm  at the end of the main Generator sequence:
 1001Generator.Members +=  { "DumpMC/Dump" } ;
The example of such printout could be inspected here.

LoKi::DumpHepMC algorithm

Rather extensive but more readable prinout coudl be achieved with LoKi::DumpHepMC algorithm:
 1000// add the printout algorithm  at the end of the main Generator sequence:
 1001Generator.Members +=  { "LoKi::DumpHepMC/Dump" } ;
 1003Dump.Depth = 5 ; // set the maximal recursion depth (default is 7): 
 1005Dump.PrintVertex = True ;  // print the vertex infomation (default is false) 
 1007Dump.PrintEndVertex = True ; // print the end-vertex infomation (default is false)
 1009// The printout mode, see the enum LoKi::DecayChain::Mode 
 1010//    // modes to print 4-vectors 
 1011//    enum Mode    
 1012//      { 
 1013//        LV_STD    = 0 , // default: as 4-values (E/px/py/pz) 
 1014//        LV_MASS       , //          as 5 values (M/E/px/py/pz)
 1015//        LV_WITHPT     , //          as 6 values (M/PT/E/px/py/pz) 
 1016//        LV_ONLYP      , //          as 3 values (px/py/pz) 
 1017//        LV_SHORT        //          as 3 values (M/PT/E) 
 1018//      } ;
 1020Dump.Mode = 2 ; // default is 0 : print as 4-values (E/px/py/pz)
The example of such printout could be inspected here.

DumpHepMCDecay algorihtm

Often one needs to pruint the ufomnration about the certain particles. Such printout one can obtain using DumpHepMCDecay algorithm. It allows to print the infomration about the decays of "interesting" particles, which are specified by th list of "interesting" PDG-codes, or list of "quarks"

 1000// add the printout algorithm  at the end of the main Generator sequence:
 1001Generator.Members +=  { "DumpHepMCDecay/Dump" } ;
 1003// set the maximal recursion depth (default is 4): 
 1004Dump.MaxLevels = 5 ; 
 1006// print only decay trees for B+ and B-:
 1007Dump.Particles = { 521 , -521 } ;
 1009/// print decays for all beauty particles (default):
 1010// Dump.Quarks = { 5 } ;
The example of such printout could be inspected here. Please note that one particle can appear in many printed "subtrees".

DumpHepMCTree algorithm

A bit more friendly printout one can obtain using DumpHepMCTree algorithm, in particular it avoid the duplication in the prinout of interetsing objects:
 1000// add the printout algorithm  at the end of the main Generator sequence:
 1001Generator.Members +=  { "DumpHepMCTree/Dump" } ;
 1003// set the maximal recursion depth (default is 4): 
 1004DumpMCDecay.MaxLevels = 5 ; 
 1006// print only decay trees for B+ and B-:
 1007DumpMCDecay.Particles = { 521 , -521 } ;
 1009/// print decays for all beauty particles (default):
 1010// DumpMCDecays.Quarks = { 5 } ;
The example of such printout could be inspected here.

LoKi::DecayChain utility

Very customizable printout, including the sophisticated selection and colorizing could be achieved using LoKi::DecayChain utility.

How can I read HepMC-ASCII input files in Gauss?

Input files in HepMC-ASCII format (e.g. form other generators) can be processed in Gauss (with no fragmentation/showering) could be processed in Gauss using the class ReadHepMCAsciiFile as the production tool :
 1000/// define "the special" production:
 1001Generation.SampleGenerationTool = "Special" ;
 1003/// define the production tool
 1004Generation.Special.ProductionTool = "ReadHepMCAsciiFile/ReadHepMC" ;
 1006/// define input file with HEpMC-ASCII events
 1007Generation.Special.ReadHepMC.Input = "my_input_file.ascii" ;
 1009/// rescale from Pythia units (GeV, mm) into Gauss units (MeV, mm)  (default)
 1010Generation.Special.ReadHepMC.Rescale = True ;
 1012/// turn off Cut tool and Decay tool.
 1013Generation.Special.CutTool = ""
 1014Generation.DecayTool = ""

-- KarolH - 07-Feb-2012


  • This option is suitable only for events which are already hadronized, for partonic-level events see the next chapter.

How can I process the partonic events from the external generators in Gauss?

Gauss currenly allows to read two types of input files with partonic events: the files in Les Houches Accord XML-format and the dumb files, produced by ALPGEN generator. Well, actually one can use also the old-style Les Houches Accord partonic events, but this option being supported by the code has never been tested.

To read the files in Les Houches Accord XML-format one need to use the class LbPythia::ReadLHE as the production tool :

 1000/// define "the special" production:
 1001Generation.SampleGenerationTool = "Special" ;
 1003/// switch-off the pileup  (recommended!)
 1004Generation.PileUpTool = "FixedNInteractions/PileUp" ; 
 1005Generation.PileUp.NInteractions = 1 ;
 1007/// no cuts
 1008Generation.Special.CutTool = "" ;
 1010/// define the production tool
 1011Generation.Special.ProductionTool = "LbPythia::ReadLHE/ReadLHE" ;
 1013/// define input file in Les Hauches Accord XML -format
 1014Generation.Special.ReadLHE.InputFile = "my_input_file.lhe"

To read the data, produced by ALPGEN generator:

 1000/// define "the special" production:
 1001Generation.SampleGenerationTool = "Special" ;
 1003/// switch-off the pileup  (recommended!)
 1004Generation.PileUpTool = "FixedNInteractions/PileUp" ; 
 1005Generation.PileUp.NInteractions = 1 ;
 1007/// define the production tool
 1008Generation.Special.ProductionTool = "LbPythia::ReadAlpGen/ReadAlpGen" ;
 1010/// define input file with unweighted events in ALPGEN format
 1011Generation.Special.ReadAlpGen.InputFile = "my_input_file.unw" ;
 1013/// define the parameter  file in ALPGEN format
 1014Generation.Special.ReadAlpGen.ParamFile = "my_input_file_unw.par" ;
 1016/// define log-file for ALPGEN (optional)
 1017Generation.Special.ReadAlpGen.LogFile = "my_log_file.log" ;
-- KarolHennessy - 09-Jun-2011

How can I use the new JetProduction production tool to generate Jet particle guns?

For details of JetProduction production tool see here.

How can I know the cuts that are applied on generator level in a given datasample? For example for Bd_JpsiKst, mm=DecProdCut (11144001)?

You can see which cut tool is applied by looking at the decay file for what is given as argument of the keyword "Cuts". The code can then be found in the "Gen/Generators" package. The properties of the tool can be changed in the decfiles in which case they should appear in the decay file as arguments of the keyword "CutsOptions". Finally when cuts on the complete event are applied they appear as argument of the keyword "FullEventCuts".

The cuts applied when the suffix "=DecProdCut" is applied is in general "DaughtersInLHCb". This means that normally the charged products are 10 mrad < theta < 400 mrad and the neutral 5 mrad < theta < 400 mrad.

-- GloriaCorti - 27 Nov 2008

Can I generate cosmics with Gauss? What is the procedure to do this?

To generate cosmics one just need to pick the appropriate generator. In fact there are two generators for cosmics: one written by Wouter that is called OTCosmic and one written by Giulia Manca, called Cosmics more general that is used by both the Muon System and the Calorimeters.

The Cosmics generator can be asked to produce events through given detectors or combinations and gives expected rates. For details on what it does and how to use it refer to the presentation given at a Gauss meeting (30 Apr 2008) by Giulia. Essentially you just have to replace the EVTTYPE.opts with an option file like the one given as example in $PARTICLEGUNSROOT/options/CosmicsGun.opts .

-- GloriaCorti - 01 Dec 2008

Is it possible to generate exotic charm states like X(3872) and Z(4430) ?

Not with Gauss as-is. To generate exotic charm states you there are two things you will have to take care of:

  • produce them
  • make them known to Gauss
To produce them you need to set up the production mechanism, for example by writing an appropriate routine for Pythia that will make them from the c-cbar, similarly to what done for other charmonia states. You need to then write a signal decay file for EvtGen to specify the signal and decay channel you want to produce. If you are interested only in exotic charm states that come from the decay of a B particle (and are not produced directly) you will need to write the decay file for EvtGen to do so. If the signal particle is the X(3872) most likely the script creating the options will not work and you may have to modify it or (for test) correct the options by hand, if it is a B the script should work.
To make the exotic charms known to Gauss you have to introduce them in the particle table (for tests you can do that in the decay file via the keyword ParticleValue). Note that this is sufficient for particles that do not travel but for those with a measurable decay lenght you will also have to make them known to G4 by adding them into the GaussPhysics package similarly to what done for other particles.
You can get in touch with Gloria Corti and Patrick Robbe for details once you have decided what do to for the production.

-- GloriaCorti - 17 Dec 2008

How do I know what is exactly in a given event type? For example what does "13410001 - Bs_DsX=cocktail,DsinAcc" means?

To understand what really is in a specific data sample, the best is to look directly at the decay file it refers to. To do that you dan look directly in the package Gen/DecFiles that contains the options and EvtGen settings for all event types. It is recommended that you use the version of the package that was used to generate the events. The simplest way to get that is to do

lxplus> SetupProject Gauss vXrY 
where vXrY is the version of Gauss that was used to generate the sample. This will set up the corresponing $DECFILESROOT environment variable for the package and version.

In general the text by the event type code is the nickname that is also the name of the decay file itself, or you can retrieve it looking at the options:

The options are in $DECFILESROOT/options/EVENTTYPE.opts (for the example that would be $DECFILESROOT/options/13410001.opts

In the options file you will find the line

ToolSvc.EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/MyDecay.dec";

in the example "MyDecay.dec" is Bs_DsX=cocktail,DsInAcc.dec.

You can now look in $DECFILESROOT/dkfiles/MyDecay.dec and you will find the whole list of decays with the relative BR for the given event type.

EvtGen reports the error: "Error in EvtParser: line:NN to long"

See this bug report in Savannah for the solution.

Gauss just says "Pythia". Which version am I using?

Pythia in general refers to Pythia6 whereas Pythia8 refers to Pythia8, so to use Pythia6 you would call $LBPYTHIAROOT/options/, and to use Pythia8 you would call $LBPYTHIA8ROOT/options/

Note that Pythia6 may still call Pythia8 for some processes (and produce a Pythia8 splash screen) even if you use $LBPYTHIAROOT/options/

-- MichaelWilkinson - 2018-05-22

Gauss seems to be using Pythia6...?

The options files generated by Gauss from the dkfiles during make, as of this writing, include the line Generation().SignalPlain.ProductionTool = "PythiaProduction". This sets Pythia6 as the production tool. You must therefore import $DECFILESROOT/options/ before $LBPYTHIA8ROOT/options/ and before any changes to Pythia generation options, e.g., $DECFILESROOT/options/, in order to override this setting.

-- MichaelWilkinson - 2018-05-22

How do I switch processes on and off in Pythia?

If you want to switch off all processes in Pythia, you can use the file $DECFILESROOT/options/ (which has the relevant Pythia8 lines at the end). If you want to selectively turn some processes on and off, you can use that file as a template and follow the online Pythia manual for reference. See also Gauss seems to be using Pythia6...?.

-- MichaelWilkinson - 2018-05-22

How do I do RICH-less Simulation, as descibed in Philip Ilten's talk?

You can turn off Cherenkov photons using $APPCONFIGOPTS/Gauss/ You may want to avoid using $APPCONFIGOPTS/Gauss/ (Note that $GAUSSOPTS/ includes the line importOptions("$APPCONFIGOPTS/Gauss/").)

You probably do not want to turn off the RICH in Gauss().DetectorGeo, Gauss().DetectorSim, Gauss().DetectorMoni, etc., as this will remove the entire RICH from the detector and you probably still want material interactions in your simulation.

-- MichaelWilkinson - 2018-05-22

How do I use ReDecay, as descibed in Philip Ilten's talk?

ReDecay takes the same underlying event and simply re-decays the signal particle, thus greatly speeding up production. (It does not re-generate the signal particle.) You can use ReDecay by including, e.g., $APPCONFIGROOT/options/Gauss/ (See $APPCONFIGROOT/options/Gauss/ for other pre-defined ReDecay options.

-- MichaelWilkinson - 2018-05-22

SetupProject and lb-run

Gauss still works using SetupProject, e.g., SetupProject Gauss v49r10. See here for an example. If your environment does not like SetupProject or you prefer not to use it for whatever reason, you can use lb-run, even for locally-built projects that were built using SetupProject, e.g., lb-run -c best --user-area ~/cmtuser Gauss/v49r10 bash --norc.

-- MichaelWilkinson - 2018-05-22

I am seeing non conservation of 4-momentum in truth MC for taus decayed according to TAUOLA. What is happening?

This is a known issue related to the numerical precision of the Lorentz boosts and Euler rotations at the LHC energy scale in TAUOLA (i.e. a rounding off error). A new version of TAUOLA with higher numerical precision might be forthcoming at some point.

-- AravindhanVenkateswaran - 2022-05-11

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt GaussMonitorAdvice.txt r1 manage 2.5 K 2010-10-14 - 18:55 MarkWhitehead The file version of the GaussMonitor.root analysis code snippet.
Edit | Attach | Watch | Print version | History: r32 < r31 < r30 < r29 < r28 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r32 - 2022-05-11 - AravindhanVenkateswaran
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb/FAQ All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback