diff --git a/DaVinciExamples/python/DaVinciExamples/debugging.py b/DaVinciExamples/python/DaVinciExamples/debugging.py index c358a8680633569eab7b91c75303e83ff160e24d..af129acfde062e71068e1014942c6316cc593cb2 100644 --- a/DaVinciExamples/python/DaVinciExamples/debugging.py +++ b/DaVinciExamples/python/DaVinciExamples/debugging.py @@ -23,7 +23,7 @@ from DaVinci.common_particles import make_std_loose_jpsi2mumu def print_decay_tree(options: Options): - jpsis = make_std_loose_jpsi2mumu(options.process) + jpsis = make_std_loose_jpsi2mumu() pdt = PrintDecayTree(name="PrintJpsis", Input=jpsis) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_array_taggers.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_array_taggers.py index ffe30de4410225581d95e7c226b7c4de01dc1adc..56f37fe516e4588a98db29f5a5c34629a402ae99 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_array_taggers.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_array_taggers.py @@ -36,7 +36,7 @@ def main(options: Options): bd2dsk_line = "SpruceB2OC_BdToDsmK_DsmToHHH_FEST_Line" bd2dsk_data = force_location(f"/Event/Spruce/{bd2dsk_line}/Particles") - pions = make_long_pions(options.process) + pions = make_long_pions() tagging_container = ParticleContainerMerger( InputContainers=[pions]).OutputContainer diff --git a/DaVinciExamples/tests/qmtest/debugging.qms/test_example-PrintDecayTree.qmt b/DaVinciExamples/tests/qmtest/debugging.qms/test_example-PrintDecayTree.qmt index 4599bba33073790d2bf7144c9f14dcd8e0ba5bca..0921bc9642450196433a26bcbefe8a71bcb951b5 100755 --- a/DaVinciExamples/tests/qmtest/debugging.qms/test_example-PrintDecayTree.qmt +++ b/DaVinciExamples/tests/qmtest/debugging.qms/test_example-PrintDecayTree.qmt @@ -25,8 +25,8 @@ <argument name="validator"><text> findReferenceBlock("""PrintJpsis INFO Number of counters : 2 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "Candidates" | 28 | 35 | 1.2500 | 0.50885 | 1.0000 | 3.0000 | - | "Events" | 28 | + | "Candidates" | 18 | 24 | 1.3333 | 0.57735 | 1.0000 | 3.0000 | + | "Events" | 18 | """, stdout, result, causes, signature_offset = 0) countErrorLines({"FATAL":0, "ERROR":0}) <argument name="exit_code"><integer>1</integer></argument> diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref b/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref index 262a989f2df9561d6b77c251812c815c2e5af714..ceef189ff0cc6c898dc855e2541886d50cc438e0 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref @@ -11,7 +11,6 @@ FSROutputStreamDstWriter INFO Data source: EventDataSvc output: SV UnpackChargedProtos.ChargedProto... INFO Using retuned RICH el and mu DLL values in combined DLLs FunctionalParticleMaker.LoKi::Hy... INFO CUT: ' ( (TrTYPE==3) &TrALL) ' ApplicationMgr INFO Application Manager Initialized successfully -DeFTDetector INFO Current FT geometry version = 63 ApplicationMgr INFO Application Manager Started successfully EventPersistencySvc INFO Added successfully Conversion service:RootCnvSvc EventSelector SUCCESS Reading Event record 1. Record number within stream 1: 1 @@ -40,7 +39,6 @@ LAZY_AND: DaVinci #=10 Sum=10 Eff=|( 100 UnpackProtoParticle/UnpackNeutralProtos #=10 Sum=10 Eff=|( 100.0000 +- 0.00000 )%| UnpackProtoParticle/UnpackChargedProtos #=10 Sum=10 Eff=|( 100.0000 +- 0.00000 )%| FunTupleBase_Particles/DimuonsTuple #=10 Sum=10 Eff=|( 100.0000 +- 0.00000 )%| -ToolSvc INFO Removing all tools created by ToolSvc RFileCnv INFO dumping contents of /NTUPLES/FILE1 TFile: name=DV-example-tupling-basic-ntp-run-mc.root, title=Gaudi Trees, option=CREATE NTupleSvc INFO NTuples saved successfully diff --git a/DaVinciTests/python/DaVinciTests/QMTest/DaVinciExclusions.py b/DaVinciTests/python/DaVinciTests/QMTest/DaVinciExclusions.py index 722211bd4f5b50439731198a3b89dd66f6b4c43d..085628ac82801853241b8a73bce3eec123c63d3f 100755 --- a/DaVinciTests/python/DaVinciTests/QMTest/DaVinciExclusions.py +++ b/DaVinciTests/python/DaVinciTests/QMTest/DaVinciExclusions.py @@ -27,7 +27,10 @@ remove_uninteresting_lines = LineSkipper(regexps=[ "DeFTDetector +INFO Current FT geometry version", "LHCb::Det::LbDD4hep::DD4hepSvc +INFO Field map location", "DeMagnetConditionCall +INFO Loading mag field from", - "MagneticFieldExtension +INFO Scale factor" + "MagneticFieldExtension +INFO Scale factor", + "ToolSvc.TrackStateProvider.Track... WARNING TransportSvc is currently incompatible with DD4HEP .*", + "ToolSvc.TrackStateProvider.Track... WARNING See https://gitlab.cern.ch/lhcb/Rec/-/issues/326 for more details", + "ToolSvc +INFO Removing all tools created by ToolSvc" ]) # Remove known warnings from the references diff --git a/DaVinciTests/python/DaVinciTests/functors.py b/DaVinciTests/python/DaVinciTests/functors.py index e4c2f4acc80666bbd0fb04f1ba8cd6fe9350e0f7..b1a53a55984b62b72b7e4f93922df171c0b57e6b 100644 --- a/DaVinciTests/python/DaVinciTests/functors.py +++ b/DaVinciTests/python/DaVinciTests/functors.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration # +# (c) Copyright 2021-2022 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". # @@ -56,7 +56,7 @@ def make_tight_d2kk(): def main(options: Options): - vd0s = make_std_loose_d2kk(options.process) + vd0s = make_std_loose_d2kk() td0s = make_tight_d2kk() print("### vD0s {0} and tD0s {1}".format(vd0s, td0s)) diff --git a/DaVinciTests/python/DaVinciTests/funtuple_array.py b/DaVinciTests/python/DaVinciTests/funtuple_array.py index 67efd4452de1fd751a87f48305b87abeb8197042..9b8919688e85f93db2da53df5c1cc2c832dccc52 100644 --- a/DaVinciTests/python/DaVinciTests/funtuple_array.py +++ b/DaVinciTests/python/DaVinciTests/funtuple_array.py @@ -27,7 +27,7 @@ def main(options: Options): # In this test we want to save the information regarding long pions available in the event # storing them in a set of arrays. - pions = make_long_pions(options.process) + pions = make_long_pions() tagging_container = ParticleContainerMerger( InputContainers=[pions]).OutputContainer diff --git a/DaVinciTests/python/DaVinciTests/read_moore_output.py b/DaVinciTests/python/DaVinciTests/read_moore_output.py index c19882da90fc097ceb4e34d89e53e35f63775363..d922c5bcf73094acbc42ae93499ee49fa8c6ea5f 100644 --- a/DaVinciTests/python/DaVinciTests/read_moore_output.py +++ b/DaVinciTests/python/DaVinciTests/read_moore_output.py @@ -18,7 +18,7 @@ from DaVinci.common_particles import make_std_loose_d2kk def d2kk(options: Options): - d0s = make_std_loose_d2kk(options.process) + d0s = make_std_loose_d2kk() pdt = PrintDecayTree(name="PrintD0s", Input=d0s) # the "upfront_reconstruction" is what unpacks reconstruction objects, particles and primary vertices diff --git a/DaVinciTests/tests/options/option_davinci_funtuple_array.py b/DaVinciTests/tests/options/option_davinci_funtuple_array.py index 9ff6381e87b4bdfe7ebf14952fdbf6c59fbf50af..53b13a5f6012d51804310bf402971925f2333628 100644 --- a/DaVinciTests/tests/options/option_davinci_funtuple_array.py +++ b/DaVinciTests/tests/options/option_davinci_funtuple_array.py @@ -34,7 +34,7 @@ bd2dsk_data = force_location(f"/Event/Spruce/{bd2dsk_line}/Particles") # In this test we want to save the information regarding long pions available in the event # storing them in a set of arrays. -pions = make_long_pions(options.process) +pions = make_long_pions() tagging_container = ParticleContainerMerger( InputContainers=[pions]).OutputContainer diff --git a/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt b/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt index 4d06714f5a8b9627752a09238b67b0dd5ec30daa..fe772296a7d5685e73e0f6a978ee3a588a07fc1c 100755 --- a/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt +++ b/DaVinciTests/tests/qmtest/io.qms/test_read_moore_dst.qmt @@ -25,18 +25,14 @@ msg_svc_format: "% F%60W%S%7W%R%T %0W%M" </text></argument> <argument name="validator"><text> -findReferenceBlock("""StdLooseD02KK INFO Number of counters : 10 +findReferenceBlock("""StdLooseD02KK INFO Number of counters : 6 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# D0 -> K+ K- " | 21 | 87 | 4.1429 | 2.6777 | 1.0000 | 11.000 | - | "# K+" | 21 | 219 | 10.429 | 5.6279 | 3.0000 | 20.000 | - | "# K-" | 21 | 203 | 9.6667 | 4.7140 | 2.0000 | 22.000 | - | "# Rec/Vertex/Primary" | 21 | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | - | "# StdLooseKaons/Particles" | 21 | 422 | 20.095 | 9.3549 | 7.0000 | 42.000 | - | "# input particles" | 21 | 422 | 20.095 | 9.3549 | 7.0000 | 42.000 | - | "# selected" | 21 | 87 | 4.1429 | - |*"#accept" | 21 | 21 |( 100.0000 +- 0.000000)% | - | "#pass combcut" | 2470 | 90 | 0.036437 | - | "#pass mother cut" | 90 | 87 | 0.96667 | + |*"# passed" | 21 | 21 |( 100.0000 +- 0.000000)% | + |*"# passed CombinationCut" | 2484 | 90 |( 3.623188 +- 0.3749350)% | + |*"# passed CompositeCut" | 90 | 83 |( 92.22222 +- 2.823087)% | + |*"# passed vertex fit" | 90 | 90 |( 100.0000 +- 0.000000)% | + | "Input1 size" | 21 | 423 | 20.143 | + | "Input2 size" | 21 | 423 | 20.143 | """, stdout, result, causes, signature_offset = 0, id = "Stream3") countErrorLines({"FATAL":0, "ERROR":0}) </text></argument> diff --git a/Phys/DaVinci/python/DaVinci/common_particles.py b/Phys/DaVinci/python/DaVinci/common_particles.py index 2c2db1cbaad63324d3d83c416b0e8d4d2a91f5ac..12205341ada83542867d7ac846d5704d97ba9054 100644 --- a/Phys/DaVinci/python/DaVinci/common_particles.py +++ b/Phys/DaVinci/python/DaVinci/common_particles.py @@ -11,17 +11,19 @@ """ Definitions of "common particles" very similar to those of Runs 1 & 2. """ - +from GaudiKernel.SystemOfUnits import MeV +import Functors as F +from Functors.math import in_range from PyConf.tonic import configurable from PyConf.Algorithms import FunctionalParticleMaker from Hlt2Conf.standard_particles import (make_long_kaons, make_long_muons, standard_protoparticle_filter, get_long_track_selector) -from Hlt2Conf.algorithms import ParticleFilterWithPVs, ParticleCombinerWithPVs +from Hlt2Conf.algorithms_thor import ParticleFilter, ParticleCombiner from DaVinci.reco_objects import (make_charged_protoparticles as - _make_charged_protoparticles, make_pvs as - _make_pvs) -from DaVinci.filter_selectors import default_particle_cuts, default_track_cuts + _make_charged_protoparticles) +from RecoConf.reco_objects_from_file import make_pvs as _make_pvs_v2 +from DaVinci.filter_selectors import default_particle_cuts #################################### #Particle makers with loose cut @@ -29,59 +31,54 @@ from DaVinci.filter_selectors import default_particle_cuts, default_track_cuts def _make_std_loose_particles(particles, pvs, name): - return ParticleFilterWithPVs( - particles, pvs, name=name, Code=default_particle_cuts()) + return ParticleFilter( + Input=particles, name=name, Cut=F.FILTER(default_particle_cuts(pvs))) @configurable -def make_std_loose_kaons(process): - with get_long_track_selector.bind( - Code=default_track_cuts()), standard_protoparticle_filter.bind( - Code='PP_HASRICH'): +def make_std_loose_kaons(): + with standard_protoparticle_filter.bind(Code='PP_HASRICH'): return _make_std_loose_particles( - make_long_kaons(), _make_pvs(process), name='StdLooseKaons') + make_long_kaons(), _make_pvs_v2(), name='StdLooseKaons') -def make_std_loose_muons(process): - #with get_long_track_selector.bind(Code=default_track_cuts()): +def make_std_loose_muons(): return _make_std_loose_particles( - make_long_muons(), _make_pvs(process), name='StdLooseMuons') + make_long_muons(), _make_pvs_v2(), name='StdLooseMuons') @configurable -def make_std_loose_jpsi2mumu(process): - muons = make_std_loose_muons(process) - descriptors = ["J/psi(1S) -> mu+ mu-"] - daughters_code = {"mu+": "ALL", "mu-": "ALL"} - combination_code = "(ADAMASS('J/psi(1S)') < 100.*MeV) & (ADOCACHI2CUT(30,''))" - vertex_code = "(CHI2VX < 25.)" - - return ParticleCombinerWithPVs( +def make_std_loose_jpsi2mumu(): + M_Jpsi = 3096.9 * MeV + muons = make_std_loose_muons() + descriptor = "J/psi(1S) -> mu+ mu-" + combination_code = (in_range(M_Jpsi - 100. * MeV, F.MASS, + M_Jpsi + 100. * MeV)) & F.MAXDOCACHI2CUT(30.) + vertex_code = F.CHI2 < 5. + + return ParticleCombiner( name="StdLooseJpsi2MuMu", - particles=muons, - pvs=_make_pvs(process), - DecayDescriptors=descriptors, - DaughtersCuts=daughters_code, + Inputs=[muons, muons], + DecayDescriptor=descriptor, CombinationCut=combination_code, - MotherCut=vertex_code) + CompositeCut=vertex_code) @configurable -def make_std_loose_d2kk(process): - kaons = make_std_loose_kaons(process) - descriptors = ["D0 -> K+ K-"] - daughters_code = {"K+": "ALL", "K-": "ALL"} - combination_code = "(ADAMASS('D0') < 100.*MeV) & (ADOCACHI2CUT(30,''))" - vertex_code = "(CHI2VX < 25.)" - - return ParticleCombinerWithPVs( +def make_std_loose_d2kk(): + D0_M = 1864.84 * MeV # +/- 0.05 + kaons = make_std_loose_kaons() + descriptor = "D0 -> K+ K-" + combination_code = (in_range(D0_M - 100. * MeV, F.MASS, + D0_M + 100. * MeV)) & F.MAXDOCACHI2CUT(30.) + vertex_code = F.CHI2 < 25. + + return ParticleCombiner( name="StdLooseD02KK", - particles=kaons, - pvs=_make_pvs(process), - DecayDescriptors=descriptors, - DaughtersCuts=daughters_code, + Inputs=[kaons, kaons], + DecayDescriptor=descriptor, CombinationCut=combination_code, - MotherCut=vertex_code) + CompositeCut=vertex_code) # Temporary function implemented for testing the MAP_ARRAY functor and ParticleTaggerAlg algorithm @@ -91,8 +88,8 @@ def make_std_loose_d2kk(process): # TO BE REMOVED AS SOON AS THIS PYTHON MODULE IS MOVED INTO ANOTHER SHARED REPO OR # IT'S REDESIGNED SPECIFICALLY FOR DAVINCI. @configurable -def make_long_pions(process): - charged_protos = _make_charged_protoparticles(process) +def make_long_pions(): + charged_protos = _make_charged_protoparticles() particles = FunctionalParticleMaker( InputProtoParticles=charged_protos, ParticleID="pion", diff --git a/Phys/DaVinci/python/DaVinci/filter_selectors.py b/Phys/DaVinci/python/DaVinci/filter_selectors.py index 41e57b8a14f731e92ed1e872e781f5f23bf3f1f9..2c97ceab3e23b64e9f0291576618e43f4f991dde 100644 --- a/Phys/DaVinci/python/DaVinci/filter_selectors.py +++ b/Phys/DaVinci/python/DaVinci/filter_selectors.py @@ -13,25 +13,17 @@ Definitions of: - Default cuts a la runs 1&2 common particles. """ -from __future__ import absolute_import, division, print_function - -from Hlt2Conf.algorithms import require_all +from GaudiKernel.SystemOfUnits import MeV +import Functors as F +from Hlt2Conf.algorithms_thor import require_all ################################# -# Default track and particle cuts +# Default particle cuts ################################# -def default_track_cuts(): - """ - Return a string with the default track cuts. - These are set as a take-all since in principle the track cuts are applied in HLT. - """ - return require_all("TrALL") - - -def default_particle_cuts(): +def default_particle_cuts(pvs): """ Return a string with the default particle standard loose cuts. """ - return require_all("PT>250*MeV", "MIPCHI2DV(PRIMARY)>4.") + return require_all(F.PT > 250 * MeV, F.MINIPCHI2(pvs) > 4)