Skip to content
Snippets Groups Projects

Fix DaVinci tests

Merged Patrick Koppenburg requested to merge pkoppenb-Tests into master
Compare and
8 files
+ 178
102
Compare changes
  • Side-by-side
  • Inline
Files
8
+ 100
0
###############################################################################
# (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. #
###############################################################################
"""
Test of functors
"""
from DaVinci.algorithms_pyconf import make_dvalgorithm
from PyConf.Algorithms import (TwoBodyCombiner, ThreeBodyCombiner,
FourBodyCombiner)
def particles_from_keyedContainer(particles):
# from DaVinci.common_particles import make_long_kaons
from PyConf.Algorithms import (
ParticleSelectionFilter,
LHCb__Converters__RangeToVectorParticle,
LHCb__VectorToSelectionParticle,
)
import Functors as F
particles = LHCb__Converters__RangeToVectorParticle(Input=particles).Output
return particles
def make_tight_d2kk():
# from DaVinci.common_particles import make_std_loose_kaons
from DaVinci.algorithms_pyconf import ParticleCombinerWithPVs
from DaVinci.reco_objects import make_pvs as _make_pvs
from DaVinci.common_particles import make_long_kaons
import Functors as F
# from DaVinci.algorithms_pyconf import threebodycombiners
# kaons = kaons_from_keyedContainer()
kaons = make_long_kaons()
descriptors = ["D0 -> K+ K-"]
daughters_code = {"K+": F.PID_K > 2., "K-": F.PID_K > 2. }
# todo : add a ADAMASS-like cut
combination_code = (F.DOCACHI2(1, 2) < 30) & (F.MASS(
["K+", "K-"]) > 1764) & (F.MASS(["K+", "K-"]) < 1964)
vertex_code = (F.CHI2DOF < 30)
print("### Kaons are {0}".format(kaons))
p = TwoBodyCombiner(
name="TightD02KK",
Inputs=[kaons],
DaughterCuts = daughters_code,
DecayDescriptors=descriptors,
Comb12Cut=combination_code,
ParticleCombiner="ParticleVertexFitter",
MotherCut=vertex_code).OutputParticles
print("### Returning {0}".format(p))
return p
__author__ = "Patrick Koppenburg"
__date__ = "2021-04-28"
from PyConf.application import configure, configure_input
from PyConf.control_flow import CompositeNode, NodeLogic
from PyConf.Algorithms import PrintDecayTree
from DaVinci import options
from DaVinci.reco_objects import upfront_reconstruction_from_file as upfront_reconstruction
from DaVinci.common_particles import make_std_loose_d2kk
options.evt_max = -1
options.print_freq = 1
options.msg_svc_format = "% F%60W%S%7W%R%T %0W%M"
d0s = make_std_loose_d2kk()
vd0s = particles_from_keyedContainer(d0s) # converter
td0s = make_tight_d2kk()
print("### vD0s {0} and tD0s {1}".format(vd0s, td0s))
pdt = PrintDecayTree(name="PrintD0s", Input=vd0s) # keyed container
pdt2 = PrintDecayTree(name="PrintTightD0s", Input=td0s)
# the "upfront_reconstruction" is what unpacks reconstruction objects, particles and primary vertices
# from file and creates protoparticles.
algs = upfront_reconstruction() + [d0s, pdt, td0s, pdt2]
node = CompositeNode(
"PrintD0Node", children=algs, combine_logic=NodeLogic.NONLAZY_OR)
# File from Moore test
options.set_input_and_conds_from_testfiledb("Moore-Output-DST")
config = configure_input(options)
config.update(configure(options, node))
Loading