From f42979f520808a9c8144715ca96c919192bf1718 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 00:45:07 +0800 Subject: [PATCH 01/10] Upload code for Lc2pKs_Xic2L0Ks_Omgc2L0Ks AP version1 --- LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py | 224 ++++++++ .../dv_data_CHARM_BaryonTwoBodyDecay.py | 127 +++++ LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml | 44 ++ LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py | 482 ++++++++++++++++++ 4 files changed, 877 insertions(+) create mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py create mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py create mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml create mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py new file mode 100644 index 0000000000..5a023b3fc6 --- /dev/null +++ b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py @@ -0,0 +1,224 @@ +############################################################################## +# (c) Copyright 2024 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. # +############################################################################### +"""Configuration functions for DTF +""" +import Functors as F +from Functors.math import log + +from FunTuple import FunctorCollection +from FunTuple.functorcollections import Kinematics + +from DecayTreeFitter import DecayTreeFitter + + +def make_basic_dtf_variables(pvs, + data, + DTF=None, + pv_constraint=False, + mass_constraint=False, + particle_name=""): + variables = ( + FunctorCollection( + { + "TRCHI2DOF": F.CHI2DOF @ F.TRACK, + "ETA": F.ETA, + "PHI": F.PHI, + "TRGHOSTPROB": F.GHOSTPROB, + "BPVIPCHI2": F.BPVIPCHI2(pvs), + "BPVIP": F.BPVIP(pvs), + "BPVX": F.BPVX(pvs), + "BPVY": F.BPVY(pvs), + "BPVZ": F.BPVZ(pvs), + "TX": F.TX, + "TY": F.TY, + "MINIPCHI2": F.MINIPCHI2(pvs), + "MINIP": F.MINIP(pvs), + "KEY": F.VALUE_OR(-1) @ F.OBJECT_KEY @ F.TRACK, + #"CTB" : F.POSITION @ F.CLOSESTTOBEAM @ F.TRACK, + "TRACKPT": F.TRACK_PT, + "TRACKHISTORY": F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK, + "QOVERP": F.QOVERP @ F.TRACK, + "NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + }) + Kinematics()) + + if (mass_constraint): + if (pv_constraint): # MASS + PV + dtf_variables_mass_pv = FunctorCollection({ + 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass_pv + else: # MASS + dtf_variables_mass = FunctorCollection({ + 'DTF_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass + elif (pv_constraint): # PV + dtf_variables_pv = FunctorCollection({ + 'DTF_PV_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_pv + else: # NO MASS/PV + dtf_variables = FunctorCollection({ + 'DTF_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables + + +def make_composite_dtf_variables(pvs, + data, + DTF=None, + pv_constraint=False, + mass_constraint=False, + particle_name=""): + variables = ( + FunctorCollection({ + "MAXPT": F.MAX(F.PT), + "MINPT": F.MIN(F.PT), + "SUMPT": F.SUM(F.PT), + "MAXP": F.MAX(F.P), + "MINP": F.MIN(F.P), + "BPVDIRA": F.BPVDIRA(pvs), + "VCHI2DOF": F.CHI2DOF, #CHI2VXNDOF + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "BPVIPCHI2": F.BPVIPCHI2(pvs), + "BPVIP": F.BPVIP(pvs), + "LOGBPVIPCHI2": log(F.BPVIPCHI2(pvs)), + "BPVLTIME": F.BPVLTIME(pvs), + "MAXBPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), #MAX_ + "MINBPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + "MAXBPVIP": F.MAX(F.BPVIP(pvs)), + "MINBPVIP": F.MIN(F.BPVIP(pvs)), + "ETA": F.ETA, + "PHI": F.PHI, + "END_VX": F.END_VX, #END_ + "END_VY": F.END_VY, + "END_VZ": F.END_VZ, + "BPVX": F.BPVX(pvs), + "BPVY": F.BPVY(pvs), + "BPVZ": F.BPVZ(pvs), + "ALLPVFD": F.ALLPV_FD(pvs), + "ALLPVIP": F.ALLPV_IP(pvs), + }) + Kinematics()) + + addstring = "DTF" + if (pv_constraint): + addstring += '_PV' + if (mass_constraint): + addstring += '_Fix' + addstring += particle_name + + DTF_chi2ndof = FunctorCollection({ + addstring + "_DTFCHI2": DTF.CHI2, + addstring + "_DTFNDOF": DTF.NDOF, + addstring + "_CTAU": DTF.CTAU, + addstring + "_CTAUERR": DTF.CTAUERR, + addstring + "_MERR": DTF.MASSERR, + }) + + if (mass_constraint): + if (pv_constraint): # MASS + PV + dtf_variables_mass_pv = FunctorCollection({ + 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass_pv + DTF_chi2ndof + else: # MASS + dtf_variables_mass = FunctorCollection({ + 'DTF_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass + DTF_chi2ndof + elif (pv_constraint): # PV + dtf_variables_pv = FunctorCollection({ + 'DTF_PV_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_pv + DTF_chi2ndof + else: # NO MASS/PV + dtf_variables = FunctorCollection({ + 'DTF_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables + DTF_chi2ndof + + +# +def make_dtf_variables(pvs, input_data, ptype, particle_to_constrain): + + if ptype not in ["basic", "composite"]: + Exception(f"I want \'basic\' or \'composite\'. Got {ptype}") + + #particle_to_constrain = ["KS0"] + + DTF = DecayTreeFitter( + name=f'DTF_{{hash}}', input_particles=input_data)#, output_level=5) + DTF_PV = DecayTreeFitter( + name=f'DTF_PV_{{hash}}', + input_particles=input_data, + input_pvs=pvs) + #output_level=5) + DTF_PV_mass = DecayTreeFitter( + name=f'DTF_PV_mass_{{hash}}', + input_particles=input_data, + input_pvs=pvs, + mass_constraints=particle_to_constrain) + #output_level=5) + + if ptype == "basic": + dtf_vars = make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF, + pv_constraint=False, + mass_constraint=False) + dtf_vars += make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF_PV, + pv_constraint=True, + mass_constraint=False) + dtf_vars += make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF_PV_mass, + pv_constraint=True, + mass_constraint=True, + particle_name=particle_to_constrain[0]) + return dtf_vars + + if ptype == "composite": + dtf_vars = make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF, + pv_constraint=False, + mass_constraint=False) + dtf_vars += make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF_PV, + pv_constraint=True, + mass_constraint=False) + dtf_vars += make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF_PV_mass, + pv_constraint=True, + mass_constraint=True, + particle_name=particle_to_constrain[0]) + return dtf_vars diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py new file mode 100644 index 0000000000..8053ab53b8 --- /dev/null +++ b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -0,0 +1,127 @@ +from .tuple_maker import make_dv_tuple, tuple_template, line_prefilter +from DaVinci import Options, make_config + +decay_descriptor = { + "LcpToPpKs_LL": { + "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", + "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", + "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", + "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", + "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", + }, + "LcpToPpKs_DD": { + "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", + "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", + "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", + "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", + "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_LLLL": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_DDLL": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_LLDD": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_DDDD": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_LLLL": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_DDLL": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_LLDD": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_DDDD": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + } +} + + +def main(options: Options): + tuples = { + "LcpToPpKs_LL": + make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], + "Hlt2Charm_LcpToPpKs_LL", ["Lambda_c+","KS0"]), + "LcpToPpKs_DD": + make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], + "Hlt2Charm_LcpToPpKs_DD", ["Lambda_c+","KS0"]), + "Xic0ToL0Ks_LLLL": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], + "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_DDLL": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], + "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_LLDD": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], + "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_DDDD": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], + "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Xi_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_LLLL": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], + "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_DDLL": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], + "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_LLDD": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], + "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_DDDD": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], + "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Omega_c0","Lambda0","KS0"]), + } + return make_config(options, tuples) diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml b/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml new file mode 100644 index 0000000000..458134e0e9 --- /dev/null +++ b/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml @@ -0,0 +1,44 @@ +defaults: + application: DaVinci/v64r9 + wg: Charm + inform: + - hong-jian.wang@cern.ch + - miroslav.saur@cern.ch + - xuanjia.peng@cern.ch + +# data configuration +{%- set datasets = [ + ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), + ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), + ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), +]%} + +{%- set dv_platform_detdesc = "x86_64_v2-el9-gcc13+detdesc-opt" %} + +{%- for data, version, decay, polarity, process, stream in datasets %} + +data_{{decay}}_charm_{{data}}_{{version}}_{{polarity}}: + application: "DaVinci/v64r9" + input: + bk_query: "/LHCb/{{data}}/Beam6800GeV-VeloClosed-{{polarity}}/Real Data/Sprucing{{version}}/94000000/CHARM.DST" + dq_flags: + - OK + - UNCHECKED + keep_running: true + n_test_lfns: 1 + options: + entrypoint: LcTopKs_XicToL0Ks_OmgcToL0Ks.dv_data_CHARM_{{decay}}:main + extra_options: + input_type: ROOT + input_process: "{{process}}" + input_stream: "{{stream}}" + input_raw_format: 0.5 + simulation: False + data_type: "Upgrade" + geometry_version: run3/trunk + conditions_version: master + output: Data_{{stream}}_{{version}}_{{decay}}.ROOT +{%- endfor %} diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py new file mode 100644 index 0000000000..19963b39a8 --- /dev/null +++ b/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py @@ -0,0 +1,482 @@ +############################################################################### +# (c) Copyright 2021-2022 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. # +############################################################################### +""" +Read an HLT2 file and create an ntuple with the new DaVinci configuration. +""" +import Functors as F +import FunTuple.functorcollections as FC +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from PyConf.reading import get_particles, get_pvs, get_rec_summary +from DaVinci.algorithms import create_lines_filter +from DaVinciMCTools import MCTruthAndBkgCat +from FunTuple.functorcollections import MCHierarchy, MCPrimaries, MCPromptDecay, Kinematics, SelectionInfo, HltTisTos, MCVertexInfo, MCKinematics, ParticleID, EventInfo +from PyConf.reading import get_odin # get_decreports, +from DecayTreeFitter import DecayTreeFitter +from .dtf_maker import make_dtf_variables + +_basic = "basic" +_composite = "composite" +_toplevel = "toplevel" +_Lc = "Lc" +_Lb = "Lb" +_Xic = "Xic" +_Omc = "Omc" + + +def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): + """ + function that returns dictionary of functors that work. + + functors are listed in order of https://lhcbdoc.web.cern.ch/lhcbdoc/moore/master/selection/thor_functors_reference.html#module-Functo + """ + if ptype not in [_basic, _composite]: + Exception(f"I want {_basic} or {_composite}. Got {ptype}") + all_vars = FunctorCollection({}) + + comp = _composite == ptype or _toplevel == ptype # is composite + basic = _basic == ptype # is not composite + + # First import everything that comes in functorcollections + all_vars += FC.Kinematics() + if basic: + all_vars += FC.ParticleID(extra_info=True) + + if comp: # all these require a vertex + all_vars.update({"BPVCORRM": F.BPVCORRM(pvs)}) + all_vars.update({"BPVCORRMERR": F.BPVCORRMERR(pvs)}) + all_vars.update({"BPVDIRA": F.BPVDIRA(pvs)}) + all_vars.update({"BPVDLS": F.BPVDLS(pvs)}) + all_vars.update({"BPVETA": F.BPVETA(pvs)}) + all_vars.update({"BPVFD": F.BPVFD(pvs)}) + all_vars.update({"BPVFDCHI2": F.BPVFDCHI2(pvs)}) + all_vars.update({"BPVFDIR": F.BPVFDIR(pvs)}) + all_vars.update({"BPVFDVEC": F.BPVFDVEC(pvs)}) + + all_vars.update({"BPVIP": F.BPVIP(pvs)}) + all_vars.update({"BPVIPCHI2": F.BPVIPCHI2(pvs)}) + all_vars.update({"BPVX": F.BPVX(pvs)}) + all_vars.update({"BPVY": F.BPVY(pvs)}) + all_vars.update({"BPVZ": F.BPVZ(pvs)}) + + if comp: # all these require a vertex + all_vars.update({"ALLPV_FD": F.ALLPV_FD(pvs)}) + all_vars.update({"ALLPV_IP": F.ALLPV_IP(pvs)}) + all_vars.update({"BPVLTIME": F.BPVLTIME(pvs)}) + all_vars.update({"BPVVDRHO": F.BPVVDRHO(pvs)}) + all_vars.update({"BPVVDX": F.BPVVDX(pvs)}) + all_vars.update({"BPVVDY": F.BPVVDY(pvs)}) + all_vars.update({"BPVVDZ": F.BPVVDZ(pvs)}) + + all_vars.update({"CHARGE": F.CHARGE}) + all_vars.update({"CHI2": F.CHI2}) + all_vars.update({"CHI2DOF": F.CHI2DOF}) + + if comp: + all_vars.update({"END_VRHO": F.END_VRHO}) + all_vars.update({"END_VX": F.END_VX}) + all_vars.update({"END_VY": F.END_VY}) + all_vars.update({"END_VZ": F.END_VZ}) + + all_vars.update({"ETA": F.ETA}) + all_vars.update({"FOURMOMENTUM": F.FOURMOMENTUM}) + all_vars.update({"ISBASIC": F.ISBASICPARTICLE}) + + if basic: + all_vars.update({"GHOSTPROB": F.GHOSTPROB}) + all_vars.update({"ISMUON": F.ISMUON}) + all_vars.update({"INMUON": F.INMUON}) + all_vars.update({"INECAL": F.INECAL}) + all_vars.update({"INHCAL": F.INHCAL}) + all_vars.update({"HASBREM": F.HASBREM}) + all_vars.update({"BREMENERGY": F.BREMENERGY}) + all_vars.update({"BREMBENDCORR": F.BREMBENDCORR}) + all_vars.update({"BREMPIDE": F.BREMPIDE}) + all_vars.update({"ECALPIDE": F.ECALPIDE}) + all_vars.update({"ECALPIDMU": F.ECALPIDMU}) + all_vars.update({"HCALPIDE": F.HCALPIDE}) + all_vars.update({"HCALPIDMU": F.HCALPIDMU}) + all_vars.update({"ELECTRONSHOWEREOP": F.ELECTRONSHOWEREOP}) + all_vars.update({"CLUSTERMATCH": F.CLUSTERMATCH_CHI2}) + all_vars.update({"ELECTRONMATCH": F.ELECTRONMATCH_CHI2}) + all_vars.update({"BREMHYPOMATCH": F.BREMHYPOMATCH_CHI2}) + all_vars.update({"ELECTRONENERGY": F.ELECTRONENERGY}) + all_vars.update({"BREMHYPOENERGY": F.BREMHYPOENERGY}) + all_vars.update({"BREMHYPODELTAX": F.BREMHYPODELTAX}) + all_vars.update({"ELECTRONID": F.ELECTRONID}) + all_vars.update({"HCALEOP": F.HCALEOP}) + # Note: the observables for the two functors below are (TRACK_MOM_X, TRACK_MOM_Y, TRACK_MOM_Z}) + # and (TRACK_POS_CLOSEST_TO_BEAM_X, TRACK_POS_CLOSEST_TO_BEAM_Y, TRACK_POS_CLOSEST_TO_BEAM_Z), + # which is why the trailing underscore in the name is added i.e. "TRACK_MOM_" and "TRACK_POS_CLOSEST_TO_BEAM_" + all_vars.update({"TRACK_MOM": F.TRACK_MOMVEC}) + #all_vars.update({"TRACK_COVARIANCE": F.TRACK_COVARIANCE @ F.TRACKSTATE @ F.TRACK}) + #all_vars.update({"TRACK_POS_CLOSESTTOBEAM_": F.TRACK_POSVEC_CLOSESTTOBEAM}) + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_X" : F.POSITION_X @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Y" : F.POSITION_Y @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Z" : F.POSITION_Z @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + + all_vars.update({"IS_ABS_ID_pi": F.IS_ABS_ID("pi+")}) + all_vars.update({"IS_ID_pi": F.IS_ID("pi-")}) + all_vars.update({"PDG_MASS_pi": F.PDG_MASS("pi+")}) + all_vars.update({"SIGNED_DELTA_MASS_pi": F.SIGNED_DELTA_MASS("pi+")}) + all_vars.update({"ABS_DELTA_MASS_pi": F.ABS_DELTA_MASS("pi+")}) + all_vars.update({"IS_NOT_H": F.IS_NOT_H}) + all_vars.update({"IS_PHOTON": F.IS_PHOTON}) + + all_vars.update({"MASS": F.MASS}) + + if comp: + all_vars.update({"MAXPT": F.MAX(F.PT)}) + all_vars.update({"MAXDOCA": F.MAXSDOCA}) + all_vars.update({"MAXDOCACHI2": F.MAXSDOCACHI2}) + # the above in cut versions. + + if comp: + all_vars.update({"MINPT": F.MIN(F.PT)}) + all_vars.update({"MINIP": F.MINIP(pvs)}) + all_vars.update({"MINIPCHI2": F.MINIPCHI2(pvs)}) + + if basic: + all_vars.update({"TRACKPT": F.TRACK_PT}) + all_vars.update({ + "TRACKHISTORY": + F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK + }) + all_vars.update({"QOVERP": F.QOVERP @ F.TRACK}) + all_vars.update({"NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK}) + all_vars.update({"NFTHITS": F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK}) + all_vars.update({"NHITS": F.VALUE_OR(-1) @ F.NHITS @ F.TRACK}) + all_vars.update({"NUTHITS": F.VALUE_OR(-1) @ F.NUTHITS @ F.TRACK}) + all_vars.update({"NVPHITS": F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK}) + all_vars.update({ + "TRACKHASVELO": + F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK + }) + all_vars.update({ + "TRACKHASUT": F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK + }) + #all_vars.update({"POS_COV_MATRIX": F.POS_COV_MATRIX}) + #all_vars.update({"THREE_MOM_COV_MATRIX": F.THREE_MOM_COV_MATRIX}) + + all_vars.update({"OBJECT_KEY": F.OBJECT_KEY}) + + all_vars.update({"PHI": F.PHI}) + + all_vars.update({"ABS_PX": F.ABS @ F.PX}) + + all_vars.update({"REFERENCEPOINT_X": F.REFERENCEPOINT_X}) + all_vars.update({"REFERENCEPOINT_Y": F.REFERENCEPOINT_Y}) + all_vars.update({"REFERENCEPOINT_Z": F.REFERENCEPOINT_Z}) + + if comp: + all_vars.update({"DOCA": F.DOCA(Child1=1, Child2=2)}) + all_vars.update({"DOCACHI2": F.DOCACHI2(Child1=1, Child2=2)}) + all_vars.update({"SDOCA": F.SDOCA(1, 2)}) + all_vars.update({"SDOCACHI2": F.SDOCACHI2(1, 2)}) + all_vars.update({"ALV": F.ALV(Child1=1, Child2=2)}) + if basic: + all_vars.update({"SHOWER_SHAPE": F.CALO_NEUTRAL_SHOWER_SHAPE}) + + if comp: + all_vars.update({"SUMPT": F.SUM(F.PT)}) + + if basic: + all_vars.update({"TX": F.TX}) + all_vars.update({"TY": F.TY}) + + print( + f"### For {ptype} returning variables {all_vars.functor_dict.keys()}") + return all_vars + + +def event_variables(PVs, ODIN, decreports, lines): + """ + event variables + """ + + evt_vars = FunctorCollection({}) + evt_vars += FC.EventInfo() + + evt_vars += FC.SelectionInfo(selection_type="Hlt2", trigger_lines=lines) + + if decreports: + evt_vars.update({ + "DECISIONS": + F.DECISIONS( + Lines=[bd2dsk_line + "Decision"], DecReports=decreports) + }) + evt_vars.update({ + "DECREPORTS_FILTER": + F.DECREPORTS_FILTER( + Lines=[bd2dsk_line + "Decision"], DecReports=decreports) + }) + + if ODIN: + evt_vars.update({"EVENTTYPE": F.EVENTTYPE(ODIN)}) + + evt_vars.update({"PV_SIZE": F.SIZE(PVs)}) + + if decreports: + evt_vars.update({"TCK": F.TCK(decreports)}) + + print(f"### For event returning variables {evt_vars.functor_dict.keys()}") + return evt_vars + + +def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, + Hlt2_decisions): + + evtpath_prefix = "/Event/HLT2/" + if not isturbo: + evtpath_prefix = "/Event/Spruce/" + + input_data = get_particles(evtpath_prefix + f"{line_name}/Particles") + + pvs = get_pvs() + + Hlt1_decisions = [ + 'Hlt1TrackMVADecision', + 'Hlt1TwoTrackMVADecision', + 'Hlt1D2KKDecision', + 'Hlt1D2KPiDecision', + 'Hlt1D2PiPiDecision', + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1KsToPiPiDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + "Hlt1DiMuonNoIP_SSDecision", + "Hlt1DiMuonDrellYan_VLowMassDecision", + "Hlt1DiMuonDrellYan_VLowMass_SSDecision", + "Hlt1DiMuonDrellYanDecision", + "Hlt1DiMuonDrellYan_SSDecision", + "Hlt1DetJpsiToMuMuPosTagLineDecision", + "Hlt1DetJpsiToMuMuNegTagLineDecision", + "Hlt1TrackElectronMVADecision", + "Hlt1SingleHighPtElectronDecision", + "Hlt1DiElectronDisplacedDecision", + "Hlt1SingleHighEtDecision", + "Hlt1DiPhotonHighMassDecision", + "Hlt1Pi02GammaGammaDecision", + "Hlt1DiElectronHighMass_SSDecision", + "Hlt1DiElectronHighMassDecision", + "Hlt1DiMuonNoIPDecision", + ] + + composite_variables = FunctorCollection({ + "END_VX_ERR": + F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "END_VY_ERR": + F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "END_VZ_ERR": + F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "BPVX_ERR": + F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "BPVY_ERR": + F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "BPVZ_ERR": + F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "PERR": + F.SQRT @ F.PERR2, + "PXERR": + F.SQRT @ F.CALL(0, 0) @ F.THREE_MOM_COV_MATRIX, + "PYERR": + F.SQRT @ F.CALL(1, 1) @ F.THREE_MOM_COV_MATRIX, + "PZERR": + F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, + "MM12": + F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)), + "MM13": + F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)), + "MM23": + F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)) + }) + + composite_variables += HltTisTos( + selection_type="Hlt1", trigger_lines=Hlt1_decisions, data=input_data) + if not isturbo: + composite_variables += HltTisTos( + selection_type="Hlt2", + trigger_lines=Hlt2_decisions, + data=input_data) + + daughter_variables = FunctorCollection({ + "PERR": + F.SQRT @ F.PERR2, + "PZERR": + F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, + }) + + #define event level variables + odin = get_odin() + decreports = None + rec_sum = get_rec_summary() + event_info = event_variables( + pvs, odin, decreports, [line_name]) + FunctorCollection({ + "nPVs": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nPVs"), + "nTTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nTTracks"), + "nLongTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nLongTracks"), + "nDownstreamTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nDownstreamTracks"), + "nUpstreamTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nUpstreamTracks"), + "nVeloTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVeloTracks"), + "nBackTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nBackTracks"), + "nRich1Hits": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich1Hits"), + "nRich2Hits": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich2Hits"), + "nVPClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVPClusters"), + "nFTClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nFTClusters"), + "eCalTot": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "eCalTot"), + "hCalTot": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "hCalTot"), + "nEcalClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nEcalClusters"), + "ALLPVX": + F.ALLPVX(pvs), + "ALLPVY": + F.ALLPVY(pvs), + "ALLPVZ": + F.ALLPVZ(pvs), + }) + + event_info += FC.SelectionInfo( + selection_type="Hlt1", trigger_lines=Hlt1_decisions) + + allvariables = { + + ############################ + #### Prompt charm lines #### + ############################ + 'Hlt2Charm_LcpToPpKs_LL': { + "Lcp": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "Pp": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KSPip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSPim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_LcpToPpKs_DD' : {}, + 'Hlt2Charm_Xic0ToL0Ks_LLLL': { + "Xic0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0p": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "L0pi": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_Xic0ToL0Ks_LLDD' : {}, + 'Hlt2Charm_Xic0ToL0Ks_DDLL' : {}, + 'Hlt2Charm_Xic0ToL0Ks_DDDD' : {}, + 'Hlt2Charm_Omc0ToL0Ks_LLLL': { + "Omc0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0p": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "L0pi": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_Omc0ToL0Ks_LLDD' : {}, + 'Hlt2Charm_Omc0ToL0Ks_DDLL' : {}, + 'Hlt2Charm_Omc0ToL0Ks_DDDD' : {}, + } + + allvariables['Hlt2Charm_LcpToPpKs_DD'] = allvariables['Hlt2Charm_LcpToPpKs_LL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + + variables = allvariables[line_name] + + #define FunTuple instance + my_tuple = Funtuple( + name=line_name, + tuple_name="DecayTree", + fields=decay_descriptor, + variables=variables, + event_variables=event_info, + store_multiple_cand_info=True, + inputs=input_data) + + return my_tuple + + +def line_prefilter(line_name): + return create_lines_filter(name=f"HLT_PASS{line_name}", lines=[line_name]) + + +def make_dv_tuple(decay_descriptor, line_name, particle_to_constrain): + my_tuple = tuple_template(decay_descriptor, line_name, + particle_to_constrain, True, []) + my_filter = line_prefilter(line_name) + return [my_filter, my_tuple] -- GitLab From cd41b6b20db7612484e4e9a66e48644bdb753464 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 15:48:51 +0800 Subject: [PATCH 02/10] Upload code for Lc2pKs_Xic2L0Ks_Omgc2L0Ks AP version1 --- Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py | 224 ++++++++ .../dv_data_CHARM_BaryonTwoBodyDecay.py | 127 +++++ Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml | 44 ++ Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py | 482 ++++++++++++++++++ 4 files changed, 877 insertions(+) create mode 100644 Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py create mode 100644 Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py create mode 100644 Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml create mode 100644 Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py new file mode 100644 index 0000000000..99507cf237 --- /dev/null +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py @@ -0,0 +1,224 @@ +############################################################################## +# (c) Copyright 2024 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. # +############################################################################### +"""Configuration functions for DTF +""" +import Functors as F +from Functors.math import log + +from FunTuple import FunctorCollection +from FunTuple.functorcollections import Kinematics + +from DecayTreeFitter import DecayTreeFitter + + +def make_basic_dtf_variables(pvs, + data, + DTF=None, + pv_constraint=False, + mass_constraint=False, + particle_name=""): + variables = ( + FunctorCollection( + { + "TRCHI2DOF": F.CHI2DOF @ F.TRACK, + "ETA": F.ETA, + "PHI": F.PHI, + "TRGHOSTPROB": F.GHOSTPROB, + "BPVIPCHI2": F.BPVIPCHI2(pvs), + "BPVIP": F.BPVIP(pvs), + "BPVX": F.BPVX(pvs), + "BPVY": F.BPVY(pvs), + "BPVZ": F.BPVZ(pvs), + "TX": F.TX, + "TY": F.TY, + "MINIPCHI2": F.MINIPCHI2(pvs), + "MINIP": F.MINIP(pvs), + "KEY": F.VALUE_OR(-1) @ F.OBJECT_KEY @ F.TRACK, + #"CTB" : F.POSITION @ F.CLOSESTTOBEAM @ F.TRACK, + "TRACKPT": F.TRACK_PT, + "TRACKHISTORY": F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK, + "QOVERP": F.QOVERP @ F.TRACK, + "NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, + }) + Kinematics()) + + if (mass_constraint): + if (pv_constraint): # MASS + PV + dtf_variables_mass_pv = FunctorCollection({ + 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass_pv + else: # MASS + dtf_variables_mass = FunctorCollection({ + 'DTF_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass + elif (pv_constraint): # PV + dtf_variables_pv = FunctorCollection({ + 'DTF_PV_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_pv + else: # NO MASS/PV + dtf_variables = FunctorCollection({ + 'DTF_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables + + +def make_composite_dtf_variables(pvs, + data, + DTF=None, + pv_constraint=False, + mass_constraint=False, + particle_name=""): + variables = ( + FunctorCollection({ + "MAXPT": F.MAX(F.PT), + "MINPT": F.MIN(F.PT), + "SUMPT": F.SUM(F.PT), + "MAXP": F.MAX(F.P), + "MINP": F.MIN(F.P), + "BPVDIRA": F.BPVDIRA(pvs), + "VCHI2DOF": F.CHI2DOF, #CHI2VXNDOF + "BPVFDCHI2": F.BPVFDCHI2(pvs), + "BPVFD": F.BPVFD(pvs), + "BPVVDRHO": F.BPVVDRHO(pvs), + "BPVVDZ": F.BPVVDZ(pvs), + "BPVIPCHI2": F.BPVIPCHI2(pvs), + "BPVIP": F.BPVIP(pvs), + "LOGBPVIPCHI2": log(F.BPVIPCHI2(pvs)), + "BPVLTIME": F.BPVLTIME(pvs), + "MAXBPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), #MAX_ + "MINBPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), + "MAXBPVIP": F.MAX(F.BPVIP(pvs)), + "MINBPVIP": F.MIN(F.BPVIP(pvs)), + "ETA": F.ETA, + "PHI": F.PHI, + "END_VX": F.END_VX, #END_ + "END_VY": F.END_VY, + "END_VZ": F.END_VZ, + "BPVX": F.BPVX(pvs), + "BPVY": F.BPVY(pvs), + "BPVZ": F.BPVZ(pvs), + "ALLPVFD": F.ALLPV_FD(pvs), + "ALLPVIP": F.ALLPV_IP(pvs), + }) + Kinematics()) + + addstring = "DTF" + if (pv_constraint): + addstring += '_PV' + if (mass_constraint): + addstring += '_Fix' + addstring += particle_name + + DTF_chi2ndof = FunctorCollection({ + addstring + "_DTFCHI2": DTF.CHI2, + addstring + "_DTFNDOF": DTF.NDOF, + addstring + "_CTAU": DTF.CTAU, + addstring + "_CTAUERR": DTF.CTAUERR, + addstring + "_MERR": DTF.MASSERR, + }) + + if (mass_constraint): + if (pv_constraint): # MASS + PV + dtf_variables_mass_pv = FunctorCollection({ + 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass_pv + DTF_chi2ndof + else: # MASS + dtf_variables_mass = FunctorCollection({ + 'DTF_Fix' + particle_name + '_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_mass + DTF_chi2ndof + elif (pv_constraint): # PV + dtf_variables_pv = FunctorCollection({ + 'DTF_PV_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables_pv + DTF_chi2ndof + else: # NO MASS/PV + dtf_variables = FunctorCollection({ + 'DTF_' + k: DTF(v) + for k, v in variables.get_thor_functors().items() + }) + return dtf_variables + DTF_chi2ndof + + +# +def make_dtf_variables(pvs, input_data, ptype, particle_to_constrain): + + if ptype not in ["basic", "composite"]: + Exception(f"I want \'basic\' or \'composite\'. Got {ptype}") + + #particle_to_constrain = ["KS0"] + + DTF = DecayTreeFitter( + name=f'DTF_{{hash}}', input_particles=input_data, output_level=5) + DTF_PV = DecayTreeFitter( + name=f'DTF_PV_{{hash}}', + input_particles=input_data, + input_pvs=pvs, + output_level=5) + DTF_PV_mass = DecayTreeFitter( + name=f'DTF_PV_mass_{{hash}}', + input_particles=input_data, + input_pvs=pvs, + mass_constraints=particle_to_constrain, + output_level=5) + + if ptype == "basic": + dtf_vars = make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF, + pv_constraint=False, + mass_constraint=False) + dtf_vars += make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF_PV, + pv_constraint=True, + mass_constraint=False) + dtf_vars += make_basic_dtf_variables( + pvs, + input_data, + DTF=DTF_PV_mass, + pv_constraint=True, + mass_constraint=True, + particle_name=particle_to_constrain[0]) + return dtf_vars + + if ptype == "composite": + dtf_vars = make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF, + pv_constraint=False, + mass_constraint=False) + dtf_vars += make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF_PV, + pv_constraint=True, + mass_constraint=False) + dtf_vars += make_composite_dtf_variables( + pvs, + input_data, + DTF=DTF_PV_mass, + pv_constraint=True, + mass_constraint=True, + particle_name=particle_to_constrain[0]) + return dtf_vars diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py new file mode 100644 index 0000000000..8053ab53b8 --- /dev/null +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -0,0 +1,127 @@ +from .tuple_maker import make_dv_tuple, tuple_template, line_prefilter +from DaVinci import Options, make_config + +decay_descriptor = { + "LcpToPpKs_LL": { + "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", + "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", + "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", + "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", + "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", + }, + "LcpToPpKs_DD": { + "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", + "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", + "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", + "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", + "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_LLLL": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_DDLL": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_LLDD": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Xic0ToL0Ks_DDDD": { + "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_LLLL": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_DDLL": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_LLDD": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + }, + "Omc0ToL0Ks_DDDD": { + "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", + "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", + "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", + "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", + "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", + "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", + "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", + } +} + + +def main(options: Options): + tuples = { + "LcpToPpKs_LL": + make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], + "Hlt2Charm_LcpToPpKs_LL", ["Lambda_c+","KS0"]), + "LcpToPpKs_DD": + make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], + "Hlt2Charm_LcpToPpKs_DD", ["Lambda_c+","KS0"]), + "Xic0ToL0Ks_LLLL": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], + "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_DDLL": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], + "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_LLDD": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], + "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Xi_c0","Lambda0","KS0"]), + "Xic0ToL0Ks_DDDD": + make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], + "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Xi_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_LLLL": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], + "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_DDLL": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], + "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_LLDD": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], + "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Omega_c0","Lambda0","KS0"]), + "Omc0ToL0Ks_DDDD": + make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], + "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Omega_c0","Lambda0","KS0"]), + } + return make_config(options, tuples) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml new file mode 100644 index 0000000000..458134e0e9 --- /dev/null +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml @@ -0,0 +1,44 @@ +defaults: + application: DaVinci/v64r9 + wg: Charm + inform: + - hong-jian.wang@cern.ch + - miroslav.saur@cern.ch + - xuanjia.peng@cern.ch + +# data configuration +{%- set datasets = [ + ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), + ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), + ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), + ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), +]%} + +{%- set dv_platform_detdesc = "x86_64_v2-el9-gcc13+detdesc-opt" %} + +{%- for data, version, decay, polarity, process, stream in datasets %} + +data_{{decay}}_charm_{{data}}_{{version}}_{{polarity}}: + application: "DaVinci/v64r9" + input: + bk_query: "/LHCb/{{data}}/Beam6800GeV-VeloClosed-{{polarity}}/Real Data/Sprucing{{version}}/94000000/CHARM.DST" + dq_flags: + - OK + - UNCHECKED + keep_running: true + n_test_lfns: 1 + options: + entrypoint: LcTopKs_XicToL0Ks_OmgcToL0Ks.dv_data_CHARM_{{decay}}:main + extra_options: + input_type: ROOT + input_process: "{{process}}" + input_stream: "{{stream}}" + input_raw_format: 0.5 + simulation: False + data_type: "Upgrade" + geometry_version: run3/trunk + conditions_version: master + output: Data_{{stream}}_{{version}}_{{decay}}.ROOT +{%- endfor %} diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py new file mode 100644 index 0000000000..19963b39a8 --- /dev/null +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py @@ -0,0 +1,482 @@ +############################################################################### +# (c) Copyright 2021-2022 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. # +############################################################################### +""" +Read an HLT2 file and create an ntuple with the new DaVinci configuration. +""" +import Functors as F +import FunTuple.functorcollections as FC +from FunTuple import FunctorCollection +from FunTuple import FunTuple_Particles as Funtuple +from PyConf.reading import get_particles, get_pvs, get_rec_summary +from DaVinci.algorithms import create_lines_filter +from DaVinciMCTools import MCTruthAndBkgCat +from FunTuple.functorcollections import MCHierarchy, MCPrimaries, MCPromptDecay, Kinematics, SelectionInfo, HltTisTos, MCVertexInfo, MCKinematics, ParticleID, EventInfo +from PyConf.reading import get_odin # get_decreports, +from DecayTreeFitter import DecayTreeFitter +from .dtf_maker import make_dtf_variables + +_basic = "basic" +_composite = "composite" +_toplevel = "toplevel" +_Lc = "Lc" +_Lb = "Lb" +_Xic = "Xic" +_Omc = "Omc" + + +def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): + """ + function that returns dictionary of functors that work. + + functors are listed in order of https://lhcbdoc.web.cern.ch/lhcbdoc/moore/master/selection/thor_functors_reference.html#module-Functo + """ + if ptype not in [_basic, _composite]: + Exception(f"I want {_basic} or {_composite}. Got {ptype}") + all_vars = FunctorCollection({}) + + comp = _composite == ptype or _toplevel == ptype # is composite + basic = _basic == ptype # is not composite + + # First import everything that comes in functorcollections + all_vars += FC.Kinematics() + if basic: + all_vars += FC.ParticleID(extra_info=True) + + if comp: # all these require a vertex + all_vars.update({"BPVCORRM": F.BPVCORRM(pvs)}) + all_vars.update({"BPVCORRMERR": F.BPVCORRMERR(pvs)}) + all_vars.update({"BPVDIRA": F.BPVDIRA(pvs)}) + all_vars.update({"BPVDLS": F.BPVDLS(pvs)}) + all_vars.update({"BPVETA": F.BPVETA(pvs)}) + all_vars.update({"BPVFD": F.BPVFD(pvs)}) + all_vars.update({"BPVFDCHI2": F.BPVFDCHI2(pvs)}) + all_vars.update({"BPVFDIR": F.BPVFDIR(pvs)}) + all_vars.update({"BPVFDVEC": F.BPVFDVEC(pvs)}) + + all_vars.update({"BPVIP": F.BPVIP(pvs)}) + all_vars.update({"BPVIPCHI2": F.BPVIPCHI2(pvs)}) + all_vars.update({"BPVX": F.BPVX(pvs)}) + all_vars.update({"BPVY": F.BPVY(pvs)}) + all_vars.update({"BPVZ": F.BPVZ(pvs)}) + + if comp: # all these require a vertex + all_vars.update({"ALLPV_FD": F.ALLPV_FD(pvs)}) + all_vars.update({"ALLPV_IP": F.ALLPV_IP(pvs)}) + all_vars.update({"BPVLTIME": F.BPVLTIME(pvs)}) + all_vars.update({"BPVVDRHO": F.BPVVDRHO(pvs)}) + all_vars.update({"BPVVDX": F.BPVVDX(pvs)}) + all_vars.update({"BPVVDY": F.BPVVDY(pvs)}) + all_vars.update({"BPVVDZ": F.BPVVDZ(pvs)}) + + all_vars.update({"CHARGE": F.CHARGE}) + all_vars.update({"CHI2": F.CHI2}) + all_vars.update({"CHI2DOF": F.CHI2DOF}) + + if comp: + all_vars.update({"END_VRHO": F.END_VRHO}) + all_vars.update({"END_VX": F.END_VX}) + all_vars.update({"END_VY": F.END_VY}) + all_vars.update({"END_VZ": F.END_VZ}) + + all_vars.update({"ETA": F.ETA}) + all_vars.update({"FOURMOMENTUM": F.FOURMOMENTUM}) + all_vars.update({"ISBASIC": F.ISBASICPARTICLE}) + + if basic: + all_vars.update({"GHOSTPROB": F.GHOSTPROB}) + all_vars.update({"ISMUON": F.ISMUON}) + all_vars.update({"INMUON": F.INMUON}) + all_vars.update({"INECAL": F.INECAL}) + all_vars.update({"INHCAL": F.INHCAL}) + all_vars.update({"HASBREM": F.HASBREM}) + all_vars.update({"BREMENERGY": F.BREMENERGY}) + all_vars.update({"BREMBENDCORR": F.BREMBENDCORR}) + all_vars.update({"BREMPIDE": F.BREMPIDE}) + all_vars.update({"ECALPIDE": F.ECALPIDE}) + all_vars.update({"ECALPIDMU": F.ECALPIDMU}) + all_vars.update({"HCALPIDE": F.HCALPIDE}) + all_vars.update({"HCALPIDMU": F.HCALPIDMU}) + all_vars.update({"ELECTRONSHOWEREOP": F.ELECTRONSHOWEREOP}) + all_vars.update({"CLUSTERMATCH": F.CLUSTERMATCH_CHI2}) + all_vars.update({"ELECTRONMATCH": F.ELECTRONMATCH_CHI2}) + all_vars.update({"BREMHYPOMATCH": F.BREMHYPOMATCH_CHI2}) + all_vars.update({"ELECTRONENERGY": F.ELECTRONENERGY}) + all_vars.update({"BREMHYPOENERGY": F.BREMHYPOENERGY}) + all_vars.update({"BREMHYPODELTAX": F.BREMHYPODELTAX}) + all_vars.update({"ELECTRONID": F.ELECTRONID}) + all_vars.update({"HCALEOP": F.HCALEOP}) + # Note: the observables for the two functors below are (TRACK_MOM_X, TRACK_MOM_Y, TRACK_MOM_Z}) + # and (TRACK_POS_CLOSEST_TO_BEAM_X, TRACK_POS_CLOSEST_TO_BEAM_Y, TRACK_POS_CLOSEST_TO_BEAM_Z), + # which is why the trailing underscore in the name is added i.e. "TRACK_MOM_" and "TRACK_POS_CLOSEST_TO_BEAM_" + all_vars.update({"TRACK_MOM": F.TRACK_MOMVEC}) + #all_vars.update({"TRACK_COVARIANCE": F.TRACK_COVARIANCE @ F.TRACKSTATE @ F.TRACK}) + #all_vars.update({"TRACK_POS_CLOSESTTOBEAM_": F.TRACK_POSVEC_CLOSESTTOBEAM}) + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_X" : F.POSITION_X @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Y" : F.POSITION_Y @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Z" : F.POSITION_Z @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks + + all_vars.update({"IS_ABS_ID_pi": F.IS_ABS_ID("pi+")}) + all_vars.update({"IS_ID_pi": F.IS_ID("pi-")}) + all_vars.update({"PDG_MASS_pi": F.PDG_MASS("pi+")}) + all_vars.update({"SIGNED_DELTA_MASS_pi": F.SIGNED_DELTA_MASS("pi+")}) + all_vars.update({"ABS_DELTA_MASS_pi": F.ABS_DELTA_MASS("pi+")}) + all_vars.update({"IS_NOT_H": F.IS_NOT_H}) + all_vars.update({"IS_PHOTON": F.IS_PHOTON}) + + all_vars.update({"MASS": F.MASS}) + + if comp: + all_vars.update({"MAXPT": F.MAX(F.PT)}) + all_vars.update({"MAXDOCA": F.MAXSDOCA}) + all_vars.update({"MAXDOCACHI2": F.MAXSDOCACHI2}) + # the above in cut versions. + + if comp: + all_vars.update({"MINPT": F.MIN(F.PT)}) + all_vars.update({"MINIP": F.MINIP(pvs)}) + all_vars.update({"MINIPCHI2": F.MINIPCHI2(pvs)}) + + if basic: + all_vars.update({"TRACKPT": F.TRACK_PT}) + all_vars.update({ + "TRACKHISTORY": + F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK + }) + all_vars.update({"QOVERP": F.QOVERP @ F.TRACK}) + all_vars.update({"NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK}) + all_vars.update({"NFTHITS": F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK}) + all_vars.update({"NHITS": F.VALUE_OR(-1) @ F.NHITS @ F.TRACK}) + all_vars.update({"NUTHITS": F.VALUE_OR(-1) @ F.NUTHITS @ F.TRACK}) + all_vars.update({"NVPHITS": F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK}) + all_vars.update({ + "TRACKHASVELO": + F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK + }) + all_vars.update({ + "TRACKHASUT": F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK + }) + #all_vars.update({"POS_COV_MATRIX": F.POS_COV_MATRIX}) + #all_vars.update({"THREE_MOM_COV_MATRIX": F.THREE_MOM_COV_MATRIX}) + + all_vars.update({"OBJECT_KEY": F.OBJECT_KEY}) + + all_vars.update({"PHI": F.PHI}) + + all_vars.update({"ABS_PX": F.ABS @ F.PX}) + + all_vars.update({"REFERENCEPOINT_X": F.REFERENCEPOINT_X}) + all_vars.update({"REFERENCEPOINT_Y": F.REFERENCEPOINT_Y}) + all_vars.update({"REFERENCEPOINT_Z": F.REFERENCEPOINT_Z}) + + if comp: + all_vars.update({"DOCA": F.DOCA(Child1=1, Child2=2)}) + all_vars.update({"DOCACHI2": F.DOCACHI2(Child1=1, Child2=2)}) + all_vars.update({"SDOCA": F.SDOCA(1, 2)}) + all_vars.update({"SDOCACHI2": F.SDOCACHI2(1, 2)}) + all_vars.update({"ALV": F.ALV(Child1=1, Child2=2)}) + if basic: + all_vars.update({"SHOWER_SHAPE": F.CALO_NEUTRAL_SHOWER_SHAPE}) + + if comp: + all_vars.update({"SUMPT": F.SUM(F.PT)}) + + if basic: + all_vars.update({"TX": F.TX}) + all_vars.update({"TY": F.TY}) + + print( + f"### For {ptype} returning variables {all_vars.functor_dict.keys()}") + return all_vars + + +def event_variables(PVs, ODIN, decreports, lines): + """ + event variables + """ + + evt_vars = FunctorCollection({}) + evt_vars += FC.EventInfo() + + evt_vars += FC.SelectionInfo(selection_type="Hlt2", trigger_lines=lines) + + if decreports: + evt_vars.update({ + "DECISIONS": + F.DECISIONS( + Lines=[bd2dsk_line + "Decision"], DecReports=decreports) + }) + evt_vars.update({ + "DECREPORTS_FILTER": + F.DECREPORTS_FILTER( + Lines=[bd2dsk_line + "Decision"], DecReports=decreports) + }) + + if ODIN: + evt_vars.update({"EVENTTYPE": F.EVENTTYPE(ODIN)}) + + evt_vars.update({"PV_SIZE": F.SIZE(PVs)}) + + if decreports: + evt_vars.update({"TCK": F.TCK(decreports)}) + + print(f"### For event returning variables {evt_vars.functor_dict.keys()}") + return evt_vars + + +def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, + Hlt2_decisions): + + evtpath_prefix = "/Event/HLT2/" + if not isturbo: + evtpath_prefix = "/Event/Spruce/" + + input_data = get_particles(evtpath_prefix + f"{line_name}/Particles") + + pvs = get_pvs() + + Hlt1_decisions = [ + 'Hlt1TrackMVADecision', + 'Hlt1TwoTrackMVADecision', + 'Hlt1D2KKDecision', + 'Hlt1D2KPiDecision', + 'Hlt1D2PiPiDecision', + 'Hlt1DiMuonHighMassDecision', + 'Hlt1DiMuonLowMassDecision', + 'Hlt1DiMuonSoftDecision', + 'Hlt1KsToPiPiDecision', + 'Hlt1LowPtMuonDecision', + 'Hlt1LowPtDiMuonDecision', + 'Hlt1SingleHighPtMuonDecision', + 'Hlt1TrackMuonMVADecision', + "Hlt1DiMuonNoIP_SSDecision", + "Hlt1DiMuonDrellYan_VLowMassDecision", + "Hlt1DiMuonDrellYan_VLowMass_SSDecision", + "Hlt1DiMuonDrellYanDecision", + "Hlt1DiMuonDrellYan_SSDecision", + "Hlt1DetJpsiToMuMuPosTagLineDecision", + "Hlt1DetJpsiToMuMuNegTagLineDecision", + "Hlt1TrackElectronMVADecision", + "Hlt1SingleHighPtElectronDecision", + "Hlt1DiElectronDisplacedDecision", + "Hlt1SingleHighEtDecision", + "Hlt1DiPhotonHighMassDecision", + "Hlt1Pi02GammaGammaDecision", + "Hlt1DiElectronHighMass_SSDecision", + "Hlt1DiElectronHighMassDecision", + "Hlt1DiMuonNoIPDecision", + ] + + composite_variables = FunctorCollection({ + "END_VX_ERR": + F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "END_VY_ERR": + F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "END_VZ_ERR": + F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.ENDVERTEX, + "BPVX_ERR": + F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "BPVY_ERR": + F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "BPVZ_ERR": + F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.BPV(pvs), + "PERR": + F.SQRT @ F.PERR2, + "PXERR": + F.SQRT @ F.CALL(0, 0) @ F.THREE_MOM_COV_MATRIX, + "PYERR": + F.SQRT @ F.CALL(1, 1) @ F.THREE_MOM_COV_MATRIX, + "PZERR": + F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, + "MM12": + F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)), + "MM13": + F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)), + "MM23": + F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)) + }) + + composite_variables += HltTisTos( + selection_type="Hlt1", trigger_lines=Hlt1_decisions, data=input_data) + if not isturbo: + composite_variables += HltTisTos( + selection_type="Hlt2", + trigger_lines=Hlt2_decisions, + data=input_data) + + daughter_variables = FunctorCollection({ + "PERR": + F.SQRT @ F.PERR2, + "PZERR": + F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, + }) + + #define event level variables + odin = get_odin() + decreports = None + rec_sum = get_rec_summary() + event_info = event_variables( + pvs, odin, decreports, [line_name]) + FunctorCollection({ + "nPVs": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nPVs"), + "nTTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nTTracks"), + "nLongTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nLongTracks"), + "nDownstreamTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nDownstreamTracks"), + "nUpstreamTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nUpstreamTracks"), + "nVeloTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVeloTracks"), + "nBackTracks": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nBackTracks"), + "nRich1Hits": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich1Hits"), + "nRich2Hits": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich2Hits"), + "nVPClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVPClusters"), + "nFTClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nFTClusters"), + "eCalTot": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "eCalTot"), + "hCalTot": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "hCalTot"), + "nEcalClusters": + F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nEcalClusters"), + "ALLPVX": + F.ALLPVX(pvs), + "ALLPVY": + F.ALLPVY(pvs), + "ALLPVZ": + F.ALLPVZ(pvs), + }) + + event_info += FC.SelectionInfo( + selection_type="Hlt1", trigger_lines=Hlt1_decisions) + + allvariables = { + + ############################ + #### Prompt charm lines #### + ############################ + 'Hlt2Charm_LcpToPpKs_LL': { + "Lcp": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "Pp": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KSPip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSPim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_LcpToPpKs_DD' : {}, + 'Hlt2Charm_Xic0ToL0Ks_LLLL': { + "Xic0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0p": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "L0pi": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_Xic0ToL0Ks_LLDD' : {}, + 'Hlt2Charm_Xic0ToL0Ks_DDLL' : {}, + 'Hlt2Charm_Xic0ToL0Ks_DDDD' : {}, + 'Hlt2Charm_Omc0ToL0Ks_LLLL': { + "Omc0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "KS": + composite_variables + all_variables( + pvs, None, _composite) + make_dtf_variables( + pvs, input_data, _composite, particle_to_constrain), + "L0p": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "L0pi": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpip": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + "KSpim": + daughter_variables + all_variables(pvs, None, _basic) + + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), + }, + 'Hlt2Charm_Omc0ToL0Ks_LLDD' : {}, + 'Hlt2Charm_Omc0ToL0Ks_DDLL' : {}, + 'Hlt2Charm_Omc0ToL0Ks_DDDD' : {}, + } + + allvariables['Hlt2Charm_LcpToPpKs_DD'] = allvariables['Hlt2Charm_LcpToPpKs_LL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Xic0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Omc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + + variables = allvariables[line_name] + + #define FunTuple instance + my_tuple = Funtuple( + name=line_name, + tuple_name="DecayTree", + fields=decay_descriptor, + variables=variables, + event_variables=event_info, + store_multiple_cand_info=True, + inputs=input_data) + + return my_tuple + + +def line_prefilter(line_name): + return create_lines_filter(name=f"HLT_PASS{line_name}", lines=[line_name]) + + +def make_dv_tuple(decay_descriptor, line_name, particle_to_constrain): + my_tuple = tuple_template(decay_descriptor, line_name, + particle_to_constrain, True, []) + my_filter = line_prefilter(line_name) + return [my_filter, my_tuple] -- GitLab From ed6240e5533c5d2fe9fa0ecd4ce08170f60e350a Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 16:22:06 +0800 Subject: [PATCH 03/10] delete duplicate dir --- LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py | 224 -------- .../dv_data_CHARM_BaryonTwoBodyDecay.py | 127 ----- LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml | 44 -- LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py | 482 ------------------ 4 files changed, 877 deletions(-) delete mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py delete mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py delete mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml delete mode 100644 LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py deleted file mode 100644 index 5a023b3fc6..0000000000 --- a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dtf_maker.py +++ /dev/null @@ -1,224 +0,0 @@ -############################################################################## -# (c) Copyright 2024 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. # -############################################################################### -"""Configuration functions for DTF -""" -import Functors as F -from Functors.math import log - -from FunTuple import FunctorCollection -from FunTuple.functorcollections import Kinematics - -from DecayTreeFitter import DecayTreeFitter - - -def make_basic_dtf_variables(pvs, - data, - DTF=None, - pv_constraint=False, - mass_constraint=False, - particle_name=""): - variables = ( - FunctorCollection( - { - "TRCHI2DOF": F.CHI2DOF @ F.TRACK, - "ETA": F.ETA, - "PHI": F.PHI, - "TRGHOSTPROB": F.GHOSTPROB, - "BPVIPCHI2": F.BPVIPCHI2(pvs), - "BPVIP": F.BPVIP(pvs), - "BPVX": F.BPVX(pvs), - "BPVY": F.BPVY(pvs), - "BPVZ": F.BPVZ(pvs), - "TX": F.TX, - "TY": F.TY, - "MINIPCHI2": F.MINIPCHI2(pvs), - "MINIP": F.MINIP(pvs), - "KEY": F.VALUE_OR(-1) @ F.OBJECT_KEY @ F.TRACK, - #"CTB" : F.POSITION @ F.CLOSESTTOBEAM @ F.TRACK, - "TRACKPT": F.TRACK_PT, - "TRACKHISTORY": F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK, - "QOVERP": F.QOVERP @ F.TRACK, - "NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK, - }) + Kinematics()) - - if (mass_constraint): - if (pv_constraint): # MASS + PV - dtf_variables_mass_pv = FunctorCollection({ - 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_mass_pv - else: # MASS - dtf_variables_mass = FunctorCollection({ - 'DTF_Fix' + particle_name + '_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_mass - elif (pv_constraint): # PV - dtf_variables_pv = FunctorCollection({ - 'DTF_PV_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_pv - else: # NO MASS/PV - dtf_variables = FunctorCollection({ - 'DTF_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables - - -def make_composite_dtf_variables(pvs, - data, - DTF=None, - pv_constraint=False, - mass_constraint=False, - particle_name=""): - variables = ( - FunctorCollection({ - "MAXPT": F.MAX(F.PT), - "MINPT": F.MIN(F.PT), - "SUMPT": F.SUM(F.PT), - "MAXP": F.MAX(F.P), - "MINP": F.MIN(F.P), - "BPVDIRA": F.BPVDIRA(pvs), - "VCHI2DOF": F.CHI2DOF, #CHI2VXNDOF - "BPVFDCHI2": F.BPVFDCHI2(pvs), - "BPVFD": F.BPVFD(pvs), - "BPVVDRHO": F.BPVVDRHO(pvs), - "BPVVDZ": F.BPVVDZ(pvs), - "BPVIPCHI2": F.BPVIPCHI2(pvs), - "BPVIP": F.BPVIP(pvs), - "LOGBPVIPCHI2": log(F.BPVIPCHI2(pvs)), - "BPVLTIME": F.BPVLTIME(pvs), - "MAXBPVIPCHI2": F.MAX(F.BPVIPCHI2(pvs)), #MAX_ - "MINBPVIPCHI2": F.MIN(F.BPVIPCHI2(pvs)), - "MAXBPVIP": F.MAX(F.BPVIP(pvs)), - "MINBPVIP": F.MIN(F.BPVIP(pvs)), - "ETA": F.ETA, - "PHI": F.PHI, - "END_VX": F.END_VX, #END_ - "END_VY": F.END_VY, - "END_VZ": F.END_VZ, - "BPVX": F.BPVX(pvs), - "BPVY": F.BPVY(pvs), - "BPVZ": F.BPVZ(pvs), - "ALLPVFD": F.ALLPV_FD(pvs), - "ALLPVIP": F.ALLPV_IP(pvs), - }) + Kinematics()) - - addstring = "DTF" - if (pv_constraint): - addstring += '_PV' - if (mass_constraint): - addstring += '_Fix' - addstring += particle_name - - DTF_chi2ndof = FunctorCollection({ - addstring + "_DTFCHI2": DTF.CHI2, - addstring + "_DTFNDOF": DTF.NDOF, - addstring + "_CTAU": DTF.CTAU, - addstring + "_CTAUERR": DTF.CTAUERR, - addstring + "_MERR": DTF.MASSERR, - }) - - if (mass_constraint): - if (pv_constraint): # MASS + PV - dtf_variables_mass_pv = FunctorCollection({ - 'DTF_PV_Fix' + particle_name + '_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_mass_pv + DTF_chi2ndof - else: # MASS - dtf_variables_mass = FunctorCollection({ - 'DTF_Fix' + particle_name + '_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_mass + DTF_chi2ndof - elif (pv_constraint): # PV - dtf_variables_pv = FunctorCollection({ - 'DTF_PV_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables_pv + DTF_chi2ndof - else: # NO MASS/PV - dtf_variables = FunctorCollection({ - 'DTF_' + k: DTF(v) - for k, v in variables.get_thor_functors().items() - }) - return dtf_variables + DTF_chi2ndof - - -# -def make_dtf_variables(pvs, input_data, ptype, particle_to_constrain): - - if ptype not in ["basic", "composite"]: - Exception(f"I want \'basic\' or \'composite\'. Got {ptype}") - - #particle_to_constrain = ["KS0"] - - DTF = DecayTreeFitter( - name=f'DTF_{{hash}}', input_particles=input_data)#, output_level=5) - DTF_PV = DecayTreeFitter( - name=f'DTF_PV_{{hash}}', - input_particles=input_data, - input_pvs=pvs) - #output_level=5) - DTF_PV_mass = DecayTreeFitter( - name=f'DTF_PV_mass_{{hash}}', - input_particles=input_data, - input_pvs=pvs, - mass_constraints=particle_to_constrain) - #output_level=5) - - if ptype == "basic": - dtf_vars = make_basic_dtf_variables( - pvs, - input_data, - DTF=DTF, - pv_constraint=False, - mass_constraint=False) - dtf_vars += make_basic_dtf_variables( - pvs, - input_data, - DTF=DTF_PV, - pv_constraint=True, - mass_constraint=False) - dtf_vars += make_basic_dtf_variables( - pvs, - input_data, - DTF=DTF_PV_mass, - pv_constraint=True, - mass_constraint=True, - particle_name=particle_to_constrain[0]) - return dtf_vars - - if ptype == "composite": - dtf_vars = make_composite_dtf_variables( - pvs, - input_data, - DTF=DTF, - pv_constraint=False, - mass_constraint=False) - dtf_vars += make_composite_dtf_variables( - pvs, - input_data, - DTF=DTF_PV, - pv_constraint=True, - mass_constraint=False) - dtf_vars += make_composite_dtf_variables( - pvs, - input_data, - DTF=DTF_PV_mass, - pv_constraint=True, - mass_constraint=True, - particle_name=particle_to_constrain[0]) - return dtf_vars diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py deleted file mode 100644 index 8053ab53b8..0000000000 --- a/LcTopKs_XicToL0Ks_OmgcToL0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ /dev/null @@ -1,127 +0,0 @@ -from .tuple_maker import make_dv_tuple, tuple_template, line_prefilter -from DaVinci import Options, make_config - -decay_descriptor = { - "LcpToPpKs_LL": { - "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", - "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", - "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", - "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", - "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", - }, - "LcpToPpKs_DD": { - "Lcp": "^([Lambda_c+ -> p+ (KS0 -> pi+ pi-)]CC)", - "Pp": " [Lambda_c+ -> ^p+ (KS0 -> pi+ pi-)]CC", - "KS" : " [Lambda_c+ -> p+ ^(KS0 -> pi+ pi-)]CC", - "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", - "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_LLLL": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_DDLL": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_LLDD": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_DDDD": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Omc0ToL0Ks_LLLL": { - "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Omc0ToL0Ks_DDLL": { - "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Omc0ToL0Ks_LLDD": { - "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Omc0ToL0Ks_DDDD": { - "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Omega_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Omega_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Omega_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - } -} - - -def main(options: Options): - tuples = { - "LcpToPpKs_LL": - make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], - "Hlt2Charm_LcpToPpKs_LL", ["Lambda_c+","KS0"]), - "LcpToPpKs_DD": - make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], - "Hlt2Charm_LcpToPpKs_DD", ["Lambda_c+","KS0"]), - "Xic0ToL0Ks_LLLL": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], - "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Xi_c0","Lambda0","KS0"]), - "Xic0ToL0Ks_DDLL": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], - "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Xi_c0","Lambda0","KS0"]), - "Xic0ToL0Ks_LLDD": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], - "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Xi_c0","Lambda0","KS0"]), - "Xic0ToL0Ks_DDDD": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], - "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Xi_c0","Lambda0","KS0"]), - "Omc0ToL0Ks_LLLL": - make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], - "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Omega_c0","Lambda0","KS0"]), - "Omc0ToL0Ks_DDLL": - make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], - "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Omega_c0","Lambda0","KS0"]), - "Omc0ToL0Ks_LLDD": - make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], - "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Omega_c0","Lambda0","KS0"]), - "Omc0ToL0Ks_DDDD": - make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], - "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Omega_c0","Lambda0","KS0"]), - } - return make_config(options, tuples) diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml b/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml deleted file mode 100644 index 458134e0e9..0000000000 --- a/LcTopKs_XicToL0Ks_OmgcToL0Ks/info.yaml +++ /dev/null @@ -1,44 +0,0 @@ -defaults: - application: DaVinci/v64r9 - wg: Charm - inform: - - hong-jian.wang@cern.ch - - miroslav.saur@cern.ch - - xuanjia.peng@cern.ch - -# data configuration -{%- set datasets = [ - ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), - ('Collision24', '24c2', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), - ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), - ('Collision24', '24c3', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), - ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagUp', 'TurboPass', 'charm'), - ('Collision24', '24c4', 'BaryonTwoBodyDecay', 'MagDown', 'TurboPass', 'charm'), -]%} - -{%- set dv_platform_detdesc = "x86_64_v2-el9-gcc13+detdesc-opt" %} - -{%- for data, version, decay, polarity, process, stream in datasets %} - -data_{{decay}}_charm_{{data}}_{{version}}_{{polarity}}: - application: "DaVinci/v64r9" - input: - bk_query: "/LHCb/{{data}}/Beam6800GeV-VeloClosed-{{polarity}}/Real Data/Sprucing{{version}}/94000000/CHARM.DST" - dq_flags: - - OK - - UNCHECKED - keep_running: true - n_test_lfns: 1 - options: - entrypoint: LcTopKs_XicToL0Ks_OmgcToL0Ks.dv_data_CHARM_{{decay}}:main - extra_options: - input_type: ROOT - input_process: "{{process}}" - input_stream: "{{stream}}" - input_raw_format: 0.5 - simulation: False - data_type: "Upgrade" - geometry_version: run3/trunk - conditions_version: master - output: Data_{{stream}}_{{version}}_{{decay}}.ROOT -{%- endfor %} diff --git a/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py b/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py deleted file mode 100644 index 19963b39a8..0000000000 --- a/LcTopKs_XicToL0Ks_OmgcToL0Ks/tuple_maker.py +++ /dev/null @@ -1,482 +0,0 @@ -############################################################################### -# (c) Copyright 2021-2022 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. # -############################################################################### -""" -Read an HLT2 file and create an ntuple with the new DaVinci configuration. -""" -import Functors as F -import FunTuple.functorcollections as FC -from FunTuple import FunctorCollection -from FunTuple import FunTuple_Particles as Funtuple -from PyConf.reading import get_particles, get_pvs, get_rec_summary -from DaVinci.algorithms import create_lines_filter -from DaVinciMCTools import MCTruthAndBkgCat -from FunTuple.functorcollections import MCHierarchy, MCPrimaries, MCPromptDecay, Kinematics, SelectionInfo, HltTisTos, MCVertexInfo, MCKinematics, ParticleID, EventInfo -from PyConf.reading import get_odin # get_decreports, -from DecayTreeFitter import DecayTreeFitter -from .dtf_maker import make_dtf_variables - -_basic = "basic" -_composite = "composite" -_toplevel = "toplevel" -_Lc = "Lc" -_Lb = "Lb" -_Xic = "Xic" -_Omc = "Omc" - - -def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): - """ - function that returns dictionary of functors that work. - - functors are listed in order of https://lhcbdoc.web.cern.ch/lhcbdoc/moore/master/selection/thor_functors_reference.html#module-Functo - """ - if ptype not in [_basic, _composite]: - Exception(f"I want {_basic} or {_composite}. Got {ptype}") - all_vars = FunctorCollection({}) - - comp = _composite == ptype or _toplevel == ptype # is composite - basic = _basic == ptype # is not composite - - # First import everything that comes in functorcollections - all_vars += FC.Kinematics() - if basic: - all_vars += FC.ParticleID(extra_info=True) - - if comp: # all these require a vertex - all_vars.update({"BPVCORRM": F.BPVCORRM(pvs)}) - all_vars.update({"BPVCORRMERR": F.BPVCORRMERR(pvs)}) - all_vars.update({"BPVDIRA": F.BPVDIRA(pvs)}) - all_vars.update({"BPVDLS": F.BPVDLS(pvs)}) - all_vars.update({"BPVETA": F.BPVETA(pvs)}) - all_vars.update({"BPVFD": F.BPVFD(pvs)}) - all_vars.update({"BPVFDCHI2": F.BPVFDCHI2(pvs)}) - all_vars.update({"BPVFDIR": F.BPVFDIR(pvs)}) - all_vars.update({"BPVFDVEC": F.BPVFDVEC(pvs)}) - - all_vars.update({"BPVIP": F.BPVIP(pvs)}) - all_vars.update({"BPVIPCHI2": F.BPVIPCHI2(pvs)}) - all_vars.update({"BPVX": F.BPVX(pvs)}) - all_vars.update({"BPVY": F.BPVY(pvs)}) - all_vars.update({"BPVZ": F.BPVZ(pvs)}) - - if comp: # all these require a vertex - all_vars.update({"ALLPV_FD": F.ALLPV_FD(pvs)}) - all_vars.update({"ALLPV_IP": F.ALLPV_IP(pvs)}) - all_vars.update({"BPVLTIME": F.BPVLTIME(pvs)}) - all_vars.update({"BPVVDRHO": F.BPVVDRHO(pvs)}) - all_vars.update({"BPVVDX": F.BPVVDX(pvs)}) - all_vars.update({"BPVVDY": F.BPVVDY(pvs)}) - all_vars.update({"BPVVDZ": F.BPVVDZ(pvs)}) - - all_vars.update({"CHARGE": F.CHARGE}) - all_vars.update({"CHI2": F.CHI2}) - all_vars.update({"CHI2DOF": F.CHI2DOF}) - - if comp: - all_vars.update({"END_VRHO": F.END_VRHO}) - all_vars.update({"END_VX": F.END_VX}) - all_vars.update({"END_VY": F.END_VY}) - all_vars.update({"END_VZ": F.END_VZ}) - - all_vars.update({"ETA": F.ETA}) - all_vars.update({"FOURMOMENTUM": F.FOURMOMENTUM}) - all_vars.update({"ISBASIC": F.ISBASICPARTICLE}) - - if basic: - all_vars.update({"GHOSTPROB": F.GHOSTPROB}) - all_vars.update({"ISMUON": F.ISMUON}) - all_vars.update({"INMUON": F.INMUON}) - all_vars.update({"INECAL": F.INECAL}) - all_vars.update({"INHCAL": F.INHCAL}) - all_vars.update({"HASBREM": F.HASBREM}) - all_vars.update({"BREMENERGY": F.BREMENERGY}) - all_vars.update({"BREMBENDCORR": F.BREMBENDCORR}) - all_vars.update({"BREMPIDE": F.BREMPIDE}) - all_vars.update({"ECALPIDE": F.ECALPIDE}) - all_vars.update({"ECALPIDMU": F.ECALPIDMU}) - all_vars.update({"HCALPIDE": F.HCALPIDE}) - all_vars.update({"HCALPIDMU": F.HCALPIDMU}) - all_vars.update({"ELECTRONSHOWEREOP": F.ELECTRONSHOWEREOP}) - all_vars.update({"CLUSTERMATCH": F.CLUSTERMATCH_CHI2}) - all_vars.update({"ELECTRONMATCH": F.ELECTRONMATCH_CHI2}) - all_vars.update({"BREMHYPOMATCH": F.BREMHYPOMATCH_CHI2}) - all_vars.update({"ELECTRONENERGY": F.ELECTRONENERGY}) - all_vars.update({"BREMHYPOENERGY": F.BREMHYPOENERGY}) - all_vars.update({"BREMHYPODELTAX": F.BREMHYPODELTAX}) - all_vars.update({"ELECTRONID": F.ELECTRONID}) - all_vars.update({"HCALEOP": F.HCALEOP}) - # Note: the observables for the two functors below are (TRACK_MOM_X, TRACK_MOM_Y, TRACK_MOM_Z}) - # and (TRACK_POS_CLOSEST_TO_BEAM_X, TRACK_POS_CLOSEST_TO_BEAM_Y, TRACK_POS_CLOSEST_TO_BEAM_Z), - # which is why the trailing underscore in the name is added i.e. "TRACK_MOM_" and "TRACK_POS_CLOSEST_TO_BEAM_" - all_vars.update({"TRACK_MOM": F.TRACK_MOMVEC}) - #all_vars.update({"TRACK_COVARIANCE": F.TRACK_COVARIANCE @ F.TRACKSTATE @ F.TRACK}) - #all_vars.update({"TRACK_POS_CLOSESTTOBEAM_": F.TRACK_POSVEC_CLOSESTTOBEAM}) - #all_vars.update({"POSITION_STATEAT_FirstMeasurement_X" : F.POSITION_X @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks - #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Y" : F.POSITION_Y @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks - #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Z" : F.POSITION_Z @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks - - all_vars.update({"IS_ABS_ID_pi": F.IS_ABS_ID("pi+")}) - all_vars.update({"IS_ID_pi": F.IS_ID("pi-")}) - all_vars.update({"PDG_MASS_pi": F.PDG_MASS("pi+")}) - all_vars.update({"SIGNED_DELTA_MASS_pi": F.SIGNED_DELTA_MASS("pi+")}) - all_vars.update({"ABS_DELTA_MASS_pi": F.ABS_DELTA_MASS("pi+")}) - all_vars.update({"IS_NOT_H": F.IS_NOT_H}) - all_vars.update({"IS_PHOTON": F.IS_PHOTON}) - - all_vars.update({"MASS": F.MASS}) - - if comp: - all_vars.update({"MAXPT": F.MAX(F.PT)}) - all_vars.update({"MAXDOCA": F.MAXSDOCA}) - all_vars.update({"MAXDOCACHI2": F.MAXSDOCACHI2}) - # the above in cut versions. - - if comp: - all_vars.update({"MINPT": F.MIN(F.PT)}) - all_vars.update({"MINIP": F.MINIP(pvs)}) - all_vars.update({"MINIPCHI2": F.MINIPCHI2(pvs)}) - - if basic: - all_vars.update({"TRACKPT": F.TRACK_PT}) - all_vars.update({ - "TRACKHISTORY": - F.VALUE_OR(-1) @ F.TRACKHISTORY @ F.TRACK - }) - all_vars.update({"QOVERP": F.QOVERP @ F.TRACK}) - all_vars.update({"NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK}) - all_vars.update({"NFTHITS": F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK}) - all_vars.update({"NHITS": F.VALUE_OR(-1) @ F.NHITS @ F.TRACK}) - all_vars.update({"NUTHITS": F.VALUE_OR(-1) @ F.NUTHITS @ F.TRACK}) - all_vars.update({"NVPHITS": F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK}) - all_vars.update({ - "TRACKHASVELO": - F.VALUE_OR(-1) @ F.TRACKHASVELO @ F.TRACK - }) - all_vars.update({ - "TRACKHASUT": F.VALUE_OR(-1) @ F.TRACKHASUT @ F.TRACK - }) - #all_vars.update({"POS_COV_MATRIX": F.POS_COV_MATRIX}) - #all_vars.update({"THREE_MOM_COV_MATRIX": F.THREE_MOM_COV_MATRIX}) - - all_vars.update({"OBJECT_KEY": F.OBJECT_KEY}) - - all_vars.update({"PHI": F.PHI}) - - all_vars.update({"ABS_PX": F.ABS @ F.PX}) - - all_vars.update({"REFERENCEPOINT_X": F.REFERENCEPOINT_X}) - all_vars.update({"REFERENCEPOINT_Y": F.REFERENCEPOINT_Y}) - all_vars.update({"REFERENCEPOINT_Z": F.REFERENCEPOINT_Z}) - - if comp: - all_vars.update({"DOCA": F.DOCA(Child1=1, Child2=2)}) - all_vars.update({"DOCACHI2": F.DOCACHI2(Child1=1, Child2=2)}) - all_vars.update({"SDOCA": F.SDOCA(1, 2)}) - all_vars.update({"SDOCACHI2": F.SDOCACHI2(1, 2)}) - all_vars.update({"ALV": F.ALV(Child1=1, Child2=2)}) - if basic: - all_vars.update({"SHOWER_SHAPE": F.CALO_NEUTRAL_SHOWER_SHAPE}) - - if comp: - all_vars.update({"SUMPT": F.SUM(F.PT)}) - - if basic: - all_vars.update({"TX": F.TX}) - all_vars.update({"TY": F.TY}) - - print( - f"### For {ptype} returning variables {all_vars.functor_dict.keys()}") - return all_vars - - -def event_variables(PVs, ODIN, decreports, lines): - """ - event variables - """ - - evt_vars = FunctorCollection({}) - evt_vars += FC.EventInfo() - - evt_vars += FC.SelectionInfo(selection_type="Hlt2", trigger_lines=lines) - - if decreports: - evt_vars.update({ - "DECISIONS": - F.DECISIONS( - Lines=[bd2dsk_line + "Decision"], DecReports=decreports) - }) - evt_vars.update({ - "DECREPORTS_FILTER": - F.DECREPORTS_FILTER( - Lines=[bd2dsk_line + "Decision"], DecReports=decreports) - }) - - if ODIN: - evt_vars.update({"EVENTTYPE": F.EVENTTYPE(ODIN)}) - - evt_vars.update({"PV_SIZE": F.SIZE(PVs)}) - - if decreports: - evt_vars.update({"TCK": F.TCK(decreports)}) - - print(f"### For event returning variables {evt_vars.functor_dict.keys()}") - return evt_vars - - -def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, - Hlt2_decisions): - - evtpath_prefix = "/Event/HLT2/" - if not isturbo: - evtpath_prefix = "/Event/Spruce/" - - input_data = get_particles(evtpath_prefix + f"{line_name}/Particles") - - pvs = get_pvs() - - Hlt1_decisions = [ - 'Hlt1TrackMVADecision', - 'Hlt1TwoTrackMVADecision', - 'Hlt1D2KKDecision', - 'Hlt1D2KPiDecision', - 'Hlt1D2PiPiDecision', - 'Hlt1DiMuonHighMassDecision', - 'Hlt1DiMuonLowMassDecision', - 'Hlt1DiMuonSoftDecision', - 'Hlt1KsToPiPiDecision', - 'Hlt1LowPtMuonDecision', - 'Hlt1LowPtDiMuonDecision', - 'Hlt1SingleHighPtMuonDecision', - 'Hlt1TrackMuonMVADecision', - "Hlt1DiMuonNoIP_SSDecision", - "Hlt1DiMuonDrellYan_VLowMassDecision", - "Hlt1DiMuonDrellYan_VLowMass_SSDecision", - "Hlt1DiMuonDrellYanDecision", - "Hlt1DiMuonDrellYan_SSDecision", - "Hlt1DetJpsiToMuMuPosTagLineDecision", - "Hlt1DetJpsiToMuMuNegTagLineDecision", - "Hlt1TrackElectronMVADecision", - "Hlt1SingleHighPtElectronDecision", - "Hlt1DiElectronDisplacedDecision", - "Hlt1SingleHighEtDecision", - "Hlt1DiPhotonHighMassDecision", - "Hlt1Pi02GammaGammaDecision", - "Hlt1DiElectronHighMass_SSDecision", - "Hlt1DiElectronHighMassDecision", - "Hlt1DiMuonNoIPDecision", - ] - - composite_variables = FunctorCollection({ - "END_VX_ERR": - F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.ENDVERTEX, - "END_VY_ERR": - F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.ENDVERTEX, - "END_VZ_ERR": - F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.ENDVERTEX, - "BPVX_ERR": - F.SQRT @ F.CALL(0, 0) @ F.POS_COV_MATRIX @ F.BPV(pvs), - "BPVY_ERR": - F.SQRT @ F.CALL(1, 1) @ F.POS_COV_MATRIX @ F.BPV(pvs), - "BPVZ_ERR": - F.SQRT @ F.CALL(2, 2) @ F.POS_COV_MATRIX @ F.BPV(pvs), - "PERR": - F.SQRT @ F.PERR2, - "PXERR": - F.SQRT @ F.CALL(0, 0) @ F.THREE_MOM_COV_MATRIX, - "PYERR": - F.SQRT @ F.CALL(1, 1) @ F.THREE_MOM_COV_MATRIX, - "PZERR": - F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, - "MM12": - F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)), - "MM13": - F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)), - "MM23": - F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)) - }) - - composite_variables += HltTisTos( - selection_type="Hlt1", trigger_lines=Hlt1_decisions, data=input_data) - if not isturbo: - composite_variables += HltTisTos( - selection_type="Hlt2", - trigger_lines=Hlt2_decisions, - data=input_data) - - daughter_variables = FunctorCollection({ - "PERR": - F.SQRT @ F.PERR2, - "PZERR": - F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, - }) - - #define event level variables - odin = get_odin() - decreports = None - rec_sum = get_rec_summary() - event_info = event_variables( - pvs, odin, decreports, [line_name]) + FunctorCollection({ - "nPVs": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nPVs"), - "nTTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nTTracks"), - "nLongTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nLongTracks"), - "nDownstreamTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nDownstreamTracks"), - "nUpstreamTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nUpstreamTracks"), - "nVeloTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVeloTracks"), - "nBackTracks": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nBackTracks"), - "nRich1Hits": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich1Hits"), - "nRich2Hits": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nRich2Hits"), - "nVPClusters": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nVPClusters"), - "nFTClusters": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nFTClusters"), - "eCalTot": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "eCalTot"), - "hCalTot": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "hCalTot"), - "nEcalClusters": - F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_sum, "nEcalClusters"), - "ALLPVX": - F.ALLPVX(pvs), - "ALLPVY": - F.ALLPVY(pvs), - "ALLPVZ": - F.ALLPVZ(pvs), - }) - - event_info += FC.SelectionInfo( - selection_type="Hlt1", trigger_lines=Hlt1_decisions) - - allvariables = { - - ############################ - #### Prompt charm lines #### - ############################ - 'Hlt2Charm_LcpToPpKs_LL': { - "Lcp": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "Pp": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KS": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "KSPip": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSPim": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - }, - 'Hlt2Charm_LcpToPpKs_DD' : {}, - 'Hlt2Charm_Xic0ToL0Ks_LLLL': { - "Xic0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "KS": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0p": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "L0pi": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpip": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpim": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - }, - 'Hlt2Charm_Xic0ToL0Ks_LLDD' : {}, - 'Hlt2Charm_Xic0ToL0Ks_DDLL' : {}, - 'Hlt2Charm_Xic0ToL0Ks_DDDD' : {}, - 'Hlt2Charm_Omc0ToL0Ks_LLLL': { - "Omc0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "KS": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0p": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "L0pi": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpip": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpim": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - }, - 'Hlt2Charm_Omc0ToL0Ks_LLDD' : {}, - 'Hlt2Charm_Omc0ToL0Ks_DDLL' : {}, - 'Hlt2Charm_Omc0ToL0Ks_DDDD' : {}, - } - - allvariables['Hlt2Charm_LcpToPpKs_DD'] = allvariables['Hlt2Charm_LcpToPpKs_LL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() - - variables = allvariables[line_name] - - #define FunTuple instance - my_tuple = Funtuple( - name=line_name, - tuple_name="DecayTree", - fields=decay_descriptor, - variables=variables, - event_variables=event_info, - store_multiple_cand_info=True, - inputs=input_data) - - return my_tuple - - -def line_prefilter(line_name): - return create_lines_filter(name=f"HLT_PASS{line_name}", lines=[line_name]) - - -def make_dv_tuple(decay_descriptor, line_name, particle_to_constrain): - my_tuple = tuple_template(decay_descriptor, line_name, - particle_to_constrain, True, []) - my_filter = line_prefilter(line_name) - return [my_filter, my_tuple] -- GitLab From 7120d511fc78f741dd6cb540c1665c26195497e4 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 18:22:09 +0800 Subject: [PATCH 04/10] remove mass-constraining mother particle --- .../dv_data_CHARM_BaryonTwoBodyDecay.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py index 8053ab53b8..f4b5d76c96 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -95,33 +95,33 @@ def main(options: Options): tuples = { "LcpToPpKs_LL": make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], - "Hlt2Charm_LcpToPpKs_LL", ["Lambda_c+","KS0"]), + "Hlt2Charm_LcpToPpKs_LL", ["KS0"]), "LcpToPpKs_DD": make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], - "Hlt2Charm_LcpToPpKs_DD", ["Lambda_c+","KS0"]), + "Hlt2Charm_LcpToPpKs_DD", ["KS0"]), "Xic0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], - "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Lambda0","KS0"]), "Xic0ToL0Ks_DDLL": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], - "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Lambda0","KS0"]), "Xic0ToL0Ks_LLDD": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], - "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Lambda0","KS0"]), "Xic0ToL0Ks_DDDD": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], - "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], - "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], - "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], - "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], - "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Lambda0","KS0"]), } return make_config(options, tuples) -- GitLab From e6523fcbcc5c318b5e64f666556f9b9597c8c382 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 18:30:49 +0800 Subject: [PATCH 05/10] remove mass-constraining mother particle --- .../dv_data_CHARM_BaryonTwoBodyDecay.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py index 8053ab53b8..f4b5d76c96 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -95,33 +95,33 @@ def main(options: Options): tuples = { "LcpToPpKs_LL": make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], - "Hlt2Charm_LcpToPpKs_LL", ["Lambda_c+","KS0"]), + "Hlt2Charm_LcpToPpKs_LL", ["KS0"]), "LcpToPpKs_DD": make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], - "Hlt2Charm_LcpToPpKs_DD", ["Lambda_c+","KS0"]), + "Hlt2Charm_LcpToPpKs_DD", ["KS0"]), "Xic0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], - "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Lambda0","KS0"]), "Xic0ToL0Ks_DDLL": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], - "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Lambda0","KS0"]), "Xic0ToL0Ks_LLDD": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], - "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Lambda0","KS0"]), "Xic0ToL0Ks_DDDD": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], - "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Xi_c0","Lambda0","KS0"]), + "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], - "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], - "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], - "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], - "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Omega_c0","Lambda0","KS0"]), + "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Lambda0","KS0"]), } return make_config(options, tuples) -- GitLab From 387dccc8545f655c7df0909bdb3c2f76ef4d406f Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sat, 23 Nov 2024 18:45:12 +0800 Subject: [PATCH 06/10] remove mass-constraining mother particle --- Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py index f4b5d76c96..6de9f535e8 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -90,7 +90,6 @@ decay_descriptor = { } } - def main(options: Options): tuples = { "LcpToPpKs_LL": -- GitLab From 10a9ef8add1cafd2eee64c07a2fc82bf93b90ce4 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Sun, 24 Nov 2024 01:47:51 +0800 Subject: [PATCH 07/10] change LcTopKs_XicToL0Ks_OmgcToL0Ks to Lc2pKs_Xic2L0Ks_Omgc2L0Ks --- Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml index 458134e0e9..dff4c657aa 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml @@ -30,7 +30,7 @@ data_{{decay}}_charm_{{data}}_{{version}}_{{polarity}}: keep_running: true n_test_lfns: 1 options: - entrypoint: LcTopKs_XicToL0Ks_OmgcToL0Ks.dv_data_CHARM_{{decay}}:main + entrypoint: Lc2pKs_Xic2L0Ks_Omgc2L0Ks.dv_data_CHARM_{{decay}}:main extra_options: input_type: ROOT input_process: "{{process}}" -- GitLab From cd3197784912730b36832178570a8e1dcd70e7f3 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Mon, 9 Dec 2024 17:46:47 +0800 Subject: [PATCH 08/10] AP of Lc2pKs_Xic2L0Ks_Omgc2L0Ks_version0 --- .../dv_data_CHARM_BaryonTwoBodyDecay.py | 12 +++++------ Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py index 6de9f535e8..4bed18e546 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -94,10 +94,10 @@ def main(options: Options): tuples = { "LcpToPpKs_LL": make_dv_tuple(decay_descriptor["LcpToPpKs_LL"], - "Hlt2Charm_LcpToPpKs_LL", ["KS0"]), + "Hlt2Charm_LcpXicpToPpKs_LL", ["KS0"]), "LcpToPpKs_DD": make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], - "Hlt2Charm_LcpToPpKs_DD", ["KS0"]), + "Hlt2Charm_LcpXicpToPpKs_DD", ["KS0"]), "Xic0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Lambda0","KS0"]), @@ -112,15 +112,15 @@ def main(options: Options): "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], - "Hlt2Charm_Omc0ToL0Ks_LLLL", ["Lambda0","KS0"]), + "Hlt2Charm_Oc0ToL0Ks_LLLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDLL"], - "Hlt2Charm_Omc0ToL0Ks_DDLL", ["Lambda0","KS0"]), + "Hlt2Charm_Oc0ToL0Ks_DDLL", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLDD"], - "Hlt2Charm_Omc0ToL0Ks_LLDD", ["Lambda0","KS0"]), + "Hlt2Charm_Oc0ToL0Ks_LLDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_DDDD": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_DDDD"], - "Hlt2Charm_Omc0ToL0Ks_DDDD", ["Lambda0","KS0"]), + "Hlt2Charm_Oc0ToL0Ks_DDDD", ["Lambda0","KS0"]), } return make_config(options, tuples) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py index 19963b39a8..dd8b929a32 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py @@ -368,7 +368,7 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, ############################ #### Prompt charm lines #### ############################ - 'Hlt2Charm_LcpToPpKs_LL': { + 'Hlt2Charm_LcpXicpToPpKs_LL': { "Lcp": composite_variables + all_variables( pvs, None, _composite) + make_dtf_variables( @@ -387,7 +387,7 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, daughter_variables + all_variables(pvs, None, _basic) + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), }, - 'Hlt2Charm_LcpToPpKs_DD' : {}, + 'Hlt2Charm_LcpXicpToPpKs_DD' : {}, 'Hlt2Charm_Xic0ToL0Ks_LLLL': { "Xic0": composite_variables + all_variables( @@ -417,7 +417,7 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, 'Hlt2Charm_Xic0ToL0Ks_LLDD' : {}, 'Hlt2Charm_Xic0ToL0Ks_DDLL' : {}, 'Hlt2Charm_Xic0ToL0Ks_DDDD' : {}, - 'Hlt2Charm_Omc0ToL0Ks_LLLL': { + 'Hlt2Charm_Oc0ToL0Ks_LLLL': { "Omc0": composite_variables + all_variables( pvs, None, _composite) + make_dtf_variables( @@ -443,18 +443,18 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, daughter_variables + all_variables(pvs, None, _basic) + make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), }, - 'Hlt2Charm_Omc0ToL0Ks_LLDD' : {}, - 'Hlt2Charm_Omc0ToL0Ks_DDLL' : {}, - 'Hlt2Charm_Omc0ToL0Ks_DDDD' : {}, + 'Hlt2Charm_Oc0ToL0Ks_LLDD' : {}, + 'Hlt2Charm_Oc0ToL0Ks_DDLL' : {}, + 'Hlt2Charm_Oc0ToL0Ks_DDDD' : {}, } - allvariables['Hlt2Charm_LcpToPpKs_DD'] = allvariables['Hlt2Charm_LcpToPpKs_LL'].copy() + allvariables['Hlt2Charm_LcpXicpToPpKs_DD'] = allvariables['Hlt2Charm_LcpXicpToPpKs_LL'].copy() allvariables['Hlt2Charm_Xic0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() allvariables['Hlt2Charm_Xic0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() allvariables['Hlt2Charm_Xic0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Omc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Omc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Oc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Oc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() + allvariables['Hlt2Charm_Oc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() variables = allvariables[line_name] -- GitLab From 49cbebc2d2041db028af093c762ea41cec578707 Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Wed, 11 Dec 2024 22:47:07 +0800 Subject: [PATCH 09/10] AP of Lc2pKs_Xic2L0Ks_Omgc2L0Ks remove variables --- Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py | 62 ++++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py index dd8b929a32..f4a2907f62 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py +++ b/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py @@ -51,8 +51,8 @@ def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): all_vars += FC.ParticleID(extra_info=True) if comp: # all these require a vertex - all_vars.update({"BPVCORRM": F.BPVCORRM(pvs)}) - all_vars.update({"BPVCORRMERR": F.BPVCORRMERR(pvs)}) + #all_vars.update({"BPVCORRM": F.BPVCORRM(pvs)}) + #all_vars.update({"BPVCORRMERR": F.BPVCORRMERR(pvs)}) all_vars.update({"BPVDIRA": F.BPVDIRA(pvs)}) all_vars.update({"BPVDLS": F.BPVDLS(pvs)}) all_vars.update({"BPVETA": F.BPVETA(pvs)}) @@ -96,23 +96,23 @@ def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): all_vars.update({"INMUON": F.INMUON}) all_vars.update({"INECAL": F.INECAL}) all_vars.update({"INHCAL": F.INHCAL}) - all_vars.update({"HASBREM": F.HASBREM}) - all_vars.update({"BREMENERGY": F.BREMENERGY}) - all_vars.update({"BREMBENDCORR": F.BREMBENDCORR}) - all_vars.update({"BREMPIDE": F.BREMPIDE}) - all_vars.update({"ECALPIDE": F.ECALPIDE}) - all_vars.update({"ECALPIDMU": F.ECALPIDMU}) - all_vars.update({"HCALPIDE": F.HCALPIDE}) - all_vars.update({"HCALPIDMU": F.HCALPIDMU}) - all_vars.update({"ELECTRONSHOWEREOP": F.ELECTRONSHOWEREOP}) - all_vars.update({"CLUSTERMATCH": F.CLUSTERMATCH_CHI2}) - all_vars.update({"ELECTRONMATCH": F.ELECTRONMATCH_CHI2}) - all_vars.update({"BREMHYPOMATCH": F.BREMHYPOMATCH_CHI2}) - all_vars.update({"ELECTRONENERGY": F.ELECTRONENERGY}) - all_vars.update({"BREMHYPOENERGY": F.BREMHYPOENERGY}) - all_vars.update({"BREMHYPODELTAX": F.BREMHYPODELTAX}) - all_vars.update({"ELECTRONID": F.ELECTRONID}) - all_vars.update({"HCALEOP": F.HCALEOP}) + #all_vars.update({"HASBREM": F.HASBREM}) + #all_vars.update({"BREMENERGY": F.BREMENERGY}) + #all_vars.update({"BREMBENDCORR": F.BREMBENDCORR}) + #all_vars.update({"BREMPIDE": F.BREMPIDE}) + #all_vars.update({"ECALPIDE": F.ECALPIDE}) + #all_vars.update({"ECALPIDMU": F.ECALPIDMU}) + #all_vars.update({"HCALPIDE": F.HCALPIDE}) + #all_vars.update({"HCALPIDMU": F.HCALPIDMU}) + #all_vars.update({"ELECTRONSHOWEREOP": F.ELECTRONSHOWEREOP}) + #all_vars.update({"CLUSTERMATCH": F.CLUSTERMATCH_CHI2}) + #all_vars.update({"ELECTRONMATCH": F.ELECTRONMATCH_CHI2}) + #all_vars.update({"BREMHYPOMATCH": F.BREMHYPOMATCH_CHI2}) + #all_vars.update({"ELECTRONENERGY": F.ELECTRONENERGY}) + #all_vars.update({"BREMHYPOENERGY": F.BREMHYPOENERGY}) + #all_vars.update({"BREMHYPODELTAX": F.BREMHYPODELTAX}) + #all_vars.update({"ELECTRONID": F.ELECTRONID}) + #all_vars.update({"HCALEOP": F.HCALEOP}) # Note: the observables for the two functors below are (TRACK_MOM_X, TRACK_MOM_Y, TRACK_MOM_Z}) # and (TRACK_POS_CLOSEST_TO_BEAM_X, TRACK_POS_CLOSEST_TO_BEAM_Y, TRACK_POS_CLOSEST_TO_BEAM_Z), # which is why the trailing underscore in the name is added i.e. "TRACK_MOM_" and "TRACK_POS_CLOSEST_TO_BEAM_" @@ -123,13 +123,13 @@ def all_variables(pvs, mctruth, ptype, candidates=None, ftAlg=None): #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Y" : F.POSITION_Y @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks #all_vars.update({"POSITION_STATEAT_FirstMeasurement_Z" : F.POSITION_Z @ F.STATE_AT("FirstMeasurement")@ F.TRACK}) #NB only long tracks - all_vars.update({"IS_ABS_ID_pi": F.IS_ABS_ID("pi+")}) - all_vars.update({"IS_ID_pi": F.IS_ID("pi-")}) - all_vars.update({"PDG_MASS_pi": F.PDG_MASS("pi+")}) - all_vars.update({"SIGNED_DELTA_MASS_pi": F.SIGNED_DELTA_MASS("pi+")}) - all_vars.update({"ABS_DELTA_MASS_pi": F.ABS_DELTA_MASS("pi+")}) - all_vars.update({"IS_NOT_H": F.IS_NOT_H}) - all_vars.update({"IS_PHOTON": F.IS_PHOTON}) + #all_vars.update({"IS_ABS_ID_pi": F.IS_ABS_ID("pi+")}) + #all_vars.update({"IS_ID_pi": F.IS_ID("pi-")}) + #all_vars.update({"PDG_MASS_pi": F.PDG_MASS("pi+")}) + #all_vars.update({"SIGNED_DELTA_MASS_pi": F.SIGNED_DELTA_MASS("pi+")}) + #all_vars.update({"ABS_DELTA_MASS_pi": F.ABS_DELTA_MASS("pi+")}) + #all_vars.update({"IS_NOT_H": F.IS_NOT_H}) + #all_vars.update({"IS_PHOTON": F.IS_PHOTON}) all_vars.update({"MASS": F.MASS}) @@ -296,11 +296,11 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, "PZERR": F.SQRT @ F.CALL(2, 2) @ F.THREE_MOM_COV_MATRIX, "MM12": - F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)), - "MM13": - F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)), - "MM23": - F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)) + F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)) + #"MM13": + #F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)), + #"MM23": + #F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)) }) composite_variables += HltTisTos( -- GitLab From 4ed4985539bdd2be177a6503cf0d57c5c09bb87b Mon Sep 17 00:00:00 2001 From: "xuanjia.peng" <xuanjia.peng@cern.ch> Date: Thu, 12 Dec 2024 16:23:48 +0800 Subject: [PATCH 10/10] AP of Lc2pKs_Omgc2L0Ks --- .../dtf_maker.py | 0 .../dv_data_CHARM_BaryonTwoBodyDecay.py | 48 ------------------- .../info.yaml | 0 .../tuple_maker.py | 32 ------------- 4 files changed, 80 deletions(-) rename {Lc2pKs_Xic2L0Ks_Omgc2L0Ks => Lc2pKs_Omgc2L0Ks}/dtf_maker.py (100%) rename {Lc2pKs_Xic2L0Ks_Omgc2L0Ks => Lc2pKs_Omgc2L0Ks}/dv_data_CHARM_BaryonTwoBodyDecay.py (58%) rename {Lc2pKs_Xic2L0Ks_Omgc2L0Ks => Lc2pKs_Omgc2L0Ks}/info.yaml (100%) rename {Lc2pKs_Xic2L0Ks_Omgc2L0Ks => Lc2pKs_Omgc2L0Ks}/tuple_maker.py (91%) diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py b/Lc2pKs_Omgc2L0Ks/dtf_maker.py similarity index 100% rename from Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dtf_maker.py rename to Lc2pKs_Omgc2L0Ks/dtf_maker.py diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py b/Lc2pKs_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py similarity index 58% rename from Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py rename to Lc2pKs_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py index 4bed18e546..2f800076a5 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py +++ b/Lc2pKs_Omgc2L0Ks/dv_data_CHARM_BaryonTwoBodyDecay.py @@ -16,42 +16,6 @@ decay_descriptor = { "KSPip" : " [Lambda_c+ -> p+ (KS0 -> ^pi+ pi-)]CC", "KSPim" : " [Lambda_c+ -> p+ (KS0 -> pi+ ^pi-)]CC", }, - "Xic0ToL0Ks_LLLL": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_DDLL": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_LLDD": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, - "Xic0ToL0Ks_DDDD": { - "Xic0" : "^([Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", - "L0" : " [Xi_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", - "KS" : " [Xi_c0 -> (Lambda0 -> p+ pi-) ^(KS0 -> pi+ pi-)]CC", - "L0p" : " [Xi_c0 -> (Lambda0 -> ^p+ pi-) (KS0 -> pi+ pi-)]CC", - "L0pi" : " [Xi_c0 -> (Lambda0 -> p+ ^pi-) (KS0 -> pi+ pi-)]CC", - "KSpip" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> ^pi+ pi-)]CC", - "KSpim" : " [Xi_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ ^pi-)]CC", - }, "Omc0ToL0Ks_LLLL": { "Omc0" : "^([Omega_c0 -> (Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC)", "L0" : " [Omega_c0 -> ^(Lambda0 -> p+ pi-) (KS0 -> pi+ pi-)]CC", @@ -98,18 +62,6 @@ def main(options: Options): "LcpToPpKs_DD": make_dv_tuple(decay_descriptor["LcpToPpKs_DD"], "Hlt2Charm_LcpXicpToPpKs_DD", ["KS0"]), - "Xic0ToL0Ks_LLLL": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLLL"], - "Hlt2Charm_Xic0ToL0Ks_LLLL", ["Lambda0","KS0"]), - "Xic0ToL0Ks_DDLL": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDLL"], - "Hlt2Charm_Xic0ToL0Ks_DDLL", ["Lambda0","KS0"]), - "Xic0ToL0Ks_LLDD": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_LLDD"], - "Hlt2Charm_Xic0ToL0Ks_LLDD", ["Lambda0","KS0"]), - "Xic0ToL0Ks_DDDD": - make_dv_tuple(decay_descriptor["Xic0ToL0Ks_DDDD"], - "Hlt2Charm_Xic0ToL0Ks_DDDD", ["Lambda0","KS0"]), "Omc0ToL0Ks_LLLL": make_dv_tuple(decay_descriptor["Omc0ToL0Ks_LLLL"], "Hlt2Charm_Oc0ToL0Ks_LLLL", ["Lambda0","KS0"]), diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml b/Lc2pKs_Omgc2L0Ks/info.yaml similarity index 100% rename from Lc2pKs_Xic2L0Ks_Omgc2L0Ks/info.yaml rename to Lc2pKs_Omgc2L0Ks/info.yaml diff --git a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py b/Lc2pKs_Omgc2L0Ks/tuple_maker.py similarity index 91% rename from Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py rename to Lc2pKs_Omgc2L0Ks/tuple_maker.py index f4a2907f62..30440f3932 100644 --- a/Lc2pKs_Xic2L0Ks_Omgc2L0Ks/tuple_maker.py +++ b/Lc2pKs_Omgc2L0Ks/tuple_maker.py @@ -388,35 +388,6 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), }, 'Hlt2Charm_LcpXicpToPpKs_DD' : {}, - 'Hlt2Charm_Xic0ToL0Ks_LLLL': { - "Xic0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "KS": - composite_variables + all_variables( - pvs, None, _composite) + make_dtf_variables( - pvs, input_data, _composite, particle_to_constrain), - "L0p": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "L0pi": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpip": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - "KSpim": - daughter_variables + all_variables(pvs, None, _basic) + - make_dtf_variables(pvs, input_data, _basic, particle_to_constrain), - }, - 'Hlt2Charm_Xic0ToL0Ks_LLDD' : {}, - 'Hlt2Charm_Xic0ToL0Ks_DDLL' : {}, - 'Hlt2Charm_Xic0ToL0Ks_DDDD' : {}, 'Hlt2Charm_Oc0ToL0Ks_LLLL': { "Omc0": composite_variables + all_variables( @@ -449,9 +420,6 @@ def tuple_template(decay_descriptor, line_name, particle_to_constrain, isturbo, } allvariables['Hlt2Charm_LcpXicpToPpKs_DD'] = allvariables['Hlt2Charm_LcpXicpToPpKs_LL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() - allvariables['Hlt2Charm_Xic0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Xic0ToL0Ks_LLLL'].copy() allvariables['Hlt2Charm_Oc0ToL0Ks_LLDD'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() allvariables['Hlt2Charm_Oc0ToL0Ks_DDLL'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() allvariables['Hlt2Charm_Oc0ToL0Ks_DDDD'] = allvariables['Hlt2Charm_Oc0ToL0Ks_LLLL'].copy() -- GitLab