From 1a3bbdf8e3514f60653b329c6d1906bd4853c942 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues <eduardo.rodrigues@cern.ch> Date: Thu, 10 Feb 2022 15:00:09 +0100 Subject: [PATCH] FunTuple - API changes --- .../tupling/example-tupling-AllFunctors.py | 10 +++--- .../tupling/example-tupling-DTF-run-mc.py | 14 ++++---- .../example-tupling-advanced-run-mc.py | 34 +++++++++---------- .../tupling/example-tupling-basic-run-mc.py | 14 ++++---- .../tupling/example-tupling-basic.py | 28 +++++++-------- .../tupling/option_davinci_configFuntuple.py | 12 +++---- .../option_davinci_tupling_from_hlt2.py | 12 +++---- ...tion_davinci_tupling_from_hlt2_gaudirun.py | 6 ++-- .../option_davinci_tupling_from_spruce.py | 18 +++++----- .../option_davinci_tupling_from_xgen.py | 12 +++---- .../test_davinci_tupling-basic-run-mc.ref | 8 ++--- .../refs/test_davinci_tupling_from_hlt2.ref | 12 +++---- ...est_davinci_tupling_from_hlt2_gaudirun.ref | 12 +++---- .../refs/test_davinci_tupling_from_xgen.ref | 20 +++++------ .../tests/options/option_davinci_filters.py | 18 +++++----- .../options/option_davinci_read_mc_xgen.py | 12 +++---- .../options/option_davinci_recVertices.py | 8 ++--- .../tests/options/option_davinci_sprucing.py | 12 +++---- Phys/DaVinci/python/DaVinci/algorithms.py | 12 +++---- Phys/DaVinci/tests/config/test_algorithms.py | 6 ++-- 20 files changed, 140 insertions(+), 140 deletions(-) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-AllFunctors.py b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-AllFunctors.py index c65bb2949..502861067 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-AllFunctors.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-AllFunctors.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -137,9 +137,9 @@ def alg_config(): DTFRelations = DTF.OutputRelations # Relations # - # Definition of branches and functors + # Definition of fields (branches) and functors # - branches_dsk = { + fields_dsk = { 'B0': "[B0 -> D_s- K+]CC", 'Kaon': "[B0 -> D_s- ^K+]CC", } @@ -160,8 +160,8 @@ def alg_config(): # my_tuple = Funtuple( name="B0DsK_Tuple", - tree_name="DecayTree", - branches=branches_dsk, + tuple_name="DecayTree", + fields=fields_dsk, variables=variables_dsk, loki_preamble=[], inputs=bd2dsk_data) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc.py b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc.py index a85c39952..d1d755860 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-DTF-run-mc.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -44,9 +44,9 @@ DTF = DTFAlg(Input=dimuons, MassConstraints=["J/psi(1S)"], OutputLevel=3) DTFRelations = DTF.OutputRelations # Relations #FunTuple: Jpsi info -branches = {} -branches['Jpsi'] = 'J/psi(1S) -> mu+ mu-' -branches['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' +fields = {} +fields['Jpsi'] = 'J/psi(1S) -> mu+ mu-' +fields['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' #make collection of functors for Jpsi variables_jpsi = FunctorCollection({ @@ -91,7 +91,7 @@ variables_muplus = FunctorCollection({ F.MAP_INPUT(Functor=F.PT, Relations=DTFRelations) }) -#associate FunctorCollection to branch name +#associate FunctorCollection to field (branch) name variables = {} variables['Jpsi'] = variables_jpsi variables['MuPlus'] = variables_muplus @@ -102,8 +102,8 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] #Configure Funtuple algorithm tuple_dimuons = Funtuple( name="DimuonsTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, loki_preamble=loki_preamble, inputs=dimuons) 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 219965723..317be6ad9 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-advanced-run-mc.py @@ -33,10 +33,10 @@ kshorts = make_KsDD() ''' Tuple observables related to Jpsi -> mu+ mu- ''' -#FunTuple: make branches to tuple (NB: adding a special keyword 'ALL' with throw an error) -branches = {} -branches['Jpsi'] = 'J/psi(1S) -> mu+ mu-' -branches['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' +#FunTuple: make fields (branches) to tuple (NB: adding a special keyword 'ALL' with throw an error) +fields = {} +fields['Jpsi'] = 'J/psi(1S) -> mu+ mu-' +fields['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' #FunTuple: make collection of functors for Jpsi variables_jpsi = FunctorCollection({ @@ -61,16 +61,16 @@ 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 -print('Variables in Jpsi branch', variables_jpsi) +print('Variables in Jpsi field', variables_jpsi) #FunTuple: make functor collection from the imported functor library Kinematics variables_all = FunctorCollection(Kinematics) -print('Variables in ALL branch', variables_all) -print('Variables in MuPlus branch', variables_extra) +print('Variables in ALL field', variables_all) +print('Variables in MuPlus field', variables_extra) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = {} -variables['ALL'] = variables_all #adds variables to all branches +variables['ALL'] = variables_all #adds variables to all fields variables['Jpsi'] = variables_jpsi variables['MuPlus'] = variables_extra @@ -80,26 +80,26 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] #FunTuple: Configure Funtuple algorithm tuple_dimuons = Funtuple( name="DimuonsTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, loki_preamble=loki_preamble, inputs=dimuons) ''' Tuple observables related to KS0 -> 2pi ''' -#FunTuple: As above make branches -branches_KS = {} -branches_KS['KS'] = 'KS0 -> pi+ pi-' -#FunTuple: Associate the functor collections to branch names +#FunTuple: As above make fields (branches) +fields_KS = {} +fields_KS['KS'] = 'KS0 -> pi+ pi-' +#FunTuple: Associate the functor collections to field names variables_KS = {} variables_KS['ALL'] = variables_all variables_KS['KS'] = variables_jpsi #FunTuple: Configure Funtuple algorithm tuple_kshorts = Funtuple( name="KsTuple", - tree_name="DecayTree", - branches=branches_KS, + tuple_name="DecayTree", + fields=fields_KS, variables=variables_KS, loki_preamble=loki_preamble, inputs=kshorts) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic-run-mc.py b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic-run-mc.py index a63b48aa8..7aecaa6e4 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic-run-mc.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic-run-mc.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -30,9 +30,9 @@ from FunTuple import FunTuple_Particles as Funtuple dimuons = make_detached_mumu() #FunTuple: Jpsi info -branches = {} -branches['Jpsi'] = 'J/psi(1S) -> mu+ mu-' -branches['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' +fields = {} +fields['Jpsi'] = 'J/psi(1S) -> mu+ mu-' +fields['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' #make collection of functors for Jpsi variables_jpsi = FunctorCollection({ @@ -57,7 +57,7 @@ variables_jpsi = FunctorCollection({ #make collection of functors for Muplus variables_muplus = FunctorCollection({'LOKI_P': 'P', 'THOR_P': F.P}) -#associate FunctorCollection to branch name +#associate FunctorCollection to (field branch) name variables = {} variables['Jpsi'] = variables_jpsi variables['MuPlus'] = variables_muplus @@ -68,8 +68,8 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] #Configure Funtuple algorithm tuple_dimuons = Funtuple( name="DimuonsTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, loki_preamble=loki_preamble, inputs=dimuons) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic.py b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic.py index fed2f0ae2..5fb3a8b61 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/example-tupling-basic.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -44,10 +44,10 @@ print(options) dimuons = make_detached_mumu() kshorts = make_KsDD() -#FunTuple: make branches to tuple -branches = {} -branches['Jpsi'] = 'J/psi(1S) -> mu+ mu-' -branches['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' +#FunTuple: make fields (branches) to tuple +fields = {} +fields['Jpsi'] = 'J/psi(1S) -> mu+ mu-' +fields['MuPlus'] = 'J/psi(1S) -> ^mu+ mu-' #FunTuple: make collection of functors for Jpsi variables_jpsi = FunctorCollection({ @@ -72,7 +72,7 @@ variables_jpsi = FunctorCollection({ #FunTuple: make collection of functors for Muplus variables_muplus = FunctorCollection({'LOKI_P': 'P', 'THOR_P': F.P}) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = {} variables['Jpsi'] = variables_jpsi variables['MuPlus'] = variables_muplus @@ -83,23 +83,23 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] #FunTuple: Configure Funtuple algorithm tuple_dimuons = Funtuple( name="DimuonsTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, loki_preamble=loki_preamble, inputs=dimuons) -#FunTuple: similarly for Ks we can make branches, functor collections, variables and FunTuple instance -branches_KS = {} -branches_KS['KS'] = 'KS0 -> pi+ pi-' -#associate the functor collections to KS branch name (NB: here we use functor collection used for jpsi) +#FunTuple: similarly for Ks we can make fields (branches), functor collections, variables and FunTuple instance +fields_KS = {} +fields_KS['KS'] = 'KS0 -> pi+ pi-' +#associate the functor collections to KS field name (NB: here we use functor collection used for jpsi) variables_KS = {} variables_KS['KS'] = variables_jpsi #funtuple instance tuple_kshorts = Funtuple( name="KsTuple", - tree_name="DecayTree", - branches=branches_KS, + tuple_name="DecayTree", + fields=fields_KS, variables=variables_KS, loki_preamble=loki_preamble, inputs=kshorts) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py index 7f3ece676..288e12033 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_configFuntuple.py @@ -15,8 +15,8 @@ filtering on an HLT2 line decision. from FunTuple import FunctorCollection from FunTuple.functorcollections import Kinematics -#FunTuple: define branches -branches = { +#FunTuple: define fields (branches) +fields = { 'B0': "[B0 -> D_s- pi+]CC", 'Ds': "[B0 -> ^D_s- pi+]CC", 'pip': "[B0 -> D_s- ^pi+]CC", @@ -37,9 +37,9 @@ variables_B = FunctorCollection({ #FunTuple: make functor collection from the imported functor library Kinematics variables_all = FunctorCollection(Kinematics) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables_B, } @@ -52,8 +52,8 @@ def main(): "/Event/Spruce/SpruceB2OC_BdToDsmPi_DsmToHHH_Line/Particles", "filters": ["HLT_PASS('SpruceB2OC_BdToDsmPi_DsmToHHH_LineDecision')"], "preamble": ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'], - "tree": "DecayTree", - "branches": branches, + "tuple": "DecayTree", + "fields": fields, "variables": variables, } diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py index 0558d9c56..92106e144 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2.py @@ -20,7 +20,7 @@ from DaVinci.algorithms import add_filter from DaVinci import options from DaVinci.truth_matching import ConfiguredMCTruthAndBkgCatAlg -branches = { +fields = { "D0": "[D0 -> K- pi+]CC", "Kminus": "[D0 -> ^K- pi+]CC", "piplus": "[D0 -> K- ^pi+]CC", @@ -75,7 +75,7 @@ def main(): #get configured "MCTruthAndBkgCatAlg" algorithm for HLT2 output mctruth = ConfiguredMCTruthAndBkgCatAlg(inputs=d02kpi_data) - #Add trueid info to each of the branches + #Add true ID info to each of the fields (branches) trueid_bkgcat_info = { "TRUEID": F.MAP_INPUT(Functor=F.PARTICLE_ID, Relations=mctruth.MCAssocTable), @@ -98,13 +98,13 @@ def main(): "BKGCAT": F.BKGCAT(Relations=mctruth.BkgCatTable) } - for branch in variables.keys(): - variables[branch] += FunctorCollection(trueid_bkgcat_info) + for field in variables.keys(): + variables[field] += FunctorCollection(trueid_bkgcat_info) my_tuple = Funtuple( name="Tuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, inputs=d02kpi_data) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2_gaudirun.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2_gaudirun.py index 3365f1475..dc0ffc3c8 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2_gaudirun.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_hlt2_gaudirun.py @@ -20,7 +20,7 @@ from DaVinci.reco_objects import make_pvs_for from DaVinci.algorithms import add_filter from DaVinci import options -branches = { +fields = { "D0": "[D0 -> K- pi+]CC", "Kminus": "[D0 -> ^K- pi+]CC", "piplus": "[D0 -> K- ^pi+]CC", @@ -54,8 +54,8 @@ def main(): "HLT_PASS('Hlt2CharmD0ToKmPipLineDecision')") my_tuple = Funtuple( name="Tuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, inputs=d02kpi_data) 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 6bb179bbd..f8fb873ee 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_spruce.py @@ -22,13 +22,13 @@ bd2dsk_line = make_data_with_FetchDataFromFile( bd2dspi_line = make_data_with_FetchDataFromFile( "/Event/Spruce/SpruceB2OC_BdToDsmPi_DsmToHHH_Line/Particles") -branches_dsk = { +fields_dsk = { 'B0': "[B0 -> D_s- K+]CC", 'Ds': "[B0 -> ^D_s- K+]CC", 'Kp': "[B0 -> D_s- ^K+]CC" } -branches_dspi = { +fields_dspi = { 'B0': "[B0 -> D_s- pi+]CC", 'Ds': "[B0 -> ^D_s- pi+]CC", 'pip': "[B0 -> D_s- ^pi+]CC", @@ -49,16 +49,16 @@ variables += variables_extra #FunTuple: make functor collection from the imported functor library Kinematics variables_all = FunctorCollection(Kinematics) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables_dsk = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables, 'Ds': variables_extra, 'Kp': variables_extra } variables_dspi = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables, 'Ds': variables_extra, 'pip': variables_extra, @@ -68,16 +68,16 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] tuple_B0DsK = Funtuple( name="B0DsK_Tuple", - tree_name="DecayTree", - branches=branches_dsk, + tuple_name="DecayTree", + fields=fields_dsk, variables=variables_dsk, loki_preamble=loki_preamble, inputs=bd2dsk_line) tuple_B0Dspi = Funtuple( name="B0Dspi_Tuple", - tree_name="DecayTree", - branches=branches_dspi, + tuple_name="DecayTree", + fields=fields_dspi, variables=variables_dspi, loki_preamble=loki_preamble, inputs=bd2dspi_line) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py index 1b8b43daf..ba383baed 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.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". # @@ -15,8 +15,8 @@ from FunTuple import FunctorCollection, FunTuple_MCParticles as FuntupleMC from PyConf.Algorithms import PrintMCTree from PyConf.dataflow import force_location -#FunTuple: define branches -branches = { +#FunTuple: define fields (branches) +fields = { 'Bu': "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC", 'Jpsi': "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC", 'Kplus': "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC", @@ -40,7 +40,7 @@ variables_all = FunctorCollection({ 'PZ': 'MCPZ', }) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = { 'ALL': variables_all, 'Bu': variables_B, @@ -69,8 +69,8 @@ def main(): tuple_BuJpsiK = FuntupleMC( name="BuJpsiK_MCTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, inputs=bu2jpsik_line) 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 43c926f63..b5c96d82f 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling-basic-run-mc.ref @@ -68,10 +68,10 @@ CombineParticles INFO Number of counters : 11 | "#pass mother cut" | 3 | 3 | 1.0000 | DimuonsTuple INFO Number of counters : 5 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# events without candidate for branch Jpsi" | 7 | - | "# events without candidate for branch MuPlus" | 7 | - | "# non-empty events for branch Jpsi" | 3 | - | "# non-empty events for branch MuPlus" | 3 | + | "# events without candidate for field Jpsi" | 7 | + | "# events without candidate for field MuPlus" | 7 | + | "# non-empty events for field Jpsi" | 3 | + | "# non-empty events for field MuPlus" | 3 | | "# processed events" | 10 | FunctionalParticleMaker INFO Number of counters : 4 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2.ref index a4968764a..018f4a0be 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2.ref @@ -95,10 +95,10 @@ ToolSvc.HltFactory INFO Number of counters : 1 | "# loaded from PYTHON" | 1 | Tuple INFO Number of counters : 7 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# events with multiple candidates for branch D0"| 7 | - | "# events with multiple candidates for branch Kminus"| 7 | - | "# events with multiple candidates for branch piplus"| 7 | - | "# non-empty events for branch D0" | 7 | - | "# non-empty events for branch Kminus" | 7 | - | "# non-empty events for branch piplus" | 7 | + | "# events with multiple candidates for field D0"| 7 | + | "# events with multiple candidates for field Kminus"| 7 | + | "# events with multiple candidates for field piplus"| 7 | + | "# non-empty events for field D0" | 7 | + | "# non-empty events for field Kminus" | 7 | + | "# non-empty events for field piplus" | 7 | | "# processed events" | 7 | diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2_gaudirun.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2_gaudirun.ref index 20bcd45e4..544e51cfe 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2_gaudirun.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_hlt2_gaudirun.ref @@ -62,10 +62,10 @@ ToolSvc.HltFactory INFO Number of counters : 1 | "# loaded from PYTHON" | 1 | Tuple INFO Number of counters : 7 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# events with multiple candidates for branch D0"| 7 | - | "# events with multiple candidates for branch Kminus"| 7 | - | "# events with multiple candidates for branch piplus"| 7 | - | "# non-empty events for branch D0" | 7 | - | "# non-empty events for branch Kminus" | 7 | - | "# non-empty events for branch piplus" | 7 | + | "# events with multiple candidates for field D0"| 7 | + | "# events with multiple candidates for field Kminus"| 7 | + | "# events with multiple candidates for field piplus"| 7 | + | "# non-empty events for field D0" | 7 | + | "# non-empty events for field Kminus" | 7 | + | "# non-empty events for field piplus" | 7 | | "# processed events" | 7 | diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index 3acf60780..24fde447b 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref @@ -42,16 +42,16 @@ ApplicationMgr INFO Application Manager Finalized succes ApplicationMgr INFO Application Manager Terminated successfully BuJpsiK_MCTuple INFO Number of counters : 11 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# events without candidate for branch Bu" | 37 | - | "# events without candidate for branch Jpsi" | 37 | - | "# events without candidate for branch Kplus" | 37 | - | "# events without candidate for branch muminus" | 37 | - | "# events without candidate for branch muplus" | 37 | - | "# non-empty events for branch Bu" | 63 | - | "# non-empty events for branch Jpsi" | 63 | - | "# non-empty events for branch Kplus" | 63 | - | "# non-empty events for branch muminus" | 63 | - | "# non-empty events for branch muplus" | 63 | + | "# events without candidate for field Bu" | 37 | + | "# events without candidate for field Jpsi" | 37 | + | "# events without candidate for field Kplus" | 37 | + | "# events without candidate for field muminus" | 37 | + | "# events without candidate for field muplus" | 37 | + | "# non-empty events for field Bu" | 63 | + | "# non-empty events for field Jpsi" | 63 | + | "# non-empty events for field Kplus" | 63 | + | "# non-empty events for field muminus" | 63 | + | "# non-empty events for field muplus" | 63 | | "# processed events" | 100 | ToolSvc.MCHybridFactory INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | diff --git a/DaVinciTests/tests/options/option_davinci_filters.py b/DaVinciTests/tests/options/option_davinci_filters.py index fa6e19a30..772ea912e 100644 --- a/DaVinciTests/tests/options/option_davinci_filters.py +++ b/DaVinciTests/tests/options/option_davinci_filters.py @@ -22,13 +22,13 @@ bd2dsk_line = make_data_with_FetchDataFromFile( bd2dspi_line = make_data_with_FetchDataFromFile( "/Event/Spruce/SpruceB2OC_BdToDsmPi_DsmToHHH_Line/Particles") -branches_dsk = { +fields_dsk = { 'B0': "[B0 -> D_s- K+]CC", 'Ds': "[B0 -> ^D_s- K+]CC", 'Kp': "[B0 -> D_s- ^K+]CC" } -branches_dspi = { +fields_dspi = { 'B0': "[B0 -> D_s- pi+]CC", 'Ds': "[B0 -> ^D_s- pi+]CC", 'pip': "[B0 -> D_s- ^pi+]CC", @@ -49,16 +49,16 @@ variables += variables_extra #FunTuple: make functor collection from the imported functor library Kinematics variables_all = FunctorCollection(Kinematics) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables_dsk = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables, 'Ds': variables_extra, 'Kp': variables_extra } variables_dspi = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables, 'Ds': variables_extra, 'pip': variables_extra, @@ -68,16 +68,16 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] tuple_B0DsK = Funtuple( name="B0DsK_Tuple", - tree_name="DecayTree", - branches=branches_dsk, + tuple_name="DecayTree", + fields=fields_dsk, variables=variables_dsk, loki_preamble=loki_preamble, inputs=bd2dsk_line) tuple_B0Dspi = Funtuple( name="B0Dspi_Tuple", - tree_name="DecayTree", - branches=branches_dspi, + tuple_name="DecayTree", + fields=fields_dspi, variables=variables_dspi, loki_preamble=loki_preamble, inputs=bd2dspi_line) diff --git a/DaVinciTests/tests/options/option_davinci_read_mc_xgen.py b/DaVinciTests/tests/options/option_davinci_read_mc_xgen.py index 71e52b5bd..711b0ff9a 100644 --- a/DaVinciTests/tests/options/option_davinci_read_mc_xgen.py +++ b/DaVinciTests/tests/options/option_davinci_read_mc_xgen.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". # @@ -15,8 +15,8 @@ from FunTuple import FunctorCollection, FunTuple_MCParticles as FuntupleMC from PyConf.Algorithms import PrintMCTree from PyConf.dataflow import force_location -#FunTuple: define branches -branches = { +#FunTuple: define fields (branches) +fields = { 'Bu': "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC", 'Jpsi': "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC", 'Kplus': "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC", @@ -40,7 +40,7 @@ variables_all = FunctorCollection({ 'PZ': 'MCPZ', }) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = { 'ALL': variables_all, 'Bu': variables_B, @@ -69,8 +69,8 @@ def main(): tuple_BuJpsiK = FuntupleMC( name="BuJpsiK_MCTuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, inputs=bu2jpsik_line) diff --git a/DaVinciTests/tests/options/option_davinci_recVertices.py b/DaVinciTests/tests/options/option_davinci_recVertices.py index 567b14f17..38eb35a23 100644 --- a/DaVinciTests/tests/options/option_davinci_recVertices.py +++ b/DaVinciTests/tests/options/option_davinci_recVertices.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -23,7 +23,7 @@ bd2dsk_line = "SpruceB2OC_BdToDsmK_DsmToHHH_FEST_Line" bd2dsk_data = make_data_with_FetchDataFromFile( f"/Event/Spruce/{bd2dsk_line}/Particles") -branches_dsk = { +fields_dsk = { 'B0': "[B0 -> D_s- K+]CC", } @@ -44,8 +44,8 @@ def alg_config(): f"HLT_PASS('{bd2dsk_line}Decision')") my_tuple = Funtuple( name="B0DsK_Tuple", - tree_name="DecayTree", - branches=branches_dsk, + tuple_name="DecayTree", + fields=fields_dsk, variables=variables_dsk, inputs=bd2dsk_data) diff --git a/DaVinciTests/tests/options/option_davinci_sprucing.py b/DaVinciTests/tests/options/option_davinci_sprucing.py index 0680ab4b5..cfe88e6bf 100644 --- a/DaVinciTests/tests/options/option_davinci_sprucing.py +++ b/DaVinciTests/tests/options/option_davinci_sprucing.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 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". # @@ -20,7 +20,7 @@ from DaVinci.algorithms import add_filter bd2dsk_line = make_data_with_FetchDataFromFile( "/Event/Spruce/SpruceB2OC_BdToDsmK_DsmToHHH_FEST_Line/Particles") -branches = { +fields = { 'B0': "[B0 -> D_s- K+]CC", 'Ds': "[B0 -> ^D_s- K+]CC", 'Kp': "[B0 -> D_s- ^K+]CC" @@ -41,9 +41,9 @@ variables_B0 += variables_extra #FunTuple: make functor collection from the imported functor library Kinematics variables_all = FunctorCollection(Kinematics) -#FunTuple: associate functor collections to branch name +#FunTuple: associate functor collections to field (branch) name variables = { - 'ALL': variables_all, #adds variables to all branches + 'ALL': variables_all, #adds variables to all fields 'B0': variables_B0, 'Ds': variables_extra, 'Kp': variables_extra @@ -53,8 +53,8 @@ loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'] tuple_B0DsK = Funtuple( name="B0DsK_Tuple", - tree_name="DecayTree", - branches=branches, + tuple_name="DecayTree", + fields=fields, variables=variables, loki_preamble=loki_preamble, inputs=bd2dsk_line) diff --git a/Phys/DaVinci/python/DaVinci/algorithms.py b/Phys/DaVinci/python/DaVinci/algorithms.py index ca4ad5432..4a27c4713 100644 --- a/Phys/DaVinci/python/DaVinci/algorithms.py +++ b/Phys/DaVinci/python/DaVinci/algorithms.py @@ -310,11 +310,11 @@ def ConfiguredFuntuple(config): Function for the FunTuple configuration and instantiation of the related HDR filter. Args: - - config: configuration dict containing information for the tuple setting: + config (dict): configuration dict containing information for the tuple setting: - dict key: name of FunTuple algorithm to be instantiated. - - tree: name of the tree built by Funtuple. - - branches: dict containing all the branches to be stored in Funtuple. - - variables: dict containing FunctorCollection to be associated to the Funtuple branches. + - tuple: name of the ntuple built by Funtuple. + - fields: dict containing all the fields (branches) to be stored in Funtuple. + - variables: dict containing FunctorCollection to be associated to the Funtuple fields (branches). - preamble: string for the LoKi preamble - location: string containing the particles location to be used as input. - filters: list of line decisions for filtering the events. @@ -342,8 +342,8 @@ def ConfiguredFuntuple(config): funTuple = Funtuple( name="Tuple_%s" % key, - tree_name=config[key]["tree"], - branches=config[key]["branches"], + tuple_name=config[key]["tuple"], + fields=config[key]["fields"], variables=config[key]["variables"], loki_preamble=config[key]["preamble"], inputs=inputs) diff --git a/Phys/DaVinci/tests/config/test_algorithms.py b/Phys/DaVinci/tests/config/test_algorithms.py index 1c70d7355..cdb3674e0 100644 --- a/Phys/DaVinci/tests/config/test_algorithms.py +++ b/Phys/DaVinci/tests/config/test_algorithms.py @@ -250,7 +250,7 @@ def test_configured_funtuple(): """ from FunTuple import FunctorCollection from FunTuple.functorcollections import Kinematics - branches = {'B0': "[B0 -> D_s- pi+]CC"} + fields = {'B0': "[B0 -> D_s- pi+]CC"} variables = {'B0': FunctorCollection(Kinematics)} config = { "TestTuple": { @@ -258,8 +258,8 @@ def test_configured_funtuple(): "filters": ["HLT_PASS('SpruceTestLine1Decision')", "VoidTest_Filter"], "preamble": ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)'], - "tree": "DecayTree", - "branches": branches, + "tuple": "DecayTree", + "fields": fields, "variables": variables, } } -- GitLab