From 4652734e2492ba1bfb71aa4b1795d0ad9c3932fa Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Mon, 27 Sep 2021 19:22:30 +0200 Subject: [PATCH 01/15] migrate the RD builders to ThOr --- .../lines/rd/builders/rdbuilder_thor.py | 561 ++++++++++++++++++ 1 file changed, 561 insertions(+) create mode 100644 Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py new file mode 100644 index 00000000000..8a200f2f9f9 --- /dev/null +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -0,0 +1,561 @@ +############################################################################### +# (c) Copyright 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. # +############################################################################### +""" +Definition of RD builders for ThOr framework. +For now does not use any MVA tools as they are not ThOr-friendly. +""" +from GaudiKernel.SystemOfUnits import GeV, MeV + +from RecoConf.reconstruction_objects import make_pvs_v2 as make_pvs + +import Functors as F +from Functors.math import in_range + +from Hlt2Conf.algorithms import ParticleFilterWithTMVA#, ParticleFilterWithPVs, ParticleFilter +from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilter + +from PyConf import configurable + +from Hlt2Conf.standard_particles import ( + make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, + make_long_pions, make_long_kaons, make_long_protons, + #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks + make_down_pions, make_down_kaons, make_down_protons, + #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below + make_long_muons, make_long_electrons_no_brem, + make_photons, make_resolved_pi0s, make_merged_pi0s, + make_detached_mumu, make_detached_dielectron_with_brem + ) + +#################################### +# Charged hadron selections # +#################################### + + +@configurable +def make_filter_tracks( + make_particles=make_has_rich_long_pions, + make_pvs=make_pvs, + name="rd_has_rich_long_pions", + pt_min=250. * MeV, #TBC with Reco + p_min=2.0 * GeV, + #p_max=150. * GeV, #propose to move such cuts to the analysis level, can be quite inefficient for certain channels like B->mumu. + #eta_min=2., #same as above + #eta_max=5., #same as above + trchi2dof_max=3, #TBC with Reco + trghostprob_max=0.4, #TBC with Reco + mipchi2dvprimary_min=None, + pid=None): + + pvs = make_pvs() + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) + return ParticleFilter(make_particles(), F.FILTER(code)) + + if pid is not None: + code &= pid + + if mipchi2dvprimary_min is not None: + code &= F.MINIPCHI2(pvs) > mipchi2dvprimary_min + + return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) + + + +#################################### +# Detached # +#################################### + + +@configurable +def make_detached_tracks(name="rd_detached_tracks", mipchi2dvprimary_min=3.): + """ + Return RD detached tracks. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_pions, + mipchi2dvprimary_min=mipchi2dvprimary_min) + + +@configurable +def make_detached_muons( + name="rd_detached_muons", + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_MU > 0.)): + """ + Return RD detached pions. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_muons, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_detached_electrons( + name="rd_detached_electrons", + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_E > 0.)): + """ + Return RD detached pions. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_electrons_no_brem, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_detached_pions( + name="rd_detached_pions", + p_min=2 * GeV, + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_K <= 0.)): + """ + Return RD detached pions. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_pions, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_detached_kaons( + name="rd_detached_kaons", + p_min=2 * GeV, + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_K > 0.)): + """ + Return RD detached kaons. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_kaons, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_detached_protons( + name="rd_detached_protons", + p_min=8.5 * GeV, + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_P > 0.)): + """ + Return RD detached protons. + """ + return make_filter_tracks( + name=name, + make_particles=make_long_protons, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +#################################### +# Prompt # +#################################### + + +@configurable +def make_prompt_pions(name="rd_prompt_pions", pid=(F.PID_K < 0.)): + """ + Return RD prompt pions. + """ + return make_filter_tracks( + make_particles=make_has_rich_long_pions, name=name, pid=pid) + + +@configurable +def make_prompt_kaons(name="rd_prompt_kaons", pid=(F.PID_K > 0.)): + """ + Return RD prompt kaons. + """ + return make_filter_tracks( + make_particles=make_has_rich_long_kaons, name=name, pid=pid) + + +@configurable +def make_prompt_protons(name="rd_prompt_protons", + p_min=10. * GeV, + pid=(F.PID_P > 0.)): + """ + Return RD prompt protons. + """ + return make_filter_tracks( + make_particles=make_has_rich_long_protons, + name=name, + p_min=p_min, + pid=pid) + + +#################################### +# Downstream tracks # +#################################### +def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? + """ + Return RD down hadrons with pion mass hypothesis. + """ + return make_filter_tracks( + make_particles=make_down_pions, name=name, pid=pid) + + +def make_detached_down_pions( + name="rd_detached_down_pions", + mipchi2dvprimary_min=3., #TBC + pt_min=0. * MeV, + p_min=0 * GeV, + pid=None): + """ + Return RD down hadrons with pion mass hypothesis. + """ + return make_filter_tracks( + make_particles=make_down_pions, + name=name, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pt_min=pt_min, + p_min=pt_min, + pid=pid) + +def make_detached_down_kaons( + name="rd_detached_down_kaons", + mipchi2dvprimary_min=3., #TBC + pt_min=0. * MeV, + p_min=0 * GeV, + pid=None): + """ + Return RD down hadrons with kaon mass hypothesis. + """ + return make_filter_tracks( + make_particles=make_down_kaons, + name=name, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pt_min=pt_min, + p_min=pt_min, + pid=pid) + +def make_detached_down_protons( + name="rd_detached_down_protons", + mipchi2dvprimary_min=3., #TBC + pt_min=0. * MeV, + p_min=0 * GeV, + pid=None): + """ + Return RD down hadrons with proton mass hypothesis. + """ + return make_filter_tracks( + make_particles=make_down_protons, + name=name, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pt_min=pt_min, + p_min=pt_min, + pid=pid) + + +#################################### +# Neutral particles # +#################################### +# builders to be updated once the CL functor is implemented in ThOr. + +@configurable +def make_rd_photons(name="rd_photons", + make_particles=make_photons, + cl_min=0.1, + et_min=250 * MeV, + e_min=0 * MeV): + """For the time being just a dummy selection""" + + code = require_all(F.PT > et_min) + return ParticleFilter(make_particles(), F.FILTER(code), name=name) + + +@configurable +def make_rd_resolved_pi0s( + name="rd_resolved_pi0s", + make_particles=make_resolved_pi0s, + pt_min=250 * MeV, + cl_min=0, + # photon_args={ + # 'ConfLevelCut': 0.1, + # 'PtCut': 250. * MeV + # }, +): + """For the time being just a dummy selection""" + + # code = require_all('PT > {pt_min}', 'P > {p_min}').format( + # pt_min=pt_min, p_min=p_min) + # + # return ParticleFilter( + # make_particles(photon_args=photon_args), Code=code, name=name) + code = F.PT > pt_min + return ParticleFilter(make_particles(), F.FILTER(code)) + + +@configurable +def make_rd_merged_pi0s(name="rd_merged_pi0s", + make_particles=make_merged_pi0s, + pt_min=250 * MeV, + cl_min=0): + """For the time being just a dummy selection""" + + # code = require_all('PT > {pt_min}', 'P > {p_min}').format( + # pt_min=pt_min, p_min=p_min) + # + # return ParticleFilter(make_particles(), Code=code, name=name) + + code = require_all(F.PT > pt_min, ) + return ParticleFilter(make_particles(), F.FILTER(code), name=name) + + +#################################### +# V0 particles and alike # +#################################### + +@configurable +def make_rd_ks0_lls(name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): + ''' + Build Long-Long KS0 candidates. Approximately corresponding to the Run2 + "StdVeryLooseKsLL" cuts. + ''' + + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! + descriptor = 'KS0 -> pi+ pi-' + 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.BPVFDCHI2(pvs) > bpvvdchi2_min + ) + return ParticleCombiner([pions, pions], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + + +@configurable +def make_rd_ks0_dds(name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): + ''' + Build Long-Long KS0 candidates. Approximately corresponding to the Run2 + "StdVeryLooseKsLL" cuts. + ''' + + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + descriptor = 'KS0 -> pi+ pi-' + 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.BPVFDCHI2(pvs) > bpvvdchi2_min + ) + return ParticleCombiner([pions, pions], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + + +@configurable +def make_rd_lambda_lls(name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): + ''' + Build Long-Long Lambda candidates. Approximately corresponding to the Run2 + "StdVeryLooseLambdaLL" cuts. + ''' + + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + descriptor = '[Lambda0 -> p+ 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.BPVFDCHI2(pvs) > bpvvdchi2_min + ) + return ParticleCombiner([protons, pions], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + +@configurable +def make_rd_lambda_dds(name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): + ''' + Build Down-Down Lambda candidates. Approximately corresponding to the Run2 + "StdVeryLooseLambdaLL" cuts. + ''' + + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + descriptor = '[Lambda0 -> p+ 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.BPVFDCHI2(pvs) > bpvvdchi2_min + ) + return ParticleCombiner([protons, pions], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + + +#################################### +# 2-body hadron combinations # +#################################### + + +@configurable +def make_rd_detached_kstar0s(name="rd_detached_kstar0s", + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): + ''' + Build Kstar0 candidates. Approximately corresponding to the Run2 + "StdVeryLooseDetachedKstar" cuts. + ''' + + pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) + descriptor = '[K*(892)0 -> pi- K+]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 + ) + return ParticleCombiner([pions, kaons], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + + +@configurable +def make_rd_detached_phis(name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): + ''' + Build phi(1020) candidates. Approximately corresponding to the Run2 + "StdLooseDetachedPhi2KK" cuts. + ''' + + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) + descriptor = 'phi(1020) -> K+ K-' + combination_code = require_all( + F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) + pvs = make_pvs() + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min + ) + return ParticleCombiner([kaons, kaons], + name=name, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code) + +#################################### +# Dileptons # +#################################### + +#Take the standard detached dileptons, filter with an MVA and save the necessary related tracks +@configurable +def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): + + dimuons = make_detached_mumu(probnn_mu=0.05, pt_mu=150 * MeV) + code = require_all(F.MASS < max_dimuon_mass) + return ParticleFilter(dimuons, F.FILTER(code)) + + +@configurable +def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): + + dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) + code = require_all(F.MASS < max_dielectron_mass) + return ParticleFilter(dielectrons, F.FILTER(code)) + + +# todo : mue with brem -- GitLab From 28d579290acabbf07f10fced4a22c21e80c46e99 Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Mon, 27 Sep 2021 17:26:58 +0000 Subject: [PATCH 02/15] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Moore/-/jobs/16537609 --- .../lines/rd/builders/rdbuilder_thor.py | 273 ++++++++++-------- 1 file changed, 156 insertions(+), 117 deletions(-) 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 8a200f2f9f9..01fe57bac99 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -19,21 +19,30 @@ from RecoConf.reconstruction_objects import make_pvs_v2 as make_pvs import Functors as F from Functors.math import in_range -from Hlt2Conf.algorithms import ParticleFilterWithTMVA#, ParticleFilterWithPVs, ParticleFilter +from Hlt2Conf.algorithms import ParticleFilterWithTMVA #, ParticleFilterWithPVs, ParticleFilter from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilter from PyConf import configurable from Hlt2Conf.standard_particles import ( - make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, - make_long_pions, make_long_kaons, make_long_protons, + make_has_rich_long_pions, + make_has_rich_long_kaons, + make_has_rich_long_protons, + make_long_pions, + make_long_kaons, + make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks - make_down_pions, make_down_kaons, make_down_protons, + make_down_pions, + make_down_kaons, + make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below - make_long_muons, make_long_electrons_no_brem, - make_photons, make_resolved_pi0s, make_merged_pi0s, - make_detached_mumu, make_detached_dielectron_with_brem - ) + make_long_muons, + make_long_electrons_no_brem, + make_photons, + make_resolved_pi0s, + make_merged_pi0s, + make_detached_mumu, + make_detached_dielectron_with_brem) #################################### # Charged hadron selections # @@ -56,7 +65,8 @@ def make_filter_tracks( pid=None): pvs = make_pvs() - code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, + F.GHOSTPROB < trghostprob_max) return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: @@ -68,7 +78,6 @@ def make_filter_tracks( return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) - #################################### # Detached # #################################### @@ -212,7 +221,8 @@ def make_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? +def make_down_tracks(name="rd_down_tracks", + pid=None): #do we really need this one? """ Return RD down hadrons with pion mass hypothesis. """ @@ -237,6 +247,7 @@ def make_detached_down_pions( p_min=pt_min, pid=pid) + def make_detached_down_kaons( name="rd_detached_down_kaons", mipchi2dvprimary_min=3., #TBC @@ -254,6 +265,7 @@ def make_detached_down_kaons( p_min=pt_min, pid=pid) + def make_detached_down_protons( name="rd_detached_down_protons", mipchi2dvprimary_min=3., #TBC @@ -277,6 +289,7 @@ def make_detached_down_protons( #################################### # builders to be updated once the CL functor is implemented in ThOr. + @configurable def make_rd_photons(name="rd_photons", make_particles=make_photons, @@ -331,31 +344,36 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", # V0 particles and alike # #################################### + @configurable -def make_rd_ks0_lls(name="rd_ks0_lls", - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=460 * MeV, # ~40 MeV window - am_max=540 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0 * GeV, # has to be 0 !!! - pi_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_ks0_lls( + name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" cuts. ''' - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) # important to get rid of any PID cuts! descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -364,30 +382,34 @@ def make_rd_ks0_lls(name="rd_ks0_lls", @configurable -def make_rd_ks0_dds(name="rd_ks0_dds", - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=420 * MeV, # ~75 MeV window - am_max=570 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_ks0_dds( + name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" 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, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -396,71 +418,88 @@ def make_rd_ks0_dds(name="rd_ks0_dds", @configurable -def make_rd_lambda_lls(name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=1076 * MeV, # ~40 MeV window - am_max=1156 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_lambda_lls( + name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + @configurable -def make_rd_lambda_dds(name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=1050 * MeV, # ~65 MeV window - am_max=1180 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_lambda_dds( + name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -475,32 +514,30 @@ def make_rd_lambda_dds(name="rd_lambda_dds", @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. ''' pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = '[K*(892)0 -> pi- K+]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + 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 - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > kstar0_pt_min) return ParticleCombiner([pions, kaons], name=name, DecayDescriptor=descriptor, @@ -509,15 +546,16 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable -def make_rd_detached_phis(name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_max=1100 * MeV, #min is the di-kaon threshold anyway - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - phi_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_phis( + name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build phi(1020) candidates. Approximately corresponding to the Run2 "StdLooseDetachedPhi2KK" cuts. @@ -525,22 +563,22 @@ def make_rd_detached_phis(name="rd_detached_phis", kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' - combination_code = require_all( - F.MASS < am_max, - F.MAXDOCACHI2CUT(adocachi2cut)) + combination_code = require_all(F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min) return ParticleCombiner([kaons, kaons], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + #################################### # Dileptons # #################################### + #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -553,7 +591,8 @@ def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @configurable def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): - dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) + dielectrons = make_detached_dielectron_with_brem( + probnn_e=0.05, m_diE_max=max_dielectron_mass) code = require_all(F.MASS < max_dielectron_mass) return ParticleFilter(dielectrons, F.FILTER(code)) -- GitLab From a17b765c407b7682f2a5dfaa855277edc1d49c01 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Mon, 27 Sep 2021 19:29:49 +0200 Subject: [PATCH 03/15] fix date --- .../python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 01fe57bac99..30b1a1430d6 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration # +# (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". # -- GitLab From 4005898e639ca5d3f03752bf09f99040f0c5f439 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Mon, 27 Sep 2021 19:32:22 +0200 Subject: [PATCH 04/15] fix unused vars --- .../lines/rd/builders/rdbuilder_thor.py | 283 ++++++++---------- 1 file changed, 119 insertions(+), 164 deletions(-) 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 30b1a1430d6..eaba4dcd128 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration # +# (c) Copyright 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". # @@ -19,30 +19,20 @@ from RecoConf.reconstruction_objects import make_pvs_v2 as make_pvs import Functors as F from Functors.math import in_range -from Hlt2Conf.algorithms import ParticleFilterWithTMVA #, ParticleFilterWithPVs, ParticleFilter from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilter from PyConf import configurable from Hlt2Conf.standard_particles import ( - make_has_rich_long_pions, - make_has_rich_long_kaons, - make_has_rich_long_protons, - make_long_pions, - make_long_kaons, - make_long_protons, + make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, + make_long_pions, make_long_kaons, make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks - make_down_pions, - make_down_kaons, - make_down_protons, + make_down_pions, make_down_kaons, make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below - make_long_muons, - make_long_electrons_no_brem, - make_photons, - make_resolved_pi0s, - make_merged_pi0s, - make_detached_mumu, - make_detached_dielectron_with_brem) + make_long_muons, make_long_electrons_no_brem, + make_photons, make_resolved_pi0s, make_merged_pi0s, + make_detached_mumu, make_detached_dielectron_with_brem + ) #################################### # Charged hadron selections # @@ -65,8 +55,7 @@ def make_filter_tracks( pid=None): pvs = make_pvs() - code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, - F.GHOSTPROB < trghostprob_max) + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: @@ -78,6 +67,7 @@ def make_filter_tracks( return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) + #################################### # Detached # #################################### @@ -221,8 +211,7 @@ def make_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", - pid=None): #do we really need this one? +def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? """ Return RD down hadrons with pion mass hypothesis. """ @@ -247,7 +236,6 @@ def make_detached_down_pions( p_min=pt_min, pid=pid) - def make_detached_down_kaons( name="rd_detached_down_kaons", mipchi2dvprimary_min=3., #TBC @@ -265,7 +253,6 @@ def make_detached_down_kaons( p_min=pt_min, pid=pid) - def make_detached_down_protons( name="rd_detached_down_protons", mipchi2dvprimary_min=3., #TBC @@ -289,7 +276,6 @@ def make_detached_down_protons( #################################### # builders to be updated once the CL functor is implemented in ThOr. - @configurable def make_rd_photons(name="rd_photons", make_particles=make_photons, @@ -344,36 +330,31 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", # V0 particles and alike # #################################### - @configurable -def make_rd_ks0_lls( - name="rd_ks0_lls", - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=460 * MeV, # ~40 MeV window - am_max=540 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0 * GeV, # has to be 0 !!! - pi_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_ks0_lls(name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" cuts. ''' - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -382,34 +363,30 @@ def make_rd_ks0_lls( @configurable -def make_rd_ks0_dds( - name="rd_ks0_dds", - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=420 * MeV, # ~75 MeV window - am_max=570 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_ks0_dds(name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" 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, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -418,88 +395,71 @@ def make_rd_ks0_dds( @configurable -def make_rd_lambda_lls( - name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=1076 * MeV, # ~40 MeV window - am_max=1156 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_lambda_lls(name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons( - p_min=p_p_min, - pt_min=p_pt_min, - mipchi2dvprimary_min=p_ipchi2_min, - pid=None) # important to get rid of any PID cuts! - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) - @configurable -def make_rd_lambda_dds( - name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=1050 * MeV, # ~65 MeV window - am_max=1180 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_lambda_dds(name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons( - p_min=p_p_min, - pt_min=p_pt_min, - mipchi2dvprimary_min=p_ipchi2_min, - pid=None) # important to get rid of any PID cuts! - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -514,30 +474,32 @@ def make_rd_lambda_dds( @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. ''' pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) descriptor = '[K*(892)0 -> pi- K+]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) + 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 + ) return ParticleCombiner([pions, kaons], name=name, DecayDescriptor=descriptor, @@ -546,16 +508,15 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable -def make_rd_detached_phis( - name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_max=1100 * MeV, #min is the di-kaon threshold anyway - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - phi_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_phis(name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build phi(1020) candidates. Approximately corresponding to the Run2 "StdLooseDetachedPhi2KK" cuts. @@ -563,22 +524,22 @@ def make_rd_detached_phis( kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' - combination_code = require_all(F.MASS < am_max, - F.MAXDOCACHI2CUT(adocachi2cut)) - pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min) + combination_code = require_all( + F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) + #pvs = make_pvs() + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min + ) return ParticleCombiner([kaons, kaons], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) - #################################### # Dileptons # #################################### - #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -591,10 +552,4 @@ def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @configurable def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): - dielectrons = make_detached_dielectron_with_brem( - probnn_e=0.05, m_diE_max=max_dielectron_mass) - code = require_all(F.MASS < max_dielectron_mass) - return ParticleFilter(dielectrons, F.FILTER(code)) - - -# todo : mue with brem + dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) -- GitLab From 35551281bace875980119f4f8facbf1d15147a8c Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Mon, 27 Sep 2021 17:32:57 +0000 Subject: [PATCH 05/15] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Moore/-/jobs/16537669 --- .../lines/rd/builders/rdbuilder_thor.py | 271 ++++++++++-------- 1 file changed, 155 insertions(+), 116 deletions(-) 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 eaba4dcd128..4c38bdd3567 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -24,15 +24,24 @@ from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilt from PyConf import configurable from Hlt2Conf.standard_particles import ( - make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, - make_long_pions, make_long_kaons, make_long_protons, + make_has_rich_long_pions, + make_has_rich_long_kaons, + make_has_rich_long_protons, + make_long_pions, + make_long_kaons, + make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks - make_down_pions, make_down_kaons, make_down_protons, + make_down_pions, + make_down_kaons, + make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below - make_long_muons, make_long_electrons_no_brem, - make_photons, make_resolved_pi0s, make_merged_pi0s, - make_detached_mumu, make_detached_dielectron_with_brem - ) + make_long_muons, + make_long_electrons_no_brem, + make_photons, + make_resolved_pi0s, + make_merged_pi0s, + make_detached_mumu, + make_detached_dielectron_with_brem) #################################### # Charged hadron selections # @@ -55,7 +64,8 @@ def make_filter_tracks( pid=None): pvs = make_pvs() - code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, + F.GHOSTPROB < trghostprob_max) return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: @@ -67,7 +77,6 @@ def make_filter_tracks( return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) - #################################### # Detached # #################################### @@ -211,7 +220,8 @@ def make_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? +def make_down_tracks(name="rd_down_tracks", + pid=None): #do we really need this one? """ Return RD down hadrons with pion mass hypothesis. """ @@ -236,6 +246,7 @@ def make_detached_down_pions( p_min=pt_min, pid=pid) + def make_detached_down_kaons( name="rd_detached_down_kaons", mipchi2dvprimary_min=3., #TBC @@ -253,6 +264,7 @@ def make_detached_down_kaons( p_min=pt_min, pid=pid) + def make_detached_down_protons( name="rd_detached_down_protons", mipchi2dvprimary_min=3., #TBC @@ -276,6 +288,7 @@ def make_detached_down_protons( #################################### # builders to be updated once the CL functor is implemented in ThOr. + @configurable def make_rd_photons(name="rd_photons", make_particles=make_photons, @@ -330,31 +343,36 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", # V0 particles and alike # #################################### + @configurable -def make_rd_ks0_lls(name="rd_ks0_lls", - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=460 * MeV, # ~40 MeV window - am_max=540 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0 * GeV, # has to be 0 !!! - pi_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_ks0_lls( + name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" cuts. ''' - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) # important to get rid of any PID cuts! descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -363,30 +381,34 @@ def make_rd_ks0_lls(name="rd_ks0_lls", @configurable -def make_rd_ks0_dds(name="rd_ks0_dds", - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=420 * MeV, # ~75 MeV window - am_max=570 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_ks0_dds( + name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" 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, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -395,71 +417,88 @@ def make_rd_ks0_dds(name="rd_ks0_dds", @configurable -def make_rd_lambda_lls(name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=1076 * MeV, # ~40 MeV window - am_max=1156 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_lambda_lls( + name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + @configurable -def make_rd_lambda_dds(name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=1050 * MeV, # ~65 MeV window - am_max=1180 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_lambda_dds( + name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -474,32 +513,30 @@ def make_rd_lambda_dds(name="rd_lambda_dds", @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. ''' pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = '[K*(892)0 -> pi- K+]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + 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 - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > kstar0_pt_min) return ParticleCombiner([pions, kaons], name=name, DecayDescriptor=descriptor, @@ -508,15 +545,16 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable -def make_rd_detached_phis(name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_max=1100 * MeV, #min is the di-kaon threshold anyway - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - phi_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_phis( + name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build phi(1020) candidates. Approximately corresponding to the Run2 "StdLooseDetachedPhi2KK" cuts. @@ -524,22 +562,22 @@ def make_rd_detached_phis(name="rd_detached_phis", kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' - combination_code = require_all( - F.MASS < am_max, - F.MAXDOCACHI2CUT(adocachi2cut)) + combination_code = require_all(F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) #pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min) return ParticleCombiner([kaons, kaons], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + #################################### # Dileptons # #################################### + #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -552,4 +590,5 @@ def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @configurable def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): - dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) + dielectrons = make_detached_dielectron_with_brem( + probnn_e=0.05, m_diE_max=max_dielectron_mass) -- GitLab From 731d248038543339f58f46482a5e022a1464a844 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Mon, 27 Sep 2021 19:34:56 +0200 Subject: [PATCH 06/15] fix accidental removal --- .../lines/rd/builders/rdbuilder_thor.py | 276 ++++++++---------- 1 file changed, 121 insertions(+), 155 deletions(-) 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 4c38bdd3567..47afff7c9f0 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -24,24 +24,15 @@ from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilt from PyConf import configurable from Hlt2Conf.standard_particles import ( - make_has_rich_long_pions, - make_has_rich_long_kaons, - make_has_rich_long_protons, - make_long_pions, - make_long_kaons, - make_long_protons, + make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, + make_long_pions, make_long_kaons, make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks - make_down_pions, - make_down_kaons, - make_down_protons, + make_down_pions, make_down_kaons, make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below - make_long_muons, - make_long_electrons_no_brem, - make_photons, - make_resolved_pi0s, - make_merged_pi0s, - make_detached_mumu, - make_detached_dielectron_with_brem) + make_long_muons, make_long_electrons_no_brem, + make_photons, make_resolved_pi0s, make_merged_pi0s, + make_detached_mumu, make_detached_dielectron_with_brem + ) #################################### # Charged hadron selections # @@ -64,8 +55,7 @@ def make_filter_tracks( pid=None): pvs = make_pvs() - code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, - F.GHOSTPROB < trghostprob_max) + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: @@ -77,6 +67,7 @@ def make_filter_tracks( return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) + #################################### # Detached # #################################### @@ -220,8 +211,7 @@ def make_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", - pid=None): #do we really need this one? +def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? """ Return RD down hadrons with pion mass hypothesis. """ @@ -246,7 +236,6 @@ def make_detached_down_pions( p_min=pt_min, pid=pid) - def make_detached_down_kaons( name="rd_detached_down_kaons", mipchi2dvprimary_min=3., #TBC @@ -264,7 +253,6 @@ def make_detached_down_kaons( p_min=pt_min, pid=pid) - def make_detached_down_protons( name="rd_detached_down_protons", mipchi2dvprimary_min=3., #TBC @@ -288,7 +276,6 @@ def make_detached_down_protons( #################################### # builders to be updated once the CL functor is implemented in ThOr. - @configurable def make_rd_photons(name="rd_photons", make_particles=make_photons, @@ -343,36 +330,31 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", # V0 particles and alike # #################################### - @configurable -def make_rd_ks0_lls( - name="rd_ks0_lls", - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=460 * MeV, # ~40 MeV window - am_max=540 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0 * GeV, # has to be 0 !!! - pi_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_ks0_lls(name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" cuts. ''' - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -381,34 +363,30 @@ def make_rd_ks0_lls( @configurable -def make_rd_ks0_dds( - name="rd_ks0_dds", - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=420 * MeV, # ~75 MeV window - am_max=570 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_ks0_dds(name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" 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, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -417,88 +395,71 @@ def make_rd_ks0_dds( @configurable -def make_rd_lambda_lls( - name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=1076 * MeV, # ~40 MeV window - am_max=1156 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_lambda_lls(name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons( - p_min=p_p_min, - pt_min=p_pt_min, - mipchi2dvprimary_min=p_ipchi2_min, - pid=None) # important to get rid of any PID cuts! - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) - @configurable -def make_rd_lambda_dds( - name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=1050 * MeV, # ~65 MeV window - am_max=1180 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_lambda_dds(name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons( - p_min=p_p_min, - pt_min=p_pt_min, - mipchi2dvprimary_min=p_ipchi2_min, - pid=None) # important to get rid of any PID cuts! - pions = make_pions( - p_min=pi_p_min, - pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, - pid=None) + protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), + F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, - F.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min + ) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -513,30 +474,32 @@ def make_rd_lambda_dds( @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. ''' pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) descriptor = '[K*(892)0 -> pi- K+]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) + 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) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > kstar0_pt_min + ) return ParticleCombiner([pions, kaons], name=name, DecayDescriptor=descriptor, @@ -545,16 +508,15 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable -def make_rd_detached_phis( - name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_max=1100 * MeV, #min is the di-kaon threshold anyway - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - phi_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_phis(name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build phi(1020) candidates. Approximately corresponding to the Run2 "StdLooseDetachedPhi2KK" cuts. @@ -562,22 +524,22 @@ def make_rd_detached_phis( kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' - combination_code = require_all(F.MASS < am_max, - F.MAXDOCACHI2CUT(adocachi2cut)) + combination_code = require_all( + F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) #pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min + ) return ParticleCombiner([kaons, kaons], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) - #################################### # Dileptons # #################################### - #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -590,5 +552,9 @@ def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @configurable def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): - dielectrons = make_detached_dielectron_with_brem( - probnn_e=0.05, m_diE_max=max_dielectron_mass) + dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) + code = require_all(F.MASS < max_dielectron_mass) + return ParticleFilter(dielectrons, F.FILTER(code)) + + +# todo : mue with brem -- GitLab From 82288e3f44dbdee2dc8b7340f7222ab5a991eb01 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Mon, 27 Sep 2021 19:50:50 +0200 Subject: [PATCH 07/15] formatting patch --- .../lines/rd/builders/rdbuilder_thor.py | 271 ++++++++++-------- 1 file changed, 155 insertions(+), 116 deletions(-) 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 47afff7c9f0..29828ef0258 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -24,15 +24,24 @@ from Hlt2Conf.algorithms_thor import require_all, ParticleCombiner, ParticleFilt from PyConf import configurable from Hlt2Conf.standard_particles import ( - make_has_rich_long_pions, make_has_rich_long_kaons, make_has_rich_long_protons, - make_long_pions, make_long_kaons, make_long_protons, + make_has_rich_long_pions, + make_has_rich_long_kaons, + make_has_rich_long_protons, + make_long_pions, + make_long_kaons, + make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks - make_down_pions, make_down_kaons, make_down_protons, + make_down_pions, + make_down_kaons, + make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below - make_long_muons, make_long_electrons_no_brem, - make_photons, make_resolved_pi0s, make_merged_pi0s, - make_detached_mumu, make_detached_dielectron_with_brem - ) + make_long_muons, + make_long_electrons_no_brem, + make_photons, + make_resolved_pi0s, + make_merged_pi0s, + make_detached_mumu, + make_detached_dielectron_with_brem) #################################### # Charged hadron selections # @@ -55,7 +64,8 @@ def make_filter_tracks( pid=None): pvs = make_pvs() - code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) + code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, + F.GHOSTPROB < trghostprob_max) return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: @@ -67,7 +77,6 @@ def make_filter_tracks( return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) - #################################### # Detached # #################################### @@ -211,7 +220,8 @@ def make_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? +def make_down_tracks(name="rd_down_tracks", + pid=None): #do we really need this one? """ Return RD down hadrons with pion mass hypothesis. """ @@ -236,6 +246,7 @@ def make_detached_down_pions( p_min=pt_min, pid=pid) + def make_detached_down_kaons( name="rd_detached_down_kaons", mipchi2dvprimary_min=3., #TBC @@ -253,6 +264,7 @@ def make_detached_down_kaons( p_min=pt_min, pid=pid) + def make_detached_down_protons( name="rd_detached_down_protons", mipchi2dvprimary_min=3., #TBC @@ -276,6 +288,7 @@ def make_detached_down_protons( #################################### # builders to be updated once the CL functor is implemented in ThOr. + @configurable def make_rd_photons(name="rd_photons", make_particles=make_photons, @@ -330,31 +343,36 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", # V0 particles and alike # #################################### + @configurable -def make_rd_ks0_lls(name="rd_ks0_lls", - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=460 * MeV, # ~40 MeV window - am_max=540 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0 * GeV, # has to be 0 !!! - pi_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_ks0_lls( + name="rd_ks0_lls", + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=460 * MeV, # ~40 MeV window + am_max=540 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0 * GeV, # has to be 0 !!! + pi_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" cuts. ''' - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) # important to get rid of any PID cuts! descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -363,30 +381,34 @@ def make_rd_ks0_lls(name="rd_ks0_lls", @configurable -def make_rd_ks0_dds(name="rd_ks0_dds", - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=420 * MeV, # ~75 MeV window - am_max=570 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_ks0_dds( + name="rd_ks0_dds", + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=420 * MeV, # ~75 MeV window + am_max=570 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=4, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 "StdVeryLooseKsLL" 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, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -395,71 +417,88 @@ def make_rd_ks0_dds(name="rd_ks0_dds", @configurable -def make_rd_lambda_lls(name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, - make_pvs=make_pvs, - am_min=1076 * MeV, # ~40 MeV window - am_max=1156 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=30.): +def make_rd_lambda_lls( + name="rd_lambda_lls", + make_protons=make_detached_protons, + make_pions=make_detached_pions, + make_pvs=make_pvs, + am_min=1076 * MeV, # ~40 MeV window + am_max=1156 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + @configurable -def make_rd_lambda_dds(name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, - make_pvs=make_pvs, - am_min=1050 * MeV, # ~65 MeV window - am_max=1180 * MeV, - pi_p_min=2 * GeV, - p_p_min=2 * GeV, - p_pt_min=0, # recommended to be 0 - pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, - adocachi2cut=30., - bpvvdchi2_min=4., - vchi2pdof_max=25.): +def make_rd_lambda_dds( + name="rd_lambda_dds", + make_protons=make_detached_down_protons, + make_pions=make_detached_down_pions, + make_pvs=make_pvs, + am_min=1050 * MeV, # ~65 MeV window + am_max=1180 * MeV, + pi_p_min=2 * GeV, + p_p_min=2 * GeV, + p_pt_min=0, # recommended to be 0 + pi_pt_min=0, # has to be 0 !!! + pi_ipchi2_min=6, + p_ipchi2_min=9, + adocachi2cut=30., + bpvvdchi2_min=4., + vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 "StdVeryLooseLambdaLL" cuts. ''' - protons = make_protons(p_min=p_p_min, pt_min=p_pt_min, mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! - pions = make_pions(p_min=pi_p_min, pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=None) + protons = make_protons( + p_min=p_p_min, + pt_min=p_pt_min, + mipchi2dvprimary_min=p_ipchi2_min, + pid=None) # important to get rid of any PID cuts! + pions = make_pions( + p_min=pi_p_min, + pt_min=pi_pt_min, + mipchi2dvprimary_min=pi_ipchi2_min, + pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.BPVFDCHI2(pvs) > bpvvdchi2_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -474,32 +513,30 @@ def make_rd_lambda_dds(name="rd_lambda_dds", @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): + make_detached_pions=make_detached_pions, + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_min=592 * MeV, + am_max=1192 * MeV, + pi_p_min=2 * GeV, + pi_pt_min=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. ''' pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min ) + kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = '[K*(892)0 -> pi- K+]cc' combination_code = require_all( - in_range(am_min, F.MASS, am_max), - F.MAXDOCACHI2CUT(adocachi2cut)) + 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 - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > kstar0_pt_min) return ParticleCombiner([pions, kaons], name=name, DecayDescriptor=descriptor, @@ -508,15 +545,16 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable -def make_rd_detached_phis(name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, - make_pvs=make_pvs, - am_max=1100 * MeV, #min is the di-kaon threshold anyway - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - phi_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_phis( + name="rd_detached_phis", + make_detached_kaons=make_detached_kaons, + make_pvs=make_pvs, + am_max=1100 * MeV, #min is the di-kaon threshold anyway + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + phi_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build phi(1020) candidates. Approximately corresponding to the Run2 "StdLooseDetachedPhi2KK" cuts. @@ -524,22 +562,22 @@ def make_rd_detached_phis(name="rd_detached_phis", kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' - combination_code = require_all( - F.MASS < am_max, - F.MAXDOCACHI2CUT(adocachi2cut)) + combination_code = require_all(F.MASS < am_max, + F.MAXDOCACHI2CUT(adocachi2cut)) #pvs = make_pvs() - vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min - ) + vertex_code = require_all(F.CHI2DOF < vchi2pdof_max, F.PT > phi_pt_min) return ParticleCombiner([kaons, kaons], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, CompositeCut=vertex_code) + #################################### # Dileptons # #################################### + #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -552,7 +590,8 @@ def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @configurable def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): - dielectrons = make_detached_dielectron_with_brem(probnn_e=0.05, m_diE_max = max_dielectron_mass) + dielectrons = make_detached_dielectron_with_brem( + probnn_e=0.05, m_diE_max=max_dielectron_mass) code = require_all(F.MASS < max_dielectron_mass) return ParticleFilter(dielectrons, F.FILTER(code)) -- GitLab From f1b85f15436ffd27f18bd7d581fe42fd0e32f515 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Wed, 29 Sep 2021 09:22:14 +0200 Subject: [PATCH 08/15] apply Renato's comments --- .../python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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 29828ef0258..24ace807f18 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -53,25 +53,21 @@ def make_filter_tracks( make_particles=make_has_rich_long_pions, make_pvs=make_pvs, name="rd_has_rich_long_pions", - pt_min=250. * MeV, #TBC with Reco + pt_min=250. * MeV, p_min=2.0 * GeV, - #p_max=150. * GeV, #propose to move such cuts to the analysis level, can be quite inefficient for certain channels like B->mumu. - #eta_min=2., #same as above - #eta_max=5., #same as above trchi2dof_max=3, #TBC with Reco trghostprob_max=0.4, #TBC with Reco mipchi2dvprimary_min=None, pid=None): - pvs = make_pvs() code = require_all(F.PT > pt_min, F.P > p_min, F.CHI2DOF < trchi2dof_max, F.GHOSTPROB < trghostprob_max) - return ParticleFilter(make_particles(), F.FILTER(code)) if pid is not None: code &= pid if mipchi2dvprimary_min is not None: + pvs = make_pvs() code &= F.MINIPCHI2(pvs) > mipchi2dvprimary_min return ParticleFilter(make_particles(), name=name, Cut=F.FILTER(code)) @@ -577,7 +573,6 @@ def make_rd_detached_phis( # Dileptons # #################################### - #Take the standard detached dileptons, filter with an MVA and save the necessary related tracks @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): -- GitLab From 28d3f7252a9e39c644922026620f91ee759ac69a Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Wed, 29 Sep 2021 11:46:50 +0200 Subject: [PATCH 09/15] add tau builder; fix D tracks --- .../lines/rd/builders/rdbuilder_thor.py | 91 +++++++++++++++---- 1 file changed, 72 insertions(+), 19 deletions(-) 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 24ace807f18..71ff0f9e325 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -12,7 +12,7 @@ Definition of RD builders for ThOr framework. For now does not use any MVA tools as they are not ThOr-friendly. """ -from GaudiKernel.SystemOfUnits import GeV, MeV +from GaudiKernel.SystemOfUnits import GeV, MeV, mm from RecoConf.reconstruction_objects import make_pvs_v2 as make_pvs @@ -227,7 +227,7 @@ def make_down_tracks(name="rd_down_tracks", def make_detached_down_pions( name="rd_detached_down_pions", - mipchi2dvprimary_min=3., #TBC + #mipchi2dvprimary_min=3., #this does not work pt_min=0. * MeV, p_min=0 * GeV, pid=None): @@ -237,7 +237,7 @@ def make_detached_down_pions( return make_filter_tracks( make_particles=make_down_pions, name=name, - mipchi2dvprimary_min=mipchi2dvprimary_min, + #mipchi2dvprimary_min=mipchi2dvprimary_min, pt_min=pt_min, p_min=pt_min, pid=pid) @@ -245,7 +245,7 @@ def make_detached_down_pions( def make_detached_down_kaons( name="rd_detached_down_kaons", - mipchi2dvprimary_min=3., #TBC + #mipchi2dvprimary_min=3., #TBC pt_min=0. * MeV, p_min=0 * GeV, pid=None): @@ -255,7 +255,7 @@ def make_detached_down_kaons( return make_filter_tracks( make_particles=make_down_kaons, name=name, - mipchi2dvprimary_min=mipchi2dvprimary_min, + #mipchi2dvprimary_min=mipchi2dvprimary_min, pt_min=pt_min, p_min=pt_min, pid=pid) @@ -263,7 +263,7 @@ def make_detached_down_kaons( def make_detached_down_protons( name="rd_detached_down_protons", - mipchi2dvprimary_min=3., #TBC + #mipchi2dvprimary_min=3., #TBC pt_min=0. * MeV, p_min=0 * GeV, pid=None): @@ -273,7 +273,7 @@ def make_detached_down_protons( return make_filter_tracks( make_particles=make_down_protons, name=name, - mipchi2dvprimary_min=mipchi2dvprimary_min, + #mipchi2dvprimary_min=mipchi2dvprimary_min, pt_min=pt_min, p_min=pt_min, pid=pid) @@ -326,11 +326,6 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", cl_min=0): """For the time being just a dummy selection""" - # code = require_all('PT > {pt_min}', 'P > {p_min}').format( - # pt_min=pt_min, p_min=p_min) - # - # return ParticleFilter(make_particles(), Code=code, name=name) - code = require_all(F.PT > pt_min, ) return ParticleFilter(make_particles(), F.FILTER(code), name=name) @@ -385,7 +380,7 @@ def make_rd_ks0_dds( am_max=570 * MeV, pi_p_min=2 * GeV, pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=4, + #pi_ipchi2_min=4, adocachi2cut=30., bpvvdchi2_min=4., vchi2pdof_max=25.): @@ -397,7 +392,7 @@ def make_rd_ks0_dds( pions = make_pions( p_min=pi_p_min, pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, + #mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = 'KS0 -> pi+ pi-' combination_code = require_all( @@ -469,8 +464,8 @@ def make_rd_lambda_dds( p_p_min=2 * GeV, p_pt_min=0, # recommended to be 0 pi_pt_min=0, # has to be 0 !!! - pi_ipchi2_min=6, - p_ipchi2_min=9, + #pi_ipchi2_min=6, + #p_ipchi2_min=9, adocachi2cut=30., bpvvdchi2_min=4., vchi2pdof_max=25.): @@ -482,12 +477,12 @@ def make_rd_lambda_dds( protons = make_protons( p_min=p_p_min, pt_min=p_pt_min, - mipchi2dvprimary_min=p_ipchi2_min, + #mipchi2dvprimary_min=p_ipchi2_min, pid=None) # important to get rid of any PID cuts! pions = make_pions( p_min=pi_p_min, pt_min=pi_pt_min, - mipchi2dvprimary_min=pi_ipchi2_min, + #mipchi2dvprimary_min=pi_ipchi2_min, pid=None) descriptor = '[Lambda0 -> p+ pi-]cc' combination_code = require_all( @@ -573,7 +568,7 @@ def make_rd_detached_phis( # Dileptons # #################################### -#Take the standard detached dileptons, filter with an MVA and save the necessary related tracks + @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): @@ -592,3 +587,61 @@ def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): # todo : mue with brem + +#################################### +# Tau builders # +#################################### + + +@configurable +def make_rd_tauons_hadronic_decay( + name="rd_tauons_hadronic_decay", + make_pions=make_detached_pions, + descriptor="[tau+ -> pi+ pi- pi+]cc", + pi_pt_min=150 * MeV, + pi_ipchi2_min=4.0, + pi_pid=(F.PID_K < 8.), + best_pi_pt_min=300 * MeV, + best_pi_ipchi2_min=5, + pt_max=300 * MeV, + am_min=400 * MeV, + am_max=3500 * MeV, + make_pvs=make_pvs, + adoca_max=0.15 * mm, + am_2pi_max=1670 * MeV, + vchi2pdof_max=25, + bpvdira_min=0.99, +): + ''' + Build tau->3pi candidates. Approximately corresponding to the Run2 + "StdLooseDetachedTau" cuts. + ''' + + pions = make_pions( + pt_min=pi_pt_min, mipchi2dvprimary_min=pi_ipchi2_min, pid=pi_pid) + + combination12_code = require_all( + F.MASS < am_2pi_max, + F.DOCA(1, 2) < adoca_max, + ) + + pvs = make_pvs() + combination_code = require_all( + in_range(am_min, F.MASS, am_max), + F.DOCA(1, 3) < adoca_max, + F.DOCA(2, 3) < adoca_max, + F.SUM(F.PT > best_pi_pt_min) > 1, + F.SUM(F.MINIPCHI2(pvs) > best_pi_ipchi2_min) > 1, + ) + #TODO: add the M23<1670 cut once this is possible. + vertex_code = require_all( + in_range(am_min, F.MASS, am_max), + F.CHI2DOF < vchi2pdof_max, + F.BPVDIRA(pvs) > bpvdira_min, + ) + return ParticleCombiner([pions, pions, pions], + name=name, + DecayDescriptor=descriptor, + Combination12Cut=combination12_code, + CombinationCut=combination_code, + CompositeCut=vertex_code) -- GitLab From c4e95544d6e3433019e67659d921eedd68df6888 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 10:49:53 +0200 Subject: [PATCH 10/15] fix the order of particles in descriptors --- .../Hlt2Conf/lines/rd/builders/rdbuilder_thor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 71ff0f9e325..725592ff318 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration # +# (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". # @@ -523,12 +523,12 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) - descriptor = '[K*(892)0 -> pi- K+]cc' + 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) - return ParticleCombiner([pions, kaons], + return ParticleCombiner([kaons, pions], name=name, DecayDescriptor=descriptor, CombinationCut=combination_code, @@ -597,7 +597,7 @@ def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): def make_rd_tauons_hadronic_decay( name="rd_tauons_hadronic_decay", make_pions=make_detached_pions, - descriptor="[tau+ -> pi+ pi- pi+]cc", + descriptor="[tau+ -> pi- pi+ pi+]cc", pi_pt_min=150 * MeV, pi_ipchi2_min=4.0, pi_pid=(F.PID_K < 8.), @@ -633,7 +633,7 @@ def make_rd_tauons_hadronic_decay( F.SUM(F.PT > best_pi_pt_min) > 1, F.SUM(F.MINIPCHI2(pvs) > best_pi_ipchi2_min) > 1, ) - #TODO: add the M23<1670 cut once this is possible. + #TODO: add the M13<1670 cut once this is possible. vertex_code = require_all( in_range(am_min, F.MASS, am_max), F.CHI2DOF < vchi2pdof_max, -- GitLab From 75cefab9a7b078913241e9ebc0487bc3e6f216c4 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 12:25:39 +0200 Subject: [PATCH 11/15] small fixes --- .../lines/rd/builders/rdbuilder_thor.py | 71 ++++++++++--------- 1 file changed, 37 insertions(+), 34 deletions(-) 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 725592ff318..e947f244e98 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -79,7 +79,8 @@ def make_filter_tracks( @configurable -def make_detached_tracks(name="rd_detached_tracks", mipchi2dvprimary_min=3.): +def make_rd_detached_tracks(name="rd_detached_tracks", + mipchi2dvprimary_min=3.): """ Return RD detached tracks. """ @@ -90,7 +91,7 @@ def make_detached_tracks(name="rd_detached_tracks", mipchi2dvprimary_min=3.): @configurable -def make_detached_muons( +def make_rd_detached_muons( name="rd_detached_muons", mipchi2dvprimary_min=3., #TBC pid=(F.PID_MU > 0.)): @@ -105,7 +106,7 @@ def make_detached_muons( @configurable -def make_detached_electrons( +def make_rd_detached_electrons( name="rd_detached_electrons", mipchi2dvprimary_min=3., #TBC pid=(F.PID_E > 0.)): @@ -120,7 +121,7 @@ def make_detached_electrons( @configurable -def make_detached_pions( +def make_rd_detached_pions( name="rd_detached_pions", p_min=2 * GeV, pt_min=250 * MeV, @@ -139,7 +140,7 @@ def make_detached_pions( @configurable -def make_detached_kaons( +def make_rd_detached_kaons( name="rd_detached_kaons", p_min=2 * GeV, pt_min=250 * MeV, @@ -150,7 +151,7 @@ def make_detached_kaons( """ return make_filter_tracks( name=name, - make_particles=make_long_kaons, + make_particles=make_has_rich_long_kaons, p_min=p_min, pt_min=pt_min, mipchi2dvprimary_min=mipchi2dvprimary_min, @@ -158,7 +159,7 @@ def make_detached_kaons( @configurable -def make_detached_protons( +def make_rd_detached_protons( name="rd_detached_protons", p_min=8.5 * GeV, pt_min=250 * MeV, @@ -169,7 +170,7 @@ def make_detached_protons( """ return make_filter_tracks( name=name, - make_particles=make_long_protons, + make_particles=make_has_rich_long_protons, p_min=p_min, pt_min=pt_min, mipchi2dvprimary_min=mipchi2dvprimary_min, @@ -182,7 +183,7 @@ def make_detached_protons( @configurable -def make_prompt_pions(name="rd_prompt_pions", pid=(F.PID_K < 0.)): +def make_rd_prompt_pions(name="rd_prompt_pions", pid=(F.PID_K < 0.)): """ Return RD prompt pions. """ @@ -191,7 +192,7 @@ def make_prompt_pions(name="rd_prompt_pions", pid=(F.PID_K < 0.)): @configurable -def make_prompt_kaons(name="rd_prompt_kaons", pid=(F.PID_K > 0.)): +def make_rd_prompt_kaons(name="rd_prompt_kaons", pid=(F.PID_K > 0.)): """ Return RD prompt kaons. """ @@ -200,9 +201,9 @@ def make_prompt_kaons(name="rd_prompt_kaons", pid=(F.PID_K > 0.)): @configurable -def make_prompt_protons(name="rd_prompt_protons", - p_min=10. * GeV, - pid=(F.PID_P > 0.)): +def make_rd_prompt_protons(name="rd_prompt_protons", + p_min=10. * GeV, + pid=(F.PID_P > 0.)): """ Return RD prompt protons. """ @@ -219,20 +220,20 @@ def make_prompt_protons(name="rd_prompt_protons", def make_down_tracks(name="rd_down_tracks", pid=None): #do we really need this one? """ - Return RD down hadrons with pion mass hypothesis. + Return RD downstream hadrons with pion mass hypothesis. """ return make_filter_tracks( make_particles=make_down_pions, name=name, pid=pid) -def make_detached_down_pions( +def make_rd_detached_down_pions( name="rd_detached_down_pions", #mipchi2dvprimary_min=3., #this does not work pt_min=0. * MeV, p_min=0 * GeV, pid=None): """ - Return RD down hadrons with pion mass hypothesis. + Return RD downstream hadrons with pion mass hypothesis. """ return make_filter_tracks( make_particles=make_down_pions, @@ -243,14 +244,14 @@ def make_detached_down_pions( pid=pid) -def make_detached_down_kaons( +def make_rd_detached_down_kaons( name="rd_detached_down_kaons", #mipchi2dvprimary_min=3., #TBC pt_min=0. * MeV, p_min=0 * GeV, pid=None): """ - Return RD down hadrons with kaon mass hypothesis. + Return RD downstream hadrons with kaon mass hypothesis. """ return make_filter_tracks( make_particles=make_down_kaons, @@ -261,14 +262,14 @@ def make_detached_down_kaons( pid=pid) -def make_detached_down_protons( +def make_rd_detached_down_protons( name="rd_detached_down_protons", #mipchi2dvprimary_min=3., #TBC pt_min=0. * MeV, p_min=0 * GeV, pid=None): """ - Return RD down hadrons with proton mass hypothesis. + Return RD downstream hadrons with proton mass hypothesis. """ return make_filter_tracks( make_particles=make_down_protons, @@ -338,7 +339,7 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", @configurable def make_rd_ks0_lls( name="rd_ks0_lls", - make_pions=make_detached_pions, + make_pions=make_rd_detached_pions, make_pvs=make_pvs, am_min=460 * MeV, # ~40 MeV window am_max=540 * MeV, @@ -374,7 +375,7 @@ def make_rd_ks0_lls( @configurable def make_rd_ks0_dds( name="rd_ks0_dds", - make_pions=make_detached_down_pions, + make_pions=make_rd_detached_down_pions, make_pvs=make_pvs, am_min=420 * MeV, # ~75 MeV window am_max=570 * MeV, @@ -410,8 +411,8 @@ def make_rd_ks0_dds( @configurable def make_rd_lambda_lls( name="rd_lambda_lls", - make_protons=make_detached_protons, - make_pions=make_detached_pions, + make_protons=make_rd_detached_protons, + make_pions=make_rd_detached_pions, make_pvs=make_pvs, am_min=1076 * MeV, # ~40 MeV window am_max=1156 * MeV, @@ -455,8 +456,8 @@ def make_rd_lambda_lls( @configurable def make_rd_lambda_dds( name="rd_lambda_dds", - make_protons=make_detached_down_protons, - make_pions=make_detached_down_pions, + make_protons=make_rd_detached_down_protons, + make_pions=make_rd_detached_down_pions, make_pvs=make_pvs, am_min=1050 * MeV, # ~65 MeV window am_max=1180 * MeV, @@ -504,8 +505,8 @@ def make_rd_lambda_dds( @configurable def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_detached_pions=make_detached_pions, - make_detached_kaons=make_detached_kaons, + make_rd_detached_pions=make_rd_detached_pions, + make_rd_detached_kaons=make_rd_detached_kaons, make_pvs=make_pvs, am_min=592 * MeV, am_max=1192 * MeV, @@ -521,8 +522,8 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", "StdVeryLooseDetachedKstar" cuts. ''' - pions = make_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) + pions = make_rd_detached_pions(p_min=pi_p_min, pt_min=pi_pt_min) + kaons = make_rd_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = '[K*(892)0 -> K+ pi-]cc' combination_code = require_all( in_range(am_min, F.MASS, am_max), F.MAXDOCACHI2CUT(adocachi2cut)) @@ -538,7 +539,7 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable def make_rd_detached_phis( name="rd_detached_phis", - make_detached_kaons=make_detached_kaons, + make_rd_detached_kaons=make_rd_detached_kaons, make_pvs=make_pvs, am_max=1100 * MeV, #min is the di-kaon threshold anyway k_p_min=2 * GeV, @@ -551,7 +552,7 @@ def make_rd_detached_phis( "StdLooseDetachedPhi2KK" cuts. ''' - kaons = make_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) + kaons = make_rd_detached_kaons(p_min=k_p_min, pt_min=k_pt_min) descriptor = 'phi(1020) -> K+ K-' combination_code = require_all(F.MASS < am_max, F.MAXDOCACHI2CUT(adocachi2cut)) @@ -572,7 +573,9 @@ def make_rd_detached_phis( @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): - dimuons = make_detached_mumu(probnn_mu=0.05, pt_mu=150 * MeV) + dimuons = make_detached_mumu( + probnn_mu=0.0, + pt_mu=150 * MeV) # I think the ProbNN does not work properly atm code = require_all(F.MASS < max_dimuon_mass) return ParticleFilter(dimuons, F.FILTER(code)) @@ -596,7 +599,7 @@ def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): @configurable def make_rd_tauons_hadronic_decay( name="rd_tauons_hadronic_decay", - make_pions=make_detached_pions, + make_pions=make_rd_detached_pions, descriptor="[tau+ -> pi- pi+ pi+]cc", pi_pt_min=150 * MeV, pi_ipchi2_min=4.0, -- GitLab From fc2c6d77944d09a2f13c78c7345d1e0bedbaae55 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 12:31:39 +0200 Subject: [PATCH 12/15] unusaed imports --- .../python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 e947f244e98..f9392f83187 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -28,8 +28,8 @@ from Hlt2Conf.standard_particles import ( make_has_rich_long_kaons, make_has_rich_long_protons, make_long_pions, - make_long_kaons, - make_long_protons, + #make_long_kaons, + #make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks make_down_pions, make_down_kaons, -- GitLab From 9049cfd6a88a10665f7ebfe84776e4b4ebe13d3f Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 14:00:31 +0200 Subject: [PATCH 13/15] separate the builders with/without hasRich requirement so that we don't require hasRich on tracks from V0 --- .../lines/rd/builders/rdbuilder_thor.py | 138 ++++++++++++------ 1 file changed, 97 insertions(+), 41 deletions(-) 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 f9392f83187..076e39a7169 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -28,15 +28,15 @@ from Hlt2Conf.standard_particles import ( make_has_rich_long_kaons, make_has_rich_long_protons, make_long_pions, - #make_long_kaons, - #make_long_protons, + make_long_kaons, + make_long_protons, #make_has_rich_down_pions, make_has_rich_down_kaons, make_has_rich_down_protons, # we don't usually need RICH info in fact for D tracks make_down_pions, make_down_kaons, make_down_protons, #make_KsLL, make_KsDD, make_LambdaLL, make_LambdaDD, # we build our own versions below make_long_muons, - make_long_electrons_no_brem, + make_long_electrons_with_brem, make_photons, make_resolved_pi0s, make_merged_pi0s, @@ -77,17 +77,16 @@ def make_filter_tracks( # Detached # #################################### - -@configurable -def make_rd_detached_tracks(name="rd_detached_tracks", - mipchi2dvprimary_min=3.): - """ - Return RD detached tracks. - """ - return make_filter_tracks( - name=name, - make_particles=make_long_pions, - mipchi2dvprimary_min=mipchi2dvprimary_min) +# @configurable +# def make_rd_detached_tracks(name="rd_detached_tracks", +# mipchi2dvprimary_min=3.): +# """ +# Return RD detached tracks. +# """ +# return make_filter_tracks( +# name=name, +# make_particles=make_long_pions, +# mipchi2dvprimary_min=mipchi2dvprimary_min) @configurable @@ -96,7 +95,7 @@ def make_rd_detached_muons( mipchi2dvprimary_min=3., #TBC pid=(F.PID_MU > 0.)): """ - Return RD detached pions. + Return RD detached muons. """ return make_filter_tracks( name=name, @@ -111,11 +110,11 @@ def make_rd_detached_electrons( mipchi2dvprimary_min=3., #TBC pid=(F.PID_E > 0.)): """ - Return RD detached pions. + Return RD detached electrons with brem recovery. """ return make_filter_tracks( name=name, - make_particles=make_long_electrons_no_brem, + make_particles=make_long_electrons_with_brem, mipchi2dvprimary_min=mipchi2dvprimary_min, pid=pid) @@ -126,7 +125,7 @@ def make_rd_detached_pions( p_min=2 * GeV, pt_min=250 * MeV, mipchi2dvprimary_min=3., #TBC - pid=(F.PID_K <= 0.)): + pid=(F.PID_K <= 2.)): """ Return RD detached pions. """ @@ -145,13 +144,13 @@ def make_rd_detached_kaons( p_min=2 * GeV, pt_min=250 * MeV, mipchi2dvprimary_min=3., #TBC - pid=(F.PID_K > 0.)): + pid=(F.PID_K > -2.)): """ Return RD detached kaons. """ return make_filter_tracks( name=name, - make_particles=make_has_rich_long_kaons, + make_particles=make_long_kaons, p_min=p_min, pt_min=pt_min, mipchi2dvprimary_min=mipchi2dvprimary_min, @@ -161,13 +160,71 @@ def make_rd_detached_kaons( @configurable def make_rd_detached_protons( name="rd_detached_protons", - p_min=8.5 * GeV, + p_min=2. * GeV, pt_min=250 * MeV, mipchi2dvprimary_min=3., #TBC - pid=(F.PID_P > 0.)): + pid=(F.PID_P > -2.)): """ Return RD detached protons. """ + return make_filter_tracks( + name=name, + make_particles=make_long_protons, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_rd_has_rich_detached_pions( + name="rd_has_rich_detached_pions", + p_min=2 * GeV, + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_K <= 0.)): + """ + Return RD detached pions with hasRich. + """ + return make_filter_tracks( + name=name, + make_particles=make_has_rich_long_pions, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_rd_has_rich_detached_kaons( + name="rd_has_rich_detached_kaons", + p_min=2 * GeV, + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=(F.PID_K > 0.)): + """ + Return RD detached kaons with hasRich. + """ + return make_filter_tracks( + name=name, + make_particles=make_has_rich_long_kaons, + p_min=p_min, + pt_min=pt_min, + mipchi2dvprimary_min=mipchi2dvprimary_min, + pid=pid) + + +@configurable +def make_rd_has_rich_detached_protons( + name="rd_has_rich_detached_protons", + p_min=8.5 * + GeV, #kaon RICH threshold below which we have no p-K separation + pt_min=250 * MeV, + mipchi2dvprimary_min=3., #TBC + pid=require_all(F.PID_P > 0., F.PID_P - F.PID_K > -2.)): + """ + Return RD detached protons with hasRich. + """ return make_filter_tracks( name=name, make_particles=make_has_rich_long_protons, @@ -294,7 +351,7 @@ def make_rd_photons(name="rd_photons", e_min=0 * MeV): """For the time being just a dummy selection""" - code = require_all(F.PT > et_min) + code = F.PT > et_min return ParticleFilter(make_particles(), F.FILTER(code), name=name) @@ -327,7 +384,7 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", cl_min=0): """For the time being just a dummy selection""" - code = require_all(F.PT > pt_min, ) + code = F.PT > pt_min return ParticleFilter(make_particles(), F.FILTER(code), name=name) @@ -504,19 +561,20 @@ def make_rd_lambda_dds( @configurable -def make_rd_detached_kstar0s(name="rd_detached_kstar0s", - make_rd_detached_pions=make_rd_detached_pions, - make_rd_detached_kaons=make_rd_detached_kaons, - make_pvs=make_pvs, - am_min=592 * MeV, - am_max=1192 * MeV, - pi_p_min=2 * GeV, - pi_pt_min=100 * MeV, - k_p_min=2 * GeV, - k_pt_min=100 * MeV, - kstar0_pt_min=400 * MeV, - adocachi2cut=30., - vchi2pdof_max=25): +def make_rd_detached_kstar0s( + name="rd_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=100 * MeV, + k_p_min=2 * GeV, + k_pt_min=100 * MeV, + kstar0_pt_min=400 * MeV, + adocachi2cut=30., + vchi2pdof_max=25): ''' Build Kstar0 candidates. Approximately corresponding to the Run2 "StdVeryLooseDetachedKstar" cuts. @@ -539,7 +597,7 @@ def make_rd_detached_kstar0s(name="rd_detached_kstar0s", @configurable def make_rd_detached_phis( name="rd_detached_phis", - make_rd_detached_kaons=make_rd_detached_kaons, + make_rd_detached_kaons=make_rd_has_rich_detached_kaons, make_pvs=make_pvs, am_max=1100 * MeV, #min is the di-kaon threshold anyway k_p_min=2 * GeV, @@ -573,9 +631,7 @@ def make_rd_detached_phis( @configurable def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): - dimuons = make_detached_mumu( - probnn_mu=0.0, - pt_mu=150 * MeV) # I think the ProbNN does not work properly atm + dimuons = make_detached_mumu(probnn_mu=0.0, pt_mu=150 * MeV) code = require_all(F.MASS < max_dimuon_mass) return ParticleFilter(dimuons, F.FILTER(code)) -- GitLab From 605546b11059d3e4d978cb8a753dc865a77ee2b6 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 15:35:47 +0200 Subject: [PATCH 14/15] placeholder for V0 BPVLTIME cuts --- .../lines/rd/builders/rdbuilder_thor.py | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) 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 076e39a7169..c92821afe49 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -12,7 +12,7 @@ Definition of RD builders for ThOr framework. For now does not use any MVA tools as they are not ThOr-friendly. """ -from GaudiKernel.SystemOfUnits import GeV, MeV, mm +from GaudiKernel.SystemOfUnits import GeV, MeV, mm, ps from RecoConf.reconstruction_objects import make_pvs_v2 as make_pvs @@ -274,13 +274,13 @@ def make_rd_prompt_protons(name="rd_prompt_protons", #################################### # Downstream tracks # #################################### -def make_down_tracks(name="rd_down_tracks", - pid=None): #do we really need this one? - """ - Return RD downstream hadrons with pion mass hypothesis. - """ - return make_filter_tracks( - make_particles=make_down_pions, name=name, pid=pid) +# def make_down_tracks(name="rd_down_tracks", +# pid=None): #do we really need this one? +# """ +# Return RD downstream hadrons with pion mass hypothesis. +# """ +# return make_filter_tracks( +# make_particles=make_down_pions, name=name, pid=pid) def make_rd_detached_down_pions( @@ -391,6 +391,7 @@ def make_rd_merged_pi0s(name="rd_merged_pi0s", #################################### # V0 particles and alike # #################################### +# they are in principle defined in the Hlt2 standard_particles, however there is no way to tune IPCHI2 cuts on their children with the current ThOr framework. @configurable @@ -405,6 +406,7 @@ def make_rd_ks0_lls( pi_ipchi2_min=9, adocachi2cut=30., bpvvdchi2_min=4., + bpvltime_min=1 * ps, vchi2pdof_max=30.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 @@ -420,8 +422,10 @@ def make_rd_ks0_lls( 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.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all( + F.CHI2DOF < vchi2pdof_max, + #F.BPVLTIME(pvs) > bpvltime_min, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -441,6 +445,7 @@ def make_rd_ks0_dds( #pi_ipchi2_min=4, adocachi2cut=30., bpvvdchi2_min=4., + bpvltime_min=1 * ps, vchi2pdof_max=25.): ''' Build Long-Long KS0 candidates. Approximately corresponding to the Run2 @@ -456,8 +461,10 @@ def make_rd_ks0_dds( 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.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all( + F.CHI2DOF < vchi2pdof_max, + #F.BPVLTIME(pvs) > bpvltime_min, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([pions, pions], name=name, DecayDescriptor=descriptor, @@ -481,6 +488,7 @@ def make_rd_lambda_lls( p_ipchi2_min=9, adocachi2cut=30., bpvvdchi2_min=4., + bpvltime_min=1 * ps, vchi2pdof_max=30.): ''' Build Long-Long Lambda candidates. Approximately corresponding to the Run2 @@ -501,8 +509,10 @@ def make_rd_lambda_lls( 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.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all( + F.CHI2DOF < vchi2pdof_max, + #F.BPVLTIME(pvs) > bpvltime_min, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -526,6 +536,7 @@ def make_rd_lambda_dds( #p_ipchi2_min=9, adocachi2cut=30., bpvvdchi2_min=4., + bpvltime_min=1 * ps, vchi2pdof_max=25.): ''' Build Down-Down Lambda candidates. Approximately corresponding to the Run2 @@ -546,8 +557,10 @@ def make_rd_lambda_dds( 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.BPVFDCHI2(pvs) > bpvvdchi2_min) + vertex_code = require_all( + F.CHI2DOF < vchi2pdof_max, + #F.BPVLTIME(pvs) > bpvltime_min, + F.BPVFDCHI2(pvs) > bpvvdchi2_min) return ParticleCombiner([protons, pions], name=name, DecayDescriptor=descriptor, @@ -594,6 +607,7 @@ def make_rd_detached_kstar0s( CompositeCut=vertex_code) +# this is in principle defined in the Hlt2 standard_particles, however there is no way to provide IPCHI2 cuts on the kaons within the current ThOr framework. @configurable def make_rd_detached_phis( name="rd_detached_phis", -- GitLab From 23d1c01d75149405bd29d0246aac3c42f21eec67 Mon Sep 17 00:00:00 2001 From: Vitalii Lisovskyi <Vitalii Lisovskyi vitalii.lisovskyi@cern.ch> Date: Thu, 30 Sep 2021 15:49:35 +0200 Subject: [PATCH 15/15] add mue combinations --- .../lines/rd/builders/rdbuilder_thor.py | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) 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 c92821afe49..bce8cb7b84b 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rdbuilder_thor.py @@ -41,7 +41,8 @@ from Hlt2Conf.standard_particles import ( make_resolved_pi0s, make_merged_pi0s, make_detached_mumu, - make_detached_dielectron_with_brem) + make_detached_dielectron_with_brem, + make_detached_mue_with_brem) #################################### # Charged hadron selections # @@ -643,23 +644,33 @@ def make_rd_detached_phis( @configurable -def filter_dimuon_noMVA(max_dimuon_mass=6000 * MeV): +def filter_dimuon_noMVA(probnn_mu=0.0, max_dimuon_mass=6000 * MeV): - dimuons = make_detached_mumu(probnn_mu=0.0, pt_mu=150 * MeV) + dimuons = make_detached_mumu(probnn_mu=probnn_mu, pt_mu=150 * MeV) code = require_all(F.MASS < max_dimuon_mass) return ParticleFilter(dimuons, F.FILTER(code)) @configurable -def filter_dielectron_noMVA(max_dielectron_mass=6000 * MeV): +def filter_dielectron_noMVA(probnn_e=0.05, max_dielectron_mass=6000 * MeV): dielectrons = make_detached_dielectron_with_brem( - probnn_e=0.05, m_diE_max=max_dielectron_mass) + probnn_e=probnn_e, m_diE_max=max_dielectron_mass) code = require_all(F.MASS < max_dielectron_mass) return ParticleFilter(dielectrons, F.FILTER(code)) -# todo : mue with brem +@configurable +def filter_mue_noMVA(max_dilepton_mass=6000 * MeV, + min_probnn_mu=0.0, + min_PIDe=2., + same_sign=False): + + dileptons = make_detached_mue_with_brem( + min_probnn_mu=min_probnn_mu, min_PIDe=min_PIDe, same_sign=same_sign) + code = require_all(F.MASS < max_dilepton_mass) + return ParticleFilter(dileptons, F.FILTER(code)) + #################################### # Tau builders # -- GitLab