Commit 8ef6bcad authored by Michal Kreps's avatar Michal Kreps
Browse files


parent 068da734
......@@ -2,183 +2,5 @@
Deadline for contributions to DecFiles v30r12 is Friday 23rd February 2018 at 14:00. Merge requests created after deadline are not guaranteed to be accepted for this release.
# Steps to add decay file
1. Find if a DecFile you want (or similar enough so you can use it) already exists
1. Read the [event type numbering convention]( or check out [the (unofficial) event type finder](
1. If you are using an old DecFile as a template, note that it might not follow the established conventions.
1. Test your DecFile (both that it runs and that it produces output you want)
1. After you've modified the release notes in the doc folder of the package commit to branch and create merge request against master.
1. Day or two after commit check in [nightlies]( slot lhcb-decfilestests that
1. there are no warning or errors from your decay file at build stage
1. your file passes test. Look for positive evidence as that will also allow you to check that file was really committed.
1. If anything fails, please correct and recheck again day after commit. If you do not understand failure, get in touch with [](mailto://
1. Email the lhcb-gauss-manager mailing list with a link to your DecFile after you placed it in a publicly accessible location on the AFS (eg. ~/public). They will also check and have the last word on the event type ID (some some special cases or newer rules may not be covered in 2). (We are going to update this step eventually, but for now it is helpful if we do not have to checkout your branch locally).
# Testing a decay file
This is done in three steps:
## Write the decay file and create the options
If you do not already have the environment set up, prepare it to run one of the latest Gauss version (v49rX for Sim09 productions, or v50rX for upgrade productions). In the examples below, v49r9 is used.
SetupProject Gauss v49r9 --build-env
cd ~/cmtuser/Gauss_v49r9
SetupProject Gauss v49r9
Then get the Gen/DecFiles package from gitlab.
git lb-clone-pkg Gen/DecFiles
Add the new decay file in the dkfiles subdirectory and create the options to be used by Gauss.
cd ~/cmtuser/Gauss_v49r9/Gen/DecFiles/
If there is no mistake in the decay file, an option file called is present in the options subdirectory, where NNNNNNNN is the event type number of the decay file. It is also recommended to run the decay file convention parser
cd ~/cmtuser/Gauss_v49r9/Gen/DecFiles/cmt
./ ../dkfiles/DecFile.dec
This should check for convention correctness for the event type and some basic mistakes, but it also has some limitations. This is our tool to help in checking, but at the end all failures are individually considered. Feel free to email any comments to lhcb-gauss-manager.
## Run Gauss to create a .xgen file
The .xgen file contains the generator level information (both in HepMC and MCParticles format) when running Gauss with only the generator part, without the simulation and Geant4 being activated.
SetupProject Gauss v49r9
cd ~/cmtuser/Gauss_v49r9 $GAUSSOPTS/ $GAUSSOPTS/ $GAUSSOPTS/ \
The number of events to generate (5 by default) is set in the file. Gauss will then produce a file called by default Gauss-NNNNNNNN-5ev-YYYYMMDD.xgen, with a name formed from the event type (NNNNNNNN), the number of events (5ev by default) and the day (in format YYYYMMDD).
## Create a MCDecayTreeTuple from the .xgen file
Use DaVinci to read the file produced by Gauss and to create a ROOT file with the information from the generator level history.
SetupProject DaVinci
where contains
from Configurables import (
from DecayTreeTuple.Configuration import *
"""Configure the variables below with:
decay: Decay you want to inspect, using 'newer' LoKi decay descriptor syntax,
decay_heads: Particles you'd like to see the decay tree of,
datafile: Where the file created by the Gauss generation phase is, and
year: What year the MC is simulating.
decay = "[B0 => ^(Lambda_c~- ==> ^p~- ^K+ ^pi-) ^p+ ^pi- ^pi+]CC"
decay_heads = ["B0", "B~0"]
datafile = "Gauss-11166070-5ev-20140429.xgen"
year = 2012
# For a quick and dirty check, you don't need to edit anything below here.
# Create an MC DTT containing any candidates matching the decay descriptor
mctuple = MCDecayTreeTuple("MCDecayTreeTuple")
mctuple.Decay = decay
mctuple.ToolList = [
# Add a 'number of photons' branch
mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True
mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {
"nPhotos": "MCNINTREE(('gamma' == MCABSID))"
# Print the decay tree for any particle in decay_heads
printMC = PrintMCTree()
printMC.ParticleNames = decay_heads
# Name of the .xgen file produced by Gauss
EventSelector().Input = ["DATAFILE='{0}' TYP='POOL_ROOTTREE'
# Configure DaVinci
DaVinci().TupleFile = "DVntuple.root"
DaVinci().Simulation = True
DaVinci().Lumi = False
DaVinci().DataType = str(year)
DaVinci().UserAlgorithms = [printMC, mctuple]
If you get the error
ToolSvc.OdinTim... FATAL ODINDecodeTool:: Exception throw: Cannot find RawEvent in [Trigger/RawEvent, DAQ/RawEvent] StatusCode=FAILURE
try adding this to your file (copied from
def doIt():
specific post-config action for (x)GEN-files
extension = "xgen"
ext = extension.upper()
from Configurables import DataOnDemandSvc
dod = DataOnDemandSvc ()
from copy import deepcopy
algs = deepcopy ( dod.AlgMap )
bad = set()
for key in algs :
if 0 <= key.find ( 'Rec' ) : bad.add ( key )
elif 0 <= key.find ( 'Raw' ) : bad.add ( key )
elif 0 <= key.find ( 'DAQ' ) : bad.add ( key )
elif 0 <= key.find ( 'Trigger' ) : bad.add ( key )
elif 0 <= key.find ( 'Phys' ) : bad.add ( key )
elif 0 <= key.find ( 'Prev/' ) : bad.add ( key )
elif 0 <= key.find ( 'Next/' ) : bad.add ( key )
elif 0 <= key.find ( '/MC/' ) and 'GEN' == ext : bad.add ( key )
for b in bad :
del algs[b]
dod.AlgMap = algs
from Configurables import EventClockSvc, CondDB
EventClockSvc ( EventTimeDecoder = "FakeEventTime" )
CondDB ( IgnoreHeartBeat = True )
appendPostConfigAction( doIt )
# Efficiency of generator level cuts
This number can be extracted from the GeneratorLog.xml file (produced by your gauss job), where the printout is of the form
<efficiency name = "generator level cut">
<after> 5 </after>
<before> 27 </before>
<value> 0.18519 </value>
<error> 0.074757 </error>
the efficiency is therefore 5/27 in this example.
# Commiting a decay file
Pre-requisite: have account on
You must commit your decay file to separate branch and create merge request against master branch. It is recommended that you check out a clean version
git lb-clone-pkg Gen/DecFiles
cd Gen/DecFiles
git checkout -b ${USER}/my-changes
Copy your decfile(s) into `dkfiles/` and add them to commit
git add dkfiles/[your decfile]
Update doc/release.notes using the same format as previous entries (with event type). Commit everything, push to the gitlab server
git add doc/release.notes
git status #(check that release.notes is updated and your decfile is added)
git commit #(with a commit message of what you updated the release notes with)
git push -u origin ${USER}/my-changes
Go to []( and create merge request.
# Guide for submitting decay file
Please follow Contribution guide on top of the page for instructions on how to prepare, test and commit decay file.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment