Commit e2e6c08c authored by Patrick Koppenburg's avatar Patrick Koppenburg 🍃
Browse files

Merge branch 'master' into pkoppenb-BKGCAT

parents 7d3d9846 2fa8e38a
Pipeline #3287740 passed with stages
in 2 minutes and 39 seconds
###############################################################################
# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
"""
Example of a typical DaVinci job:
- selection of two detached opposite-charge muons
- tuple of the selected candidates
- runs DecayTreeFitterAlg and stores some output
This example is meant to be run with
$ ./run davinci run-mc --simplejob --inputfiledb Upgrade_Bd2KstarMuMu --joboptfile example-tupling-basic.yaml --user_algorithms example-tupling-DTF-run-mc:main
"""
__author__ = "P. Koppenburg"
__date__ = "2021-11-23"
import Functors as F
from DaVinci.standard_particles import make_detached_mumu
from DaVinci.reco_objects import upfront_reconstruction_from_file as upfront_reconstruction
from FunTuple import FunctorCollection
from FunTuple import FunTuple_Particles as Funtuple
# Prepare the node with the selection
dimuons = make_detached_mumu()
#
# DecayTreeFitter Algorithm
#
from PyConf.Algorithms import DecayTreeFitterAlg
DTF = DecayTreeFitterAlg(
Input=dimuons, MassConstraints=[443], PrintTree=True, OutputLevel=3)
DTFParts = DTF.Output # Particles
DTFRelations = DTF.OutputRelations # Relations
#FunTuple: Jpsi info
branches = {}
branches['Jpsi'] = 'J/psi(1S) -> mu+ mu-'
branches['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,
'THOR_MASS':
F.MASS,
'DTF_PT':
F.MAP_INPUT(Functor=F.PT, Relations=DTFRelations),
'DTF_MASS':
F.MAP_INPUT(Functor=F.MASS, Relations=DTFRelations),
})
#make collection of functors for Muplus
variables_muplus = FunctorCollection({
'LOKI_P':
'P',
'THOR_P':
F.P,
'DTF_PT':
F.MAP_INPUT(Functor=F.PT, Relations=DTFRelations)
})
#associate FunctorCollection to 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",
tree_name="DecayTree",
branches=branches,
variables=variables,
loki_preamble=loki_preamble,
inputs=dimuons)
def main():
tools = []
algs = upfront_reconstruction() + [dimuons, DTF, tuple_dimuons]
return algs, tools
###############################################################################
# (c) Copyright 2020-2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
enable_unpack: False
evt_max: 10
histo_file: 'DV-example-tupling-DTF-his.root'
input_raw_format: 4.3
lumi: False
ntuple_file: 'DV-example-tupling-DTF-ntp.root'
unpack_stream: '/Event/'
......@@ -13,9 +13,9 @@
*
* This is the code reference manual for the DaVinci Physics Analysis classes.
* These pages have been generated directly from the code and reflect the exact
* These pages have been generated directly from the code and reflect the exact
* state of the software for this version of the DaVinciSys packages. More
* information is available from the
* information is available from the
* <a href="http://cern.ch/lhcb-release-area/DOC/davinci/">web pages</a>
* of the DaVinci project
*
......
......@@ -86,7 +86,7 @@ def run_job(configurables, export=None, with_defaults=False, dry_run=None):
applyConfigurableUsers_old()
dict_opts_old = get_configurable_opts(
Configurable.allConfigurables.values(), with_defaults)
list(Configurable.allConfigurables.values()), with_defaults)
dict_opts = get_configurable_opts(configurables, with_defaults)
conflicts = [
......
......@@ -9,4 +9,3 @@
# or submit itself to any jurisdiction. #
###############################################################################
# tells python that this directory is a module
<?xml version="1.0" ?>
<!--
###############################################################################
# (c) Copyright 2020-2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
-->
<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<!--
#######################################################
# SUMMARY OF THIS TEST
# ...................
# Author: pkoppenb
# Purpose: Test for DecayTreeFitting
# Prerequisites: None
# inputfiledb Upgrade_Bd2KstarMuMu_ldst $DAVINCIROOT/options/DaVinciDB-Example.yaml
# user_algorithms $DAVINCIEXAMPLESROOT/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc:main
#######################################################
-->
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>davinci</text></argument>
<argument name="args"><set>
<text>run-mc</text>
<text>--inputfiledb</text>
<text>Upgrade_Bd2KstarMuMu_ldst</text>
<text>$DAVINCIROOT/options/DaVinciDB-Example.yaml</text>
<text>--joboptfile</text>
<text>../../../DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc.yaml</text>
<text>--user_algorithms</text>
<text>../../../DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc:main</text>
</set></argument>
<argument name="validator"><text>
findReferenceBlock("""DimuonsTuple SUCCESS ID=DecayTree Title="DecayTree" #items=14 {Jpsi_LOKI_P,Jpsi_LOKI_PT,Jpsi_LOKI_Muonp_PT,Jpsi_LOKI_Muonm_PT,Jpsi_LOKI_MAXPT,Jp}""")
</text></argument>
</extension>
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