From 36245f695a08f630cc8c1ff171ad299551544ea0 Mon Sep 17 00:00:00 2001
From: Martin Tat <martin.tat@cern.ch>
Date: Wed, 9 Oct 2024 10:36:21 +0200
Subject: [PATCH 1/3] Remove PID cuts on B0->hhll (bugfix)

---
 .../Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
index 61086c9a645..6eb2ee01591 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
@@ -285,6 +285,9 @@ BtoHHee = {
         "am_min": 0. * MeV,  #iddlM
         "am_max": 6_500. * MeV,  #5_500. * MeV,#iddlM
         "bpvvdchi2_min": 0.,  ##iddlM3Body
+    },
+    "rhos": {
+        "pi_pid": None,
     }
 }
 
@@ -310,6 +313,9 @@ BtoHHmumu = {
         "am_min": 0. * MeV,  #iddlM
         "am_max": 6_500 * MeV,  #5_500. * MeV,#iddlM
         #IsMuon #iddlM
+    },
+    "rhos": {
+        "pi_pid": None,
     }
 }
 
@@ -320,7 +326,7 @@ def Spruce_B0ToHpHmEE_line(name="SpruceRD_B0ToHpHmEE", prescale=1):
     pvs = make_pvs()
     dielectrons = rdbuilder_thor.make_rd_detached_dielectron(
         **BtoHHee["dielectrons"], opposite_sign=True)
-    rhos = rdbuilder_thor.make_rd_detached_rho0()
+    rhos = rdbuilder_thor.make_rd_detached_rho0(**BtoHHee["rhos"])
 
     B = b_to_xll_builders.make_rd_BToXll(
         dielectrons,
@@ -364,7 +370,7 @@ def Spruce_B0ToHpHmEE_SameSign_line(name="SpruceRD_B0ToHpHmEE_SameSign",
     pvs = make_pvs()
     dielectrons = rdbuilder_thor.make_rd_detached_dielectron(
         **BtoHHee["dielectrons"], opposite_sign=False)
-    rhos = rdbuilder_thor.make_rd_detached_rho0()
+    rhos = rdbuilder_thor.make_rd_detached_rho0(**BtoHHee["rhos"])
 
     B = b_to_xll_builders.make_rd_BToXll(
         dielectrons,
@@ -407,7 +413,7 @@ def Spruce_B0ToHpHmMuMu_line(name="SpruceRD_B0ToHpHmMuMu", prescale=1):
     pvs = make_pvs()
     dimuons = rdbuilder_thor.make_rd_detached_dimuon(
         **BtoHHmumu["dimuons"], same_sign=False)
-    rhos = rdbuilder_thor.make_rd_detached_rho0()
+    rhos = rdbuilder_thor.make_rd_detached_rho0(**BtoHHmumu["rhos"])
 
     B = b_to_xll_builders.make_rd_BToXll(
         dimuons,
@@ -451,7 +457,7 @@ def Spruce_B0ToHpHmMuMu_SameSign_line(name="SpruceRD_B0ToHpHmMuMu_SameSign",
     pvs = make_pvs()
     dimuons = rdbuilder_thor.make_rd_detached_dimuon(
         **BtoHHmumu["dimuons"], same_sign=True)
-    rhos = rdbuilder_thor.make_rd_detached_rho0()
+    rhos = rdbuilder_thor.make_rd_detached_rho0(**BtoHHmumu["rhos"])
 
     B = b_to_xll_builders.make_rd_BToXll(
         dimuons,
-- 
GitLab


From dc39b340f2c40dcfe4e7d47b36d53a054303ee53 Mon Sep 17 00:00:00 2001
From: Fionn Caitlin Ros Bishop <fionn.caitlin.ros.bishop@cern.ch>
Date: Wed, 23 Oct 2024 15:44:10 +0200
Subject: [PATCH 2/3] Adding converted Lb->Lgamma and B+->K*+gamma lines

---
 .../rd/b_to_xgamma_conv_exclusive_spruce.py   | 351 ++++++++++++++++--
 .../builders/baryonic_radiative_builders.py   |   3 +-
 .../lines/rd/builders/rdbuilder_thor.py       |  82 +++-
 3 files changed, 394 insertions(+), 42 deletions(-)

diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xgamma_conv_exclusive_spruce.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xgamma_conv_exclusive_spruce.py
index 84af558b58a..4e5d0d68ecb 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xgamma_conv_exclusive_spruce.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xgamma_conv_exclusive_spruce.py
@@ -19,6 +19,12 @@ PID-exclusive B -> XX gamma Hlt2 lines with converted gamma
 author: Fionn Bishop
 date: 05.02.24
 
+- L_b0 -> L gamma
+- B+ -> K*+ gamma
+
+author: Fionn Bishop
+date: 17.10.24
+
 '''
 from Moore.lines import SpruceLine
 from Moore.config import register_line_builder
@@ -32,11 +38,16 @@ from Hlt2Conf.lines.rd.builders.rd_prefilters import rd_prefilter
 from Hlt2Conf.algorithms_thor import ParticleFilter
 
 from Hlt2Conf.lines.rd.builders.rdbuilder_thor import (
-    make_rd_detached_kstar0s, make_rd_detached_phis, make_rd_detached_rho0)
+    make_rd_detached_kstar0s, make_rd_detached_phis, make_rd_detached_rho0,
+    make_rd_kstarp_DD, make_rd_kstarp_LL)
 
 from Hlt2Conf.lines.rd.builders.b_to_xgamma_exclusive_builders import (
     make_b2xgamma_excl, make_rd_detached_pK)
 
+from Hlt2Conf.lines.rd.builders.baryonic_radiative_builders import (
+    make_rd_lb_to_lgamma_LL, make_rd_lb_to_lgamma_DD,
+    filter_lambdasLL_for_lb_to_lg, filter_lambdasDD_for_lb_to_lg)
+
 from Hlt2Conf.lines.rd.builders.rad_incl_builder import (make_gamma_eeLL,
                                                          make_gamma_eeDD)
 
@@ -57,6 +68,24 @@ def make_rho0s_with_tighter_mass():
         name="rd_detached_rho0s_mass_btoxgamma_{hash}")
 
 
+def make_b2xgamma_conv_excl_spruce(
+        intermediate,
+        photons,
+        pvs,
+        descriptor,
+        name,
+):
+    return make_b2xgamma_excl(
+        intermediate=intermediate,
+        photons=photons,
+        pvs=pvs,
+        descriptor=descriptor,
+        dira_min=0.,
+        name=name,
+        bpv_fdchi2_min=16.,
+        vchi2pdof_max=25.)
+
+
 @register_line_builder(sprucing_lines)
 def spruce_bd_to_kpigamma_gammatoeeLL_line(
         name="SpruceRD_BdToKpPimGamma_GammaToEELL", persistreco=False,
@@ -67,14 +96,11 @@ def spruce_bd_to_kpigamma_gammatoeeLL_line(
 
     photons = make_gamma_eeLL(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=kpi,
         photons=photons,
         pvs=pvs,
         descriptor="[B0 -> K*(892)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BdToKpiGamma_GammaToEELL_Combiner_{hash}")
 
     return SpruceLine(
@@ -104,14 +130,11 @@ def spruce_bs_to_kkgamma_gammatoeeLL_line(
 
     photons = make_gamma_eeLL(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=kk,
         photons=photons,
         pvs=pvs,
         descriptor="[B_s0 -> phi(1020) gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BsToKKGamma_GammaToEELL_Combiner_{hash}")
 
     return SpruceLine(
@@ -134,14 +157,11 @@ def spruce_bd_to_pipigamma_gammatoeeLL_line(
 
     photons = make_gamma_eeLL(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=pipi,
         photons=photons,
         pvs=pvs,
         descriptor="[B0 -> rho(770)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BdTopipiGamma_GammaToEELL_Combiner_{hash}")
 
     return SpruceLine(
@@ -172,14 +192,11 @@ def spruce_lb_to_pkgamma_gammatoeeLL_line(
 
     photons = make_gamma_eeLL(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=pk,
         photons=photons,
         pvs=pvs,
         descriptor="[Lambda_b0 -> Lambda(1520)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_LbTopKGamma_GammaToEELL_Combiner_{hash}")
 
     return SpruceLine(
@@ -201,14 +218,11 @@ def spruce_bd_to_kpigamma_gammatoeeDD_line(
 
     photons = make_gamma_eeDD(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=kpi,
         photons=photons,
         pvs=pvs,
         descriptor="[B0 -> K*(892)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BdToKpiGamma_GammaToEEDD_Combiner_{hash}")
 
     return SpruceLine(
@@ -238,14 +252,11 @@ def spruce_bs_to_kkgamma_gammatoeeDD_line(
 
     photons = make_gamma_eeDD(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=kk,
         photons=photons,
         pvs=pvs,
         descriptor="[B_s0 -> phi(1020) gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BsToKKGamma_GammaToEEDD_Combiner_{hash}")
 
     return SpruceLine(
@@ -268,14 +279,11 @@ def spruce_bd_to_pipigamma_gammatoeeDD_line(
 
     photons = make_gamma_eeDD(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=pipi,
         photons=photons,
         pvs=pvs,
         descriptor="[B0 -> rho(770)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_BdTopipiGamma_GammaToEEDD_Combiner_{hash}")
 
     return SpruceLine(
@@ -306,14 +314,11 @@ def spruce_lb_to_pkgamma_gammatoeeDD_line(
 
     photons = make_gamma_eeDD(pvs)
 
-    b = make_b2xgamma_excl(
+    b = make_b2xgamma_conv_excl_spruce(
         intermediate=pk,
         photons=photons,
         pvs=pvs,
         descriptor="[Lambda_b0 -> Lambda(1520)0 gamma]cc",
-        dira_min=0.,
-        bpv_fdchi2_min=16.,
-        vchi2pdof_max=25.,
         name="rd_LbTopKGamma_GammaToEEDD_Combiner_{hash}")
 
     return SpruceLine(
@@ -323,3 +328,283 @@ def spruce_lb_to_pkgamma_gammatoeeDD_line(
         persistreco=persistreco,
         hlt2_filter_code=['Hlt2RD_BToHHGamma_GammaToEEDD_Incl_FullDecision'],
     )
+
+
+@register_line_builder(sprucing_lines)
+def lb_to_lgamma_ll_gammatoeedd_line(
+        name='SpruceRD_LbToLambdaGamma_LL_GammaToEEDD',
+        prescale=1.,
+        persistreco=False,
+        prefilter=rd_prefilter):
+
+    pvs = make_pvs()
+
+    lambda_ll = filter_lambdasLL_for_lb_to_lg(pvs=pvs)
+    photons = make_gamma_eeDD(pvs)
+
+    lb_ll = make_rd_lb_to_lgamma_LL(Lambda=lambda_ll, gamma=photons, pvs=pvs)
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [lb_ll],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def lb_to_lgamma_ll_gammatoeell_line(
+        name='SpruceRD_LbToLambdaGamma_LL_GammaToEELL',
+        prescale=1.,
+        persistreco=False,
+        prefilter=rd_prefilter):
+
+    pvs = make_pvs()
+
+    lambda_ll = filter_lambdasLL_for_lb_to_lg(pvs=pvs)
+    photons = make_gamma_eeLL(pvs)
+
+    lb_ll = make_rd_lb_to_lgamma_LL(Lambda=lambda_ll, gamma=photons, pvs=pvs)
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [lb_ll],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def lb_to_lgamma_dd_gammatoeedd_line(
+        name='SpruceRD_LbToLambdaGamma_DD_GammaToEEDD',
+        prescale=1.,
+        persistreco=False,
+        prefilter=rd_prefilter):
+
+    pvs = make_pvs()
+
+    lambda_dd = filter_lambdasDD_for_lb_to_lg(pvs=pvs)
+    photons = make_gamma_eeDD(pvs)
+
+    lb_dd = make_rd_lb_to_lgamma_DD(Lambda=lambda_dd, gamma=photons, pvs=pvs)
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [lb_dd],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def lb_to_lgamma_dd_gammatoeell_line(
+        name='SpruceRD_LbToLambdaGamma_DD_GammaToEELL',
+        prescale=1.,
+        persistreco=False,
+        prefilter=rd_prefilter):
+
+    pvs = make_pvs()
+
+    lambda_dd = filter_lambdasDD_for_lb_to_lg(pvs=pvs)
+    photons = make_gamma_eeLL(pvs)
+
+    lb_dd = make_rd_lb_to_lgamma_DD(Lambda=lambda_dd, gamma=photons, pvs=pvs)
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [lb_dd],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def spruce_bu_to_kstpgamma_kstptoksLLpi_gammatoeeLL_line(
+        name="SpruceRD_BuToKstpGamma_KstpToKSLLPi_GammaToEELL",
+        persistreco=False,
+        prescale=1.):
+
+    pvs = make_pvs()
+    kstp = make_rd_kstarp_LL()
+
+    photons = make_gamma_eeLL(pvs)
+
+    b = make_b2xgamma_conv_excl_spruce(
+        intermediate=kstp,
+        photons=photons,
+        pvs=pvs,
+        descriptor="[B+ -> K*(892)+ gamma]cc",
+        name="rd_BuToKstpGamma_KstpToKSLLPi_GammaToEELL_Combiner_{hash}")
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [kstp, b],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def spruce_bu_to_kstpgamma_kstptoksLLpi_gammatoeeDD_line(
+        name="SpruceRD_BuToKstpGamma_KstpToKSLLPi_GammaToEEDD",
+        persistreco=False,
+        prescale=1.):
+
+    pvs = make_pvs()
+    kstp = make_rd_kstarp_LL()
+
+    photons = make_gamma_eeDD(pvs)
+
+    b = make_b2xgamma_conv_excl_spruce(
+        intermediate=kstp,
+        photons=photons,
+        pvs=pvs,
+        descriptor="[B+ -> K*(892)+ gamma]cc",
+        name="rd_BuToKstpGamma_KstpToKSLLPi_GammaToEEDD_Combiner_{hash}")
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [kstp, b],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def spruce_bu_to_kstpgamma_kstptoksDDpi_gammatoeeLL_line(
+        name="SpruceRD_BuToKstpGamma_KstpToKSDDPi_GammaToEELL",
+        persistreco=False,
+        prescale=1.):
+
+    pvs = make_pvs()
+    kstp = make_rd_kstarp_DD()
+
+    photons = make_gamma_eeLL(pvs)
+
+    b = make_b2xgamma_conv_excl_spruce(
+        intermediate=kstp,
+        photons=photons,
+        pvs=pvs,
+        descriptor="[B+ -> K*(892)+ gamma]cc",
+        name="rd_BuToKstpGamma_KstpToKSDDPi_GammaToEELL_Combiner_{hash}")
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [kstp, b],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEELL_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
+
+
+@register_line_builder(sprucing_lines)
+def spruce_bu_to_kstpgamma_kstptoksDDpi_gammatoeeDD_line(
+        name="SpruceRD_BuToKstpGamma_KstpToKSDDPi_GammaToEEDD",
+        persistreco=False,
+        prescale=1.):
+
+    pvs = make_pvs()
+    kstp = make_rd_kstarp_DD()
+
+    photons = make_gamma_eeDD(pvs)
+
+    b = make_b2xgamma_conv_excl_spruce(
+        intermediate=kstp,
+        photons=photons,
+        pvs=pvs,
+        descriptor="[B+ -> K*(892)+ gamma]cc",
+        name="rd_BuToKstpGamma_KstpToKSDDPi_GammaToEEDD_Combiner_{hash}")
+
+    return SpruceLine(
+        name=name,
+        algs=rd_prefilter() + [kstp, b],
+        prescale=prescale,
+        persistreco=persistreco,
+        hlt2_filter_code=[
+            'Hlt2RD_BToHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2RD_BToHHHGamma_GammaToEEDD_Incl_FullDecision',
+            'Hlt2Topo2BodyDecision',
+            'Hlt2Topo3BodyDecision',
+            'Hlt2_InclDetDiElectronDecision',
+            'Hlt2_InclDetDiElectron_3BodyDecision',
+            'Hlt2_InclDetDiElectron_4BodyDecision',
+            'Hlt2_InclDetDiElectron_4Body_PionSSDecision',
+            'Hlt2_InclDetDiElectron_neutralDecision',
+        ],
+    )
diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/baryonic_radiative_builders.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/baryonic_radiative_builders.py
index af4ba215639..12543643c13 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/baryonic_radiative_builders.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/baryonic_radiative_builders.py
@@ -191,7 +191,7 @@ def filter_lambdasDD_for_lb_to_lg(
 def make_rd_lb_to_lgamma_LL(Lambda,
                             gamma,
                             pvs,
-                            name="make_rd_lb_to_lgamma_LL",
+                            name="make_rd_lb_to_lgamma_LL_{hash}",
                             Lb_UM=6119.6 * MeV,
                             Lb_LM=5119.6 * MeV,
                             Lb_PT_Min=1000 * MeV,
@@ -219,6 +219,7 @@ def make_rd_lb_to_lgamma_DD(
         Lambda,
         gamma,
         pvs,
+        name="make_rd_lb_to_lgamma_DD_{hash}",
         Lb_UM=6119.6 * MeV,
         Lb_LM=5119.6 * MeV,
         Lb_PT_Min=1500 * MeV,
diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py
index 89dcbe3038b..57bbf741386 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py
@@ -1,4 +1,3 @@
-##############################################################################
 # (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration           #
 #                                                                             #
 # This software is distributed under the terms of the GNU General Public      #
@@ -34,6 +33,7 @@ make_rd_lambda_dds - Lambda0 builder from downstream tracks
 
 -- Popular intermediate hadrons --
 make_rd_detached_kstar0s - K*->K+pi- builder
+make_rd_kstarp_{LL,DD} - K*+->KS0 pi+ builder
 make_rd_detached_phis - phi->K+K- builder
 make_rd_detached_rho0 - rho->pi+pi- builder
 make_rd_detached_etaprime - eta'->pi+pi-gamma builder
@@ -48,7 +48,7 @@ make_rd_{prompt,detached}_mue - mue (same- or opposite-sign) combination
 make_rd_tauons_hadronic_decay - tau->3pi builder
 make_rd_detached_dihadron - hh builder (same- or opposite-sign)
 """
-from GaudiKernel.SystemOfUnits import GeV, MeV, ps, micrometer
+from GaudiKernel.SystemOfUnits import GeV, MeV, ps, micrometer, mm
 from RecoConf.reconstruction_objects import make_pvs
 
 import Functors as F
@@ -520,7 +520,6 @@ def make_rd_ks0_dds(
         mass_window=64. * MeV,
         pi_p_min=2. * GeV,
         pi_pt_min=0.,  # has to be 0 !!!
-        #pi_ipchi2_min=4,
         adocachi2cut=30.,
         bpvvdchi2_min=4.,
         bpvltime_min=1. * ps,
@@ -530,11 +529,7 @@ def make_rd_ks0_dds(
     "StdLooseKsDD" cuts.
     '''
 
-    pions = make_pions(
-        p_min=pi_p_min,
-        pt_min=pi_pt_min,
-        #mipchi2dvprimary_min=pi_ipchi2_min,
-        pid=None)
+    pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, pid=None)
     descriptor = 'KS0 -> pi+ pi-'
     combination_code = F.require_all(
         F.ABS_DELTA_MASS("KS0") < mass_window_comb,
@@ -708,6 +703,77 @@ def make_Kstps_with_pi0s(
                             CompositeCut=vertex_code)
 
 
+@configurable
+def make_rd_kstarp_LL(name='rd_kstarp_LL_{hash}',
+                      make_pions=make_rd_detached_pions,
+                      make_ks=make_rd_ks0_lls,
+                      make_pvs=make_pvs,
+                      am_min=742 * MeV,
+                      am_max=1042 * MeV,
+                      pi_p_min=2 * GeV,
+                      pi_pt_min=500 * MeV,
+                      pi_mipchi2_min=16,
+                      adoca12_max=0.1 * mm,
+                      asumpt_min=1000 * MeV,
+                      bpvfdchi2_min=50,
+                      vchi2pdof_max=16):
+    '''
+    Build Kstarplus candidates.
+    '''
+    ks = make_ks()
+
+    pions = make_pions(
+        p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_mipchi2_min)
+    descriptor = '[K*(892)+ -> KS0 pi+]cc'
+    combination_code = F.require_all(
+        in_range(am_min - 10 * MeV, F.MASS, am_max + 10 * MeV),
+        F.SUM(F.PT) > asumpt_min, F.MAXSDOCACUT(adoca12_max))
+    pvs = make_pvs()
+    vertex_code = F.require_all(F.CHI2DOF < vchi2pdof_max,
+                                F.BPVFDCHI2(pvs) > bpvfdchi2_min,
+                                in_range(am_min, F.MASS, am_max))
+    return ParticleCombiner([ks, pions],
+                            name=name,
+                            DecayDescriptor=descriptor,
+                            CombinationCut=combination_code,
+                            CompositeCut=vertex_code)
+
+
+@configurable
+def make_rd_kstarp_DD(name='rd_kstarp_DD_{hash}',
+                      make_pions=make_rd_detached_pions,
+                      make_ks=make_rd_ks0_dds,
+                      make_pvs=make_pvs,
+                      am_min=742 * MeV,
+                      am_max=1042 * MeV,
+                      pi_p_min=2 * GeV,
+                      pi_pt_min=500 * MeV,
+                      pi_mipchi2_min=16,
+                      adoca12_max=0.1 * mm,
+                      asumpt_min=1000 * MeV,
+                      bpvfdchi2_min=50,
+                      vchi2pdof_max=16):
+    '''
+    Build Kstarplus candidates.
+    '''
+    ks = make_ks()
+    pions = make_pions(
+        p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_mipchi2_min)
+    descriptor = '[K*(892)+ -> KS0 pi+]cc'
+    combination_code = F.require_all(
+        in_range(am_min - 10 * MeV, F.MASS, am_max + 10 * MeV),
+        F.SUM(F.PT) > asumpt_min, F.MAXSDOCACUT(adoca12_max))
+    pvs = make_pvs()
+    vertex_code = F.require_all(F.CHI2DOF < vchi2pdof_max,
+                                F.BPVFDCHI2(pvs) > bpvfdchi2_min,
+                                in_range(am_min, F.MASS, am_max))
+    return ParticleCombiner([ks, pions],
+                            name=name,
+                            DecayDescriptor=descriptor,
+                            CombinationCut=combination_code,
+                            CompositeCut=vertex_code)
+
+
 @configurable
 def make_rd_detached_kstar0s(
         name="rd_detached_kstar0s_{hash}",
-- 
GitLab


From 3f23da907cba8d5e443ca596699d2fe4d2dd3f17 Mon Sep 17 00:00:00 2001
From: Martin Tat <martin.tat@cern.ch>
Date: Thu, 24 Oct 2024 09:10:37 +0200
Subject: [PATCH 3/3] Tightened B vertex chi2 cuts in three- and four-body IDDL
 spruce lines and...

---
 .../python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
index 6eb2ee01591..ebb8db6abc8 100644
--- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
+++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_xll_spruce_hhll.py
@@ -40,7 +40,7 @@ BtoHee = {
         "am_max": 7_000. * MeV,  #iddl NOT M
         "B_pt_min": 0. * MeV,
         "FDchi2_min": 10.,  #100.,#iddlM
-        "vchi2pdof_max": 30.,  #9., #iddlM
+        "vchi2pdof_max": 20.,  #9., #iddlM
         "bpvipchi2_max": 100_000.,  #16., #not in iddl, loosened
         "min_cosine": 0.9995,  #not in iddl
     },
@@ -70,7 +70,7 @@ BtoHmumu = {
         "am_max": 7_000. * MeV,  #iddl NOT M
         "B_pt_min": 0. * MeV,  #iddlM
         "FDchi2_min": 10.,  #36.,
-        "vchi2pdof_max": 30.,  #16.,#iddlM
+        "vchi2pdof_max": 20.,  #16.,#iddlM
         "bpvipchi2_max": 100_000.,  #5., #no cut in iddl, loosened
         "min_cosine": 0.9995,  #no cut in iddl, NOT M
     },
@@ -270,7 +270,7 @@ BtoHHee = {
         "am_max": 7_000. * MeV,  #iddl NOT M
         "B_pt_min": 0. * MeV,  #iddlM
         "FDchi2_min": 10.,  #100.,#iddlM
-        "vchi2pdof_max": 30.,  #9.,#iddlM
+        "vchi2pdof_max": 20.,  #9.,#iddlM
         "bpvipchi2_max": 100_000.,  #16.,# not in iddl, loosen cut
         "min_cosine": 0.9995,  #not in iddl, NOT M
     },
@@ -288,6 +288,7 @@ BtoHHee = {
     },
     "rhos": {
         "pi_pid": None,
+        "pi_ipchi2_min": 6.,
     }
 }
 
@@ -297,7 +298,7 @@ BtoHHmumu = {
         "am_max": 7_000. * MeV,  #iddl NOT M
         "B_pt_min": 0. * MeV,  #iddlM
         "FDchi2_min": 10.,  #36.,
-        "vchi2pdof_max": 30.,  #16.,#iddlM
+        "vchi2pdof_max": 20.,  #16.,#iddlM
         "bpvipchi2_max": 100_000.,  #5., #no cut in iddl, loosened
         "min_cosine": 0.9995,  #no cut in iddl, NOT M
     },
@@ -316,6 +317,7 @@ BtoHHmumu = {
     },
     "rhos": {
         "pi_pid": None,
+        "pi_ipchi2_min": 6.,
     }
 }
 
-- 
GitLab