Basic DaVinci Job on MC

This example shows how to:

  1. reconstruct and select two detached opposite-charge muons

  2. add a tuple of the selected candidates.

import Functors as F
from Hlt2Conf.standard_particles import make_detached_mumu
from FunTuple import FunctorCollection
from FunTuple import FunTuple_Particles as Funtuple
from DaVinci import Options, make_config


def main(options: Options):
    # Prepare the node with the selection
    dimuons = make_detached_mumu()

    # FunTuple: Jpsi info
    fields = {}
    fields["Jpsi"] = "J/psi(1S) -> mu+ mu-"
    fields["MuPlus"] = "J/psi(1S) -> ^mu+ mu-"

    # make collection of functors for Jpsi
    variables_jpsi = FunctorCollection(
        {
            "LOKI_P": "P",
            "LOKI_PT": "PT",
            "LOKI_Muonp_PT": "CHILD(PT, 1)",
            "LOKI_Muonm_PT": "CHILD(PT, 2)",
            "LOKI_MAXPT": "TRACK_MAX_PT",
            "LOKI_N_HIGHPT_TRCKS": "NINTREE(ISBASIC & HASTRACK & (PT > 1500*MeV))",
            "THOR_P": F.P,
            "THOR_PT": F.PT,
        }
    )

    # make collection of functors for Muplus
    variables_muplus = FunctorCollection({"LOKI_P": "P", "THOR_P": F.P})

    # associate FunctorCollection to (field branch) name
    variables = {}
    variables["Jpsi"] = variables_jpsi
    variables["MuPlus"] = variables_muplus

    # FunTuple: define list of preambles for loki
    loki_preamble = ["TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)"]

    # Configure Funtuple algorithm
    tuple_dimuons = Funtuple(
        name="DimuonsTuple",
        tuple_name="DecayTree",
        fields=fields,
        variables=variables,
        loki_preamble=loki_preamble,
        inputs=dimuons,
    )

    return make_config(options, [tuple_dimuons])

To run the example:

lbexec DaVinciExamples.tupling.basic_run_mc:main $DAVINCIEXAMPLESROOT/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml+$DAVINCIEXAMPLESROOT/example_options/example_tupling_basic_run_mc.yaml

For reference, these are the options of this example

input_files: root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076720/0000/00076720_000000{01,02,04,27,36,37,38,39,43,51,57,68}_1.ldst
input_type: ROOT
simulation: true
conddb_tag: sim-20171127-vc-md100
dddb_tag: dddb-20171126
conditions_version: master
geometry_version: run3/trunk
input_process: Brunel
persistreco_version: 0.0
lumi: False
write_fsr: False
evt_max: 10
histo_file: DV-example-tupling-basic-his-run-mc.root
input_raw_format: 4.3
ntuple_file: DV-example-tupling-basic-ntp-run-mc.root
input_process: Brunel