From c74b9133b3ae4f7fb1b515ca01d18bf697b4b1c4 Mon Sep 17 00:00:00 2001
From: Aravindhan Venkateswaran <aravindhan.venkateswaran@cern.ch>
Date: Fri, 14 Jul 2023 10:09:17 +0200
Subject: [PATCH] Add B2STauTauInclusive

---
 .../StrippingB2STauTauInclusive.py            | 161 ++++++++++++++++++
 1 file changed, 161 insertions(+)
 create mode 100644 Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2STauTauInclusive.py

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2STauTauInclusive.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2STauTauInclusive.py
new file mode 100644
index 000000000..0fde2c71e
--- /dev/null
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2STauTauInclusive.py
@@ -0,0 +1,161 @@
+###############################################################################
+# (c) Copyright 2000-2019 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".   #
+#                                                                             #
+# In applying this licence, CERN does not waive the privileges and immunities #
+# granted to it by virtue of its status as an Intergovernmental Organization  #
+# or submit itself to any jurisdiction.                                       #
+###############################################################################
+__author__ = [' A. Venkateswaran']
+__date__ = '13/06/2023'
+__version__ = '$Revision: 0.1$'
+
+from GaudiKernel.SystemOfUnits import MeV
+
+from StandardParticles import StdNoPIDsKaons, StdNoPIDsPions
+
+from StrippingUtils.Utils import LineBuilder
+from StrippingConf.StrippingLine import StrippingLine
+from PhysSelPython.Wrappers import Selection, DataOnDemand, SimpleSelection
+from GaudiConfUtils.ConfigurableGenerators import DaVinci__N4BodyDecays, FilterDesktop
+
+__all__ = (
+    'default_config',
+    'B2STauTauInclusiveConf'
+)
+
+default_config = {
+    'NAME': 'B2STauTauInclusive',
+    'BUILDERTYPE': 'B2STauTauInclusiveConf',
+    'WGs': ['RD'],
+    'CONFIG': {
+        'SpdMult': '600',
+        #
+        'UsePID': True,
+        #
+        'FD_B_Max': 100,
+        'PT_B': 2000 * MeV,
+        'P_B': 10000 * MeV,
+        'FDCHI2_B': 16,
+        'FDCHI2_BK': 16,
+        'MASS_LOW_B': 1000 * MeV,
+        'MASS_LOW_BK': 3000 * MeV,
+        'MASS_HIGH_B': 7000 * MeV,
+        #
+        'VCHI2_Eta': 9,
+        'VCHI2_Rho': 9,
+        'VCHI2_K1': 9,
+        'PT_Rho': 800 * MeV,
+        'PT_K1': 800 * MeV,
+        'PT_K': 800 * MeV,
+        'PT_Etap': 800 * MeV,
+        'P_K': 3000 * MeV,
+        'IPCHI2_Tr': 16,
+        'TRACKCHI2_Tr': 6,
+        'TRGHOPROB_Tr': 0.5,
+        'MASS_LOW_Rho': 280 * MeV,
+        'MASS_HIGH_Rho': 1100 * MeV,
+        'MASS_LOW_K1': 400 * MeV,
+        'MASS_HIGH_K1': 1700 * MeV,
+        'MASS_LOW_Etap': 800 * MeV,
+        'MASS_HIGH_Etap': 1100 * MeV,
+        'MASS_HIGH_Tau': 1800 * MeV,
+        #
+        'B2STauTauInclusive_LinePrescale': 1,
+        'B2STauTauInclusive_LinePostscale': 1,
+        'RelInfoTools': [{"Type": "RelInfoVertexIsolation",
+                          "Location": "BVars_VertexIsoInfo",
+                          "DaughterLocations": {"[Beauty -> ^Hadron Hadron  l  l]CC": "H1_VertexIsoInfo",
+                                                "[Beauty -> Hadron ^Hadron  l  l]CC": "H2_VertexIsoInfo",
+                                                "[Beauty ->  Hadron Hadron ^l  l]CC": "Tau1_VertexIsoInfo",
+                                                "[Beauty ->  Hadron  Hadron l ^l]CC": "Tau2_VertexIsoInfo"
+                                                }},
+                         {"Type": "RelInfoConeIsolation",
+                          "ConeSize": 0.5,
+                          "Variables": [],
+                          "Location": "BVars_ConeIsoInfo",
+                          "DaughterLocations": {"[Beauty -> ^Hadron  Hadron l  l]CC": "H1_ConeIsoInfo",
+                                                "[Beauty -> Hadron  ^Hadron l  l]CC": "H2_ConeIsoInfo",
+                                                "[Beauty ->  Hadron Hadron ^l  l]CC": "Tau1_ConeIsoInfo",
+                                                "[Beauty ->  Hadron  Hadron l ^l]CC": "Tau2_ConeIsoInfo"
+                                                }}
+                         ]
+    },
+    'STREAMS': ['Bhadron']
+}
+
+
+class B2STauTauInclusiveConf(LineBuilder):
+
+    __configuration_keys__ = default_config['CONFIG'].keys()
+
+    def __init__(self, name, config):
+
+        LineBuilder.__init__(self, name, config)
+        self.FilterSPD = {
+            'Code':
+            " ( recSummary(LHCb.RecSummary.nSPDhits,'Raw/Spd/Digits') < %(SpdMult)s )"
+            % config,
+            'Preambulo': [
+                "from LoKiNumbers.decorators import *",
+                "from LoKiCore.basic import LHCb"
+            ]
+        }
+
+        trackCuts = "(MIPCHI2DV(PRIMARY) > %(IPCHI2_Tr)s) & (TRCHI2DOF < %(TRACKCHI2_Tr)s) & (TRGHOSTPROB < %(TRGHOPROB_Tr)s)" % config
+
+        self.selKaons = SimpleSelection(
+            "Kaons_" + name, FilterDesktop, [StdNoPIDsKaons], Code=trackCuts)
+
+        self.selPions = SimpleSelection(
+            "Pions_" + name, FilterDesktop, [StdNoPIDsPions], Code=trackCuts)
+
+        TauCuts = "(M < %(MASS_HIGH_Tau)s)" % config
+
+        self.rawTau = DataOnDemand("Phys/StdTightDetachedTau3pi/Particles")
+
+        self.selTau = SimpleSelection(
+            "Tau" + name, FilterDesktop, [self.rawTau], Code=TauCuts)
+
+        self.B2hhTauTau = self._makeB2hhTauTau(
+            name, self.selKaons, self.selPions, self.selTau, config)
+
+        self.B2hhTauTau_Line = self._makeLine(
+            "B2hhTauTauLine", self.B2hhTauTau, config)
+
+    def _makeB2hhTauTau(self, name, pionSel, kaonSel, TauSel, config):
+
+        combcut = "in_range ( %(MASS_LOW_B)s, AM, %(MASS_HIGH_B)s )" % config
+        mothercut = "( BPVVDCHI2 > %(FDCHI2_B)s ) & ( BPVVD < %(FD_B_Max)s ) " % config
+        mothercut += " & (PT > %(PT_B)s) & (P > %(P_B)s) " % config
+
+        Combine = DaVinci__N4BodyDecays(
+            DecayDescriptors=["[B0 -> K+ pi- tau+ tau-]cc"],
+            Combination12Cut="AM < 4000",
+            Combination123Cut="AM < 6000",
+            CombinationCut=combcut,
+            MotherCut=mothercut)
+
+        return Selection("B2STauTauInclusiveLine_TauTau",
+                         Algorithm=Combine,
+                         RequiredSelections=[kaonSel,
+                                             pionSel,
+                                             TauSel])
+
+    # Helpers to make lines
+
+    def _makeLine(self, name, sel, config):
+
+        line = StrippingLine(
+            name,
+            prescale=config['B2STauTauInclusive_LinePrescale'],
+            postscale=config['B2STauTauInclusive_LinePostscale'],
+            MDSTFlag=True,
+            FILTER=self.FilterSPD,
+            RelatedInfoTools=config['RelInfoTools'],
+            selection=sel,
+            MaxCandidates=50)
+        self.registerLine(line)
+        return line
-- 
GitLab