diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/__init__.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/__init__.py index e379b94f0fea9e7f16ceda2bb140ee24ae330c54..002e81102d50da536ad211a8568316fbf95af2bf 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/__init__.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/__init__.py @@ -30,6 +30,7 @@ from . import hlt2_btosmutau_exclusive from . import hlt2_btostautau_exclusive from . import bu_to_xll from . import bu_to_xll_sprucing +from . import rad_incl # provide "all_lines" for correct registration by the overall HLT2 lines module all_lines = {} @@ -50,6 +51,7 @@ all_lines.update(b_to_kstarmumu.all_lines) all_lines.update(hlt2_btosmutau_exclusive.all_lines) all_lines.update(hlt2_btostautau_exclusive.all_lines) all_lines.update(bu_to_xll.all_lines) +all_lines.update(rad_incl.all_lines) sprucing_lines = {} sprucing_lines.update(spruce_beauty2xtaul.sprucing_lines) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma.py deleted file mode 100644 index e7fd603400865c958e5ab2c245846fab803eb2c7..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma.py +++ /dev/null @@ -1,97 +0,0 @@ -############################################################################### -# (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 B->HHgamma HLT2 line. - -Final states built are (omitting intermediate resonances): - - 1. B0 -> K+ K- gamma - 2. [B+ -> K+ KS0 gamma]cc - 3. [B+ -> K+ Lambda0 gamma]cc - 4. [B+ -> K+ Lambda~0 gamma]cc - -This line first combines 2 hadrons, where at least one of them must be charged. -The result is combined with a high-pt photon to build a B candidate. -The b candidates are then given to a BDT to further reduce the output rate. -These radiative inclusive lines are inclusive in the sense that no PID is used -when selecting the hadrons, and no mass requirements are applied either to the -K*, D*, or B candidates -""" -from __future__ import absolute_import -from Moore.config import HltLine, register_line_builder -from Hlt2Conf.standard_particles import ( - make_KsDD, - make_KsLL, - make_LambdaDD, - make_LambdaLL, - make_long_kaons, - make_merged_pi0s, - make_photons, - make_resolved_pi0s, -) -from Hlt2Conf.algorithms import ParticleContainersMerger -from RecoConf.reconstruction_objects import make_pvs, upfront_reconstruction - -from .builders import ( - basic_builder, - hh_builder, - b_builder, - b_tmva_builder, - radinclusive_extra_outputs, -) - -all_lines = {} - - -@register_line_builder(all_lines) -def btohhgamma_inclusive_line(name="Hlt2BToHHGamma_Inclusive_Line", - prescale=1): - pvs = make_pvs() - - charged_hadrons = basic_builder.filter_basic_hadrons( - make_long_kaons(), pvs) - Ks0_LL = basic_builder.filter_neutral_hadrons(make_KsLL(), pvs) - Ks0_DD = basic_builder.filter_neutral_hadrons(make_KsDD(), pvs) - Ks0 = ParticleContainersMerger([Ks0_LL, Ks0_DD]) - Lambda_LL = basic_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) - Lambda_DD = basic_builder.filter_neutral_hadrons(make_LambdaDD(), pvs) - Lambda = ParticleContainersMerger([Lambda_LL, Lambda_DD]) - photons = basic_builder.filter_photons(make_photons(), pvs) - - kstars = hh_builder.make_hh([charged_hadrons, Ks0, Lambda], pvs, [ - "K*(892)0 -> K+ K-", "[K*(892)+ -> K+ KS0]cc", - "[K*(892)+ -> Lambda0 K+]cc", "[K*(892)- -> Lambda0 K-]cc" - ]) - presel_b = b_builder.make_presel_b( - kstars, photons, pvs, - ["B0 -> K*(892)0 gamma", "[B+ -> K*(892)+ gamma]cc"]) - b = b_tmva_builder.make_b(presel_b, pvs, "HHgamma", 0.18) - - return HltLine( - name=name, - algs=upfront_reconstruction() + [b], - extra_outputs=[ - ("ExtraHadron", radinclusive_extra_outputs.charged_hadrons()), - ("ExtraKs0LL", - radinclusive_extra_outputs.neutral_hadrons(make_KsLL())), - ("ExtraKs0DD", - radinclusive_extra_outputs.neutral_hadrons(make_KsDD())), - ("ExtraLambdaLL", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaLL())), - ("ExtraLambdaDD", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaDD())), - ("ExtraGamma", radinclusive_extra_outputs.gamma()), - ("ExtraPi0Merged", - radinclusive_extra_outputs.pi0(make_merged_pi0s())), - ("ExtraPi0Resolved", - radinclusive_extra_outputs.pi0(make_resolved_pi0s())), - ], - prescale=prescale, - ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma_gamma_to_ee.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma_gamma_to_ee.py deleted file mode 100644 index 8e8866493f3114fd25dcccbb2f8f8b7a80f7f269..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhgamma_gamma_to_ee.py +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################### -# (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 B->HHgammaEE HLT2 line. - -Final states built are (omitting intermediate resonances): - - 1. B0 -> K+ K- (gamma -> e+ e-) - 2. [B+ -> K+ KS0 (gamma -> e+ e-)]cc - 3. [B+ -> K+ Lambda0 (gamma -> e+ e-)]cc - 4. [B+ -> K+ Lambda~0 (gamma -> e+ e-)]cc - -This line first combines 2 hadrons, where at least one of them must be charged. -The result is combined with a "converted" photon, which is built from an -electron-positron pair with small invariant mass, to build a B candidate. -The b candidates are then given to a BDT to further reduce the output rate. -These radiative inclusive lines are inclusive in the sense that no PID is used -when selecting the hadrons, and no mass requirements are applied either to the -K*, D*, or B candidates -""" -from __future__ import absolute_import -from Moore.config import HltLine, register_line_builder -from Hlt2Conf.standard_particles import ( - make_long_electrons_no_brem, - make_KsDD, - make_KsLL, - make_LambdaDD, - make_LambdaLL, - make_long_kaons, - make_merged_pi0s, - make_resolved_pi0s, -) -from Hlt2Conf.algorithms import ParticleContainersMerger -from RecoConf.reconstruction_objects import make_pvs, upfront_reconstruction - -from .builders import ( - basic_builder, - gamma_ee_builder, - hh_builder, - b_builder, - b_tmva_builder, - radinclusive_extra_outputs, -) - -all_lines = {} - - -@register_line_builder(all_lines) -def btohhgammaee_inclusive_line(name="Hlt2BToHHGammaEE_Inclusive_Line", - prescale=1): - pvs = make_pvs() - - electrons = basic_builder.filter_electrons(make_long_electrons_no_brem(), - pvs) - charged_hadrons = basic_builder.filter_basic_hadrons( - make_long_kaons(), pvs) - Ks0_LL = basic_builder.filter_neutral_hadrons(make_KsLL(), pvs) - Ks0_DD = basic_builder.filter_neutral_hadrons(make_KsDD(), pvs) - Ks0 = ParticleContainersMerger([Ks0_LL, Ks0_DD]) - Lambda_LL = basic_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) - Lambda_DD = basic_builder.filter_neutral_hadrons(make_LambdaDD(), pvs) - Lambda = ParticleContainersMerger([Lambda_LL, Lambda_DD]) - photons = gamma_ee_builder.make_gamma_ee(electrons, pvs) - - kstars = hh_builder.make_hh([charged_hadrons, Ks0, Lambda], pvs, [ - "K*(892)0 -> K+ K-", "[K*(892)+ -> K+ KS0]cc", - "[K*(892)+ -> Lambda0 K+]cc", "[K*(892)- -> Lambda0 K-]cc" - ]) - presel_b = b_builder.make_presel_b( - kstars, photons, pvs, - ["B0 -> K*(892)0 gamma", "[B+ -> K*(892)+ gamma]cc"]) - b = b_tmva_builder.make_b(presel_b, pvs, "HHgammaEE", 0.084) - - return HltLine( - name=name, - algs=upfront_reconstruction() + [b], - extra_outputs=[ - ("ExtraHadron", radinclusive_extra_outputs.charged_hadrons()), - ("ExtraKs0LL", - radinclusive_extra_outputs.neutral_hadrons(make_KsLL())), - ("ExtraKs0DD", - radinclusive_extra_outputs.neutral_hadrons(make_KsDD())), - ("ExtraLambdaLL", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaLL())), - ("ExtraLambdaDD", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaDD())), - ("ExtraGamma", radinclusive_extra_outputs.gamma()), - ("ExtraPi0Merged", - radinclusive_extra_outputs.pi0(make_merged_pi0s())), - ("ExtraPi0Resolved", - radinclusive_extra_outputs.pi0(make_resolved_pi0s())), - ], - prescale=prescale, - ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma.py deleted file mode 100644 index 334704a1879bb66fb444da94da8d5528e503bf23..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma.py +++ /dev/null @@ -1,121 +0,0 @@ -############################################################################### -# (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 B->HHHgamma HLT2 line. - -Final states built are (omitting intermediate resonances): - - 1. [B+ -> (K+ K-) K+ gamma]cc - 2. B0 -> (K+ K-) KS0 gamma - 3. [B0 -> (K+ K-) Lambda0 gamma]cc - 4. [B+ -> (K+ KS0) KS0 gamma]cc - 5. [B+ -> (K+ KS0) Lambda0 gamma]cc - 6. [B+ -> (K+ KS0) Lambda~0 gamma]cc - 7. [B+ -> (Lambda0 K+) KS0 gamma]cc (same final state as 5.) - 8. [B+ -> (Lambda0 K+) Lambda0 gamma]cc - 9. [B+ -> (Lambda0 K+) Lambda~0 gamma]cc - 10. [B+ -> (Lambda~0 K+) KS0 gamma]cc (same final state as 6.) - 11. [B+ -> (Lambda~0 K+) Lambda0 gamma]cc (same final state as 9.) - 12. [B+ -> (Lambda~0 K+) Lambda~0 gamma]cc - -This line first combines 2 hadrons in the same manner as the HHgamma lines, -where at least one of them must be charged. -The result is combined with a 3rd hadron, which is always neutral except when -the 2-hadron system is (K+ K-) in order to avoid repeating final states. -However, we allow repeating final states when two neutrals are present to keep -the list of combinations simpler. -The result is combined with a high-pt photon to build a B candidate. -The b candidates are then given to a BDT to further reduce the output rate. -These radiative inclusive lines are inclusive in the sense that no PID is used -when selecting the hadrons, and no mass requirements are applied either to the -K*, D*, or B candidates -""" -from __future__ import absolute_import -from Moore.config import HltLine, register_line_builder -from Hlt2Conf.standard_particles import ( - make_KsDD, - make_KsLL, - make_LambdaDD, - make_LambdaLL, - make_long_kaons, - make_merged_pi0s, - make_photons, - make_resolved_pi0s, -) -from Hlt2Conf.algorithms import ParticleContainersMerger -from RecoConf.reconstruction_objects import make_pvs, upfront_reconstruction - -from .builders import ( - basic_builder, - hh_builder, - hhh_builder, - b_builder, - b_tmva_builder, - radinclusive_extra_outputs, -) - -all_lines = {} - - -@register_line_builder(all_lines) -def btohhhgamma_inclusive_line(name="Hlt2BToHHHGamma_Inclusive_Line", - prescale=1): - pvs = make_pvs() - - charged_hadrons = basic_builder.filter_basic_hadrons( - make_long_kaons(), pvs) - Ks0_LL = basic_builder.filter_neutral_hadrons(make_KsLL(), pvs) - Ks0_DD = basic_builder.filter_neutral_hadrons(make_KsDD(), pvs) - Ks0 = ParticleContainersMerger([Ks0_LL, Ks0_DD]) - Lambda_LL = basic_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) - Lambda_DD = basic_builder.filter_neutral_hadrons(make_LambdaDD(), pvs) - Lambda = ParticleContainersMerger([Lambda_LL, Lambda_DD]) - last_charged_hadrons = basic_builder.filter_third_hadrons( - make_long_kaons(), pvs) - photons = basic_builder.filter_photons(make_photons(), pvs) - kstars = hh_builder.make_hh([charged_hadrons, Ks0, Lambda], pvs, [ - "K*(892)0 -> K+ K-", "[K*(892)+ -> K+ KS0]cc", - "[K*(892)+ -> Lambda0 K+]cc", "[K*(892)- -> Lambda0 K-]cc" - ]) - - dstars = hhh_builder.make_hhh( - [kstars, last_charged_hadrons, Ks0, Lambda], pvs, [ - 'D*(2010)+ -> K*(892)0 K+', 'D*(2010)- -> K*(892)0 K-', - 'D*(2007)0 -> K*(892)0 KS0', 'D*(2007)0 -> K*(892)0 Lambda0', - 'D*(2007)~0 -> K*(892)0 Lambda~0', '[D*(2010)+ -> K*(892)+ KS0]cc', - '[D*(2010)+ -> K*(892)+ Lambda0]cc', - '[D*(2010)+ -> K*(892)+ Lambda~0]cc' - ]) - presel_b = b_builder.make_presel_b( - dstars, photons, pvs, - ["[B+ -> D*(2010)+ gamma]cc", "[B0 -> D*(2007)0 gamma]cc"]) - b = b_tmva_builder.make_b(presel_b, pvs, "HHHgamma", 0.116) - - return HltLine( - name=name, - algs=upfront_reconstruction() + [b], - extra_outputs=[ - ("ExtraHadron", radinclusive_extra_outputs.charged_hadrons()), - ("ExtraKs0LL", - radinclusive_extra_outputs.neutral_hadrons(make_KsLL())), - ("ExtraKs0DD", - radinclusive_extra_outputs.neutral_hadrons(make_KsDD())), - ("ExtraLambdaLL", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaLL())), - ("ExtraLambdaDD", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaDD())), - ("ExtraGamma", radinclusive_extra_outputs.gamma()), - ("ExtraPi0Merged", - radinclusive_extra_outputs.pi0(make_merged_pi0s())), - ("ExtraPi0Resolved", - radinclusive_extra_outputs.pi0(make_resolved_pi0s())), - ], - prescale=prescale, - ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma_gamma_to_ee.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma_gamma_to_ee.py deleted file mode 100644 index 5ce56bcef60768e42d17a814e9422426d3d63203..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_hhhgamma_gamma_to_ee.py +++ /dev/null @@ -1,126 +0,0 @@ -############################################################################### -# (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 B->HHHgammaEE HLT2 line. - -Final states built are (omitting intermediate resonances): - - 1. [B+ -> (K+ K-) K+ (gamma -> e+ e-)]cc - 2. B0 -> (K+ K-) KS0 (gamma -> e+ e-) - 3. [B0 -> (K+ K-) Lambda0 (gamma -> e+ e-)]cc - 4. [B+ -> (K+ KS0) KS0 (gamma -> e+ e-)]cc - 5. [B+ -> (K+ KS0) Lambda0 (gamma -> e+ e-)]cc - 6. [B+ -> (K+ KS0) Lambda~0 (gamma -> e+ e-)]cc - 7. [B+ -> (Lambda0 K+) KS0 (gamma -> e+ e-)]cc (same final state as 5.) - 8. [B+ -> (Lambda0 K+) Lambda0 (gamma -> e+ e-)]cc - 9. [B+ -> (Lambda0 K+) Lambda~0 (gamma -> e+ e-)]cc - 10. [B+ -> (Lambda~0 K+) KS0 (gamma -> e+ e-)]cc (same final state as 6.) - 11. [B+ -> (Lambda~0 K+) Lambda0 (gamma -> e+ e-)]cc (same final state as 9.) - 12. [B+ -> (Lambda~0 K+) Lambda~0 (gamma -> e+ e-)]cc - -This line first combines 2 hadrons in the same manner as the HHgamma lines, -where at least one of them must be charged. -The result is combined with a 3rd hadron, which is always neutral except when -the 2-hadron system is (K+ K-) in order to avoid repeating final states. -However, we allow repeating final states when two neutrals are present to keep -the list of combinations simpler. -The result is combined with a "converted" photon, which is built from an -electron-positron pair with small invariant mass, to build a B candidate. -The b candidates are then given to a BDT to further reduce the output rate. -These radiative inclusive lines are inclusive in the sense that no PID is used -when selecting the hadrons, and no mass requirements are applied either to the -K*, D*, or B candidates -""" -from __future__ import absolute_import -from Moore.config import HltLine, register_line_builder -from Hlt2Conf.standard_particles import ( - make_long_electrons_no_brem, - make_KsDD, - make_KsLL, - make_LambdaDD, - make_LambdaLL, - make_long_kaons, - make_merged_pi0s, - make_resolved_pi0s, -) -from Hlt2Conf.algorithms import ParticleContainersMerger -from RecoConf.reconstruction_objects import make_pvs, upfront_reconstruction - -from .builders import ( - basic_builder, - gamma_ee_builder, - hh_builder, - hhh_builder, - b_builder, - b_tmva_builder, - radinclusive_extra_outputs, -) - -all_lines = {} - - -@register_line_builder(all_lines) -def btohhhgammaee_inclusive_line(name="Hlt2BToHHHGammaEE_Inclusive_Line", - prescale=1): - pvs = make_pvs() - electrons = basic_builder.filter_electrons(make_long_electrons_no_brem(), - pvs) - - charged_hadrons = basic_builder.filter_basic_hadrons( - make_long_kaons(), pvs) - Ks0_LL = basic_builder.filter_neutral_hadrons(make_KsLL(), pvs) - Ks0_DD = basic_builder.filter_neutral_hadrons(make_KsDD(), pvs) - Ks0 = ParticleContainersMerger([Ks0_LL, Ks0_DD]) - Lambda_LL = basic_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) - Lambda_DD = basic_builder.filter_neutral_hadrons(make_LambdaDD(), pvs) - Lambda = ParticleContainersMerger([Lambda_LL, Lambda_DD]) - last_charged_hadrons = basic_builder.filter_third_hadrons( - make_long_kaons(), pvs) - photons = gamma_ee_builder.make_gamma_ee(electrons, pvs) - kstars = hh_builder.make_hh([charged_hadrons, Ks0, Lambda], pvs, [ - "K*(892)0 -> K+ K-", "[K*(892)+ -> K+ KS0]cc", - "[K*(892)+ -> Lambda0 K+]cc", "[K*(892)- -> Lambda0 K-]cc" - ]) - - dstars = hhh_builder.make_hhh( - [kstars, last_charged_hadrons, Ks0, Lambda], pvs, [ - 'D*(2010)+ -> K*(892)0 K+', 'D*(2010)- -> K*(892)0 K-', - 'D*(2007)0 -> K*(892)0 KS0', 'D*(2007)0 -> K*(892)0 Lambda0', - 'D*(2007)~0 -> K*(892)0 Lambda~0', '[D*(2010)+ -> K*(892)+ KS0]cc', - '[D*(2010)+ -> K*(892)+ Lambda0]cc', - '[D*(2010)+ -> K*(892)+ Lambda~0]cc' - ]) - - presel_b = b_builder.make_presel_b( - dstars, photons, pvs, - ["[B+ -> D*(2010)+ gamma]cc", "[B0 -> D*(2007)0 gamma]cc"]) - b = b_tmva_builder.make_b(presel_b, pvs, "HHHgammaEE", 0.05) - - return HltLine( - name=name, - algs=upfront_reconstruction() + [b], - extra_outputs=[ - ("ExtraHadron", radinclusive_extra_outputs.charged_hadrons()), - ("ExtraKs0LL", - radinclusive_extra_outputs.neutral_hadrons(make_KsLL())), - ("ExtraKs0DD", - radinclusive_extra_outputs.neutral_hadrons(make_KsDD())), - ("ExtraLambdaLL", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaLL())), - ("ExtraLambdaDD", - radinclusive_extra_outputs.neutral_hadrons(make_LambdaDD())), - ("ExtraGamma", radinclusive_extra_outputs.gamma()), - ("ExtraPi0Merged", - radinclusive_extra_outputs.pi0(make_merged_pi0s())), - ("ExtraPi0Resolved", - radinclusive_extra_outputs.pi0(make_resolved_pi0s())), - ], - prescale=prescale, - ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_majolep_majo_to_leppi.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_majolep_majo_to_leppi.py index 162b39a68e0cf170cba12823575129a41453cfbe..80db7bfa33db36a6fcf401f6c727091bf6beac7e 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_majolep_majo_to_leppi.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/b_to_majolep_majo_to_leppi.py @@ -9,10 +9,10 @@ # or submit itself to any jurisdiction. # ############################################################################### """ -This defines HLT2 lines for B+(-)/B_c+(-) -> mu/e(+/-) N, N-> e/mu pi, where N is a neutral lepton +This defines HLT2 lines for B+(-)/B_c+(-) -> mu/e(+/-) N, N-> e/mu pi, where N is a neutral lepton And a normalisation line for B+ -> pi+ KS0, where KS0 -> pi+pi- -Both same sign lepton and opposite sign lepton are included due to the KS0 descriptor being independent of the lepton signs. -N has no lifetime hypothesis applied. Combination of the neutral lepton daugthers is limited between 200(to cut conversion)-7000 MeV +Both same sign lepton and opposite sign lepton are included due to the KS0 descriptor being independent of the lepton signs. +N has no lifetime hypothesis applied. Combination of the neutral lepton daugthers is limited between 200(to cut conversion)-7000 MeV All leptons from B are Long. Daughters of the neutral lepton can be both Long and Downstream. Loose and Tight lines have a different PID cut looseness on pions and electrons. Note, PID_E is applied to pions too, so there is a need for a no_brem added calibration. Tight lines will hopefully have raw event information saved, specifically tracking infor. @@ -35,10 +35,6 @@ Hlt2RD_BuToKs0Pi_Ks0ToPiPi_DD_Line: B+ -> pi KS0 (->pipi) DD line Contact: Lera Lukashenko, valeriia.lukashenko@cern.ch -TO DO: - - basic_builder depends on LoKi and is to be removed, all lines must be updated accordingly - - when standard_particles ported to ThOr, only make_pvs should be used - """ from Moore.config import register_line_builder from Moore.lines import Hlt2Line @@ -51,7 +47,7 @@ from Hlt2Conf.standard_particles import ( from RecoConf.reconstruction_objects import make_pvs -from Hlt2Conf.lines.rd.builders import basic_builder +from Hlt2Conf.lines.rd.builders import rad_incl_builder from Hlt2Conf.lines.rd.builders.majorana_builder import make_majorana_lepton, make_majorana, make_bhadron_majorana from Hlt2Conf.lines.rd.builders.rd_prefilters import rd_prefilter import Functors as F @@ -441,8 +437,9 @@ def BuToKs0Pi_Ks0ToPiPi_LL_line(name="Hlt2RD_BuToKs0Pi_Ks0ToPiPi_LL_Line", pvs=pvs, pt_min=700 * MeV, pid=(F.PID_E <= 0.)) - Ks2pipi = basic_builder.filter_neutral_hadrons(make_KsLL_fromSV(), - make_pvs()) + #Here change to make_pvs_v2 when rad_incl_builders are in thor + Ks2pipi = rad_incl_builder.filter_neutral_hadrons(make_KsLL_fromSV(), + make_pvs()) b2Ks0Pi = make_bhadron_majorana( name='B2KsPi_LL', @@ -471,8 +468,8 @@ def BuToKs0Pi_Ks0ToPiPi_DD_line(name="Hlt2RD_BuToKs0Pi_Ks0ToPiPi_DD_Line", pvs=pvs, pt_min=700 * MeV, pid=(F.PID_E <= 0.)) - Ks2pipi = basic_builder.filter_neutral_hadrons(make_KsDD_fromSV(), - make_pvs()) + Ks2pipi = rad_incl_builder.filter_neutral_hadrons(make_KsDD_fromSV(), + make_pvs()) b2Ks0Pi = make_bhadron_majorana( name='B2KsPi_DD', diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_builder.py deleted file mode 100644 index e9ee14b71bde5241d34bb9787f614722a20a5133..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_builder.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################### -# (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 inclusive_radiative_b b builder -""" -from GaudiKernel.SystemOfUnits import GeV -from Hlt2Conf.algorithms import require_all, ParticleCombinerWithPVs -from PyConf import configurable - - -@configurable -def make_presel_b(kstars, - photons, - pvs, - descriptors, - apt_min=2.0 * GeV, - vtx_chi2_max=1000., - eta_min=2., - eta_max=5., - corrm_min=1.0 * GeV, - corrm_max=11.0 * GeV, - dira_min=0., - bpvvdchi2_min=0.): - """Builds B->X gamma for inclusive_radiative_b selection""" - combination_code = require_all("APT > {apt_min}", - "AM < {corrm_max}").format( - apt_min=apt_min, corrm_max=corrm_max) - - vertex_code = require_all( - "HASVERTEX", "CHI2VXNDOF < {vtx_chi2_max}", - "in_range({eta_min}, BPVETA(), {eta_max})", - "in_range({corrm_min}, BPVCORRM(), {corrm_max})", - "BPVDIRA() > {dira_min}", "BPVVDCHI2() > {bpvvdchi2_min}").format( - vtx_chi2_max=vtx_chi2_max, - eta_min=eta_min, - eta_max=eta_max, - corrm_min=corrm_min, - corrm_max=corrm_max, - dira_min=dira_min, - bpvvdchi2_min=bpvvdchi2_min) - - return ParticleCombinerWithPVs( - particles=[kstars, photons], - pvs=pvs, - DecayDescriptors=descriptors, - CombinationCut=combination_code, - MotherCut=vertex_code) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_tmva_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_tmva_builder.py index 4ce594fe2ecfbf5f22270d3270b76d6e2c98a6ac..3265bc0026d2dbf6b430c470383643034d994ced 100644 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_tmva_builder.py +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/b_tmva_builder.py @@ -10,83 +10,88 @@ ############################################################################### """Definition of inclusive_radiative_b b TMVA selections (BDT) """ -from Hlt2Conf.algorithms import ParticleFilterWithTMVA from PyConf import configurable -hhg_vars = { - "ipchi2": - "log10(BPVIPCHI2())", - 'ipchi2_min': - "log10(MINTREE(BPVIPCHI2(), ((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0'))))", - 'gamma_pt': - "CHILD(2, PT)", - 'm_corrected': - "BPVCORRM()", - 'vm_corrected': - "CHILD(1, BPVCORRM())", - 'fdchi2': - "log10(BPVVDCHI2())", - 'vtx_chi2': - "log10(VFASPF(VCHI2))", - 'doca': - "CHILD(1, DOCA(1,2))" -} +import Functors as F +from Functors.math import log +from Hlt2Conf.algorithms_thor import ParticleFilter, require_all +from GaudiKernel.SystemOfUnits import GeV -hhgee_vars = { - 'mcor': - "BPVCORRM()", - 'chi2': - "VFASPF(VCHI2)", - 'sumpt': - "SUMTREE(PT, ((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')), 0.0)/MeV", - 'eta': - "BPVETA()", - 'fdchi2': - "BPVVDCHI2()", - 'minpt': - "MINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')), PT)/MeV", - 'nlt16': - "NINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')) & (BPVIPCHI2() < 16))", - 'ipchi2': - "BPVIPCHI2()", - 'n1trk': - "NINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')) & (PT > 1*GeV) & (BPVIPCHI2() > 16))" -} -hhhg_vars = { - 'ipchi2': - "log10(BPVIPCHI2())", - 'ipchi2_min': - "log10(MINTREE(BPVIPCHI2(), ((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0'))))", - 'gamma_pt': - "CHILD(2, PT)", - 'gamma_p': - "CHILD(2, P)", - 'm_corrected': - "BPVCORRM()", - 'fdchi2': - "log10(BPVVDCHI2())", - 'vtx_chi2': - "log10(VFASPF(VCHI2))", - 'chi2dof_max': - "MAXTREE(TRCHI2DOF, ISBASIC & HASTRACK & (ABSID=='K+'))" -} +@configurable +def make_b2(presel_b, pvs, name, bdt_cut, filter_name="rd_rad_incl_B"): + def sum_finalstates_hh(functor): + return F.CHILD(1, F.SUM(functor)) + F.CHILD(2, functor), -hhhgee_vars = hhgee_vars + def sum_finalstates_hhh(functor): + return F.CHILD(1, F.CHILD(1, (F.SUM(functor)))) + F.CHILD( + 1, F.CHILD(2, functor)) + F.CHILD(2, functor) -bdt_vars = { - "HHgamma": hhg_vars, - "HHgammaEE": hhgee_vars, - "HHHgamma": hhhg_vars, - "HHHgammaEE": hhhgee_vars -} + #TODO this should be log10, or change the BDT + hhg_vars_thor = { + "ipchi2": log(F.BPVIPCHI2(pvs)) / log(10), + 'ipchi2_min': log(F.CHILD(1, F.MIN(F.BPVIPCHI2(pvs)))) / log(10), + 'gamma_pt': F.CHILD(2, F.PT), + 'm_corrected': F.BPVCORRM(pvs), + 'vm_corrected': F.CHILD(1, F.BPVCORRM(pvs)), + 'fdchi2': log(F.BPVFDCHI2(pvs)) / log(10), + 'vtx_chi2': log(F.CHI2) / log(10), + 'doca': F.CHILD(1, F.DOCA(1, 2)) + } + hhgee_vars_thor = { + 'mcor': F.BPVCORRM(pvs), + 'chi2': F.CHI2, + 'sumpt': sum_finalstates_hh(F.PT), + 'eta': F.BPVETA(pvs), + 'fdchi2': F.BPVFDCHI2(pvs), + 'minpt': F.ALL(), + # "MINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')), PT)/MeV", # TODO + 'nlt16': sum_finalstates_hh(F.BPVIPCHI2(pvs) < 16), + 'ipchi2': F.BPVIPCHI2(pvs), + 'n1trk': sum_finalstates_hh((F.PT > 1 * GeV) & (F.BPVIPCHI2(pvs) > 16)) + } + #TODO this should be log10, or change the BDT + hhhg_vars_thor = { + 'ipchi2': log(F.BPVIPCHI2(pvs)) / log(10), + 'ipchi2_min': F.ALL(), + # "log10(MINTREE(BPVIPCHI2(), ((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0'))))", # TODO + 'gamma_pt': F.CHILD(2, F.PT), + 'gamma_p': F.CHILD(2, F.P), + 'm_corrected': F.BPVCORRM(pvs), + 'fdchi2': log(F.BPVFDCHI2(pvs)) / log(10), + 'vtx_chi2': log(F.CHI2) / log(10), + 'chi2dof_max': F.ALL(), + # "MAXTREE(TRCHI2DOF, ISBASIC & HASTRACK & (ABSID=='K+'))" # TODO + } -@configurable -def make_b(presel_b, pvs, name, bdt_cut): - mva_name = '{name}MVA'.format(name=name) - mva_code = "VALUE('LoKi::Hybrid::DictValue/{mva_name}') > {bdt_cut}".format( - bdt_cut=bdt_cut, mva_name=mva_name) - xml_file = 'paramfile://data/Hlt2_Radiative_{name}.xml'.format(name=name) - return ParticleFilterWithTMVA(name, presel_b, pvs, mva_code, mva_name, - xml_file, bdt_vars[name]) + hhhgee_vars_thor = { + 'mcor': F.BPVCORRM(pvs), + 'chi2': F.CHI2, + 'sumpt': sum_finalstates_hhh(F.PT), + 'eta': F.BPVETA(pvs), + 'fdchi2': F.BPVFDCHI2(pvs), + 'minpt': F.ALL(), + # "MINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')|(ABSID=='gamma')), PT)/MeV", # TODO + 'nlt16': sum_finalstates_hhh(F.BPVIPCHI2(pvs) < 16), + 'ipchi2': F.BPVIPCHI2(pvs), + 'n1trk': + sum_finalstates_hhh((F.PT > 1 * GeV) & (F.BPVIPCHI2(pvs) > 16)) + } + + bdt_vars_thor = { + "HHgamma": hhg_vars_thor, + "HHgammaEE": hhgee_vars_thor, + "HHHgamma": hhhg_vars_thor, + "HHHgammaEE": hhhgee_vars_thor + } + + code = require_all( + F.MVA( + MVAType='TMVA', + Config={ + 'XMLFile': 'paramfile://data/Hlt2_Radiative_%s.xml' % name, + 'Name': 'BDT', + }, + Inputs=bdt_vars_thor[name]) > bdt_cut) + return ParticleFilter(presel_b, F.FILTER(code), name=filter_name) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/basic_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/basic_builder.py deleted file mode 100644 index 3585d757459221251e0518f611bf358d4bf6bcbf..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/basic_builder.py +++ /dev/null @@ -1,127 +0,0 @@ -############################################################################### -# (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 inclusive_radiative_b basic particles: hadrons, photons, electrons -""" -import math -from Hlt2Conf.algorithms import require_all, ParticleFilterWithPVs -from GaudiKernel.SystemOfUnits import GeV -from PyConf import configurable - - -@configurable -def filter_electrons(particles, pvs, pt_min=0.1 * GeV): - """Returns electrons for inclusive_radiative_b selection """ - code = require_all("PT > {pt_min}").format(pt_min=pt_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_photons(particles, pvs, pt_min=2.0 * GeV, p_min=5.0 * GeV): - """Returns photons for inclusive_radiative_b selection""" - code = require_all("PT > {pt_min}", "P > {p_min}").format( - pt_min=pt_min, p_min=p_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_basic_hadrons( - particles, - pvs, - pt_min=1.0 * GeV, - pt_max=25.0 * GeV, - ipchi2_min=7.4, - trchi2_max=2.5, - trgp_max=0.2, - param1=1.0, - param2=1.0, - param3=1.1, -): - """Returns basic hadrons with the inclusive_radiative_b selections""" - log_ipchi2_min = math.log(ipchi2_min) - difficult_cut = require_all( - "in_range({pt_min}, PT, {pt_max})", - "log(BPVIPCHI2()) > ({param1} / ((PT / GeV - {param2}) ** 2) + ({param3} / {pt_max}) * ({pt_max} - PT) + {log_ipchi2_min})", - ) - code = require_all( - "TRCHI2DOF < {trchi2_max}", - "TRGHOSTPROB < {trgp_max}", - "((PT > {pt_max}) & (BPVIPCHI2() > {ipchi2_min})) | (" + difficult_cut - + ")", - ).format( - pt_min=pt_min, - pt_max=pt_max, - ipchi2_min=ipchi2_min, - log_ipchi2_min=log_ipchi2_min, - trchi2_max=trchi2_max, - trgp_max=trgp_max, - param1=param1, - param2=param2, - param3=param3, - ) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_third_hadrons(particles, - pvs, - pt_min=0.2 * GeV, - p_min=3.0 * GeV, - trchi2_max=3.0, - ipchi2_min=4.0): - """Returns third hadron used in HHH inclusive_radiative_b selections""" - code = require_all( - "PT > {pt_min}", - "P > {p_min}", - "TRCHI2DOF < {trchi2_max}", - "MIPCHI2DV(PRIMARY) > {ipchi2_min}", - ).format( - pt_min=pt_min, - p_min=p_min, - trchi2_max=trchi2_max, - ipchi2_min=ipchi2_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_extra_charged_hadrons(particles, - pvs, - pt_min=0.8 * GeV, - trchi2_max=2.5, - trgp_max=0.2, - ipchi2_min=8.0): - """Returns extra charged hadrons with the inclusive_radiative_b selections""" - code = require_all( - "PT > {pt_min}", - "TRGHOSTPROB < {trgp_max}", - "TRCHI2DOF < {trchi2_max}", - "MIPCHI2DV(PRIMARY) > {ipchi2_min}", - ).format( - pt_min=pt_min, - trchi2_max=trchi2_max, - trgp_max=trgp_max, - ipchi2_min=ipchi2_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_neutral_hadrons(particles, pvs, pt_min=0.5 * GeV, ipchi2_min=0.0): - """Returns extra neutral hadrons with the inclusive_radiative_b selections""" - code = require_all("PT > {pt_min}", - "MIPCHI2DV(PRIMARY) > {ipchi2_min}").format( - pt_min=pt_min, ipchi2_min=ipchi2_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) - - -@configurable -def filter_pi0(particles, pvs, pt_min=1.6 * GeV): - """Returns extra pi0s for inclusive_radiative_b selection""" - code = require_all("PT > {pt_min}").format(pt_min=pt_min) - return ParticleFilterWithPVs(particles, pvs, Code=code) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/gamma_ee_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/gamma_ee_builder.py deleted file mode 100644 index 4b9453d66d8e274a7699d22f6787e990fbaddb6a..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/gamma_ee_builder.py +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################### -# (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 inclusive_radiative_b gamma->ee builder -""" -from GaudiKernel.SystemOfUnits import GeV, MeV -from Hlt2Conf.algorithms import require_all, ParticleCombinerWithPVs -from PyConf import configurable - - -@configurable -def make_gamma_ee(electrons, - pvs, - apt_min=1.5 * GeV, - ap_min=0.0 * GeV, - am_max=50.0 * MeV): - - combination_code = require_all("APT > {apt_min}", "AM < {am_max}", - "AP > {ap_min}").format( - apt_min=apt_min, - am_max=am_max, - ap_min=ap_min) - - vertex_code = require_all("ALL") - - return ParticleCombinerWithPVs( - particles=[electrons], - pvs=pvs, - DecayDescriptors=["gamma -> e+ e-"], - CombinationCut=combination_code, - MotherCut=vertex_code) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hh_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hh_builder.py deleted file mode 100644 index c53ba4e4197df57a19b12eabc3d9a511851759ec..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hh_builder.py +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################### -# (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 HH builder for inclusive_radiative_b selections -""" -from Hlt2Conf.algorithms import require_all, ParticleCombinerWithPVs -from GaudiKernel.SystemOfUnits import GeV -from PyConf import configurable - - -@configurable -def make_hh(hadrons, - pvs, - descriptors, - apt_min=2.0 * GeV, - num_neutral_tracks_max=2, - doca_chi2_max=1000., - am_max=10.0 * GeV, - mipchi2dv_max=16., - num_charged_tracks_max=2, - vtx_chi2_max=1000., - bpvvdchi2_min=16., - eta_min=2., - eta_max=5.): - """Builds two-hadron particle for inclusive_radiative_b""" - combination_code = require_all( - "APT > {apt_min}", - "ANUM((ID=='KS0')|(ABSID=='Lambda0')) < {num_neutral_tracks_max}", - "ACUTDOCACHI2({doca_chi2_max}, '')", "AM < {am_max}", - "ANUM((ABSID=='K+') & (MIPCHI2DV(PRIMARY) < {mipchi2dv_max})) < {num_charged_tracks_max}" - ).format( - apt_min=apt_min, - num_neutral_tracks_max=num_neutral_tracks_max, - doca_chi2_max=doca_chi2_max, - am_max=am_max, - mipchi2dv_max=mipchi2dv_max, - num_charged_tracks_max=num_charged_tracks_max) - - vertex_code = require_all( - "HASVERTEX", "VFASPF(VCHI2) < {vtx_chi2_max}", - "BPVVDCHI2() > {bpvvdchi2_min}", - "in_range({eta_min}, BPVETA(), {eta_max})").format( - vtx_chi2_max=vtx_chi2_max, - bpvvdchi2_min=bpvvdchi2_min, - eta_min=eta_min, - eta_max=eta_max) - - return ParticleCombinerWithPVs( - particles=hadrons, - pvs=pvs, - DecayDescriptors=descriptors, - CombinationCut=combination_code, - MotherCut=vertex_code) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hhh_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hhh_builder.py deleted file mode 100644 index ceca0bfbb8b1a97ac10e38ed19947891ed2d11a6..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/hhh_builder.py +++ /dev/null @@ -1,61 +0,0 @@ -############################################################################### -# (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 (HH)H builder for inclusive_radiative_b selections. -""" -from Hlt2Conf.algorithms import require_all, ParticleCombinerWithPVs -from GaudiKernel.SystemOfUnits import GeV -from PyConf import configurable - - -@configurable -def make_hhh(particles, - pvs, - descriptors, - apt_min=2.0 * GeV, - num_neutral_tracks_max=2, - doca_chi2_max=1000., - am_max=10.0 * GeV, - mipchi2dv_max=16., - vtx_chi2_max=1000., - bpvvdchi2_min=16., - eta_min=2., - eta_max=5., - dira_min=0.): - """Builds HHH particle as HH + H for inclusive_radiative_b""" - combination_code = require_all( - "APT > {apt_min}", - "ANUM((ID=='KS0')|(ABSID=='Lambda0')) < {num_neutral_tracks_max}", - "ACUTDOCACHI2({doca_chi2_max}, '')", "AM < {am_max}", - "(ACHILD(NINTREE(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')", - "MIPCHI2DV(PRIMARY) < {mipchi2dv_max})),1)+ANUM(((ABSID=='K+')|(ID=='KS0')|(ABSID=='Lambda0')", - "MIPCHI2DV(PRIMARY) < {mipchi2dv_max}))) < 2").format( - apt_min=apt_min, - num_neutral_tracks_max=num_neutral_tracks_max, - doca_chi2_max=doca_chi2_max, - am_max=am_max, - mipchi2dv_max=mipchi2dv_max) - - vertex_code = require_all("HASVERTEX", "VFASPF(VCHI2) < {vtx_chi2_max}", - "BPVVDCHI2() > {bpvvdchi2_min}", - "in_range({eta_min}, BPVETA(), {eta_max})", - "BPVDIRA() > {dira_min}").format( - vtx_chi2_max=vtx_chi2_max, - bpvvdchi2_min=bpvvdchi2_min, - eta_min=eta_min, - eta_max=eta_max, - dira_min=dira_min) - - return ParticleCombinerWithPVs( - particles=particles, - pvs=pvs, - DecayDescriptors=descriptors, - CombinationCut=combination_code, - MotherCut=vertex_code) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rad_incl_builder.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rad_incl_builder.py new file mode 100644 index 0000000000000000000000000000000000000000..ce9c7df7d3598b32f0ce4c61027904d13805f534 --- /dev/null +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/rad_incl_builder.py @@ -0,0 +1,406 @@ +############################################################################### +# (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 radiative inclusive builders +""" + +import math +import Functors as F +from Functors.math import in_range, log + +from Hlt2Conf.algorithms import ParticleContainersMerger +from Hlt2Conf.algorithms_thor import ( + require_all, + ParticleFilter, + ParticleCombiner, +) +from Hlt2Conf.standard_particles import make_long_kaons, make_photons +from RecoConf.reconstruction_objects import make_pvs + +from GaudiKernel.SystemOfUnits import GeV, MeV +from PyConf import configurable + +#################################### +# basic builders # +#################################### +# Definition of inclusive_radiative_b basic particles: hadrons, photons, electrons + + +@configurable +def filter_electrons(particles, + pvs, + pt_min=0.1 * GeV, + name="rd_rad_incl_electrons"): + """Returns electrons for inclusive_radiative_b selection """ + code = require_all(F.PT > pt_min) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_photons(particles, + pvs, + pt_min=2.0 * GeV, + p_min=5.0 * GeV, + name="rd_rad_incl_photons"): + """Returns photons for inclusive_radiative_b selection""" + code = require_all( + F.PT > pt_min, + F.P > p_min, + ) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_basic_hadrons(particles, + pvs, + pt_min=1.0 * GeV, + pt_max=25.0 * GeV, + ipchi2_min=7.4, + trchi2_max=2.5, + trgp_max=0.2, + param1=1.0, + param2=1.0, + param3=1.1, + name="rd_rad_incl_charged_hadrons"): + """Returns basic hadrons with the inclusive_radiative_b selections""" + difficult_cut = require_all( + in_range(pt_min, F.PT, pt_max), + log(F.BPVIPCHI2(pvs)) > + (param1 / ((F.PT / GeV - param2)**2) + + (param3 / pt_max) * (pt_max - F.PT) + math.log(ipchi2_min)), + ) # mimicking track mva HLT1 cut, IP chi2 over a hyperbola-like function of PT + + code = require_all( + # F.CHI2DOF < trchi2_max, # <- removed for the early data taking in 2022 + # F.GHOSTPROB < trgp_max, # <- removed for the early data taking in 2022 + ((F.PT > pt_max) & (F.BPVIPCHI2(pvs) > ipchi2_min)) | + (difficult_cut), ) + + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_third_hadrons(particles, + pvs, + pt_min=0.2 * GeV, + p_min=3.0 * GeV, + trchi2_max=3.0, + ipchi2_min=4.0, + name="rd_rad_incl_third_hadrons"): + """Returns third hadron used in HHH inclusive_radiative_b selections""" + code = require_all( + F.PT > pt_min, + F.P > p_min, + # F.CHI2DOF < trchi2_max, # <- removed for the early data taking in 2022 + F.MINIPCHI2CUT(IPChi2Cut=ipchi2_min, Vertices=pvs), + ) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_extra_charged_hadrons(particles, + pvs, + pt_min=0.8 * GeV, + trchi2_max=2.5, + trgp_max=0.2, + ipchi2_min=8.0, + name="rd_rad_incl_extra_ch_hadons"): + """Returns extra charged hadrons with the inclusive_radiative_b selections""" + code = require_all( + F.PT > pt_min, + # F.GHOSTPROB < trgp_max, # <- removed for the early data taking in 2022 + # F.CHI2DOF < trchi2_max, # <- removed for the early data taking in 2022 + F.MINIPCHI2CUT(IPChi2Cut=ipchi2_min, Vertices=pvs), + ) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_neutral_hadrons(particles, + pvs, + pt_min=0.5 * GeV, + ipchi2_min=0.0, + name="rd_rad_incl_neutral_hadrons"): + """Returns extra neutral hadrons with the inclusive_radiative_b selections""" + code = require_all( + F.PT > pt_min, + F.MINIPCHI2CUT(IPChi2Cut=ipchi2_min, Vertices=pvs), + ) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +@configurable +def filter_pi0(particles, pvs, pt_min=1.6 * GeV, + name="rd_rad_incl_extra_pi0s"): + """Returns extra pi0s for inclusive_radiative_b selection""" + code = require_all(F.PT > pt_min) + return ParticleFilter(particles, F.FILTER(code), name=name) + + +#################################### +# hh builder # +#################################### +# Definition of HH builder for inclusive_radiative_b selections +@configurable +def make_hh(inputs, + pvs, + descriptors, + pt_min=2.0 * GeV, + doca_chi2_max=1000., + m_max=10.0 * GeV, + mipchi2dv_max=16., + num_charged_tracks_max=2, + vtx_chi2_max=1000., + bpvfdchi2_min=16., + eta_min=2., + eta_max=5., + name="rd_rad_incl_hh"): + """Builds two-hadron particle for inclusive_radiative_b""" + combination_code = require_all( + F.PT > pt_min, + F.MAXDOCACHI2CUT(doca_chi2_max), + F.MASS < m_max, + ) + + vertex_code = require_all( + F.CHI2 < vtx_chi2_max, + F.BPVFDCHI2(pvs) > bpvfdchi2_min, + in_range(eta_min, F.BPVETA(pvs), eta_max), + ) + + hh = [] + for input, descriptor in zip( + inputs, + descriptors, + ): + subname = "rd_rad_incl_K*" + if ("K+ K-" in descriptor): + subname = "rd_rad_incl_K*0ToK+K-" + if ("K+ KS0" in descriptor): + subname = "rd_rad_incl_K*+ToK+KS0" + if ("K+ Lambda0" in descriptor): + subname = "rd_rad_incl_K*+ToK+Lambda0" + if ("K- Lambda0" in descriptor): + subname = "rd_rad_incl_K*-ToK-Lambda0" + hh.append( + ParticleCombiner( + input, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code, + name=subname)) + + return ParticleContainersMerger(hh, name=name) + + +#################################### +# hhh builder # +#################################### +# Definition of (HH)H builder for inclusive_radiative_b selections. +@configurable +def make_hhh(inputs, + pvs, + descriptors, + pt_min=2.0 * GeV, + doca_chi2_max=1000., + m_max=10.0 * GeV, + mipchi2_max=16., + vtx_chi2_max=1000., + bpvfdchi2_min=16., + eta_min=2., + eta_max=5., + dira_min=0., + name="rd_rad_incl_hhh"): + """Builds HHH particle as HH + H for inclusive_radiative_b""" + combination_code = require_all( + F.PT > pt_min, + F.MAXDOCACHI2CUT(doca_chi2_max), + F.MASS < m_max, + ) + + vertex_code = require_all( + F.CHI2 < vtx_chi2_max, + F.BPVFDCHI2(pvs) > bpvfdchi2_min, + in_range(eta_min, F.BPVETA(pvs), eta_max), + F.BPVDIRA(pvs) > dira_min, + ) + + hhh = [] + for input, descriptor in zip(inputs, descriptors): + subname = "rd_rad_incl_D*" + if ("K*(892)0 K+" in descriptor): + subname = "rd_rad_incl_D*ToK*0K+" + if ("K*(892)0 K-" in descriptor): + subname = "rd_rad_incl_D*ToK*0K-" + if ("K*(892)0 KS0" in descriptor): + subname = "rd_rad_incl_D*ToK*0KS0" + if ("K*(892)+ KS0" in descriptor): + subname = "rd_rad_incl_D*ToK*+KS0" + if ("K*(892)0 Lambda0" in descriptor): + subname = "rd_rad_incl_D*ToK*0Lambda0" + if ("K*(892)0 Lambda~0" in descriptor): + subname = "rd_rad_incl_D*ToK*0Lambda~0" + if ("K*(892)+ Lambda0" in descriptor): + subname = "rd_rad_incl_D*ToK*+Lambda0" + if ("K*(892)+ Lambda~0" in descriptor): + subname = "rd_rad_incl_D*ToK*+Lambda~0" + hhh.append( + ParticleCombiner( + input, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code, + name=subname)) + return ParticleContainersMerger(hhh, name=name) + + +#################################### +# Converted photons # +#################################### +# Definition of inclusive_radiative_b gamma->ee builder + + +@configurable +def make_gamma_ee(electrons, + pvs, + pt_min=1.5 * GeV, + p_min=0.0 * GeV, + m_max=50.0 * MeV, + name="rd_rad_incl_converted_photons"): + + combination_code = require_all( + F.PT > pt_min, + F.MASS < m_max, + F.P > p_min, + ) + + vertex_code = require_all(F.ALL) + + return ParticleCombiner( + [electrons, electrons], + DecayDescriptor="gamma -> e+ e-", + CombinationCut=combination_code, + CompositeCut=vertex_code, + name=name, + ) + + +#################################### +# B builder # +#################################### +# Definition of HH builder for inclusive_radiative_b selections + + +@configurable +def make_presel_b(inputs, + pvs, + descriptors, + pt_min=2.0 * GeV, + vtx_chi2_max=1000., + eta_min=2., + eta_max=5., + corrm_min=1.0 * GeV, + corrm_max=11.0 * GeV, + dira_min=0., + bpvvdchi2_min=0., + name="rd_rad_incl_presel_B"): + """Builds B->X gamma for inclusive_radiative_b selection""" + combination_code = require_all( + F.PT > pt_min, + F.MASS < corrm_max, + ) + + vertex_code = require_all( + F.CHI2DOF < vtx_chi2_max, + in_range(eta_min, F.BPVETA(pvs), eta_max), + in_range(corrm_min, F.BPVCORRM(pvs), corrm_max), + F.BPVDIRA(pvs) > dira_min, + F.BPVFDCHI2(pvs) > bpvvdchi2_min, + ) + + presel_b = [] + for descriptor in descriptors: + subname = "rd_rad_incl_preselB" + if ("K*(892)0 gamma" in descriptor): + subname = "rd_rad_incl_preselB0ToK*0Gamma" + if ("K*(892)+ gamma" in descriptor): + subname = "rd_rad_incl_preselB+ToK*+Gamma" + if ("D*(2007)0 gamma" in descriptor): + subname = "rd_rad_incl_preselB0ToD*0Gamma" + if ("D*(2010)+ gamma" in descriptor): + subname = "rd_rad_incl_preselB+ToD*+Gamma" + presel_b.append( + ParticleCombiner( + inputs, + DecayDescriptor=descriptor, + CombinationCut=combination_code, + CompositeCut=vertex_code, + name=subname)) + + return ParticleContainersMerger(presel_b, name=name) + + +#################################### +# extra outputs # +#################################### +# Definition of HH builder for inclusive_radiative_b selections + + +def extra_charged_hadrons(particles=make_long_kaons, + pvs=make_pvs, + pt_min=1.2 * GeV, + ipchi2_min=150., + name="rd_rad_incl_extra_ch_hadrons"): + return filter_extra_charged_hadrons( + particles(), + pvs(), + pt_min=pt_min, + ipchi2_min=ipchi2_min, + name=name, + ) + + +def extra_neutral_hadrons(particles, + pvs=make_pvs, + pt_min=1.2 * GeV, + ipchi2_min=5.0, + name="rd_rad_incl_extra_neutral_hadrons"): + return filter_neutral_hadrons( + particles, + pvs(), + pt_min=pt_min, + ipchi2_min=ipchi2_min, + name=name, + ) + + +def extra_gamma(particles=make_photons, + pvs=make_pvs, + pt_min=3.3 * GeV, + name="rd_rad_incl_extra_photons"): + return filter_photons( + particles(), + pvs(), + pt_min=pt_min, + p_min=0., + name=name, + ) + + +def extra_pi0(particles, + pvs=make_pvs, + pt_min=3.3 * GeV, + name="rd_rad_incl_extra_pi0s"): + return filter_pi0( + particles, + pvs(), + pt_min=pt_min, + name=name, + ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/radinclusive_extra_outputs.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/radinclusive_extra_outputs.py deleted file mode 100644 index 9d4c3b62d3e6e6793723e19ad9a3d7b41a4e3028..0000000000000000000000000000000000000000 --- a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/builders/radinclusive_extra_outputs.py +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################### -# (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. # -############################################################################### -from __future__ import absolute_import - -from Hlt2Conf.lines.rd.builders import basic_builder -from Hlt2Conf.standard_particles import make_long_kaons, make_photons -from RecoConf.reconstruction_objects import make_pvs - -from GaudiKernel.SystemOfUnits import GeV - - -def charged_hadrons(particles=make_long_kaons, - pvs=make_pvs, - pt_min=1.2 * GeV, - ipchi2_min=150.): - return basic_builder.filter_extra_charged_hadrons( - particles(), - pvs(), - pt_min=pt_min, - ipchi2_min=ipchi2_min, - ) - - -def neutral_hadrons(particles, pvs=make_pvs, pt_min=1.2 * GeV, ipchi2_min=5.0): - return basic_builder.filter_neutral_hadrons( - particles, - pvs(), - pt_min=pt_min, - ipchi2_min=ipchi2_min, - ) - - -def gamma(particles=make_photons, pvs=make_pvs, pt_min=3.3 * GeV): - return basic_builder.filter_photons( - particles(), - pvs(), - pt_min=pt_min, - p_min=0., - ) - - -def pi0(particles, pvs=make_pvs, pt_min=3.3 * GeV): - return basic_builder.filter_pi0( - particles, - pvs(), - pt_min=pt_min, - ) diff --git a/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/rad_incl.py b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/rad_incl.py new file mode 100644 index 0000000000000000000000000000000000000000..5a5388172df78dae8d1683798ef1257bd491dd5f --- /dev/null +++ b/Hlt/Hlt2Conf/python/Hlt2Conf/lines/rd/rad_incl.py @@ -0,0 +1,389 @@ +############################################################################### +# (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 Radiative inclusive Lines. + +It contains the following lines (see descriptors below) +- Hlt2RD_BToHHGamma_Incl_Line + +The lines below are working in suboptimal mode and are thus not yet registered +to the all_lines dictionary. We feed a constant value to a BDT input since we +don't have the needed MINTREE functor available. + +- Hlt2RD_BToHHHGamma_Incl_Line +- Hlt2RD_BToHHGamma_GammaToEE_Incl_Line +- Hlt2RD_BToHHHGamma_GammaToEE_Incl_Line + +Further work will be done in order to retrain the BDTs with available functors, +with samples including a wider variety of decays and with run3 data when +available. + +author: Alejandro Alfonso, Aniol Lobo +date: 08.04.2022 + +This lines first combine 2 hadrons, where at least one of them must be charged. +In HHH lines the result is combined with a 3rd hadron, which is always neutral +except when the 2-hadron system is (K+ K-) in order to avoid repeating final +states. However, we allow repeating final states when two neutrals are present +to keep the list of combinations simpler. +The result is combined in hh(h)g lines with a high-pt photon to build a B +candidate and with a "converted" photon, which is built from an +electron-positron pair with small invariant mass, in hh(h)g_g_to_ee lines. +The b candidates are then given to a BDT to further reduce the output rate. +These radiative inclusive lines are inclusive in the sense that no PID is used +when selecting the hadrons, and no mass requirements are applied either to the +K*, D*, or B candidates +""" + +from __future__ import absolute_import +from Moore.config import HltLine, register_line_builder +from Hlt2Conf.standard_particles import ( + make_long_electrons_no_brem, + make_long_kaons, + make_photons, +) +from RecoConf.reconstruction_objects import make_pvs + +from .builders import ( + rd_prefilters, + rdbuilder_thor, + rad_incl_builder, + b_tmva_builder, +) + +all_lines = {} + +make_KsLL = rdbuilder_thor.make_rd_ks0_lls +make_LambdaLL = rdbuilder_thor.make_rd_lambda_lls +make_merged_pi0s = rdbuilder_thor.make_rd_merged_pi0s +make_resolved_pi0s = rdbuilder_thor.make_rd_resolved_pi0s + + +@register_line_builder(all_lines) +def BToHHGamma_Incl_line(name="Hlt2RD_BToHHGamma_Incl_Line", + prescale=1, + persistreco=True): + """Definition of B->HHgamma HLT2 line. + + Final states built are (omitting intermediate resonances): + + 1. B0 -> K+ K- gamma + 2. [B+ -> K+ KS0 gamma]cc + 3. [B+ -> K+ Lambda0 gamma]cc + 4. [B+ -> K+ Lambda~0 gamma]cc + + This line first combines 2 hadrons, where at least one of them must be charged. + The result is combined with a high-pt photon to build a B candidate. + The b candidates are then given to a BDT to further reduce the output rate. + These radiative inclusive lines are inclusive in the sense that no PID is used + when selecting the hadrons, and no mass requirements are applied either to the + K*, D*, or B candidates + """ + pvs = make_pvs() + + charged_hadrons = rad_incl_builder.filter_basic_hadrons( + make_long_kaons(), pvs) + Ks0 = rad_incl_builder.filter_neutral_hadrons(make_KsLL(), pvs) + Lambda = rad_incl_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) + + photons = rad_incl_builder.filter_photons(make_photons(), pvs) + + kstars = rad_incl_builder.make_hh([ + [charged_hadrons, charged_hadrons], + [charged_hadrons, Ks0], + [Lambda, charged_hadrons], + [Lambda, charged_hadrons], + ], pvs, [ + "K*(892)0 -> K+ K-", + "[K*(892)+ -> K+ KS0]cc", + "[K*(892)+ -> Lambda0 K+]cc", + "[K*(892)- -> Lambda0 K-]cc", + ]) + presel_b = rad_incl_builder.make_presel_b( + [kstars, photons], pvs, + ["B0 -> K*(892)0 gamma", "[B+ -> K*(892)+ gamma]cc"]) + b = b_tmva_builder.make_b2(presel_b, pvs, "HHgamma", 0.22) + + return HltLine( + name=name, + algs=rd_prefilters.rd_prefilter() + [kstars, b], + extra_outputs=[ + ("ExtraHadron", rad_incl_builder.extra_charged_hadrons()), + ("ExtraKs0LL", + rad_incl_builder.extra_neutral_hadrons(make_KsLL())), + ("ExtraLambdaLL", + rad_incl_builder.extra_neutral_hadrons(make_LambdaLL())), + ("ExtraGamma", rad_incl_builder.extra_gamma()), + ("ExtraPi0Merged", rad_incl_builder.extra_pi0(make_merged_pi0s())), + ], + prescale=prescale, + persistreco=persistreco, + ) + + +# @register_line_builder(all_lines) # Waiting for MINTREE ThOr Functor +def BToHHHGamma_Incl_line(name="Hlt2RD_BToHHHGamma_Incl_Line", + prescale=1, + persistreco=True): + """Definition of B->HHHgamma HLT2 line. + + Final states built are (omitting intermediate resonances): + + 1. [B+ -> (K+ K-) K+ gamma]cc + 2. B0 -> (K+ K-) KS0 gamma + 3. [B0 -> (K+ K-) Lambda0 gamma]cc + 4. [B+ -> (K+ KS0) KS0 gamma]cc + 5. [B+ -> (K+ KS0) Lambda0 gamma]cc + 6. [B+ -> (K+ KS0) Lambda~0 gamma]cc + 7. [B+ -> (Lambda0 K+) KS0 gamma]cc (same final state as 5.) + 8. [B+ -> (Lambda0 K+) Lambda0 gamma]cc + 9. [B+ -> (Lambda0 K+) Lambda~0 gamma]cc + 10. [B+ -> (Lambda~0 K+) KS0 gamma]cc (same final state as 6.) + 11. [B+ -> (Lambda~0 K+) Lambda0 gamma]cc (same final state as 9.) + 12. [B+ -> (Lambda~0 K+) Lambda~0 gamma]cc + + This line first combines 2 hadrons in the same manner as the HHgamma lines, + where at least one of them must be charged. + The result is combined with a 3rd hadron, which is always neutral except when + the 2-hadron system is (K+ K-) in order to avoid repeating final states. + However, we allow repeating final states when two neutrals are present to keep + the list of combinations simpler. + The result is combined with a high-pt photon to build a B candidate. + The b candidates are then given to a BDT to further reduce the output rate. + These radiative inclusive lines are inclusive in the sense that no PID is used + when selecting the hadrons, and no mass requirements are applied either to the + K*, D*, or B candidates + """ + pvs = make_pvs() + + charged_hadrons = rad_incl_builder.filter_basic_hadrons( + make_long_kaons(), pvs) + Ks0 = rad_incl_builder.filter_neutral_hadrons(make_KsLL(), pvs) + Lambda = rad_incl_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) + last_charged_hadrons = rad_incl_builder.filter_third_hadrons( + make_long_kaons(), pvs) + photons = rad_incl_builder.filter_photons(make_photons(), pvs) + kstars = rad_incl_builder.make_hh([ + [charged_hadrons, charged_hadrons], + [charged_hadrons, Ks0], + [charged_hadrons, Lambda], + [charged_hadrons, Lambda], + ], pvs, [ + "K*(892)0 -> K+ K-", + "[K*(892)+ -> K+ KS0]cc", + "[K*(892)+ -> K+ Lambda0]cc", + "[K*(892)- -> K- Lambda0]cc", + ]) + + dstars = rad_incl_builder.make_hhh([ + [kstars, last_charged_hadrons], + [kstars, last_charged_hadrons], + [kstars, Ks0], + [kstars, Ks0], + [kstars, Lambda], + [kstars, Lambda], + [kstars, Lambda], + [kstars, Lambda], + ], pvs, [ + 'D*(2010)+ -> K*(892)0 K+', + 'D*(2010)- -> K*(892)0 K-', + 'D*(2007)0 -> K*(892)0 KS0', + '[D*(2010)+ -> K*(892)+ KS0]cc', + 'D*(2007)0 -> K*(892)0 Lambda0', + 'D*(2007)~0 -> K*(892)0 Lambda~0', + '[D*(2010)+ -> K*(892)+ Lambda0]cc', + '[D*(2010)+ -> K*(892)+ Lambda~0]cc', + ]) + presel_b = rad_incl_builder.make_presel_b( + [dstars, photons], pvs, + ["[B+ -> D*(2010)+ gamma]cc", "[B0 -> D*(2007)0 gamma]cc"]) + b = b_tmva_builder.make_b2(presel_b, pvs, "HHHgamma", 0.116) + + return HltLine( + name=name, + algs=rd_prefilters.rd_prefilter() + [kstars, dstars, b], + extra_outputs=[ + ("ExtraHadron", rad_incl_builder.extra_charged_hadrons()), + ("ExtraKs0LL", + rad_incl_builder.extra_neutral_hadrons(make_KsLL())), + ("ExtraLambdaLL", + rad_incl_builder.extra_neutral_hadrons(make_LambdaLL())), + ("ExtraGamma", rad_incl_builder.extra_gamma()), + ("ExtraPi0Merged", rad_incl_builder.extra_pi0(make_merged_pi0s())), + ], + prescale=prescale, + persistreco=persistreco, + ) + + +# @register_line_builder(all_lines) # Waiting for MINTREE ThOr Functor +def BToHHGamma_GammaToEE_Incl_line( + name="Hlt2RD_BToHHGamma_GammaToEE_Incl_Line", prescale=1, + persistreco=True): + """Definition of B->HHgammaEE HLT2 line. + + Final states built are (omitting intermediate resonances): + + 1. B0 -> K+ K- (gamma -> e+ e-) + 2. [B+ -> K+ KS0 (gamma -> e+ e-)]cc + 3. [B+ -> K+ Lambda0 (gamma -> e+ e-)]cc + 4. [B+ -> K+ Lambda~0 (gamma -> e+ e-)]cc + + This line first combines 2 hadrons, where at least one of them must be charged. + The result is combined with a "converted" photon, which is built from an + electron-positron pair with small invariant mass, to build a B candidate. + The b candidates are then given to a BDT to further reduce the output rate. + These radiative inclusive lines are inclusive in the sense that no PID is used + when selecting the hadrons, and no mass requirements are applied either to the + K*, D*, or B candidates + """ + pvs = make_pvs() + + electrons = rad_incl_builder.filter_electrons( + make_long_electrons_no_brem(), pvs) + charged_hadrons = rad_incl_builder.filter_basic_hadrons( + make_long_kaons(), pvs) + Ks0 = rad_incl_builder.filter_neutral_hadrons(make_KsLL(), pvs) + Lambda = rad_incl_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) + + photons = rad_incl_builder.make_gamma_ee(electrons, pvs) + + kstars = rad_incl_builder.make_hh([ + [charged_hadrons, charged_hadrons], + [charged_hadrons, Ks0], + [charged_hadrons, Lambda], + [charged_hadrons, Lambda], + ], pvs, [ + "K*(892)0 -> K+ K-", + "[K*(892)+ -> K+ KS0]cc", + "[K*(892)+ -> K+ Lambda0]cc", + "[K*(892)- -> K- Lambda0]cc", + ]) + presel_b = rad_incl_builder.make_presel_b( + [kstars, photons], pvs, + ["B0 -> K*(892)0 gamma", "[B+ -> K*(892)+ gamma]cc"]) + b = b_tmva_builder.make_b2(presel_b, pvs, "HHgammaEE", 0.084) + + return HltLine( + name=name, + algs=rd_prefilters.rd_prefilter() + [kstars, b], + extra_outputs=[ + ("ExtraHadron", rad_incl_builder.extra_charged_hadrons()), + ("ExtraKs0LL", + rad_incl_builder.extra_neutral_hadrons(make_KsLL())), + ("ExtraLambdaLL", + rad_incl_builder.extra_neutral_hadrons(make_LambdaLL())), + ("ExtraGamma", rad_incl_builder.extra_gamma()), + ("ExtraPi0Merged", rad_incl_builder.extra_pi0(make_merged_pi0s())), + ], + prescale=prescale, + persistreco=persistreco, + ) + + +# @register_line_builder(all_lines) # Waiting for MINTREE ThOr Functor +def BToHHHGamma_GammaToEE_Incl_line( + name="Hlt2RD_BToHHHGamma_GammaToEE_Incl_Line", + prescale=1, + persistreco=True): + """Definition of B->HHHgammaEE HLT2 line. + + Final states built are (omitting intermediate resonances): + + 1. [B+ -> (K+ K-) K+ (gamma -> e+ e-)]cc + 2. B0 -> (K+ K-) KS0 (gamma -> e+ e-) + 3. [B0 -> (K+ K-) Lambda0 (gamma -> e+ e-)]cc + 4. [B+ -> (K+ KS0) KS0 (gamma -> e+ e-)]cc + 5. [B+ -> (K+ KS0) Lambda0 (gamma -> e+ e-)]cc + 6. [B+ -> (K+ KS0) Lambda~0 (gamma -> e+ e-)]cc + 7. [B+ -> (Lambda0 K+) KS0 (gamma -> e+ e-)]cc (same final state as 5.) + 8. [B+ -> (Lambda0 K+) Lambda0 (gamma -> e+ e-)]cc + 9. [B+ -> (Lambda0 K+) Lambda~0 (gamma -> e+ e-)]cc + 10. [B+ -> (Lambda~0 K+) KS0 (gamma -> e+ e-)]cc (same final state as 6.) + 11. [B+ -> (Lambda~0 K+) Lambda0 (gamma -> e+ e-)]cc (same final state as 9.) + 12. [B+ -> (Lambda~0 K+) Lambda~0 (gamma -> e+ e-)]cc + + This line first combines 2 hadrons in the same manner as the HHgamma lines, + where at least one of them must be charged. + The result is combined with a 3rd hadron, which is always neutral except when + the 2-hadron system is (K+ K-) in order to avoid repeating final states. + However, we allow repeating final states when two neutrals are present to keep + the list of combinations simpler. + The result is combined with a "converted" photon, which is built from an + electron-positron pair with small invariant mass, to build a B candidate. + The b candidates are then given to a BDT to further reduce the output rate. + These radiative inclusive lines are inclusive in the sense that no PID is used + when selecting the hadrons, and no mass requirements are applied either to the + K*, D*, or B candidates + """ + pvs = make_pvs() + + electrons = rad_incl_builder.filter_electrons( + make_long_electrons_no_brem(), pvs) + + charged_hadrons = rad_incl_builder.filter_basic_hadrons( + make_long_kaons(), pvs) + Ks0 = rad_incl_builder.filter_neutral_hadrons(make_KsLL(), pvs) + Lambda = rad_incl_builder.filter_neutral_hadrons(make_LambdaLL(), pvs) + last_charged_hadrons = rad_incl_builder.filter_third_hadrons( + make_long_kaons(), pvs) + photons = rad_incl_builder.make_gamma_ee(electrons, pvs) + kstars = rad_incl_builder.make_hh([ + [charged_hadrons, charged_hadrons], + [charged_hadrons, Ks0], + [charged_hadrons, Lambda], + [charged_hadrons, Lambda], + ], pvs, [ + "K*(892)0 -> K+ K-", + "[K*(892)+ -> K+ KS0]cc", + "[K*(892)+ -> K+ Lambda0]cc", + "[K*(892)- -> K- Lambda0]cc", + ]) + + dstars = rad_incl_builder.make_hhh([ + [kstars, last_charged_hadrons], + [kstars, last_charged_hadrons], + [kstars, Ks0], + [kstars, Ks0], + [kstars, Lambda], + [kstars, Lambda], + [kstars, Lambda], + [kstars, Lambda], + ], pvs, [ + 'D*(2010)+ -> K*(892)0 K+', + 'D*(2010)- -> K*(892)0 K-', + 'D*(2007)0 -> K*(892)0 KS0', + '[D*(2010)+ -> K*(892)+ KS0]cc', + 'D*(2007)0 -> K*(892)0 Lambda0', + 'D*(2007)~0 -> K*(892)0 Lambda~0', + '[D*(2010)+ -> K*(892)+ Lambda0]cc', + '[D*(2010)+ -> K*(892)+ Lambda~0]cc', + ]) + + presel_b = rad_incl_builder.make_presel_b( + [dstars, photons], pvs, + ["[B+ -> D*(2010)+ gamma]cc", "[B0 -> D*(2007)0 gamma]cc"]) + b = b_tmva_builder.make_b2(presel_b, pvs, "HHHgammaEE", 0.05) + + return HltLine( + name=name, + algs=rd_prefilters.rd_prefilter() + [kstars, dstars, b], + extra_outputs=[ + ("ExtraHadron", rad_incl_builder.extra_charged_hadrons()), + ("ExtraKs0LL", + rad_incl_builder.extra_neutral_hadrons(make_KsLL())), + ("ExtraLambdaLL", + rad_incl_builder.extra_neutral_hadrons(make_LambdaLL())), + ("ExtraGamma", rad_incl_builder.extra_gamma()), + ("ExtraPi0Merged", rad_incl_builder.extra_pi0(make_merged_pi0s())), + ], + prescale=prescale, + persistreco=persistreco, + )