diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.py b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.py index cfcba84bd97077df5b8a31d22d71cd3128a66a61..1a2bedf0ed06be5943d4073ce355699950c67c5d 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.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". # @@ -25,7 +25,7 @@ from DaVinci.standard_particles import make_detached_mumu, make_KsDD from DaVinci.reco_objects import upfront_reconstruction_from_file as upfront_reconstruction from FunTuple import FunctorCollection from FunTuple import FunTuple_Particles as Funtuple -from FunTuple.NewTupleTools import Kinematics +from FunTuple.functorcollections import Kinematics # Prepare the node with the selection dimuons = make_detached_mumu() @@ -40,39 +40,24 @@ branches['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' #FunTuple: make collection of functors for Jpsi variables_jpsi = FunctorCollection({ - 'LOKI_P': - 'P', - 'LOKI_MAXPT': - 'TRACK_MAX_PT', - 'LOKI_NTRCKS_ABV_THRSHLD': - 'NINTREE(ISBASIC & (PT > 15*MeV))', - 'LOKI_Muonp_PT': - 'CHILD(PT, 1)', - 'LOKI_Muonm_PT': - 'CHILD(PT, 2)', - 'THOR_PT': - F.PT, - 'THOR_PX': - F.PX, - 'THOR_PY': - F.PY, - 'THOR_PZ': - F.PZ, - 'THOR_PE': - F.ENERGY, - 'THOR_FourMom_P': - F.FOURMOMENTUM, + 'THOR_PT': F.PT, + 'THOR_PX': F.PX, + 'THOR_PY': F.PY, + 'THOR_PZ': F.PZ, + 'THOR_PE': F.ENERGY, + 'THOR_FourMom_P': F.FOURMOMENTUM, + 'LOKI_MAXPT': 'TRACK_MAX_PT', }) -#FunTuple: extend the collection given dictionary -#In case of common entries (i.e. common key and not functor code) the program warns user and overwrites the previous entry +#FunTuple: extend the collection given a dictionary +#In case of common entries (i.e. common key irrespective of functor code) the program warns user and overwrites the previous entry variables_jpsi.update({ - 'LOKI_PT': 'PT' + 'THOR_PT': F.PT }) #OR like dictionaries can do variables_jpsi['LOKI_PT'] = 'PT' #FunTuple: Remove from collection given the list of variable names -variables_jpsi.pop(['THOR_PT', 'LOKI_P']) +variables_jpsi.pop(['THOR_PT', 'THOR_PE']) #FunTuple: Join two functor #If entries already exist user is warned about picking entries from the base instance. -variables_extra = FunctorCollection({'LOKI_PT': 'PT', 'THOR_P': F.P}) +variables_extra = FunctorCollection({'THOR_E': F.ENERGY, 'THOR_P': F.P}) variables_jpsi += variables_extra #FunTuple: Can also subtract two FunctorCollection to get unique entries like below #variables_unique = variables_jpsi - variables_extra diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py index b2b14b4fb3991e3e7d72c0e265c063d5cabd03c0..7f3ece6760f2273d29c8cd185e55b75adefed199 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.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". # @@ -13,7 +13,7 @@ Example options to read the output of a Sprucing job with the new DaVinci config filtering on an HLT2 line decision. """ from FunTuple import FunctorCollection -from FunTuple.NewTupleTools import Kinematics +from FunTuple.functorcollections import Kinematics #FunTuple: define branches branches = { diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.py index 489a43024dedb02ee1805e7712d5188c6166efe8..6bb179bbd0ebb83a74b5bd9436f3cd5808d33ade 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.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". # @@ -13,7 +13,7 @@ Read the output of an Sprucing job with the new DaVinci configuration. """ from FunTuple import FunctorCollection from FunTuple import FunTuple_Particles as Funtuple -from FunTuple.NewTupleTools import Kinematics +from FunTuple.functorcollections import Kinematics from PyConf.application import make_data_with_FetchDataFromFile from DaVinci.algorithms import add_filter diff --git a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_advanced.qmt b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_advanced.qmt index f65a4b0060ef55ba2f1f2564bab68d8fa3e93fea..4da59eec69b3df959fab7306bac1314d7ce51092 100755 --- a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_advanced.qmt +++ b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_advanced.qmt @@ -1,7 +1,7 @@