====== Useful things for Gauss ======
===== How to write out MCParticles in Gauss =====
It can be very useful to let Gauss write out MCParticles in the Generation directly (without the detector simulation), which then can be analysed.
This can be achieved the following way (write this at the end of your version of Gauss-Job.py):
gtos = GenerationToSimulation()
gtos.SkipGeant = True
gs = GaudiSequencer("GenMonitor")
MCTruthStream = OutputStream("MCTruthStream")
MCTruthStream.ItemList += [ "/Event/Gen#1", "/Event/Gen/HepMCEvents#1", "/Event/MC#1", "/Event/MC/Header#1", "/Event/MC/Particles#1", "/Event/MC/Vertices#1" ]
MCTruthStream.Output = "DATAFILE='MCTruth.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'"
gs.Members += [ SimInit(), gtos, MCTruthStream ]
The root file can then be run over with an MCTupleTool in DaVinci (with certain restrictions, i.e. only tools which only access 4-vectors will run...)
To avoid error messages like:
MainEventGaussSim FATAL SimInit:: Exception throw: put():: could not register 'LHCb::MCHeader' at address '/Event/MC/Header' StatusCode=2
you have to make sure that you have included
Gauss().Phases = ["Generator"]
Gauss().Output = 'NONE'
Gauss().Histograms = 'NONE'
in your Gauss-Job.py file.
===== Running EvtGen standalone =====
You can run EvtGen standalone, letting the particles decay at rest. This is very fast, as no underlying event has to be generated.
A prototype file could look like (Gauss v41r1):
#Event Type: 11114001
from Configurables import Generation
Generation().EventType = 11114001
from Configurables import StandAloneDecayTool
Generation().SampleGenerationTool = "StandAloneDecayTool";
Generation().addTool( StandAloneDecayTool )
Generation().StandAloneDecayTool.ProductionTool = "PythiaProduction";
from Configurables import ToolSvc
from Configurables import EvtGenDecay
ToolSvc().addTool( EvtGenDecay )
ToolSvc().EvtGenDecay.UserDecayFile ="$DECFILESROOT/dkfiles/Bd_Kstmumu=DecProdCut.dec"
Generation().StandAloneDecayTool.SignalPIDList = [ 511,-511 ]
These both things (running EvtGen standalone and writing out MCParticles) can of course be combined.
===== Running Particle Gun =====
If you want to run a particle gun producing a particle type which should decay in EvtGen you have to change your options file accordingly to this prototype file (Gauss v41r1):
# file /home/hep/che/cmtuser/Gauss_v41r0/Gen/DecFiles/options/27876001.py generated: Wed, 04 Apr 2012 11:45:14
#
# Event Type: 27876001
#
# ASCII decay Descriptor: { [ D*+ -> pi+ pi+ pi- ]cc }
#
from Configurables import ParticleGun
from Configurables import MomentumRange
ParticleGun().addTool( MomentumRange )
from GaudiKernel import SystemOfUnits
ParticleGun().MomentumRange.MomentumMin = 150.0*SystemOfUnits.GeV
from GaudiKernel import SystemOfUnits
ParticleGun().MomentumRange.MomentumMax = 1000.0*SystemOfUnits.GeV
ParticleGun().EventType = 27876001
ParticleGun().ParticleGunTool = "MomentumRange"
ParticleGun().NumberOfParticlesTool = "FlatNParticles"
ParticleGun().MomentumRange.PdgCodes = [ 413,-413 ]
from Configurables import ToolSvc
from Configurables import EvtGenDecay
ToolSvc().addTool( EvtGenDecay )
ToolSvc().EvtGenDecay.UserDecayFile = "$DECFILESROOT/dkfiles/incl_Dst3body=cocktail.dec"
from Gaudi.Configuration import *
importOptions( "$DECFILESROOT/options/TrackersAcceptance.opts" )
ParticleGun().DecayTool = "EvtGenDecay"
The numbering is incorrect as options file for Particle Guns start with 5. As the numbering scheme in case of Particle Guns aims at stable particles the official numbering scheme does not make much sense in this case. Anyhow, the numbering does not affect the performance of the option file for Particle Guns.
In addition you have to add the line
Gauss().Production = 'PGUN'
to your Gauss Job file.