Process the .sim files
Would be nice to process the .sim or .xgen files to check that everything is ok
The command should be something like this:
lb-run -c best DaVinci/v45r4 gaudirun.py tupleResult.py
being tupleResult.py this:
from Configurables import (
DaVinci,
MCDecayTreeTuple,
LoKi__Hybrid__MCTupleTool
)
from DecayTreeTuple.Configuration import *
from glob import glob
decay = "[B_s0 -> ^(K*(892)0 -> ^K+ ^pi-) ^(K*(892)~0 -> ^K- ^pi+)]CC"
datafiles = ['Gauss-2016.sim']
mc_basic_loki_vars = {
'ETA': 'MCETA',
'PHI': 'MCPHI',
'PT': 'MCPT',
'PX': 'MCPX',
'PY': 'MCPY',
'PZ': 'MCPZ',
'E': 'MCE',
'P': 'MCP',
'M': 'MCM'
}
# 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.addBranches ({
'B' : '[[B_s0]cc -> (K*(892)0 -> K+ pi-) (K*(892)~0 -> K- pi+)]CC',
'Kst' : '[[B_s0]cc -> ^(K*(892)0 -> K+ pi-) (K*(892)~0 -> K- pi+)]CC',
'Kstb': '[[B_s0]cc -> (K*(892)0 -> K+ pi-) ^(K*(892)~0 -> K- pi+)]CC',
'Kp' : '[[B_s0]cc -> (K*(892)0 -> ^K+ pi-) (K*(892)~0 -> K- pi+)]CC',
'pim' : '[[B_s0]cc -> (K*(892)0 -> K+ ^pi-) (K*(892)~0 -> K- pi+)]CC',
'Km' : '[[B_s0]cc -> (K*(892)0 -> K+ pi-) (K*(892)~0 -> ^K- pi+)]CC',
'pip' : '[[B_s0]cc -> (K*(892)0 -> K+ pi-) (K*(892)~0 -> K- ^pi+)]CC'
})
'''
mctl=[ 'MCTupleToolAngles',
'MCTupleToolHierarchy',
'MCTupleToolKinematic',
'MCTupleToolPrimaries',
'MCTupleToolReconstructed',
'MCTupleToolInteractions' ]
mctuple.ToolList = mctl
mctuple.addTupleTool(
'LoKi::Hybrid::MCTupleTool/basicLoKiTT'
).Variables = mc_basic_loki_vars
# Name of the .xgen file produced by Gauss
from GaudiConf import IOHelper
# Use the local input data
IOHelper().inputFiles(
datafiles, clear=True)
# Configure DaVinci
DaVinci().TupleFile = "DVntuple.root"
DaVinci().Simulation = True
DaVinci().Lumi = False
DaVinci().DataType = '2016'
DaVinci().InputType = 'DIGI'
DaVinci().UserAlgorithms = [mctuple]
from Gaudi.Configuration import appendPostConfigAction
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 )
The only three things that have to be changed are the decay (must be written by the user) and the year and datafile, that could be read by the previous rule (I guess)
Edited by Asier Pereiro Castro