===== LoKi =====
===== Idea =====
LoKi is a package for the simple and user-friendly data analysis. Mostly the Filters are used. To get a list of available filter look at the [[loki:lists| referenc links]].
===== How to add a Variable in DecayTreeTuple =====
When using a python optionsfile, one can add several tools to the DecayTreeTuple that will store information in the final tuple. However, one can also add (LoKi) variables by hand. Add in your code (some of these things might already be in):
from Configurables import LoKi__Hybrid__TupleTool
LoKiTool = LoKi__Hybrid__TupleTool( 'LoKiTool')
...
myTuple.addTool(LoKiTool, name = 'LoKiTool')
myTuple.ToolList = [
"LoKi::Hybrid::TupleTool/LoKiTool",
other tools...
]
Now you have to define the variables (a dictionary in Python). Suppose you want to add the deposited energy of a MIP (minimum ionizing particle) in your calorimeter(Ecal, Hcal, Pre-shower). For this, do:
myTuple.LoKiTool.Variables = {
"HcalE" : "PPINFO( LHCb.ProtoParticle.CaloHcalE , -10)",
"EcalE" : "PPINFO( LHCb.ProtoParticle.CaloEcalE , -10)",
"PrsE" : "PPINFO( LHCb.ProtoParticle.CaloPrsE , -10)"
}
**Notes:**
* Mind the two ''__''!
* The code on the right side of the '':'' is just a LoKi particle function, which can be found in the [[loki:lists| referenc links]]. Don't forget: It's Python, not C++ (e.g. there aren't any ''::'' for namespaces).
===== Adding bool Variables =====
If your particle function returns a bool value, you first have to convert it in order to store it in a tuple. This can be done with the ''switch''-function, e.g.,
myTuple.LoKiTool.Variables = {
"IsMuon" : "switch(ISMUON,1,0)",
}
which will return 1 if the ISMUON returns ''true'' and 0 otherwise.