Skip to content
Snippets Groups Projects
Commit b072e678 authored by Izaac Sanderswood's avatar Izaac Sanderswood
Browse files

close to final versions of bs2phigamma and bd2kstgamma lines

parent dd5982d4
No related branches found
No related tags found
1 merge request!1240Bs2PhiGamma and Bd2KstGamma HLT2 and Sprucing lines
Pipeline #3721743 failed
......@@ -23,6 +23,7 @@ from . import b_to_majolep_majo_to_leppi
from . import qqbar_to_ll
from . import b_to_ll_LFV
from . import b_to_kstarmumu
from . import exclusive_bs_to_phigamma
# provide "all_lines" for correct registration by the overall HLT2 lines module
all_lines = {}
......@@ -37,6 +38,7 @@ all_lines.update(b_to_majolep_majo_to_leppi.all_lines)
all_lines.update(qqbar_to_ll.all_lines)
all_lines.update(b_to_ll_LFV.hlt2_lines)
all_lines.update(b_to_kstarmumu.all_lines)
all_lines.update(exclusive_bs_to_phigamma.all_lines)
sprucing_lines = {}
sprucing_lines.update(spruce_beauty2xtaul.sprucing_lines)
###############################################################################
# (c) Copyright 2021 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. #
###############################################################################
""" Bs2PhiGamma Hlt2 Line
"""
from Moore.config import register_line_builder
from Moore.lines import Hlt2Line
from RecoConf.reconstruction_objects import upfront_reconstruction
from GaudiKernel.SystemOfUnits import GeV, MeV, mm, picosecond
import Functors as F
from Functors.math import in_range
from RecoConf.reconstruction_objects import (
make_pvs_v2 as make_pvs,
make_pvs as make_pvs_v1
)
from PyConf import configurable
from Hlt2Conf.lines.rd.builders.rdbuilder_thor import (
make_rd_photons as make_photons,
make_rd_detached_phis,
make_rd_detached_kstar0s
)
from Hlt2Conf.lines.rd.builders.bs_to_phi_gamma_builders import (
make_bs2phigamma,
make_b02kstgamma
)
all_lines = {}
from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter, require_all
# make sure we passed GEC and have PV in event
def prefilters():
return [require_pvs(make_pvs())]
@register_line_builder(all_lines)
def bs2phigamma_line(name="Hlt2BsToPhiGammaLine",prescale=1):
pvs = make_pvs()
pvs_v1 = make_pvs_v1()
phis = make_rd_detached_phis()
photons = make_photons() ;
b_s0 = make_bs2phigamma(phis=phis,photons=photons)
return Hlt2Line(
name=name,
algs=upfront_reconstruction()+[phis,photons,b_s0],
prescale=prescale,
)
@register_line_builder(all_lines)
def b02kstgamma_line(name="Hlt2BdToKstGammaLine",prescale=1):
pvs = make_pvs()
pvs_v1 = make_pvs_v1()
# to do: check that cuts for these Kst are suitable
kst = make_rd_detached_kstar0s()
# to do: check that cuts for these photons are suitable
photons = make_photons() ;
b0 = make_b02kstgamma(kst=kst,photons=photons)
return Hlt2Line(
name=name,
algs=upfront_reconstruction()+[kst,photons,b0],
prescale=prescale,
)
\ No newline at end of file
###############################################################################
# (c) Copyright 2021 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. #
###############################################################################
""" Bs2PhiGamma Hlt2 Line
"""
from Moore.config import register_line_builder
from Moore.lines import Hlt2Line
from RecoConf.reconstruction_objects import upfront_reconstruction
from GaudiKernel.SystemOfUnits import GeV, MeV, mm, picosecond
import Functors as F
from Functors.math import in_range
from RecoConf.reconstruction_objects import (
make_pvs_v2 as make_pvs,
make_pvs as make_pvs_v1
)
from PyConf import configurable
from Hlt2Conf.lines.rd.builders.rdbuilder_thor import (
make_rd_photons,
make_rd_detached_phis,
make_rd_detached_kstar0s
)
from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter, require_all
@configurable
def make_excl_b2xgamma(intermediate,
photons,
descriptor,
comb_m_min,
comb_m_max,
pt_min,
name
):
combination_code = require_all(
F.PT > pt_min,
)
vertex_code = require_all(
in_range(comb_m_min,F.MASS,comb_m_max),
)
# return particle combiner
return ParticleCombiner(name=name,
ParticleCombiner="ParticleAdder",
Inputs=[intermediate,photons],
DecayDescriptor=descriptor,
CombinationCut=combination_code,
CompositeCut=vertex_code
)
# Make the Bs
@configurable
def make_bs2phigamma(phis,
photons,
descriptor="[B_s0 -> phi(1020) gamma]cc",
comb_m_min=4866 * MeV,
comb_m_max=5866 * MeV,
pt_min=1000 * MeV,
name="BsToPhiGammaCombiner"
):
return make_excl_b2xgamma(name=name,
intermediate=phis,
photons=photons,
descriptor=descriptor,
comb_m_min=comb_m_min,
comb_m_max=comb_m_max,
pt_min=pt_min,
)
@configurable
def make_b02kstgamma(kst,
photons,
descriptor="[B0 -> K*(892)0 gamma]cc",
comb_m_min=4779*MeV,
comb_m_max=5779*MeV,
pt_min=1000*MeV,
vchi2pdof_max=16,
ipchi2_max=25.,
dira_min=0.063,
bpvltime_min=2*picosecond,
name="BdToKstGammaCombiner"
):
return make_excl_b2xgamma(name=name,
intermediate=kst,
photons=photons,
descriptor=descriptor,
comb_m_min=comb_m_min,
comb_m_max=comb_m_max,
pt_min=pt_min,
)
\ No newline at end of file
# (c) Copyright 2020 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. #
###############################################################################
""" Hlt2 particle filters/combiners for the following:
phi -> (KK) with high pt and DIRA cuts
Kst -> (K pi) with high pt and DIRA cuts
exclusive B -> hh gamma builder using ParticleAdder
Bs -> phi(-> KK) gamma
Bd -> Kst(-> pi K) gamma
photons with high pt cut
author: Izaac Sanderswood
date: 17.03.22
"""
from GaudiKernel.SystemOfUnits import GeV, MeV
import Functors as F
from Functors.math import in_range
from RecoConf.reconstruction_objects import (
make_pvs_v2 as make_pvs,
)
from PyConf import configurable
from Hlt2Conf.standard_particles import (
make_photons,
)
from Hlt2Conf.lines.rd.builders.rdbuilder_thor import (
make_rd_has_rich_detached_pions,
make_rd_has_rich_detached_kaons,
)
from Hlt2Conf.algorithms_thor import ParticleCombiner, ParticleFilter, require_all
####################################
# 2-body hadron combinations #
####################################
@configurable
def make_exclusive_highpt_detached_kstar0s(
name="rd_BdToKstGamma_detached_kstar0s",
make_rd_detached_pions=make_rd_has_rich_detached_pions,
make_rd_detached_kaons=make_rd_has_rich_detached_kaons,
make_pvs=make_pvs,
am_min=592. * MeV,
am_max=1192. * MeV,
pi_p_min=2. * GeV,
pi_pt_min=500. * MeV,
pi_ipchi2_min=4.,
pi_pid=(F.PID_K < 8.),
k_p_min=3. * GeV,
k_pt_min=500. * MeV,
k_ipchi2_min=4.,
k_pid=(F.PID_K > 0.),
kstar0_pt_min=1500. * MeV,
adocachi2cut=30.,
vchi2pdof_max=25.,
dira_min=0.8):
'''
Build exclusive Kstar0 candidates. Mirrors the rd builder but with much tighter cuts and an additional DIRA cut.
'''
pions = make_rd_detached_pions(
p_min=pi_p_min,
pt_min=pi_pt_min,
mipchi2dvprimary_min=pi_ipchi2_min,
pid=pi_pid)
kaons = make_rd_detached_kaons(
p_min=k_p_min,
pt_min=k_pt_min,
mipchi2dvprimary_min=k_ipchi2_min,
pid=k_pid,
)
descriptor = '[K*(892)0 -> K+ pi-]cc'
combination_code = require_all(
in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut))
pvs = make_pvs()
vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > kstar0_pt_min, F.BPVDIRA(pvs) > dira_min)
return ParticleCombiner([kaons, pions],
name=name,
DecayDescriptor=descriptor,
CombinationCut=combination_code,
CompositeCut=vertex_code)
@configurable
def make_exclusive_highpt_detached_phis(
name="rd_BsToPhiGamma_detached_phis",
make_rd_detached_kaons=make_rd_has_rich_detached_kaons,
make_pvs=make_pvs,
am_min=950. * MeV,
am_max=1100. * MeV,
k_p_min=2. * GeV,
k_pt_min=500. * MeV,
k_ipchi2_min=4.,
k_pid=(F.PID_K > 0.),
phi_pt_min=1500. * MeV,
adocachi2cut=30.,
vchi2pdof_max=25.,
dira_min=0.8
):
'''
Build exclusive phi(1020) candidates. Mirrors the rd builder but with much tighter cuts and an additional DIRA cut.
'''
kaons = make_rd_detached_kaons(
p_min=k_p_min,
pt_min=k_pt_min,
mipchi2dvprimary_min=k_ipchi2_min,
pid=k_pid)
descriptor = 'phi(1020) -> K+ K-'
combination_code = require_all(
in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut))
pvs = make_pvs()
vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min,F.BPVDIRA(pvs) > dira_min)
return ParticleCombiner([kaons, kaons],
name=name,
DecayDescriptor=descriptor,
CombinationCut=combination_code,
CompositeCut=vertex_code)
@configurable
def make_exclusive_highpt_photons(name="bs2phig_photons",
make_particles=make_photons,
e_min=50. * MeV,
et_min=2.7 * GeV,
is_photon_min = 0.5,
is_not_h_min = 0.5):
"""Exclusive HighPt Photons"""
code = require_all(F.PT > et_min, F.P > e_min, F.IS_PHOTON > is_photon_min, F.IS_NOT_H > is_not_h_min)
return ParticleFilter(make_particles(), F.FILTER(code), name=name)
@configurable
def make_excl_b2xgamma(intermediate,
photons,
descriptor,
comb_m_min,
comb_m_max,
pt_min,
name
):
combination_code = require_all(
F.PT > pt_min,
in_range(comb_m_min,F.MASS,comb_m_max),
)
vertex_code = require_all(
in_range(comb_m_min,F.MASS,comb_m_max),
F.PT > pt_min,
)
# return particle combiner
return ParticleCombiner(name=name,
ParticleCombiner="ParticleAdder",
Inputs=[intermediate,photons],
DecayDescriptor=descriptor,
CombinationCut=combination_code,
CompositeCut=vertex_code
)
# Make the Bs
@configurable
def make_bs2phigamma(phis,
photons,
descriptor="[B_s0 -> phi(1020) gamma]cc",
comb_m_min=4866 * MeV,
comb_m_max=5866 * MeV,
pt_min=2000 * MeV,
name="rd_BsToPhiGammaCombiner"
):
return make_excl_b2xgamma(name=name,
intermediate=phis,
photons=photons,
descriptor=descriptor,
comb_m_min=comb_m_min,
comb_m_max=comb_m_max,
pt_min=pt_min,
)
@configurable
def make_b02kstgamma(kst,
photons,
descriptor="[B0 -> K*(892)0 gamma]cc",
comb_m_min=4779*MeV,
comb_m_max=5779*MeV,
pt_min=2000*MeV,
name="rd_BdToKstGammaCombiner"
):
return make_excl_b2xgamma(name=name,
intermediate=kst,
photons=photons,
descriptor=descriptor,
comb_m_min=comb_m_min,
comb_m_max=comb_m_max,
pt_min=pt_min,
)
# (c) Copyright 2020 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. #
###############################################################################
""" Registration of exclusive radiative lines.
Bs -> phi(-> KK) gamma
Bd -> Kst(-> pi K) gamma
the latter is used as a control channel
author: Izaac Sanderswood
date: 17.03.22
"""
from Moore.config import register_line_builder
from Moore.lines import Hlt2Line
from RecoConf.reconstruction_objects import upfront_reconstruction
from Hlt2Conf.lines.rd.builders.exclusive_bs_to_phigamma_builders import (
make_bs2phigamma,
make_b02kstgamma,
make_exclusive_highpt_detached_kstar0s,
make_exclusive_highpt_detached_phis,
make_exclusive_highpt_photons
)
from Hlt2Conf.lines.rd.builders.rd_prefilters import rd_prefilter
all_lines = {}
@register_line_builder(all_lines)
def bs_to_phigamma_line(name="Hlt2RD_BsToPhiGammaLine",prescale=1):
phis = make_exclusive_highpt_detached_phis()
photons = make_exclusive_highpt_photons() ;
b_s0 = make_bs2phigamma(phis=phis,photons=photons)
return Hlt2Line(
name=name,
algs=rd_prefilter()+[phis,photons,b_s0],
prescale=prescale,
)
@register_line_builder(all_lines)
def bd_to_kstgamma_line(name="Hlt2RD_BdToKstGammaLine",prescale=1):
kst = make_exclusive_highpt_detached_kstar0s()
photons = make_exclusive_highpt_photons() ;
b0 = make_b02kstgamma(kst=kst,photons=photons)
return Hlt2Line(
name=name,
algs=rd_prefilter()+[kst,photons,b0],
prescale=prescale,
)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment