From 63169b786d6566bb7d9fceca171e8c5568925c92 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 08:38:32 +0200 Subject: [PATCH 01/19] Add name as argument of TrackIsolation functorcollection --- .../python/FunTuple/functorcollections.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 810d804e6..fcdf80de1 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -838,12 +838,13 @@ def MCReconstructed( return FunctorCollection(func_dict) -def TrackIsolation(*, iso_rel_table: Algorithm) -> FunctorCollection: +def TrackIsolation(*, name: str, iso_rel_table: Algorithm) -> FunctorCollection: """ Candidate-level collection of functors on track isolation, using information related to the particles inside the cone around a given reference particle. Args: + name (string): string that differentiate the different charge of the cone iso_rel_table (WeightedRelTableAlg): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles inside the cone itself. @@ -893,20 +894,20 @@ def TrackIsolation(*, iso_rel_table: Algorithm) -> FunctorCollection: DELTA_PHI = F.ADJUST_ANGLE @ (REL_PHI - REF_PHI) TrackIsolationVariables = { - "HEAD_CMULT": F.VALUE_OR(0) + f"HEAD_{name}_CMULT": F.VALUE_OR(0) @ F.MAP_INPUT_SIZE(Relations=iso_rel_table.OutputRelations), - "HEAD_CP": SUMCONE(F.P), - "HEAD_CPT": SUMCONE(F.PT), - "HEAD_CPX": SUMCONE(F.PX), - "HEAD_CPY": SUMCONE(F.PY), - "HEAD_CPZ": SUMCONE(F.PZ), - "HEAD_PASY": ASYM(F.P), - "HEAD_PTASY": ASYM(F.PT), - "HEAD_PXASY": ASYM(F.PX), - "HEAD_PYASY": ASYM(F.PY), - "HEAD_PZASY": ASYM(F.PZ), - "HEAD_DETA": F.MAP(DELTA_ETA()).bind(RELS(), F.FORWARDARGS), - "HEAD_DPHI": F.MAP(DELTA_PHI()).bind(RELS(), F.FORWARDARGS), + f"HEAD_{name}_CP": SUMCONE(F.P), + f"HEAD_{name}_CPT": SUMCONE(F.PT), + f"HEAD_{name}_CPX": SUMCONE(F.PX), + f"HEAD_{name}_CPY": SUMCONE(F.PY), + f"HEAD_{name}_CPZ": SUMCONE(F.PZ), + f"HEAD_{name}_PASY": ASYM(F.P), + f"HEAD_{name}_PTASY": ASYM(F.PT), + f"HEAD_{name}_PXASY": ASYM(F.PX), + f"HEAD_{name}_PYASY": ASYM(F.PY), + f"HEAD_{name}_PZASY": ASYM(F.PZ), + f"HEAD_{name}_DETA": F.MAP(DELTA_ETA()).bind(RELS(), F.FORWARDARGS), + f"HEAD_{name}_DPHI": F.MAP(DELTA_PHI()).bind(RELS(), F.FORWARDARGS), } return FunctorCollection(TrackIsolationVariables) -- GitLab From 68e8088e4fe575a797cfb5bd93723bc61ec57520 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 16:09:08 +0200 Subject: [PATCH 02/19] Add ConeIsolation functorcollection, fix docstrings --- .../python/FunTuple/functorcollections.py | 85 ++++++++++++++----- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index fcdf80de1..290e9f076 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -24,7 +24,7 @@ from PyConf.reading import get_odin, get_decreports, get_hlt1_selreports # type from PyConf.application import make_data_with_FetchDataFromFile # type: ignore[import] from PyConf.dataflow import DataHandle # type: ignore[import] from PyConf.components import Algorithm # type: ignore[import] -from PyConf.Algorithms import HltTisTosAlg, Hlt1TrueSimEffAlg, Hlt2TrueSimEffAlg # type: ignore[import] +from PyConf.Algorithms import HltTisTosAlg, Hlt1TrueSimEffAlg, Hlt2TrueSimEffAlg, WeightedRelTableAlg # type: ignore[import] import DaVinciMCTools # type: ignore[import] from DecayTreeFitter import DecayTreeFitter # type: ignore[import] from .FunctorCollection import FunctorCollection @@ -838,42 +838,43 @@ def MCReconstructed( return FunctorCollection(func_dict) -def TrackIsolation(*, name: str, iso_rel_table: Algorithm) -> FunctorCollection: +def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorCollection: """ - Candidate-level collection of functors on track isolation, using information related to the particles + Candidate-level collection of functors on track or neutral isolation, using information related to the particles inside the cone around a given reference particle. Args: - name (string): string that differentiate the different charge of the cone + name (string): string that distinguishes branches according to some criteria + (for example if the cone is made by charged or neutral particles). + By default set to "CC" ("charged cone") iso_rel_table (WeightedRelTableAlg): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles inside the cone itself. Example: + import Functors as F from FunTuple import FunTuple_Particles as Funtuple - from FunTuple.functorcollections import TrackIsolation + from FunTuple.functorcollections import ParticleIsolation from PyConf.Algorithms import WeightedRelTableAlg + from PyConf.reading import get_particles + + branches = {"B": "[B0 -> ([J/psi(1S) -> tau+ mu-]CC)(K*(892)0 -> K+ pi-)]CC"} + b2ksttaumu_data = get_particles(f"/Event/HLT2/{line}/Particles") + b_cciso_data = get_particles(f"/Event/HLT2/{line}/B_{tes_long_track_iso}/Particles") iso_rel_table = WeightedRelTableAlg( - ReferenceParticles=..., - InputCandidates=..., - Cut=..., + ReferenceParticles=b2ksttaumu_data, + InputCandidates=b_cciso_data, + Cut=F.require_all(F.DR2()<1., ~F.FIND_IN_TREE()), #ask for cone geometry with max_coneangle = 1. and extra particles not belonging to the signal OutputLevel=INFO) - variables = TrackIsolation(iso_rel_table) + variables = FC.ParticleIsolation(name="CC", iso_rel_table=iso_rel_table) tuple = Funtuple(name="MyTuple", - fields=..., + fields=branches, variables=variables, ...) - - - Todo: - Exclude particles that are in the decay descriptor and therefore belong to the decay that is being looked for. - At the moment WeightedRelTableAlg is making relations between the reference particle (head of the cone) - and related particles (particles within the cone) without checking whenever the particles in the cone - belong to the same decay of the head. """ SUMCONE = lambda func: F.SUMCONE( Functor=func, Relations=iso_rel_table.OutputRelations @@ -893,7 +894,7 @@ def TrackIsolation(*, name: str, iso_rel_table: Algorithm) -> FunctorCollection: # evaluate DELTA PHI between reference and related particles DELTA_PHI = F.ADJUST_ANGLE @ (REL_PHI - REF_PHI) - TrackIsolationVariables = { + ParticleIsolationVariables = { f"HEAD_{name}_CMULT": F.VALUE_OR(0) @ F.MAP_INPUT_SIZE(Relations=iso_rel_table.OutputRelations), f"HEAD_{name}_CP": SUMCONE(F.P), @@ -909,8 +910,54 @@ def TrackIsolation(*, name: str, iso_rel_table: Algorithm) -> FunctorCollection: f"HEAD_{name}_DETA": F.MAP(DELTA_ETA()).bind(RELS(), F.FORWARDARGS), f"HEAD_{name}_DPHI": F.MAP(DELTA_PHI()).bind(RELS(), F.FORWARDARGS), } - return FunctorCollection(TrackIsolationVariables) + return FunctorCollection(ParticleIsolationVariables) + +def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataHandle, neutral_cone: DataHandle, cut: DataHandle) -> FunctorCollection: + """ + Candidate-level collection of functors on track or neutral isolation, using information related to the particles + inside the cone around a given reference particle. + Args: + name (string): string that distinguishes branches according to some criteria + (for example the cone size). + By default set to "1" + head_cone (DataHandle): container that represents the head of the cone. + charged_cone (DataHandle): container that represents the extra charged particles persisted from the event. + neutral_cone (DataHandle): container that represents the extra neutral particles persisted from the event. + cut (DataHandle): selection to relate head particles with extra particles + + Example: + import Functors as F + from FunTuple import FunTuple_Particles as Funtuple + from FunTuple.functorcollections import ParticleIsolation + from PyConf.Algorithms import WeightedRelTableAlg + from PyConf.reading import get_particles + + branches = {"B": "[B0 -> ([J/psi(1S) -> tau+ mu-]CC)(K*(892)0 -> K+ pi-)]CC"} + + b2ksttaumu_data = get_particles(f"/Event/HLT2/{line}/Particles") + b_cciso_data = get_particles(f"/Event/HLT2/{line}/B_{tes_long_track_iso}/Particles") + b_nciso_data = get_particles(f"/Event/HLT2/{line}/B_{tes_neutrals_iso}/Particles") + + variables = FC.ConeIsolation(name="FixPV", head_cone=b2ksttaumu_data, charged_cone=b_cciso_data, neutral_cone=b_nciso_data, cut=F.SHARE_BPV()) + + tuple = Funtuple(name="MyTuple", + fields=branches, + variables=variables, + ...) + """ + cc_isoAlg = WeightedRelTableAlg( + ReferenceParticles=head_cone, InputCandidates=charged_cone, Cut=cut + ) + nc_isoAlg = WeightedRelTableAlg( + ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut + ) + #Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary + func_dict = {} + func_dict.update(FC.ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) + func_dict.update(FC.ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) + + return FunctorCollection(func_dict) def NeutralCaloInfo() -> FunctorCollection: """ -- GitLab From 7c3f2127a14f202ad000fc695aa3420b4b83aa5a Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 18:03:24 +0200 Subject: [PATCH 03/19] Fix linting --- Phys/FunTuple/python/FunTuple/functorcollections.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 290e9f076..11e375d5e 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -847,7 +847,7 @@ def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorC name (string): string that distinguishes branches according to some criteria (for example if the cone is made by charged or neutral particles). By default set to "CC" ("charged cone") - iso_rel_table (WeightedRelTableAlg): algorithm instance returning the required relations table + iso_rel_table (Algorithm): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles inside the cone itself. @@ -866,7 +866,7 @@ def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorC iso_rel_table = WeightedRelTableAlg( ReferenceParticles=b2ksttaumu_data, InputCandidates=b_cciso_data, - Cut=F.require_all(F.DR2()<1., ~F.FIND_IN_TREE()), #ask for cone geometry with max_coneangle = 1. and extra particles not belonging to the signal + Cut=F.require_all(F.DR2()<1., ~F.FIND_IN_TREE()), #requires cone geometry with max_coneangle = 1. and extra particles not belonging to the signal OutputLevel=INFO) variables = FC.ParticleIsolation(name="CC", iso_rel_table=iso_rel_table) @@ -945,7 +945,8 @@ def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataH fields=branches, variables=variables, ...) - """ + """ + #Prepare relation tables cc_isoAlg = WeightedRelTableAlg( ReferenceParticles=head_cone, InputCandidates=charged_cone, Cut=cut ) @@ -954,8 +955,8 @@ def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataH ) #Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary func_dict = {} - func_dict.update(FC.ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) - func_dict.update(FC.ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) + func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) + func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) return FunctorCollection(func_dict) -- GitLab From 0434eeecee47ad29aeaf4bfbd2fcf1e2ca96e070 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 18:11:04 +0200 Subject: [PATCH 04/19] Update names --- Phys/FunTuple/python/FunTuple/functorcollections.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 11e375d5e..d2c7a1321 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -40,7 +40,8 @@ __all__ = ( "MCPromptDecay", "MCReconstructible", "MCReconstructed", - "TrackIsolation", + "ParticleIsolation", + "ConeIsolation", "NeutralCaloInfo", "DecayTreeFitterResults", "ParticleID", -- GitLab From f6a1ce65a04c9c48a367d7d4dc1107d03b9334f2 Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Fri, 30 Jun 2023 16:11:37 +0000 Subject: [PATCH 05/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30702346 --- .../python/FunTuple/functorcollections.py | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index d2c7a1321..ac9a76614 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -839,7 +839,9 @@ def MCReconstructed( return FunctorCollection(func_dict) -def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorCollection: +def ParticleIsolation( + *, name: str = "CC", iso_rel_table: Algorithm +) -> FunctorCollection: """ Candidate-level collection of functors on track or neutral isolation, using information related to the particles inside the cone around a given reference particle. @@ -858,7 +860,7 @@ def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorC from FunTuple.functorcollections import ParticleIsolation from PyConf.Algorithms import WeightedRelTableAlg from PyConf.reading import get_particles - + branches = {"B": "[B0 -> ([J/psi(1S) -> tau+ mu-]CC)(K*(892)0 -> K+ pi-)]CC"} b2ksttaumu_data = get_particles(f"/Event/HLT2/{line}/Particles") @@ -913,7 +915,15 @@ def ParticleIsolation(*, name: str = "CC", iso_rel_table: Algorithm) -> FunctorC } return FunctorCollection(ParticleIsolationVariables) -def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataHandle, neutral_cone: DataHandle, cut: DataHandle) -> FunctorCollection: + +def ConeIsolation( + *, + name: str = "1", + head_cone: DataHandle, + charged_cone: DataHandle, + neutral_cone: DataHandle, + cut: DataHandle, +) -> FunctorCollection: """ Candidate-level collection of functors on track or neutral isolation, using information related to the particles inside the cone around a given reference particle. @@ -933,7 +943,7 @@ def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataH from FunTuple.functorcollections import ParticleIsolation from PyConf.Algorithms import WeightedRelTableAlg from PyConf.reading import get_particles - + branches = {"B": "[B0 -> ([J/psi(1S) -> tau+ mu-]CC)(K*(892)0 -> K+ pi-)]CC"} b2ksttaumu_data = get_particles(f"/Event/HLT2/{line}/Particles") @@ -947,20 +957,21 @@ def ConeIsolation(*, name: str = "1", head_cone: DataHandle, charged_cone: DataH variables=variables, ...) """ - #Prepare relation tables + # Prepare relation tables cc_isoAlg = WeightedRelTableAlg( ReferenceParticles=head_cone, InputCandidates=charged_cone, Cut=cut ) nc_isoAlg = WeightedRelTableAlg( ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut ) - #Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary + # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary func_dict = {} func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) - + return FunctorCollection(func_dict) + def NeutralCaloInfo() -> FunctorCollection: """ Candidate-level collection of functors on neutral calorimeter hypotheses information. -- GitLab From afb9a4d4f4d944df25497468674c22e689e4e54c Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 18:27:11 +0200 Subject: [PATCH 06/19] Try to fix ConeIsolation functorcollection --- Phys/FunTuple/python/FunTuple/functorcollections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index ac9a76614..69f2d688c 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -965,7 +965,10 @@ def ConeIsolation( ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut ) # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary - func_dict = {} + func_dict = {"CC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} + func_dict = {"CC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} + func_dict = {"NC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} + func_dict = {"NC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) -- GitLab From a9e1d2c5b639dde3d114a5cb846ca15529e5c19a Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 18:29:25 +0200 Subject: [PATCH 07/19] Fix branches --- Phys/FunTuple/python/FunTuple/functorcollections.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 69f2d688c..9911c3d42 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -965,10 +965,10 @@ def ConeIsolation( ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut ) # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary - func_dict = {"CC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} - func_dict = {"CC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} - func_dict = {"NC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} - func_dict = {"NC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} + func_dict = {"CC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), + "CC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), + "NC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), + "NC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) -- GitLab From 330fb104c3648dc630343dd5450536936aa84a14 Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Fri, 30 Jun 2023 16:29:58 +0000 Subject: [PATCH 08/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30702691 --- .../python/FunTuple/functorcollections.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 9911c3d42..e6d29adca 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -965,10 +965,20 @@ def ConeIsolation( ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut ) # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary - func_dict = {"CC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), - "CC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), - "NC_{name}_Max_PT": F.MAXCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations), - "NC_{name}_Min_PT": F.MINCONE(Functor=F.PT, Relations=cc_isoAlg.OutputRelations)} + func_dict = { + "CC_{name}_Max_PT": F.MAXCONE( + Functor=F.PT, Relations=cc_isoAlg.OutputRelations + ), + "CC_{name}_Min_PT": F.MINCONE( + Functor=F.PT, Relations=cc_isoAlg.OutputRelations + ), + "NC_{name}_Max_PT": F.MAXCONE( + Functor=F.PT, Relations=cc_isoAlg.OutputRelations + ), + "NC_{name}_Min_PT": F.MINCONE( + Functor=F.PT, Relations=cc_isoAlg.OutputRelations + ), + } func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) -- GitLab From 65416d39033c560051079fdae9b1027fbe5335cd Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Fri, 30 Jun 2023 18:32:28 +0200 Subject: [PATCH 09/19] Fix typo for rel table input --- Phys/FunTuple/python/FunTuple/functorcollections.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index e6d29adca..93db8cb9e 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -973,10 +973,10 @@ def ConeIsolation( Functor=F.PT, Relations=cc_isoAlg.OutputRelations ), "NC_{name}_Max_PT": F.MAXCONE( - Functor=F.PT, Relations=cc_isoAlg.OutputRelations + Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), "NC_{name}_Min_PT": F.MINCONE( - Functor=F.PT, Relations=cc_isoAlg.OutputRelations + Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), } func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) -- GitLab From 7bc6d3c14ae97585429c60dc265736c652b6c2be Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Sun, 2 Jul 2023 23:06:23 +0200 Subject: [PATCH 10/19] Fix merging of funct_dict --- Phys/FunTuple/python/FunTuple/functorcollections.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 93db8cb9e..ffa775acb 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -966,21 +966,21 @@ def ConeIsolation( ) # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary func_dict = { - "CC_{name}_Max_PT": F.MAXCONE( + f"HEAD_CC_{name}_Max_PT": F.MAXCONE( Functor=F.PT, Relations=cc_isoAlg.OutputRelations ), - "CC_{name}_Min_PT": F.MINCONE( + f"HEAD_CC_{name}_Min_PT": F.MINCONE( Functor=F.PT, Relations=cc_isoAlg.OutputRelations ), - "NC_{name}_Max_PT": F.MAXCONE( + f"HEAD_NC_{name}_Max_PT": F.MAXCONE( Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), - "NC_{name}_Min_PT": F.MINCONE( + f"HEAD_NC_{name}_Min_PT": F.MINCONE( Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), } - func_dict.update(ParticleIsolation(name=f"_CC_{name}", iso_rel_table=cc_isoAlg)) - func_dict.update(ParticleIsolation(name=f"_NC_{name}", iso_rel_table=nc_isoAlg)) + func_dict.update(ParticleIsolation(name=f"CC_{name}", iso_rel_table=cc_isoAlg).functor_dict) + func_dict.update(ParticleIsolation(name=f"NC_{name}", iso_rel_table=nc_isoAlg).functor_dict) return FunctorCollection(func_dict) -- GitLab From c7f5949b58dd6141f0ddeb873031dfb7eed3d454 Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Sun, 2 Jul 2023 21:06:59 +0000 Subject: [PATCH 11/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30726736 --- Phys/FunTuple/python/FunTuple/functorcollections.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index ffa775acb..2990f1cce 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -979,8 +979,12 @@ def ConeIsolation( Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), } - func_dict.update(ParticleIsolation(name=f"CC_{name}", iso_rel_table=cc_isoAlg).functor_dict) - func_dict.update(ParticleIsolation(name=f"NC_{name}", iso_rel_table=nc_isoAlg).functor_dict) + func_dict.update( + ParticleIsolation(name=f"CC_{name}", iso_rel_table=cc_isoAlg).functor_dict + ) + func_dict.update( + ParticleIsolation(name=f"NC_{name}", iso_rel_table=nc_isoAlg).functor_dict + ) return FunctorCollection(func_dict) -- GitLab From 2976fbe5927305b7c70e5002805c0bc663f3ee69 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Mon, 3 Jul 2023 12:01:40 +0200 Subject: [PATCH 12/19] Set null string to default --- .../python/FunTuple/functorcollections.py | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 2990f1cce..48f4bae11 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -849,7 +849,7 @@ def ParticleIsolation( Args: name (string): string that distinguishes branches according to some criteria (for example if the cone is made by charged or neutral particles). - By default set to "CC" ("charged cone") + By default set to "" iso_rel_table (Algorithm): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles inside the cone itself. @@ -897,21 +897,24 @@ def ParticleIsolation( # evaluate DELTA PHI between reference and related particles DELTA_PHI = F.ADJUST_ANGLE @ (REL_PHI - REF_PHI) + prefix = "HEAD" + if name: prefix += f"_{name}" + ParticleIsolationVariables = { - f"HEAD_{name}_CMULT": F.VALUE_OR(0) + f"{prefix}_CMULT": F.VALUE_OR(0) @ F.MAP_INPUT_SIZE(Relations=iso_rel_table.OutputRelations), - f"HEAD_{name}_CP": SUMCONE(F.P), - f"HEAD_{name}_CPT": SUMCONE(F.PT), - f"HEAD_{name}_CPX": SUMCONE(F.PX), - f"HEAD_{name}_CPY": SUMCONE(F.PY), - f"HEAD_{name}_CPZ": SUMCONE(F.PZ), - f"HEAD_{name}_PASY": ASYM(F.P), - f"HEAD_{name}_PTASY": ASYM(F.PT), - f"HEAD_{name}_PXASY": ASYM(F.PX), - f"HEAD_{name}_PYASY": ASYM(F.PY), - f"HEAD_{name}_PZASY": ASYM(F.PZ), - f"HEAD_{name}_DETA": F.MAP(DELTA_ETA()).bind(RELS(), F.FORWARDARGS), - f"HEAD_{name}_DPHI": F.MAP(DELTA_PHI()).bind(RELS(), F.FORWARDARGS), + f"{prefix}_CP": SUMCONE(F.P), + f"{prefix}_CPT": SUMCONE(F.PT), + f"{prefix}_CPX": SUMCONE(F.PX), + f"{prefix}_CPY": SUMCONE(F.PY), + f"{prefix}_CPZ": SUMCONE(F.PZ), + f"{prefix}_PASY": ASYM(F.P), + f"{prefix}_PTASY": ASYM(F.PT), + f"{prefix}_PXASY": ASYM(F.PX), + f"{prefix}_PYASY": ASYM(F.PY), + f"{prefix}_PZASY": ASYM(F.PZ), + f"{prefix}_DETA": F.MAP(DELTA_ETA()).bind(RELS(), F.FORWARDARGS), + f"{prefix}_DPHI": F.MAP(DELTA_PHI()).bind(RELS(), F.FORWARDARGS), } return FunctorCollection(ParticleIsolationVariables) @@ -931,7 +934,7 @@ def ConeIsolation( Args: name (string): string that distinguishes branches according to some criteria (for example the cone size). - By default set to "1" + By default set to "" head_cone (DataHandle): container that represents the head of the cone. charged_cone (DataHandle): container that represents the extra charged particles persisted from the event. neutral_cone (DataHandle): container that represents the extra neutral particles persisted from the event. @@ -964,26 +967,35 @@ def ConeIsolation( nc_isoAlg = WeightedRelTableAlg( ReferenceParticles=head_cone, InputCandidates=neutral_cone, Cut=cut ) - # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary + + cc_str = "CC" + nc_str = "NC" + if name: + cc_str += f"_{name}" + nc_str += f"_{name}" + + cc_prefix = "HEAD_"+cc_str + nc_prefix = "HEAD_"+nc_str + # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary func_dict = { - f"HEAD_CC_{name}_Max_PT": F.MAXCONE( + f"{cc_prefix}_Max_PT": F.MAXCONE( Functor=F.PT, Relations=cc_isoAlg.OutputRelations ), - f"HEAD_CC_{name}_Min_PT": F.MINCONE( + f"{cc_prefix}_Min_PT": F.MINCONE( Functor=F.PT, Relations=cc_isoAlg.OutputRelations ), - f"HEAD_NC_{name}_Max_PT": F.MAXCONE( + f"{nc_prefix}_Max_PT": F.MAXCONE( Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), - f"HEAD_NC_{name}_Min_PT": F.MINCONE( + f"{nc_prefix}_Min_PT": F.MINCONE( Functor=F.PT, Relations=nc_isoAlg.OutputRelations ), } func_dict.update( - ParticleIsolation(name=f"CC_{name}", iso_rel_table=cc_isoAlg).functor_dict + ParticleIsolation(name=f"{cc_str}", iso_rel_table=cc_isoAlg).functor_dict ) func_dict.update( - ParticleIsolation(name=f"NC_{name}", iso_rel_table=nc_isoAlg).functor_dict + ParticleIsolation(name=f"{nc_str}", iso_rel_table=nc_isoAlg).functor_dict ) return FunctorCollection(func_dict) -- GitLab From 84941ebc28a7ae4efa12566d865271c9fff97b14 Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Mon, 3 Jul 2023 10:02:32 +0000 Subject: [PATCH 13/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30739997 --- Phys/FunTuple/python/FunTuple/functorcollections.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 48f4bae11..3838541a4 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -898,8 +898,9 @@ def ParticleIsolation( DELTA_PHI = F.ADJUST_ANGLE @ (REL_PHI - REF_PHI) prefix = "HEAD" - if name: prefix += f"_{name}" - + if name: + prefix += f"_{name}" + ParticleIsolationVariables = { f"{prefix}_CMULT": F.VALUE_OR(0) @ F.MAP_INPUT_SIZE(Relations=iso_rel_table.OutputRelations), @@ -973,10 +974,10 @@ def ConeIsolation( if name: cc_str += f"_{name}" nc_str += f"_{name}" - - cc_prefix = "HEAD_"+cc_str - nc_prefix = "HEAD_"+nc_str - # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary + + cc_prefix = "HEAD_" + cc_str + nc_prefix = "HEAD_" + nc_str + # Invoke twice the ParticleIsolation functorcollection, once for neutral and once for charged particles, then add to the functor dictionary func_dict = { f"{cc_prefix}_Max_PT": F.MAXCONE( Functor=F.PT, Relations=cc_isoAlg.OutputRelations -- GitLab From 780516f2f42e717b054d88639d5f514b7b15db23 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Mon, 3 Jul 2023 18:12:18 +0200 Subject: [PATCH 14/19] Remove default argument --- Phys/FunTuple/python/FunTuple/functorcollections.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 3838541a4..f3198aba7 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -840,7 +840,7 @@ def MCReconstructed( def ParticleIsolation( - *, name: str = "CC", iso_rel_table: Algorithm + *, name: str = "", iso_rel_table: Algorithm ) -> FunctorCollection: """ Candidate-level collection of functors on track or neutral isolation, using information related to the particles @@ -922,7 +922,7 @@ def ParticleIsolation( def ConeIsolation( *, - name: str = "1", + name: str = "", head_cone: DataHandle, charged_cone: DataHandle, neutral_cone: DataHandle, -- GitLab From 68eb85c1b6c0f2da53b15e784b8d6ddca174f90e Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Mon, 3 Jul 2023 16:13:02 +0000 Subject: [PATCH 15/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30761763 --- Phys/FunTuple/python/FunTuple/functorcollections.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index f3198aba7..01afb891d 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -839,9 +839,7 @@ def MCReconstructed( return FunctorCollection(func_dict) -def ParticleIsolation( - *, name: str = "", iso_rel_table: Algorithm -) -> FunctorCollection: +def ParticleIsolation(*, name: str = "", iso_rel_table: Algorithm) -> FunctorCollection: """ Candidate-level collection of functors on track or neutral isolation, using information related to the particles inside the cone around a given reference particle. -- GitLab From 1c6b9cb4cc5d8142d70f8845e61accc886875c83 Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Tue, 4 Jul 2023 12:20:18 +0200 Subject: [PATCH 16/19] Try to improve docstrings --- .../python/FunTuple/functorcollections.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 01afb891d..0708c582a 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -839,18 +839,18 @@ def MCReconstructed( return FunctorCollection(func_dict) -def ParticleIsolation(*, name: str = "", iso_rel_table: Algorithm) -> FunctorCollection: +def ParticleIsolation(*, iso_rel_table: Algorithm, name: str = "") -> FunctorCollection: """ - Candidate-level collection of functors on track or neutral isolation, using information related to the particles - inside the cone around a given reference particle. + Candidate-level collection of functors on track or neutral isolation, using information from 'iso_rel_table' argument + relating two containers of particles, reference particles and extra particles (head particles of the cone and particles inside the cone). Args: - name (string): string that distinguishes branches according to some criteria - (for example if the cone is made by charged or neutral particles). + name (string, optional): string that helps in distinguishing variables according to some criteria + (for example if the isolation criteria are applied to charged or neutral particles). By default set to "" iso_rel_table (Algorithm): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) - to associated particles inside the cone itself. + to associated particles (inside the cone itself). Example: import Functors as F @@ -920,21 +920,22 @@ def ParticleIsolation(*, name: str = "", iso_rel_table: Algorithm) -> FunctorCol def ConeIsolation( *, - name: str = "", head_cone: DataHandle, charged_cone: DataHandle, neutral_cone: DataHandle, cut: DataHandle, + name: str = "", ) -> FunctorCollection: """ - Candidate-level collection of functors on track or neutral isolation, using information related to the particles - inside the cone around a given reference particle. + Candidate-level collection of functors on charged and neutral isolation, using information from relations between sets of particles + determined by a given criteria. Calculates the relations that 'head_cone' particle selection has with 'charged_cone' particle selection and + 'neutral_cone' particle selection, respectively. The cone isolation criteria are determined by the expression in the 'cut'. Args: - name (string): string that distinguishes branches according to some criteria - (for example the cone size). + name (string, optional): string that helps in distinguishing variables according to some criteria + (for example the cone size criteria). By default set to "" - head_cone (DataHandle): container that represents the head of the cone. + head_cone (DataHandle): container that represents the reference particles (head of the cone). charged_cone (DataHandle): container that represents the extra charged particles persisted from the event. neutral_cone (DataHandle): container that represents the extra neutral particles persisted from the event. cut (DataHandle): selection to relate head particles with extra particles -- GitLab From d053d32dde6bf3ddc1f9ed148cb86f30b84c733b Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Tue, 4 Jul 2023 10:21:29 +0000 Subject: [PATCH 17/19] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Analysis/-/jobs/30778093 --- Phys/FunTuple/python/FunTuple/functorcollections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index 0708c582a..c12c8e0e9 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -929,7 +929,7 @@ def ConeIsolation( """ Candidate-level collection of functors on charged and neutral isolation, using information from relations between sets of particles determined by a given criteria. Calculates the relations that 'head_cone' particle selection has with 'charged_cone' particle selection and - 'neutral_cone' particle selection, respectively. The cone isolation criteria are determined by the expression in the 'cut'. + 'neutral_cone' particle selection, respectively. The cone isolation criteria are determined by the expression in the 'cut'. Args: name (string, optional): string that helps in distinguishing variables according to some criteria -- GitLab From a7b4adb99646c32f8ff7662980fb816f39e4254f Mon Sep 17 00:00:00 2001 From: Tommaso Fulghesu <tommaso.fulghesu@cern.ch> Date: Tue, 4 Jul 2023 14:45:02 +0200 Subject: [PATCH 18/19] Apply @erodrigu's suggestions --- .../python/FunTuple/functorcollections.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index c12c8e0e9..e6c219313 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -841,16 +841,13 @@ def MCReconstructed( def ParticleIsolation(*, iso_rel_table: Algorithm, name: str = "") -> FunctorCollection: """ - Candidate-level collection of functors on track or neutral isolation, using information from 'iso_rel_table' argument - relating two containers of particles, reference particles and extra particles (head particles of the cone and particles inside the cone). + Candidate-level collection of functors on track or neutral isolation, using information from 'iso_rel_table' argument relating containers of reference and extra particle, namely head particles of the cone and particles inside the cone. Args: - name (string, optional): string that helps in distinguishing variables according to some criteria - (for example if the isolation criteria are applied to charged or neutral particles). - By default set to "" iso_rel_table (Algorithm): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles (inside the cone itself). + name (string, optional): string that helps in distinguishing variables according to some criteria (for example if the isolation criteria are applied to charged or neutral particles). By default set to "" Example: import Functors as F @@ -927,18 +924,14 @@ def ConeIsolation( name: str = "", ) -> FunctorCollection: """ - Candidate-level collection of functors on charged and neutral isolation, using information from relations between sets of particles - determined by a given criteria. Calculates the relations that 'head_cone' particle selection has with 'charged_cone' particle selection and - 'neutral_cone' particle selection, respectively. The cone isolation criteria are determined by the expression in the 'cut'. + Candidate-level collection of functors on charged and neutral isolation, using information from relations between sets of particles determined by a given criteria. Calculates the relations that 'head_cone' particle selection has with 'charged_cone' particle selection and 'neutral_cone' particle selection, respectively. The cone isolation criteria are determined by the expression in the 'cut'. Args: - name (string, optional): string that helps in distinguishing variables according to some criteria - (for example the cone size criteria). - By default set to "" head_cone (DataHandle): container that represents the reference particles (head of the cone). charged_cone (DataHandle): container that represents the extra charged particles persisted from the event. neutral_cone (DataHandle): container that represents the extra neutral particles persisted from the event. cut (DataHandle): selection to relate head particles with extra particles + name (string, optional): string that helps in distinguishing variables according to some criteria (for example the cone size criteria). By default set to "" Example: import Functors as F @@ -946,6 +939,7 @@ def ConeIsolation( from FunTuple.functorcollections import ParticleIsolation from PyConf.Algorithms import WeightedRelTableAlg from PyConf.reading import get_particles + from GaudiKernel.SystemOfUnits import GeV branches = {"B": "[B0 -> ([J/psi(1S) -> tau+ mu-]CC)(K*(892)0 -> K+ pi-)]CC"} @@ -953,7 +947,7 @@ def ConeIsolation( b_cciso_data = get_particles(f"/Event/HLT2/{line}/B_{tes_long_track_iso}/Particles") b_nciso_data = get_particles(f"/Event/HLT2/{line}/B_{tes_neutrals_iso}/Particles") - variables = FC.ConeIsolation(name="FixPV", head_cone=b2ksttaumu_data, charged_cone=b_cciso_data, neutral_cone=b_nciso_data, cut=F.SHARE_BPV()) + variables = FC.ConeIsolation(name="MassConst", head_cone=b2ksttaumu_data, charged_cone=b_cciso_data, neutral_cone=b_nciso_data, cut=((F.COMB_MASS-F.MASS@F.FORWARDARG0)<0.5*GeV) tuple = Funtuple(name="MyTuple", fields=branches, -- GitLab From afc4700f6ece36104ca9e25d4f8b82a7c50ac5c1 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues <eduardo.rodrigues@cern.ch> Date: Thu, 3 Aug 2023 17:56:44 +0200 Subject: [PATCH 19/19] Trivial update to docstrings. --- Phys/FunTuple/python/FunTuple/functorcollections.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Phys/FunTuple/python/FunTuple/functorcollections.py b/Phys/FunTuple/python/FunTuple/functorcollections.py index e6c219313..1cb23aff8 100644 --- a/Phys/FunTuple/python/FunTuple/functorcollections.py +++ b/Phys/FunTuple/python/FunTuple/functorcollections.py @@ -847,7 +847,9 @@ def ParticleIsolation(*, iso_rel_table: Algorithm, name: str = "") -> FunctorCol iso_rel_table (Algorithm): algorithm instance returning the required relations table that maps a reference particle (forming the head of the cone) to associated particles (inside the cone itself). - name (string, optional): string that helps in distinguishing variables according to some criteria (for example if the isolation criteria are applied to charged or neutral particles). By default set to "" + name (string, optional): string that helps in distinguishing variables + according to some criteria (for example if the isolation criteria are applied to charged or neutral particles). + Defaults to "". Example: import Functors as F @@ -931,7 +933,9 @@ def ConeIsolation( charged_cone (DataHandle): container that represents the extra charged particles persisted from the event. neutral_cone (DataHandle): container that represents the extra neutral particles persisted from the event. cut (DataHandle): selection to relate head particles with extra particles - name (string, optional): string that helps in distinguishing variables according to some criteria (for example the cone size criteria). By default set to "" + name (string, optional): string that helps in distinguishing variables + according to some criteria (for example the cone size criteria). + Defaults to "". Example: import Functors as F -- GitLab