From 2da8719f7bda86b8625ac842f638eba18e511e62 Mon Sep 17 00:00:00 2001
From: Mark Smith <mark.smith@cern.ch>
Date: Thu, 12 Oct 2023 13:10:27 +0200
Subject: [PATCH] DsstGamma line

---
 .../StrippingBeauty2XGammaExclusive.py        | 116 +++++++++++++++++-
 1 file changed, 114 insertions(+), 2 deletions(-)

diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingBeauty2XGammaExclusive.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingBeauty2XGammaExclusive.py
index 7c295da76..78dbaa964 100644
--- a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingBeauty2XGammaExclusive.py
+++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingBeauty2XGammaExclusive.py
@@ -21,7 +21,7 @@ __author__ = ['Fatima Soomro', 'Albert Puig', 'Pablo Ruiz Valls', 'Luis Miguel G
 __date__ = '09/11/2016'
 __version__ = '$Revision: 2.0 $'
 
-__all__ = ('StrippingB2XGammaConf', 'makePhoton', 'makePhi2KK', 'makeKstar', 'makeBs2PhiGamma', 'makeBd2KstGamma', 'default_config')
+__all__ = ('StrippingB2XGammaConf', 'makePhoton', 'makePhi2KK', 'makeKstar', 'makeDs2KKPi', 'makeDsst2DsGamma', 'makeBs2PhiGamma', 'makeBd2KstGamma', 'makeBp2DsstGamma', 'default_config')
 
 from Gaudi.Configuration import *
 from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles
@@ -41,13 +41,21 @@ default_config = {
           
           ,'PhiMassWin'          : 15.       # MeV
           ,'KstMassWin'          : 100.      # MeV  was(150)
+          ,'DsMassWin'           : 60.     # MeV
+          ,'DsstMassMin'         : 1962.     # MeV
+          ,'DsstMassMax'         : 2262.     # MeV
           ,'PhiVCHI2'            : 9.       # dimensionless
           ,'KstVCHI2'            : 9.       # dimensionless
+          ,'DsVCHI2'             : 5.       # dimensionless
           ,'BdDIRA'			 	 : 60e-3      # rad
 
           ,'photonPT'            : 2500.     # MeV
+          ,'Bp2DsstGammaPhotonPT' : 2000.   # MeV
+          ,'DsstGammaConeCut'    : 0.45     # dimensionless
+          ,'DsstGammaCL'         : 0.4      # dimensionless
 
-          ,'B_PT'                : 2000.     # MeV (was 3000)  
+          ,'B_PT'                : 2000.     # MeV (was 3000)
+          ,'Bs_PT'                : 4000.     # MeV (was 3000)
           ,'SumVec_PT'			 : 1500.	#MeV (was 1500)
           ,'MinTrack_PT'         : 500.		#MeV
           ,'MinTrack_P'          : 3000.    #MeV
@@ -55,8 +63,12 @@ default_config = {
           
           ,'BMassMin'            : 4000.     # MeV
           ,'BMassMax'           : 7000.     # MeV
+          ,'BpMassMin'          : 4500.     #MeV
+          ,'BpMassMax'          : 6000.     #MeV
           ,'BsPVIPchi2'          : 9.       # Dimensionless
+          ,'BpDsPVIPchi2'          : 9.       # Dimensionless
           ,'B0PVIPchi2'          : 9.       # Dimensionless
+          ,'DsstVTXchi2'        : 9.        # Dimensionless
           ,'BsVTXchi2'          : 9.       # Dimensionless
           ,'B0VTXchi2'          : 9.       # Dimensionless
           ,'GhostProb_Max'		: 0.4		# Dimensionless
@@ -125,6 +137,24 @@ class Beauty2XGammaExclusiveConf(LineBuilder):
                                 config['SumVec_PT'],
                                 config['MinTrack_PT'],
                                 config['MinTrack_P'])
+        self.selDs = makeDs2KKPi('DsSel' + self.name,
+                                 config['TrIPchi2'],
+                                 config['TrChi2'],
+                                 config['DsMassWin'],
+                                 config['DsVCHI2'],
+                                 config['GhostProb_Max'],
+                                 config['SumVec_PT'],
+                                 config['MinTrack_PT'],
+                                 config['MinTrack_P']                                 
+        )
+        self.selDsst = makeDsst2DsGamma('Dsst2DsGamaSel' + self.name,
+                                        self.selDs,
+                                        config['DsstMassMin'],
+                                        config['DsstMassMax'],
+                                        config['DsVCHI2'],
+                                        config['DsstGammaConeCut'],
+                                        config['DsstGammaCL']
+        )
         # Bs->Phi Gamma selections
         self.selBs2PhiGamma = makeBs2PhiGamma(self.name + 'Bs2PhiGamma',
                                               self.selPhi2KK,
@@ -146,6 +176,15 @@ class Beauty2XGammaExclusiveConf(LineBuilder):
                                               config['B_PT'],
                                               config['B_APT'],
                                               config['BdDIRA'])
+        # Bs->Dsst Gamma selection
+        self.selBp2DsstGamma = makeBp2DsstGamma(self.name + 'Bp2DsstGamma',
+                                                self.selDsst,
+                                                config['BpMassMin'],
+                                                config['BpMassMax'],
+                                                config['BsVTXchi2'],
+                                                config['BpDsPVIPchi2'],
+                                                config['Bs_PT'],
+                                                config['Bp2DsstGammaPhotonPT'])
         # Stripping lines
         self.Bs2PhiGammaLine = StrippingLine(self.name + 'Bs2PhiGammaLine',
                                              prescale=config['Bs2PhiGammaPreScale'],
@@ -162,6 +201,13 @@ class Beauty2XGammaExclusiveConf(LineBuilder):
                                              EnableFlavourTagging = True,
                                              selection=self.selBd2KstGamma)
         self.registerLine(self.Bd2KstGammaLine)
+
+        self.Bp2DsstGammaLine = StrippingLine(self.name + 'Bp2DsstGammaLine',
+                                              prescale=1.,
+                                              postscale=1.,
+                                              EnableFlavourTagging = False,
+                                              selection=self.selBp2DsstGamma)
+        self.registerLine(self.Bp2DsstGammaLine)
         
 def makePhoton(name, photonPT):
     """Create photon Selection object starting from DataOnDemand 'Phys/StdLooseAllPhotons'.
@@ -184,6 +230,7 @@ def makePhoton(name, photonPT):
     _stdGamma = StdLooseAllPhotons
     return Selection(name, Algorithm=_gammaFilter, RequiredSelections=[_stdGamma])
 
+
 def makePhi2KK(name, TrIPchi2Phi, TrChi2, PhiMassWin, PhiVCHI2, GhostProb_Max, SumVec_PT, MinTrack_PT, MinTrack_P) :
     """
     Create and return a Phi->KK Selection object, starting from DataOnDemand 'Phys/StdLoosePhi2KK'.
@@ -226,6 +273,71 @@ def makeKstar(name, TrIPchi2Kst, TrChi2, KstMassWin, KstVCHI2, GhostProb_Max, Su
     _stdKst2Kpi = DataOnDemand(Location="Phys/StdVeryLooseDetachedKst2Kpi/Particles")
     return Selection(name, Algorithm=_kstFilter, RequiredSelections=[_stdKst2Kpi])
 
+
+def makeDs2KKPi(name, TrIPchi2Ds, TrChi2, DsMassWin, DsVCHI2, GhostProb_Max, SumVec_PT, MinTrack_PT, MinTrack_P) :
+    """
+    Create and return a Ds->KKpi Selection object, starting from DataOnDemand 'Phys/StdLooseDsplus2KKPi'.
+    
+    @arg name: name of the Selection.
+    @arg TrIPchi2Ds: tracks IP chi2
+    @arg TrChi2: tracks chi2
+    @arg DsMassWin: Ds mass window
+    @arg DsVCHI2: vertex chi2 of the Ds
+    
+    @return: Selection object
+    
+    """
+    _preambulo = ["goodTrack = ((MIPCHI2DV(PRIMARY) > %(TrIPchi2Ds)s) & (TRCHI2DOF < %(TrChi2)s) & (MAXTREE(TRGHOSTPROB, HASTRACK) < %(GhostProb_Max)s) & (P > %(MinTrack_P)s) & (PT > %(MinTrack_PT)s))" % locals(),
+                  "goodDs = (((VFASPF(VCHI2/VDOF) < %(DsVCHI2)s)) & (ADMASS('D_s+') < %(DsMassWin)s*MeV) & (SUMTREE(PT, ISBASIC, 0.0) > %(SumVec_PT)s))" % locals()]
+    _code = "goodDs & CHILDCUT( goodTrack , 1 ) & CHILDCUT( goodTrack , 2 ) & CHILDCUT( goodTrack , 3 )"
+    _dsFilter = FilterDesktop(Preambulo=_preambulo, Code=_code)
+    _stdDs2KKpi = DataOnDemand(Location="Phys/StdLooseDsplus2KKPi/Particles")
+    return Selection(name, Algorithm=_dsFilter, RequiredSelections=[_stdDs2KKpi])
+
+
+def makeDsst2DsGamma(name, DsSel, DsstMassMin, DsstMassMax, DsstVTXchi2, DsstGammaConeCut, DsstGammaCL) :
+    """
+    Create and return a Ds*->Ds gamma Selection object, using photons from Phys/StdVeryLooseAllPhotons.
+    
+    @arg name: name of the Selection.
+    @arg DsstMassMin: Dsst mass min
+    @arg DsstMassMax: Dsst mass max
+    @arg DsstVCHI2: vertex chi2 of the Ds*
+    @return: Selection object
+    
+    """
+    _gammaForDsst = DataOnDemand(Location="Phys/StdVeryLooseAllPhotons/Particles")
+    _gammaForDsstFilter = FilterDesktop(Code = "(CL>%(DsstGammaCL)s)" % locals())
+    _gammaForDsstSelection = Selection(name+'GammaSel', Algorithm = _gammaForDsstFilter, RequiredSelections=[_gammaForDsst])
+    _combinationCut = "((AM > %(DsstMassMin)s) & (AM < %(DsstMassMax)s) & (abs(ACHILD(PHI, 1) - ACHILD(PHI, 2))<%(DsstGammaConeCut)s) &  (abs(ACHILD(ETA, 1) - ACHILD(ETA, 2))<%(DsstGammaConeCut)s) )" % locals()
+    _motherCut = "(VFASPF(VCHI2/VDOF) <%(DsstVTXchi2)s) & (M > %(DsstMassMin)s) & (M < %(DsstMassMax)s)" % locals()
+    _Dsst = CombineParticles(DecayDescriptor="[D*_s+ -> D_s+ gamma]cc",
+                             CombinationCut=_combinationCut,
+                             MotherCut=_motherCut,
+                             ReFitPVs=False)
+    return Selection(name, Algorithm=_Dsst, RequiredSelections = [_gammaForDsstSelection, DsSel])
+
+def makeBp2DsstGamma(name, DsstSel, BpMassMin, BpMassMax, BsVTXchi2, BpDsPVIPchi2, BPT, photonPT) :
+    """
+    Create and return a Ds*->Ds gamma Selection object, using photons from Phys/StdVeryLooseAllPhotons.
+    
+    @arg name: name of the Selection.
+    @arg DsstMassWin: Ds mass window
+    
+    @return: Selection object
+    
+    """
+    _gammaForBs = makePhoton('B2DsGammaPhotonSel' + name,photonPT)
+    _combinationCut = "((AM > %(BpMassMin)s) & (AM < %(BpMassMax)s))" % locals()
+    _motherCut = "(VFASPF(VCHI2/VDOF) <%(BsVTXchi2)s) & (M > %(BpMassMin)s) & (M < %(BpMassMax)s) & (BPVIPCHI2() < %(BpDsPVIPchi2)s) & (PT > %(BPT)s)" % locals()
+    _Dsst = CombineParticles(DecayDescriptor="[B+ -> D*_s+ gamma]cc",
+                             CombinationCut=_combinationCut,
+                             MotherCut=_motherCut,
+                             ReFitPVs=False)
+    return Selection(name, Algorithm=_Dsst, RequiredSelections = [_gammaForBs, DsstSel])
+
+
+
 def makeBs2PhiGamma(name, phiSel, gammaSel, BsVTXchi2, BsPVIPchi2, BMassMin, BMassMax, BPT, B_APT):
     """
     Create and return a Bs -> Phi Gamma Selection object, starting with the daughters' selections.
-- 
GitLab