From 5de38957a3d4e0cc65d75ae840471ad5e18a1712 Mon Sep 17 00:00:00 2001 From: Xingyu Tong <xtong@lxplus790.cern.ch> Date: Sat, 15 Jul 2023 17:13:41 +0200 Subject: [PATCH 1/3] Move StrippingB2ppbargamma and StrippingB2LambdapbargammaLines to RD WG --- .../StrippingB2LambdapbargammaLines.py | 467 ++++++++++++++++++ .../StrippingRD/StrippingB2ppbargamma.py | 215 ++++++++ 2 files changed, 682 insertions(+) create mode 100644 Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py create mode 100644 Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py new file mode 100644 index 000000000..34a1309aa --- /dev/null +++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py @@ -0,0 +1,467 @@ +############################################################################### +# (c) Copyright 2023 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. # +############################################################################### +""" +Module for construction of B- ->Lambda0 p~- gamma stripping Selections and StrippingLines. +Provides functions to build Lambda0->DD, Lambda0->LL, and Lambda0->LD selections. +Provides class B2LambdapbargammaLinesConf, which constructs the Selections and StrippingLines +given a configuration dictionary. +Exported symbols (use python help!): + - B2LambdapbargammaLinesConf +""" + +__author__ = ["Xingyu Tong"] +__date__ = '10/07/2023' +__version__ = '$Revision: 1.0 $' +__all__ = 'StrippingB2LambdapbargammaLinesConf' + +from Gaudi.Configuration import * +from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles +from PhysSelPython.Wrappers import Selection, DataOnDemand +from StrippingConf.StrippingLine import StrippingLine +from StrippingUtils.Utils import LineBuilder + +from StandardParticles import StdLooseProtons as Protons +from StandardParticles import StdLooseAllPhotons as Photons + +''' +2016: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.3700| 74| | 5.630| + |_StrippingSequenceStreamBhadron_ | 0.3700| 74| | 5.620| + |!StrippingB2LambdapbargammaDDLine | 0.0950| 19| 2.842| 3.515| + |!StrippingB2LambdapbargammaLLLine | 0.2300| 46| 3.609| 0.785| + |!StrippingB2LambdapbargammaLDLine | 0.0550| 11| 2.545| 0.611| + |!StrippingB2LambdapbargammaDDLine_TIMING | 0.0950| 19| 2.842| 0.045| + |!StrippingB2LambdapbargammaLLLine_TIMING | 0.2300| 46| 3.609| 0.049| + |!StrippingB2LambdapbargammaLDLine_TIMING | 0.0550| 11| 2.545| 0.033| +2017: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.4750| 95| | 6.796| + |_StrippingSequenceStreamBhadron_ | 0.4750| 95| | 6.787| + |!StrippingB2LambdapbargammaDDLine | 0.1700| 34| 2.971| 4.221| + |!StrippingB2LambdapbargammaLLLine | 0.2500| 50| 3.380| 1.016| + |!StrippingB2LambdapbargammaLDLine | 0.0600| 12| 2.833| 0.756| + |!StrippingB2LambdapbargammaDDLine_TIMING | 0.1700| 34| 2.971| 0.058| + |!StrippingB2LambdapbargammaLLLine_TIMING | 0.2500| 50| 3.380| 0.052| + |!StrippingB2LambdapbargammaLDLine_TIMING | 0.0600| 12| 2.833| 0.035| +2018: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.5200| 104| | 7.167| + |_StrippingSequenceStreamBhadron_ | 0.5200| 104| | 7.157| + |!StrippingB2LambdapbargammaDDLine | 0.1600| 32| 3.000| 4.449| + |!StrippingB2LambdapbargammaLLLine | 0.2950| 59| 3.085| 1.109| + |!StrippingB2LambdapbargammaLDLine | 0.0750| 15| 1.600| 0.774| + |!StrippingB2LambdapbargammaDDLine_TIMING | 0.1600| 32| 3.000| 0.061| + |!StrippingB2LambdapbargammaLLLine_TIMING | 0.2950| 59| 3.085| 0.057| + |!StrippingB2LambdapbargammaLDLine_TIMING | 0.0750| 15| 1.600| 0.045| +''' + +default_config = { + 'NAME': 'B2Lambdapbargamma', + 'WGs': ['BnoC'], + 'BUILDERTYPE': 'B2LambdapbargammaLinesConf', + 'CONFIG': {'Trk_Chi2': 4.0, + 'Trk_GhostProb': 0.4, + 'gamma_PT_MIN': 400.0, + 'gamma_CL_MIN': 0.25, + 'gamma_ISNOTE_MIN': -999.0, + 'ProtonP': 15000., # MeV + 'ProtonPT': 1000., # MeV + 'ProtonPIDp': 0., + 'ProtonDLLpK': 0., + 'Lambda_DD_MassWindow': 20.0, + 'Lambda_DD_VtxChi2': 9.0, + 'Lambda_DD_FDChi2': 50.0, + 'Lambda_DD_Pmin': 5000.0, + 'Lambda_LL_MassWindow': 20.0, + 'Lambda_LL_VtxChi2': 9.0, + 'Lambda_LD_MassWindow': 25.0, + 'Lambda_LD_VtxChi2': 16.0, + 'Lambda_LD_FDChi2': 50.0, + 'Lambda_LD_Pmin': 5000.0, + 'B0_Mlow': 779.0, + 'B0_Mhigh': 1921.0, + 'B0_APTmin': 1900.0, + 'B0_PTmin': 2000.0, + 'B0Daug_DD_maxDocaChi2': 5.0, + 'B0Daug_LL_maxDocaChi2': 5.0, + 'B0Daug_LD_maxDocaChi2': 5.0, + 'B0Daug_DD_PTsum': 4000.0, + 'B0Daug_LL_PTsum': 4000.0, + 'B0Daug_LD_PTsum': 4000.0, + 'B0_VtxChi2': 16.0, + 'B0_Dira': 0.9990, + 'B0_DD_IPCHI2wrtPV': 16.0, + 'B0_LL_IPCHI2wrtPV': 16.0, + 'B0_LD_IPCHI2wrtPV': 16.0, + 'B0_FDwrtPV': 0.8, + 'B0_DD_FDChi2': 25, + 'B0_LL_FDChi2': 25, + 'B0_LD_FDChi2': 25, + 'GEC_MaxTracks': 250, + 'Prescale': 1.0, + 'Postscale': 1.0, + 'RelatedInfoTools': [{"Type": "RelInfoConeVariables", + "ConeAngle": 1.7, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar17' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 1.5, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar15' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 1.0, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar10' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 0.8, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar08' + }, + {"Type": "RelInfoVertexIsolation", + "Location": "VtxIsolationVar" + } + ] + }, + 'STREAMS': ['Bhadron'] +} + + +class B2LambdapbargammaLinesConf(LineBuilder): + + __configuration_keys__ = default_config['CONFIG'].keys() + + def __init__(self, name, config): + + LineBuilder.__init__(self, name, config) + + GECCode = {'Code': "(recSummaryTrack(LHCb.RecSummary.nLongTracks, TrLONG) < %s)" % config['GEC_MaxTracks'], + 'Preambulo': ["from LoKiTracks.decorators import *"]} + + self.protons = Protons + self.photons = Photons + + self.makeLambda2DD('Lambda0DD', config) + self.makeLambda2LL('Lambda0LL', config) + self.makeLambda2LD('Lambda0LD', config) + + namesSelections = [(name + 'DD', self.makeB2LambdapbargammaDD(name + 'DD', config)), + (name + 'LL', self.makeB2LambdapbargammaLL(name + 'LL', config)), + (name + 'LD', self.makeB2LambdapbargammaLD(name + 'LD', config)), + ] + + # make lines + + for selName, sel in namesSelections: + + extra = {} + + line = StrippingLine(selName + 'Line', + selection=sel, + prescale=config['Prescale'], + postscale=config['Postscale'], + RelatedInfoTools=config['RelatedInfoTools'], + FILTER=GECCode, + **extra) + + self.registerLine(line) + + def makeLambda2DD(self, name, config): + # define all the cuts + _massCut = "(ADMASS('Lambda0')<%s*MeV)" % config['Lambda_DD_MassWindow'] + _vtxCut = "(VFASPF(VCHI2)<%s) " % config['Lambda_DD_VtxChi2'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['Lambda_DD_FDChi2'] + _momCut = "(P>%s*MeV)" % config['Lambda_DD_Pmin'] + + _allCuts = _momCut + _allCuts += '&'+_massCut + _allCuts += '&'+_vtxCut + _allCuts += '&'+_fdChi2Cut + + # get the Lambda0's to filter + _stdLambdaDD = DataOnDemand(Location="Phys/StdLooseLambdaDD/Particles") + + # make the filter + _filterLambdaDD = FilterDesktop(Code=_allCuts) + + # make and store the Selection object + self.selLambda2DD = Selection( + name, Algorithm=_filterLambdaDD, RequiredSelections=[_stdLambdaDD]) + + return self.selLambda2DD + + def makeLambda2LL(self, name, config): + # define all the cuts + _massCut = "(ADMASS('Lambda0')<%s*MeV)" % config['Lambda_LL_MassWindow'] + _vtxCut = "(VFASPF(VCHI2)<%s)" % config['Lambda_LL_VtxChi2'] + _trkChi2Cut1 = "(CHILDCUT((TRCHI2DOF<%s),1))" % config['Trk_Chi2'] + _trkChi2Cut2 = "(CHILDCUT((TRCHI2DOF<%s),2))" % config['Trk_Chi2'] + _trkGhostProbCut1 = "(CHILDCUT((TRGHOSTPROB<%s),1))" % config['Trk_GhostProb'] + _trkGhostProbCut2 = "(CHILDCUT((TRGHOSTPROB<%s),2))" % config['Trk_GhostProb'] + + _allCuts = _massCut + _allCuts += '&'+_trkChi2Cut1 + _allCuts += '&'+_trkChi2Cut2 + _allCuts += '&'+_vtxCut + _allCuts += '&'+_trkGhostProbCut1 + _allCuts += '&'+_trkGhostProbCut2 + + # get the Lambda's to filter + _stdLambdaLL = DataOnDemand( + Location="Phys/StdVeryLooseLambdaLL/Particles") + + # make the filter + _filterLambdaLL = FilterDesktop(Code=_allCuts) + + # make and store the Selection object + self.selLambda2LL = Selection( + name, Algorithm=_filterLambdaLL, RequiredSelections=[_stdLambdaLL]) + + return self.selLambda2LL + + def makeLambda2LD(self, name, config): + # define all the cuts + _massCut = "(ADMASS('Lambda0')<%s*MeV)" % config['Lambda_LD_MassWindow'] + _vtxCut = "(VFASPF(VCHI2)<%s) " % config['Lambda_LD_VtxChi2'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['Lambda_LD_FDChi2'] + _momCut = "(P>%s*MeV)" % config['Lambda_LD_Pmin'] + + _allCuts = _momCut + _allCuts += '&'+_massCut + _allCuts += '&'+_vtxCut + _allCuts += '&'+_fdChi2Cut + + # get the Lambda0's to filter + _stdLambdaLD = DataOnDemand(Location="Phys/StdLooseLambdaLD/Particles") + + # make the filter + _filterLambdaLD = FilterDesktop(Code=_allCuts) + + # make and store the Selection object + self.selLambda2LD = Selection( + name, Algorithm=_filterLambdaLD, RequiredSelections=[_stdLambdaLD]) + + return self.selLambda2LD + + def makeB2LambdapbargammaDD(self, name, config): + """ + Create and store a B- ->Lambda0(DD) p~- gamma Selection object. + Arguments: + name : name of the Selection. + config : config dictionary + """ + + _gammacut = "(PT > %s*MeV)" % config['gamma_PT_MIN'] + _gammacut += '&'+"(CL > %f)" % config['gamma_CL_MIN'] + _gammacut += '&' + \ + "(PPINFO(LHCb.ProtoParticle.IsNotE,-1) > %s)" % config['gamma_ISNOTE_MIN'] + + _massCutLow = "(AM>(5279-%s)*MeV)" % config['B0_Mlow'] + _massCutHigh = "(AM<(5279+%s)*MeV)" % config['B0_Mhigh'] + _aptCut = "(APT>%s*MeV)" % config['B0_APTmin'] + _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config['B0Daug_DD_maxDocaChi2'] + _daugPtSumCut = "((APT1+APT2+APT3)>%s*MeV)" % config['B0Daug_DD_PTsum'] + + _combCuts = _aptCut + _combCuts += '&'+_daugPtSumCut + _combCuts += '&'+_massCutLow + _combCuts += '&'+_massCutHigh + _combCuts += '&'+_maxDocaChi2Cut + + _ptCut = "(PT>%s*MeV)" % config['B0_PTmin'] + _vtxChi2Cut = "(VFASPF(VCHI2)<%s)" % config['B0_VtxChi2'] + _diraCut = "(BPVDIRA>%s)" % config['B0_Dira'] + _ipChi2Cut = "(MIPCHI2DV(PRIMARY)<%s)" % config['B0_DD_IPCHI2wrtPV'] + _fdCut = "(VFASPF(VMINVDDV(PRIMARY))>%s)" % config['B0_FDwrtPV'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['B0_DD_FDChi2'] + + _motherCuts = _ptCut + _motherCuts += '&'+_vtxChi2Cut + _motherCuts += '&'+_diraCut + _motherCuts += '&'+_ipChi2Cut + _motherCuts += '&'+_fdCut # lookhere + _motherCuts += '&'+_fdChi2Cut + + _B0 = CombineParticles() + + _B0.DecayDescriptors = ["[B- -> Lambda0 p~- gamma]cc"] + + _trkGhostProbCut = "(TRGHOSTPROB<%s)" % config['Trk_GhostProb'] + _trkChi2Cut = "(TRCHI2DOF<%s)" % config['Trk_Chi2'] + _protonPCut = "(P>%s)" % config["ProtonP"] + _protonPTCut = "(PT>%s)" % config["ProtonPT"] + _protonPIDpCut = "(PIDp-PIDpi> %s ) " % config["ProtonPIDp"] + _protonDLLpKCut = "(PIDp-PIDK> %s ) " % config["ProtonDLLpK"] + + _daughtersCuts = _trkChi2Cut + _daughtersCuts += '&'+_trkGhostProbCut + _daughtersCuts += '&' + _protonPCut + _daughtersCuts += '&' + _protonPTCut + _daughtersCuts += '&' + _protonPIDpCut + _daughtersCuts += '&' + _protonDLLpKCut + + _B0.DaughtersCuts = {"p~-": _daughtersCuts, + "gamma": _gammacut, + } + _B0.CombinationCut = _combCuts + _B0.MotherCut = _motherCuts + _B0.ReFitPVs = True + + _B0Conf = _B0.configurable(name + '_combined') + + self.selB2LambdapbargammaDD = Selection(name, Algorithm=_B0Conf, RequiredSelections=[ + self.selLambda2DD, self.protons, self.photons]) + return self.selB2LambdapbargammaDD + + def makeB2LambdapbargammaLL(self, name, config): + """ + Create and store a B- ->Lambda0(LL) p~- gamma Selection object. + Arguments: + name : name of the Selection. + config : config dictionary + """ + + _gammacut = "(PT > %s*MeV)" % config['gamma_PT_MIN'] + _gammacut += '&'+"(CL > %f)" % config['gamma_CL_MIN'] + _gammacut += '&' + \ + "(PPINFO(LHCb.ProtoParticle.IsNotE,-1) > %s)" % config['gamma_ISNOTE_MIN'] + + _massCutLow = "(AM>(5279-%s)*MeV)" % config['B0_Mlow'] + _massCutHigh = "(AM<(5279+%s)*MeV)" % config['B0_Mhigh'] + _aptCut = "(APT>%s*MeV)" % config['B0_APTmin'] + _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config['B0Daug_LL_maxDocaChi2'] + _daugPtSumCut = "((APT1+APT2+APT3)>%s*MeV)" % config['B0Daug_LL_PTsum'] + + _combCuts = _aptCut + _combCuts += '&'+_daugPtSumCut + _combCuts += '&'+_massCutLow + _combCuts += '&'+_massCutHigh + _combCuts += '&'+_maxDocaChi2Cut + + _ptCut = "(PT>%s*MeV)" % config['B0_PTmin'] + _vtxChi2Cut = "(VFASPF(VCHI2)<%s)" % config['B0_VtxChi2'] + _diraCut = "(BPVDIRA>%s)" % config['B0_Dira'] + _ipChi2Cut = "(MIPCHI2DV(PRIMARY)<%s)" % config['B0_LL_IPCHI2wrtPV'] + _fdCut = "(VFASPF(VMINVDDV(PRIMARY))>%s)" % config['B0_FDwrtPV'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['B0_LL_FDChi2'] + + _motherCuts = _ptCut + _motherCuts += '&'+_vtxChi2Cut + _motherCuts += '&'+_diraCut + _motherCuts += '&'+_ipChi2Cut + _motherCuts += '&'+_fdChi2Cut + _motherCuts += '&'+_fdCut + + _B0 = CombineParticles() + + _B0.DecayDescriptors = ["[B- -> Lambda0 p~- gamma]cc"] + + _trkGhostProbCut = "(TRGHOSTPROB<%s)" % config['Trk_GhostProb'] + _trkChi2Cut = "(TRCHI2DOF<%s)" % config['Trk_Chi2'] + _protonPCut = "(P>%s)" % config["ProtonP"] + _protonPTCut = "(PT>%s)" % config["ProtonPT"] + _protonPIDpCut = "(PIDp-PIDpi> %s ) " % config["ProtonPIDp"] + _protonDLLpKCut = "(PIDp-PIDK> %s ) " % config["ProtonDLLpK"] + + _daughtersCuts = _trkChi2Cut + _daughtersCuts += '&'+_trkGhostProbCut + _daughtersCuts += '&' + _protonPCut + _daughtersCuts += '&' + _protonPTCut + _daughtersCuts += '&' + _protonPIDpCut + _daughtersCuts += '&' + _protonDLLpKCut + + _B0.DaughtersCuts = {"p~-": _daughtersCuts, + "gamma": _gammacut, + } + _B0.CombinationCut = _combCuts + _B0.MotherCut = _motherCuts + _B0.ReFitPVs = True + + _B0Conf = _B0.configurable(name + '_combined') + + self.selB2LambdapbargammaLL = Selection( + name, Algorithm=_B0Conf, RequiredSelections=[self.selLambda2LL, self.protons, self.photons]) + return self.selB2LambdapbargammaLL + + def makeB2LambdapbargammaLD(self, name, config): + """ + Create and store a B- ->Lambda0(LD) p~- gamma Selection object. + Arguments: + name : name of the Selection. + config : config dictionary + """ + _gammacut = "(PT > %s*MeV)" % config['gamma_PT_MIN'] + _gammacut += '&'+"(CL > %f)" % config['gamma_CL_MIN'] + _gammacut += '&' + \ + "(PPINFO(LHCb.ProtoParticle.IsNotE,-1) > %s)" % config['gamma_ISNOTE_MIN'] + + _massCutLow = "(AM>(5279-%s)*MeV)" % config['B0_Mlow'] + _massCutHigh = "(AM<(5279+%s)*MeV)" % config['B0_Mhigh'] + _aptCut = "(APT>%s*MeV)" % config['B0_APTmin'] + _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config['B0Daug_LD_maxDocaChi2'] + _daugPtSumCut = "((APT1+APT2+APT3)>%s*MeV)" % config['B0Daug_LD_PTsum'] + + _combCuts = _aptCut + _combCuts += '&'+_daugPtSumCut + _combCuts += '&'+_massCutLow + _combCuts += '&'+_massCutHigh + _combCuts += '&'+_maxDocaChi2Cut + + _ptCut = "(PT>%s*MeV)" % config['B0_PTmin'] + _vtxChi2Cut = "(VFASPF(VCHI2)<%s)" % config['B0_VtxChi2'] + _diraCut = "(BPVDIRA>%s)" % config['B0_Dira'] + _ipChi2Cut = "(MIPCHI2DV(PRIMARY)<%s)" % config['B0_LD_IPCHI2wrtPV'] + _fdCut = "(VFASPF(VMINVDDV(PRIMARY))>%s)" % config['B0_FDwrtPV'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['B0_LD_FDChi2'] + + _motherCuts = _ptCut + _motherCuts += '&'+_vtxChi2Cut + _motherCuts += '&'+_diraCut + _motherCuts += '&'+_ipChi2Cut + _motherCuts += '&'+_fdChi2Cut + _motherCuts += '&'+_fdCut + + _B0 = CombineParticles() + + _B0.DecayDescriptors = ["[B- -> Lambda0 p~- gamma]cc"] + + _trkGhostProbCut = "(TRGHOSTPROB<%s)" % config['Trk_GhostProb'] + _trkChi2Cut = "(TRCHI2DOF<%s)" % config['Trk_Chi2'] + _protonPCut = "(P>%s)" % config["ProtonP"] + _protonPTCut = "(PT>%s)" % config["ProtonPT"] + _protonPIDpCut = "(PIDp-PIDpi> %s ) " % config["ProtonPIDp"] + _protonDLLpKCut = "(PIDp-PIDK> %s ) " % config["ProtonDLLpK"] + + _daughtersCuts = _trkChi2Cut + _daughtersCuts += '&'+_trkGhostProbCut + _daughtersCuts += '&' + _protonPCut + _daughtersCuts += '&' + _protonPTCut + _daughtersCuts += '&' + _protonPIDpCut + _daughtersCuts += '&' + _protonDLLpKCut + + _B0.DaughtersCuts = {"p~-": _daughtersCuts, + "gamma": _gammacut, + } + _B0.CombinationCut = _combCuts + _B0.MotherCut = _motherCuts + _B0.ReFitPVs = True + + _B0Conf = _B0.configurable(name + '_combined') + + self.selB2LambdapbargammaLD = Selection(name, Algorithm=_B0Conf, RequiredSelections=[ + self.selLambda2LD, self.protons, self.photons]) + return self.selB2LambdapbargammaLD diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py new file mode 100644 index 000000000..fda02dc42 --- /dev/null +++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py @@ -0,0 +1,215 @@ +############################################################################### +# (c) Copyright 2023 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. # +############################################################################### +""" +Module for construction of B0 ->p p~ gamma stripping Selections and StrippingLines. +Provides class B2ppbargammaConf, which constructs the Selections and StrippingLines +given a configuration dictionary. +Exported symbols (use python help!): + - B2ppbargammaConf +""" + +__author__ = ["Xingyu Tong"] +__date__ = '10/07/2023' +__version__ = '$Revision: 1.0 $' +__all__ = 'StrippingB2ppbargammaConf' + +from Gaudi.Configuration import * +from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles +from PhysSelPython.Wrappers import Selection, DataOnDemand +from StrippingConf.StrippingLine import StrippingLine +from StrippingUtils.Utils import LineBuilder + +from StandardParticles import StdLooseProtons as Protons +from StandardParticles import StdLooseAllPhotons as Photons + +''' +2016: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.1850| 37| | 5.614| + |_StrippingSequenceStreamBhadron_ | 0.1850| 37| | 5.599| + |!StrippingB2ppbargammaLine | 0.1850| 37| 6.919| 4.574| + |!StrippingB2ppbargammaLine_TIMING | 0.1850| 37| 6.919| 0.116| +2017: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.2650| 53| | 6.750| + |_StrippingSequenceStreamBhadron_ | 0.2650| 53| | 6.731| + |!StrippingB2ppbargammaLine | 0.2650| 53| 7.434| 5.576| + |!StrippingB2ppbargammaLine_TIMING | 0.2650| 53| 7.434| 0.135| +2018: +StrippingReport INFO Event 20000, Good event 20000 + | *Decision name*|*Rate,%*|*Accepted*| *Mult*|*ms/evt*| + |_StrippingGlobal_ | 0.3900| 78| | 7.111| + |_StrippingSequenceStreamBhadron_ | 0.3900| 78| | 7.096| + |!StrippingB2ppbargammaLine | 0.3900| 78| 6.308| 5.918| + |!StrippingB2ppbargammaLine_TIMING | 0.3900| 78| 6.308| 0.133| +''' + +default_config = { + 'NAME': 'B2ppbargamma', + 'WGs': ['BnoC'], + 'BUILDERTYPE': 'B2ppbargammaConf', + 'CONFIG': {'Trk_Chi2': 4.0, + 'Trk_GhostProb': 0.4, + 'gamma_PT_MIN': 400.0, + 'gamma_CL_MIN': 0.25, + 'gamma_ISNOTE_MIN': -999.0, + 'ProtonP': 15000., # MeV + 'ProtonPT': 1000., # MeV + 'ProtonPIDp': 0., + 'ProtonDLLpK': 0., + 'B0_Mlow': 779.0, + 'B0_Mhigh': 1921.0, + 'B0_APTmin': 1900.0, + 'B0_PTmin': 2000.0, + 'B0Daug_maxDocaChi2': 5.0, + 'B0Daug_PTsum': 4000.0, + 'B0_VtxChi2': 16.0, + 'B0_Dira': 0.9990, + 'B0_IPCHI2wrtPV': 25.0, + 'B0_FDwrtPV': 0.8, + 'B0_FDChi2': 25, + 'GEC_MaxTracks': 250, + 'Prescale': 1.0, + 'Postscale': 1.0, + 'RelatedInfoTools': [{"Type": "RelInfoConeVariables", + "ConeAngle": 1.7, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar17' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 1.5, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar15' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 1.0, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar10' + }, + {"Type": "RelInfoConeVariables", + "ConeAngle": 0.8, + "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'], + "Location": 'ConeVar08' + }, + {"Type": "RelInfoVertexIsolation", + "Location": "VtxIsolationVar" + } + ] + }, + 'STREAMS': ['Bhadron'] +} + + +class B2ppbargammaConf(LineBuilder): + + __configuration_keys__ = default_config['CONFIG'].keys() + + def __init__(self, name, config): + + LineBuilder.__init__(self, name, config) + + GECCode = {'Code': "(recSummaryTrack(LHCb.RecSummary.nLongTracks, TrLONG) < %s)" % config['GEC_MaxTracks'], + 'Preambulo': ["from LoKiTracks.decorators import *"]} + + self.protons = Protons + self.photons = Photons + + namesSelections = [(name, self.makeB2ppbargamma(name, config)), + ] + + # make lines + + for selName, sel in namesSelections: + + extra = {} + + line = StrippingLine(selName + 'Line', + selection=sel, + prescale=config['Prescale'], + postscale=config['Postscale'], + RelatedInfoTools=config['RelatedInfoTools'], + FILTER=GECCode, + **extra) + + self.registerLine(line) + + def makeB2ppbargamma(self, name, config): + """ + Create and store a B0 -> p+ p~- gamma Selection object. + Arguments: + name : name of the Selection. + config : config dictionary + """ + + _gammacut = "(PT > %s*MeV)" % config['gamma_PT_MIN'] + _gammacut += '&'+"(CL > %f)" % config['gamma_CL_MIN'] + _gammacut += '&' + \ + "(PPINFO(LHCb.ProtoParticle.IsNotE,-1) > %s)" % config['gamma_ISNOTE_MIN'] + + _massCutLow = "(AM>(5279-%s)*MeV)" % config['B0_Mlow'] + _massCutHigh = "(AM<(5279+%s)*MeV)" % config['B0_Mhigh'] + _aptCut = "(APT>%s*MeV)" % config['B0_APTmin'] + _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config['B0Daug_maxDocaChi2'] + _daugPtSumCut = "((APT1+APT2+APT3)>%s*MeV)" % config['B0Daug_PTsum'] + + _combCuts = _aptCut + _combCuts += '&'+_daugPtSumCut + _combCuts += '&'+_massCutLow + _combCuts += '&'+_massCutHigh + _combCuts += '&'+_maxDocaChi2Cut + + _ptCut = "(PT>%s*MeV)" % config['B0_PTmin'] + _vtxChi2Cut = "(VFASPF(VCHI2)<%s)" % config['B0_VtxChi2'] + _diraCut = "(BPVDIRA>%s)" % config['B0_Dira'] + _ipChi2Cut = "(MIPCHI2DV(PRIMARY)<%s)" % config['B0_IPCHI2wrtPV'] + _fdCut = "(VFASPF(VMINVDDV(PRIMARY))>%s)" % config['B0_FDwrtPV'] + _fdChi2Cut = "(BPVVDCHI2>%s)" % config['B0_FDChi2'] + + _motherCuts = _ptCut + _motherCuts += '&'+_vtxChi2Cut + _motherCuts += '&'+_diraCut + _motherCuts += '&'+_ipChi2Cut + _motherCuts += '&'+_fdChi2Cut + _motherCuts += '&'+_fdCut + + _B0 = CombineParticles() + + _B0.DecayDescriptors = ["[B0 -> p+ p~- gamma]cc"] + + _trkGhostProbCut = "(TRGHOSTPROB<%s)" % config['Trk_GhostProb'] + _trkChi2Cut = "(TRCHI2DOF<%s)" % config['Trk_Chi2'] + _protonPCut = "(P>%s*MeV)" % config["ProtonP"] + _protonPTCut = "(PT>%s*MeV)" % config["ProtonPT"] + _protonPIDpCut = "(PIDp-PIDpi> %s ) " % config["ProtonPIDp"] + _protonDLLpKCut = "(PIDp-PIDK> %s ) " % config["ProtonDLLpK"] + + _daughtersCuts = _trkChi2Cut + _daughtersCuts += '&'+_trkGhostProbCut + _daughtersCuts += '&' + _protonPCut + _daughtersCuts += '&' + _protonPTCut + _daughtersCuts += '&' + _protonPIDpCut + _daughtersCuts += '&' + _protonDLLpKCut + + _B0.DaughtersCuts = {"p+": _daughtersCuts, + "p~-": _daughtersCuts, + "gamma": _gammacut, + } + _B0.CombinationCut = _combCuts + _B0.MotherCut = _motherCuts + _B0.ReFitPVs = True + + _B0Conf = _B0.configurable(name + '_combined') + + self.selB2ppbargamma = Selection( + name, Algorithm=_B0Conf, RequiredSelections=[self.protons, self.photons]) + return self.selB2ppbargamma -- GitLab From 934059278e89654c49db15b66511e37785aaa12e Mon Sep 17 00:00:00 2001 From: Xingyu Tong <xingyu.tong@cern.ch> Date: Mon, 17 Jul 2023 07:43:40 +0200 Subject: [PATCH 2/3] Update StrippingB2LambdapbargammaLines.py, chang WG from BnoC to RD --- .../StrippingRD/StrippingB2LambdapbargammaLines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py index 34a1309aa..f53960103 100644 --- a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py +++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2LambdapbargammaLines.py @@ -69,7 +69,7 @@ StrippingReport INFO Event 20000, default_config = { 'NAME': 'B2Lambdapbargamma', - 'WGs': ['BnoC'], + 'WGs': ['RD'], 'BUILDERTYPE': 'B2LambdapbargammaLinesConf', 'CONFIG': {'Trk_Chi2': 4.0, 'Trk_GhostProb': 0.4, -- GitLab From 03bd246ae82826bbf4559939e92d16ac8c47b4ee Mon Sep 17 00:00:00 2001 From: Xingyu Tong <xingyu.tong@cern.ch> Date: Mon, 17 Jul 2023 07:45:09 +0200 Subject: [PATCH 3/3] Update StrippingB2ppbargamma.py, chang the WG from BnoC to RD --- .../StrippingSelections/StrippingRD/StrippingB2ppbargamma.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py index fda02dc42..12cdf6764 100644 --- a/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py +++ b/Phys/StrippingSelections/python/StrippingSelections/StrippingRD/StrippingB2ppbargamma.py @@ -56,7 +56,7 @@ StrippingReport INFO Event 20000, default_config = { 'NAME': 'B2ppbargamma', - 'WGs': ['BnoC'], + 'WGs': ['RD'], 'BUILDERTYPE': 'B2ppbargammaConf', 'CONFIG': {'Trk_Chi2': 4.0, 'Trk_GhostProb': 0.4, -- GitLab