diff --git a/rare_charm/info.yaml b/rare_charm/info.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..85199482aea2c41af1b99489024c5ee45c7cac69
--- /dev/null
+++ b/rare_charm/info.yaml
@@ -0,0 +1,61 @@
+defaults:
+  inform:
+      - donata.osthues@cern.ch
+  wg: Charm
+
+
+{%- set conditions = [
+  "MagDown",
+  "MagUp",
+]%}
+
+
+{%- set subsamples = [
+    "rare_charm",
+]%}
+
+{%- set datasets = [
+    ("-Excl-UT", "24c1"),
+    ("-Excl-UT", "24c2"),
+    ("", "24c2"),
+    ("", "24c3"),
+    ("", "24c4"),
+]%}
+
+
+{% for id in subsamples %}
+{% for ut, sprucing in datasets %}
+{% for polarity in conditions %}
+
+{{id}}_2024_{{sprucing}}{{ut}}_{{polarity}}:
+  application: "DaVinci/v64r13"
+  input:
+    bk_query: "/LHCb/Collision24/Beam6800GeV-VeloClosed-{{polarity}}{{ut}}/Real Data/Sprucing{{sprucing}}/94000000/CHARM.DST"
+
+    dq_flags:
+      - UNCHECKED
+      - OK
+    keep_running: true
+  output: DVTUPLE.ROOT
+  options:
+    entrypoint: rare_charm.main_{{id}}:main
+    extra_options:
+      input_raw_format: 0.5
+      input_type: ROOT
+      simulation: False
+      data_type: "Upgrade"
+      event_store: HiveWhiteBoard
+      geometry_version: run3/2024.Q1.2-v00.00
+      conditions_version: master
+      input_process: "TurboPass"
+      input_stream: "charm"
+      evt_max: -1
+      compression:
+        algorithm: ZSTD
+        level: 1
+        max_buffer_size: 1048576
+
+
+{%- endfor %}
+{%- endfor %}
+{%- endfor %}
diff --git a/rare_charm/main_Lb_to_Lcl.py b/rare_charm/main_Lb_to_Lcl.py
new file mode 100644
index 0000000000000000000000000000000000000000..c7b7c2c5ecd5524f5e8d04d5164c1afb95c99ecc
--- /dev/null
+++ b/rare_charm/main_Lb_to_Lcl.py
@@ -0,0 +1,32 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+
+from .options.Lb_to_Lcl import *
+
+from DaVinci import Options, make_config
+from PyConf.reading import get_pvs, get_rec_summary
+
+def main(options: Options):
+        
+    # get ODIN and DecReports location
+    pvs = get_pvs()
+    rec_summary = get_rec_summary()
+
+    tuples = {
+        "Lc2pmumu"   : maketuple_Lb2Lcmu_Lc2pmumu(options, pvs, rec_summary),
+        "Lc2pee"     : maketuple_Lb2Lcmu_Lc2pee(options, pvs, rec_summary),
+        "Lc2KSp_LL"  : maketuple_Lb2Lcmu_Lc2KSp_LL(options, pvs, rec_summary),
+        "Lc2KSp_DD"  : maketuple_Lb2Lcmu_Lc2KSp_DD(options, pvs, rec_summary),
+    }
+        
+    config = make_config(options, tuples)
+
+    return config
\ No newline at end of file
diff --git a/rare_charm/main_Lc_to_pll.py b/rare_charm/main_Lc_to_pll.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b50668aef9c5a0abd25b24c00c684516eb1e839
--- /dev/null
+++ b/rare_charm/main_Lc_to_pll.py
@@ -0,0 +1,41 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+
+from .options.Lc_to_pll import *
+
+from DaVinci import Options, make_config
+from PyConf.reading import get_pvs, get_rec_summary
+
+def main(options: Options):
+        
+    # get ODIN and DecReports location
+    pvs = get_pvs()
+    rec_summary = get_rec_summary()
+
+    tuples = {
+        "Lc2pmumu_OS" : maketuple_Lc2pmumu(options, pvs, rec_summary),
+        "Lc2pmumu_SS" : maketuple_Lc2pmumu_SS(options, pvs, rec_summary),
+        "Lc2pee_OS"   : maketuple_Lc2pee(options, pvs, rec_summary),
+        "Lc2pee_SS"   : maketuple_Lc2pee_SS(options, pvs, rec_summary),
+        "Lc2pmue_OS"  : maketuple_Lc2pmue_OS(options, pvs, rec_summary),
+        "Lc2pmue_SS"  : maketuple_Lc2pmue_SS(options, pvs, rec_summary),
+        # control channels
+        "Lc2pmumu_WS" : maketuple_Lc2pmumu_WS(options, pvs, rec_summary),
+        "Lc2pee_WS"   : maketuple_Lc2pee_WS(options, pvs, rec_summary),
+        "Lc2pmue_WS"  : maketuple_Lc2pmue_WS(options, pvs, rec_summary),
+        "Lc2ppipi"    : maketuple_Lc2ppipi(options, pvs, rec_summary),
+        "Lc2KSp_LL"   : maketuple_Lc2KSp_LL(options, pvs, rec_summary),
+        "Lc2KSp_DD"   : maketuple_Lc2KSp_DD(options, pvs, rec_summary),
+    }
+        
+    config = make_config(options, tuples)
+
+    return config
diff --git a/rare_charm/main_d0_to_hhll.py b/rare_charm/main_d0_to_hhll.py
new file mode 100644
index 0000000000000000000000000000000000000000..9def1684bffafd7d562dc1e16e0adc1c62cceaa0
--- /dev/null
+++ b/rare_charm/main_d0_to_hhll.py
@@ -0,0 +1,41 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+
+from .options.d0_to_hhll import *
+
+from DaVinci import Options, make_config
+from PyConf.reading import get_pvs, get_rec_summary
+
+def main(options: Options):
+        
+    # get ODIN and DecReports location
+    pvs = get_pvs()
+    rec_summary = get_rec_summary()
+
+    tuples = {
+        "Dst2D0pi_D02pipimumu"   : maketuple_Dst2D0pi_D02pipimumu(options, pvs, rec_summary),
+        "Dst2D0pi_D02KKmumu"     : maketuple_Dst2D0pi_D02KKmumu(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_RS" : maketuple_Dst2D0pi_D02Kpimumu_RS(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_WS" : maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary),
+        "D02Kpimumu"             : maketuple_D02Kpimumu(options, pvs, rec_summary),
+        # control channels
+        "DstToD0pi_D0ToKKPiPi"     : maketuple_DstToD0pi_D0ToKKPiPi(options, pvs, rec_summary),
+        "DstToD0pi_D0ToKPiPiPi_RS" : maketuple_DstToD0pi_D0ToKPiPiPi_RS(options, pvs, rec_summary),
+        "DstToD0pi_D0ToKPiPiPi_WS" : maketuple_DstToD0pi_D0ToKPiPiPi_WS(options, pvs, rec_summary),
+        "DstToD0pi_D0ToPiPiPiPi"   : maketuple_DstToD0pi_D0ToPiPiPiPi(options, pvs, rec_summary),
+        "Dst2D0pi_D02pipimumu_WS"  : maketuple_Dst2D0pi_D02pipimumu_WS(options, pvs, rec_summary),
+        "Dst2D0pi_D02KKmumu_WS"    : maketuple_Dst2D0pi_D02KKmumu_WS(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_WS"   : maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary),
+    }
+ 
+    config = make_config(options, tuples)
+
+    return config
diff --git a/rare_charm/main_d_to_hll.py b/rare_charm/main_d_to_hll.py
new file mode 100644
index 0000000000000000000000000000000000000000..f7841c2c67c439627ba3ef0e4794791a08c7f5cb
--- /dev/null
+++ b/rare_charm/main_d_to_hll.py
@@ -0,0 +1,43 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+
+from .options.d_to_hll import *
+
+from DaVinci import Options, make_config
+from PyConf.reading import get_pvs, get_rec_summary
+
+def main(options: Options):
+        
+    # get ODIN and DecReports location
+    pvs = get_pvs()
+    rec_summary = get_rec_summary()
+
+    tuples = {
+        "D2pimumu_OS" : maketuple_D2pimumu_OS(options, pvs, rec_summary),
+        "D2pimumu_SS" : maketuple_D2pimumu_SS(options, pvs, rec_summary),
+        "D2Kmumu_OS"  : maketuple_D2Kmumu_OS(options, pvs, rec_summary),
+        "D2Kmumu_SS"  : maketuple_D2Kmumu_SS(options, pvs, rec_summary),
+        "D2piee_OS"  : maketuple_D2piee_OS(options, pvs, rec_summary),
+        "D2piee_SS"  : maketuple_D2piee_SS(options, pvs, rec_summary),
+        "D2Kee_SS"   : maketuple_D2Kee_OS(options, pvs, rec_summary),
+        "D2Kee_OS"   : maketuple_D2Kee_SS(options, pvs, rec_summary),
+        # control channels
+        "D2pimumu_WS" : maketuple_D2pimumu_WS(options, pvs, rec_summary),
+        "D2Kmumu_WS"  : maketuple_D2Kmumu_WS(options, pvs, rec_summary),
+        "D2Kpipi"     : maketuple_D2Kpipi(options, pvs, rec_summary),
+        "D2pipipi"    : maketuple_D2pipipi(options, pvs, rec_summary),
+        "D2KSK_LL"    : maketuple_D2KSK_LL(options, pvs, rec_summary),
+        "D2KSpi_LL"   : maketuple_D2KSpi_LL(options, pvs, rec_summary),
+    }
+        
+    config = make_config(options, tuples)
+
+    return config
\ No newline at end of file
diff --git a/rare_charm/main_rare_charm.py b/rare_charm/main_rare_charm.py
new file mode 100644
index 0000000000000000000000000000000000000000..d73243ceb9d0066228bb3915e816fbf78af78f32
--- /dev/null
+++ b/rare_charm/main_rare_charm.py
@@ -0,0 +1,80 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+
+from .options.Lb_to_Lcl import *
+from .options.Lc_to_pll import *
+from .options.d0_to_hhll import *
+from .options.d_to_hll import *
+
+from DaVinci import Options, make_config
+from PyConf.reading import get_pvs, get_rec_summary
+
+def main(options: Options):
+        
+    # get ODIN and DecReports location
+    pvs = get_pvs()
+    rec_summary = get_rec_summary()
+
+    tuples = {
+        # --- Lb_to_Lcl
+        "Lc2pmumu"   : maketuple_Lb2Lcmu_Lc2pmumu(options, pvs, rec_summary),
+        "Lc2pee"     : maketuple_Lb2Lcmu_Lc2pee(options, pvs, rec_summary),
+        "Lc2KSp_LL"  : maketuple_Lb2Lcmu_Lc2KSp_LL(options, pvs, rec_summary),
+        "Lc2KSp_DD"  : maketuple_Lb2Lcmu_Lc2KSp_DD(options, pvs, rec_summary),
+        # --- Lc_to_pll
+        "Lc2pmumu_OS" : maketuple_Lc2pmumu(options, pvs, rec_summary),
+        "Lc2pmumu_SS" : maketuple_Lc2pmumu_SS(options, pvs, rec_summary),
+        "Lc2pee_OS"   : maketuple_Lc2pee(options, pvs, rec_summary),
+        "Lc2pee_SS"   : maketuple_Lc2pee_SS(options, pvs, rec_summary),
+        "Lc2pmue_OS"  : maketuple_Lc2pmue_OS(options, pvs, rec_summary),
+        "Lc2pmue_SS"  : maketuple_Lc2pmue_SS(options, pvs, rec_summary),
+        # control channels
+        "Lc2pmumu_WS" : maketuple_Lc2pmumu_WS(options, pvs, rec_summary),
+        "Lc2pee_WS"   : maketuple_Lc2pee_WS(options, pvs, rec_summary),
+        "Lc2pmue_WS"  : maketuple_Lc2pmue_WS(options, pvs, rec_summary),
+        "Lc2ppipi"    : maketuple_Lc2ppipi(options, pvs, rec_summary),
+        "Lc2KSp_LL"   : maketuple_Lc2KSp_LL(options, pvs, rec_summary),
+        "Lc2KSp_DD"   : maketuple_Lc2KSp_DD(options, pvs, rec_summary),
+        # --- d0_to_hhll
+        "Dst2D0pi_D02pipimumu"   : maketuple_Dst2D0pi_D02pipimumu(options, pvs, rec_summary),
+        "Dst2D0pi_D02KKmumu"     : maketuple_Dst2D0pi_D02KKmumu(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_RS" : maketuple_Dst2D0pi_D02Kpimumu_RS(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_WS" : maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary),
+        "D02Kpimumu"             : maketuple_D02Kpimumu(options, pvs, rec_summary),
+        # control channels
+        "DstToD0pi_D0ToKKPiPi"     : maketuple_DstToD0pi_D0ToKKPiPi(options, pvs, rec_summary),
+        "DstToD0pi_D0ToKPiPiPi_RS" : maketuple_DstToD0pi_D0ToKPiPiPi_RS(options, pvs, rec_summary),
+        "DstToD0pi_D0ToKPiPiPi_WS" : maketuple_DstToD0pi_D0ToKPiPiPi_WS(options, pvs, rec_summary),
+        "DstToD0pi_D0ToPiPiPiPi"   : maketuple_DstToD0pi_D0ToPiPiPiPi(options, pvs, rec_summary),
+        "Dst2D0pi_D02pipimumu_WS"  : maketuple_Dst2D0pi_D02pipimumu_WS(options, pvs, rec_summary),
+        "Dst2D0pi_D02KKmumu_WS"    : maketuple_Dst2D0pi_D02KKmumu_WS(options, pvs, rec_summary),
+        "Dst2D0pi_D02Kpimumu_WS"   : maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary),
+        # --- d_to_hll
+        "D2pimumu_OS" : maketuple_D2pimumu_OS(options, pvs, rec_summary),
+        "D2pimumu_SS" : maketuple_D2pimumu_SS(options, pvs, rec_summary),
+        "D2Kmumu_OS"  : maketuple_D2Kmumu_OS(options, pvs, rec_summary),
+        "D2Kmumu_SS"  : maketuple_D2Kmumu_SS(options, pvs, rec_summary),
+        "D2piee_OS"  : maketuple_D2piee_OS(options, pvs, rec_summary),
+        "D2piee_SS"  : maketuple_D2piee_SS(options, pvs, rec_summary),
+        "D2Kee_SS"   : maketuple_D2Kee_OS(options, pvs, rec_summary),
+        "D2Kee_OS"   : maketuple_D2Kee_SS(options, pvs, rec_summary),
+        # control channels
+        "D2pimumu_WS" : maketuple_D2pimumu_WS(options, pvs, rec_summary),
+        "D2Kmumu_WS"  : maketuple_D2Kmumu_WS(options, pvs, rec_summary),
+        "D2Kpipi"     : maketuple_D2Kpipi(options, pvs, rec_summary),
+        "D2pipipi"    : maketuple_D2pipipi(options, pvs, rec_summary),
+        "D2KSK_LL"    : maketuple_D2KSK_LL(options, pvs, rec_summary),
+        "D2KSpi_LL"   : maketuple_D2KSpi_LL(options, pvs, rec_summary),
+    }
+        
+    config = make_config(options, tuples)
+
+    return config
diff --git a/rare_charm/options/Lb_to_Lcl.py b/rare_charm/options/Lb_to_Lcl.py
new file mode 100644
index 0000000000000000000000000000000000000000..7eca718833aaeabe3cff4a20e8c881cfa63a5b36
--- /dev/null
+++ b/rare_charm/options/Lb_to_Lcl.py
@@ -0,0 +1,152 @@
+from .tupling import (
+    make_composite_variables,
+    make_basic_variables,
+    make_hlt2_event_variables,
+    make_basic_isolation_variables,
+    make_intermediate_isolation_variables,
+    make_top_isolation_variables,
+)
+
+from .rare_charm import (
+    make_dtf_variables_pmumu,
+    make_dtf_variables_KSh,
+)
+
+from DaVinci.algorithms import create_lines_filter
+from PyConf.reading import get_particles
+from PyConf.reading import get_particles
+import FunTuple.functorcollections as FC
+from FunTuple import FunTuple_Particles as Funtuple
+
+
+
+def maketuple_Lb2Lcmu_Lc2pmumu(options, pvs, rec_summary):
+    name = "Lb2Lcmu_Lc2pmumu"
+    turbo_line = "Hlt2Charm_B2LcpMum_LcpToPpMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lb"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> mu- mu+) p+) mu-]CC",
+        "Lc"     : "[Lambda_b0 -> ^(Lambda_c+ -> (J/psi(1S) -> mu- mu+) p+) mu-]CC",
+        "Jpsi"   : "[Lambda_b0 -> (Lambda_c+ -> ^(J/psi(1S) -> mu- mu+) p+) mu-]CC",
+        "lm"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> ^mu- mu+) p+) mu-]CC",
+        "lp"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> mu- ^mu+) p+) mu-]CC",
+        "pp"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> mu- mu+) ^p+) mu-]CC",
+        "mumtag" : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> mu- mu+) p+) ^mu-]CC",
+
+    }
+
+    variables = {
+        "Lb"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "Lambda_c+")+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "mumtag" : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lb2Lcmu_Lc2pee(options, pvs, rec_summary):
+    name = "Lb2Lcmu_Lc2pee"
+    turbo_line = "Hlt2Charm_B2LcpMum_LcpToPpEmEp"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lb"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> e- e+) p+) mu-]CC",
+        "Lc"     : "[Lambda_b0 -> ^(Lambda_c+ -> (J/psi(1S) -> e- e+) p+) mu-]CC",
+        "Jpsi"   : "[Lambda_b0 -> (Lambda_c+ -> ^(J/psi(1S) -> e- e+) p+) mu-]CC",
+        "lm"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> ^e- e+) p+) mu-]CC",
+        "lp"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> e- ^e+) p+) mu-]CC",
+        "pp"     : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> e- e+) ^p+) mu-]CC",
+        "mumtag" : "[Lambda_b0 -> (Lambda_c+ -> (J/psi(1S) -> e- e+) p+) ^mu-]CC",
+
+    }
+
+    variables = {
+        "Lb"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "Lambda_c+")+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "mumtag" : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_Lb2Lcmu_Lc2KSp_LL(options, pvs, rec_summary):
+    name = "Lb2Lcmu_Lc2KSp_LL"
+    turbo_line = "Hlt2Charm_B2LcpMumX_LcpToKsPp_LL_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lb"    : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) p+) mu-]CC",
+        "Lc"    : "[Lambda_b0 -> ^(Lambda_c+ -> (KS0 -> pi- pi+) p+) mu-]CC",
+        "KS0"   : "[Lambda_b0 -> (Lambda_c+ -> ^(KS0 -> pi- pi+) p+) mu-]CC",
+        "pim"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> ^pi- pi+) p+) mu-]CC",
+        "pip"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- ^pi+) p+) mu-]CC",
+        "pp"    : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) ^p+) mu-]CC",
+        "mum"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) p+) ^mu-]CC",
+    }
+
+    variables = {
+        "Lb"    : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "Lc"    : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "Lambda_c+")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "KS0"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pp"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "mum"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_Lb2Lcmu_Lc2KSp_DD(options, pvs, rec_summary):
+    name = "Lb2Lcmu_Lc2KSp_DD"
+    turbo_line = "Hlt2Charm_B2LcpMumX_LcpToKsPp_DD_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lb"    : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) p+) mu-]CC",
+        "Lc"    : "[Lambda_b0 -> ^(Lambda_c+ -> (KS0 -> pi- pi+) p+) mu-]CC",
+        "KS0"   : "[Lambda_b0 -> (Lambda_c+ -> ^(KS0 -> pi- pi+) p+) mu-]CC",
+        "pim"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> ^pi- pi+) p+) mu-]CC",
+        "pip"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- ^pi+) p+) mu-]CC",
+        "pp"    : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) ^p+) mu-]CC",
+        "mum"   : "[Lambda_b0 -> (Lambda_c+ -> (KS0 -> pi- pi+) p+) ^mu-]CC",
+    }
+
+    variables = {
+        "Lb"    : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "Lc"    : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "Lambda_c+")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "KS0"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pp"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "mum"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
diff --git a/rare_charm/options/Lc_to_pll.py b/rare_charm/options/Lc_to_pll.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffe1f0d22d2cac2a6423fce61affd43e57d2d0b6
--- /dev/null
+++ b/rare_charm/options/Lc_to_pll.py
@@ -0,0 +1,363 @@
+from .tupling import (
+    make_composite_variables,
+    make_basic_variables,
+    make_hlt2_event_variables,
+    make_basic_isolation_variables,
+    make_intermediate_isolation_variables,
+    make_top_isolation_variables,
+)
+from .rare_charm import (
+    make_dtf_variables_pmumu,
+    make_dtf_variables_KSh,
+)
+from DaVinci.algorithms import create_lines_filter
+from PyConf.reading import get_particles
+from PyConf.reading import get_particles
+from FunTuple import FunTuple_Particles as Funtuple
+
+
+
+def maketuple_Lc2pmumu(options, pvs, rec_summary):
+    name = "Lc2pmumu"
+    turbo_line = "Hlt2Charm_LcpToPpMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> mu- mu+) p+]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> mu- mu+) p+]CC",
+        "lm"   : "[Lambda_c+ -> (J/psi(1S) -> ^mu- mu+) p+]CC",
+        "lp"   : "[Lambda_c+ -> (J/psi(1S) -> mu- ^mu+) p+]CC",
+        "pp"   : "[Lambda_c+ -> (J/psi(1S) -> mu- mu+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pmumu_SS(options, pvs, rec_summary):
+    name = "Lc2pmumu_SS"
+    turbo_line = "Hlt2Charm_LcpToPmMupMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ mu+) p~-]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> mu+ mu+) p~-]CC",
+        "lp1"  : "[Lambda_c+ -> (J/psi(1S) -> ^mu+ mu+) p~-]CC",
+        "lp2"  : "[Lambda_c+ -> (J/psi(1S) -> mu+ ^mu+) p~-]CC",
+        "pm"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ mu+) ^p~-]CC",
+    }
+
+    variables = {
+        "Lc"    : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lp1"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp2"   : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pm"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pee(options, pvs, rec_summary):
+    name = "Lc2pee"
+    turbo_line = "Hlt2Charm_LcpToPpEmEp"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> e- e+) p+]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> e- e+) p+]CC",
+        "lm"   : "[Lambda_c+ -> (J/psi(1S) -> ^e- e+) p+]CC",
+        "lp"   : "[Lambda_c+ -> (J/psi(1S) -> e- ^e+) p+]CC",
+        "pp"   : "[Lambda_c+ -> (J/psi(1S) -> e- e+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pee_SS(options, pvs, rec_summary):
+    name = "Lc2pee_SS"
+    turbo_line = "Hlt2Charm_LcpToPmEpEp"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (J/psi(1S) -> e+ e+) p~-]CC",
+        "Jpsi"  : "[Lambda_c+ -> ^(J/psi(1S) -> e+ e+) p~-]CC",
+        "lp1"   : "[Lambda_c+ -> (J/psi(1S) -> ^e+ e+) p~-]CC",
+        "lp2"   : "[Lambda_c+ -> (J/psi(1S) -> e+ ^e+) p~-]CC",
+        "pm"    : "[Lambda_c+ -> (J/psi(1S) -> e+ e+) ^p~-]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lp1"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp2"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pmue_OS(options, pvs, rec_summary):
+    name = "Lc2pmue_OS"
+    turbo_line = "Hlt2Charm_LcpToPpMumpEpm"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> [mu-]CC [e+]CC) p+]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> [mu-]CC [e+]CC) p+]CC",
+        "mu"   : "[Lambda_c+ -> (J/psi(1S) -> ^[mu-]CC [e+]CC) p+]CC",
+        "e"   : "[Lambda_c+ -> (J/psi(1S) -> [mu-]CC ^[e+]CC) p+]CC",
+        "pp"   : "[Lambda_c+ -> (J/psi(1S) -> [mu-]CC [e+]CC) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "mu"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "e"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pmue_SS(options, pvs, rec_summary):
+    name = "Lc2pmue_SS"
+    turbo_line = "Hlt2Charm_LcpToPmMupEp"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ e+) p~-]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> mu+ e+) p~-]CC",
+        "l1"   : "[Lambda_c+ -> (J/psi(1S) -> ^mu+ e+) p~-]CC",
+        "l2"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ ^e+) p~-]CC",
+        "pp"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ e+) ^p~-]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "l1"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "l2"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+        
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+######################################################################################################################
+################################################## control channels ################################################## 
+######################################################################################################################
+
+
+
+def maketuple_Lc2pmumu_WS(options, pvs, rec_summary):
+    name = "Lc2pmumu_WS"
+    turbo_line = "Hlt2Charm_LcpToPpMupMup_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (J/psi(1S) -> mu+ mu+) p+]CC",
+        "Jpsi"  : "[Lambda_c+ -> ^(J/psi(1S) -> mu+ mu+) p+]CC",
+        "lp1"   : "[Lambda_c+ -> (J/psi(1S) -> ^mu+ mu+) p+]CC",
+        "lp2"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ ^mu+) p+]CC",
+        "pp"    : "[Lambda_c+ -> (J/psi(1S) -> mu+ mu+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lp1"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp2"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pee_WS(options, pvs, rec_summary):
+    name = "Lc2pee_WS"
+    turbo_line = "Hlt2Charm_LcpToPpEpEp_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (J/psi(1S) -> e+ e+) p+]CC",
+        "Jpsi"  : "[Lambda_c+ -> ^(J/psi(1S) -> e+ e+) p+]CC",
+        "lp1"   : "[Lambda_c+ -> (J/psi(1S) -> ^e+ e+) p+]CC",
+        "lp2"   : "[Lambda_c+ -> (J/psi(1S) -> e+ ^e+) p+]CC",
+        "pp"    : "[Lambda_c+ -> (J/psi(1S) -> e+ e+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lp1"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp2"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2pmue_WS(options, pvs, rec_summary):
+    name = "Lc2pmue_WS"
+    turbo_line = "Hlt2Charm_LcpToPpMupEp_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (J/psi(1S) -> mu+ e+) p+]CC",
+        "Jpsi"  : "[Lambda_c+ -> ^(J/psi(1S) -> mu+ e+) p+]CC",
+        "lp1"   : "[Lambda_c+ -> (J/psi(1S) -> ^mu+ e+) p+]CC",
+        "lp2"   : "[Lambda_c+ -> (J/psi(1S) -> mu+ ^e+) p+]CC",
+        "pp"    : "[Lambda_c+ -> (J/psi(1S) -> mu+ e+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lp1"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp2"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2ppipi(options, pvs, rec_summary):
+    name = "Lc2ppipi"
+    turbo_line = "Hlt2Charm_LcpToPpPimPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"   : "[Lambda_c+ -> (J/psi(1S) -> pi- pi+) p+]CC",
+        "Jpsi" : "[Lambda_c+ -> ^(J/psi(1S) -> pi- pi+) p+]CC",
+        "lm"   : "[Lambda_c+ -> (J/psi(1S) -> ^pi- pi+) p+]CC",
+        "lp"   : "[Lambda_c+ -> (J/psi(1S) -> pi- ^pi+) p+]CC",
+        "pp"   : "[Lambda_c+ -> (J/psi(1S) -> pi- pi+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "Jpsi"   : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "composite"),
+        "lm"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "lp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_pmumu(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2KSp_LL(options, pvs, rec_summary):
+    name = "Lc2KSp_LL"
+    turbo_line = "Hlt2Charm_LcpToKsPp_LL_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (KS0 -> pi- pi+) p+]CC",
+        "KS0"   : "[Lambda_c+ -> ^(KS0 -> pi- pi+) p+]CC",
+        "pim"   : "[Lambda_c+ -> (KS0 -> ^pi- pi+) p+]CC",
+        "pip"   : "[Lambda_c+ -> (KS0 -> pi- ^pi+) p+]CC",
+        "pp"    : "[Lambda_c+ -> (KS0 -> pi- pi+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "KS0"    : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "pim"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pip"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Lc2KSp_DD(options, pvs, rec_summary):
+    name = "Lc2KSp_DD"
+    turbo_line = "Hlt2Charm_LcpToKsPp_DD_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Lc"    : "[Lambda_c+ -> (KS0 -> pi- pi+) p+]CC",
+        "KS0"   : "[Lambda_c+ -> ^(KS0 -> pi- pi+) p+]CC",
+        "pim"   : "[Lambda_c+ -> (KS0 -> ^pi- pi+) p+]CC",
+        "pip"   : "[Lambda_c+ -> (KS0 -> pi- ^pi+) p+]CC",
+        "pp"   : "[Lambda_c+ -> (KS0 -> pi- pi+) ^p+]CC",
+    }
+
+    variables = {
+        "Lc"     : make_composite_variables(options, pvs, input_data)+make_top_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "KS0"    : make_composite_variables(options, pvs, input_data)+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0")+make_dtf_variables_KSh(options, pvs, input_data, "composite"),
+        "pim"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pip"    : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+        "pp"     : make_basic_variables(options, pvs, input_data)+make_basic_isolation_variables(turbo_line, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic"),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
diff --git a/rare_charm/options/d0_to_hhll.py b/rare_charm/options/d0_to_hhll.py
new file mode 100644
index 0000000000000000000000000000000000000000..58351257be0f4560773415473802d7d8058c84bd
--- /dev/null
+++ b/rare_charm/options/d0_to_hhll.py
@@ -0,0 +1,438 @@
+from .tupling import (
+    make_composite_variables,
+    make_composite_variables_3body,
+    make_basic_variables,
+    make_hlt2_event_variables,
+    make_DeltaM_variable,
+    make_basic_isolation_variables,
+    make_intermediate_isolation_variables,
+    make_top_isolation_variables,
+)
+from .rare_charm import (
+    make_dtf_variables_hhmumu,
+)
+from DaVinci.algorithms import create_lines_filter
+from PyConf.reading import get_particles
+from FunTuple import FunTuple_Particles as Funtuple
+
+
+
+def maketuple_Dst2D0pi_D02pipimumu(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02pipimumu"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToPimPipMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"  : "[D*(2010)+ -> ([D0]CC -> pi+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "D0"   : "[D*(2010)+ -> ^([D0]CC -> pi+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "pip"  : "[D*(2010)+ -> ([D0]CC -> ^pi+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "pim"  : "[D*(2010)+ -> ([D0]CC -> pi+ ^pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Jpsi" : "[D*(2010)+ -> ([D0]CC -> pi+ pi- ^(J/psi(1S) -> mu- mu+)) pi+]CC",
+        "lm"   : "[D*(2010)+ -> ([D0]CC -> pi+ pi- (J/psi(1S) -> ^mu- mu+)) pi+]CC",
+        "lp"   : "[D*(2010)+ -> ([D0]CC -> pi+ pi- (J/psi(1S) -> mu- ^mu+)) pi+]CC",
+        "spip" : "[D*(2010)+ -> ([D0]CC -> pi+ pi- (J/psi(1S) -> mu- mu+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Dst2D0pi_D02KKmumu(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02KKmumu"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmKpMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"  : "[D*(2010)+ -> ([D0]CC -> K+ K- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "D0"   : "[D*(2010)+ -> ^([D0]CC -> K+ K- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Kp"   : "[D*(2010)+ -> ([D0]CC -> ^K+ K- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Km"   : "[D*(2010)+ -> ([D0]CC -> K+ ^K- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Jpsi" : "[D*(2010)+ -> ([D0]CC -> K+ K- ^(J/psi(1S) -> mu- mu+)) pi+]CC",
+        "lm"   : "[D*(2010)+ -> ([D0]CC -> K+ K- (J/psi(1S) -> ^mu- mu+)) pi+]CC",
+        "lp"   : "[D*(2010)+ -> ([D0]CC -> K+ K- (J/psi(1S) -> mu- ^mu+)) pi+]CC",
+        "spip" : "[D*(2010)+ -> ([D0]CC -> K+ K- (J/psi(1S) -> mu- mu+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "Kp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Km"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+def maketuple_Dst2D0pi_D02Kpimumu_RS(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02Kpimumu_RS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmPipMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"  : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "D0"   : "[D*(2010)+ -> ^(D0 -> K- pi+ (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Km"   : "[D*(2010)+ -> (D0 -> ^K- pi+ (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "pip"  : "[D*(2010)+ -> (D0 -> K- ^pi+ (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Jpsi" : "[D*(2010)+ -> (D0 -> K- pi+ ^(J/psi(1S) -> mu- mu+)) pi+]CC",
+        "lm"   : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> ^mu- mu+)) pi+]CC",
+        "lp"   : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> mu- ^mu+)) pi+]CC",
+        "spip" : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> mu- mu+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "Km"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02Kpimumu_WS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKpPimMumMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"  : "[D*(2010)+ -> (D0 -> K+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "D0"   : "[D*(2010)+ -> ^(D0 -> K+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Kp"   : "[D*(2010)+ -> (D0 -> ^K+ pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "pim"  : "[D*(2010)+ -> (D0 -> K+ ^pi- (J/psi(1S) -> mu- mu+)) pi+]CC",
+        "Jpsi" : "[D*(2010)+ -> (D0 -> K+ pi- ^(J/psi(1S) -> mu- mu+)) pi+]CC",
+        "lm"   : "[D*(2010)+ -> (D0 -> K+ pi- (J/psi(1S) -> ^mu- mu+)) pi+]CC",
+        "lp"   : "[D*(2010)+ -> (D0 -> K+ pi- (J/psi(1S) -> mu- ^mu+)) pi+]CC",
+        "spip" : "[D*(2010)+ -> (D0 -> K+ pi- (J/psi(1S) -> mu- mu+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "Kp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+def maketuple_D02Kpimumu(options, pvs, rec_summary):
+    name = "D02Kpimumu"
+    turbo_line = "Hlt2Charm_D0ToKmPipMumMup_Untag"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}", [turbo_line])
+
+    branches = {
+        "D0"   : "[D0 -> K- pi+ (J/psi(1S) -> mu- mu+)]CC",
+        "Km"   : "[D0 -> ^K- pi+ (J/psi(1S) -> mu- mu+)]CC",
+        "pip"  : "[D0 -> K- ^pi+ (J/psi(1S) -> mu- mu+)]CC",
+        "Jpsi" : "[D0 -> K- pi+ ^(J/psi(1S) -> mu- mu+)]CC",
+        "lm"   : "[D0 -> K- pi+ (J/psi(1S) -> ^mu- mu+)]CC",
+        "lp"   : "[D0 -> K- pi+ (J/psi(1S) -> mu- ^mu+)]CC",
+    }
+
+    variables = {
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_top_isolation_variables(turbo_line, input_data),
+        "Km"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+######################################################################################################################
+################################################## control channels ################################################## 
+######################################################################################################################
+
+
+
+def maketuple_DstToD0pi_D0ToKKPiPi(options, pvs, rec_summary):
+    name = "DstToD0pi_D0ToKKPiPi"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmKpPimPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> ([D0]CC -> K- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^([D0]CC -> K- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Km"    : "[D*(2010)+ -> ([D0]CC -> ^K- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Kp"    : "[D*(2010)+ -> ([D0]CC -> K- ^K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> ([D0]CC -> K- K+ ^(J/psi(1S) -> pi- pi+)) pi+]CC",
+        "lm"    : "[D*(2010)+ -> ([D0]CC -> K- K+ (J/psi(1S) -> ^pi- pi+)) pi+]CC",
+        "lp"    : "[D*(2010)+ -> ([D0]CC -> K- K+ (J/psi(1S) -> pi- ^pi+)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> ([D0]CC -> K- K+ (J/psi(1S) -> pi- pi+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "Km"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Kp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_DstToD0pi_D0ToKPiPiPi_RS(options, pvs, rec_summary):
+    name = "DstToD0pi_D0ToKPiPiPi_RS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmPimPipPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^(D0 -> K- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Km"    : "[D*(2010)+ -> (D0 -> ^K- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "pip"   : "[D*(2010)+ -> (D0 -> K- ^pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> (D0 -> K- pi+ ^(J/psi(1S) -> pi- pi+)) pi+]CC",
+        "lm"    : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> ^pi- pi+)) pi+]CC",
+        "lp"    : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> pi- ^pi+)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> (D0 -> K- pi+ (J/psi(1S) -> pi- pi+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "Km"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_DstToD0pi_D0ToKPiPiPi_WS(options, pvs, rec_summary):
+    name = "DstToD0pi_D0ToKPiPiPi_WS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKpPimPimPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> (D0 -> pi- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^(D0 -> pi- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "pim"   : "[D*(2010)+ -> (D0 -> ^pi- K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Kp"    : "[D*(2010)+ -> (D0 -> pi- ^K+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> (D0 -> pi- K+ ^(J/psi(1S) -> pi- pi+)) pi+]CC",
+        "lm"    : "[D*(2010)+ -> (D0 -> pi- K+ (J/psi(1S) -> ^pi- pi+)) pi+]CC",
+        "lp"    : "[D*(2010)+ -> (D0 -> pi- K+ (J/psi(1S) -> pi- ^pi+)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> (D0 -> pi- K+ (J/psi(1S) -> pi- pi+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Kp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_DstToD0pi_D0ToPiPiPiPi(options, pvs, rec_summary):
+    name = "DstToD0pi_D0ToPiPiPiPi"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToPimPimPipPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> ([D0]CC -> pi- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^([D0]CC -> pi- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "pim"   : "[D*(2010)+ -> ([D0]CC -> ^pi- pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "pip"   : "[D*(2010)+ -> ([D0]CC -> pi- ^pi+ (J/psi(1S) -> pi- pi+)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> ([D0]CC -> pi- pi+ ^(J/psi(1S) -> pi- pi+)) pi+]CC",
+        "lm"    : "[D*(2010)+ -> ([D0]CC -> pi- pi+ (J/psi(1S) -> ^pi- pi+)) pi+]CC",
+        "lp"    : "[D*(2010)+ -> ([D0]CC -> pi- pi+ (J/psi(1S) -> pi- ^pi+)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> ([D0]CC -> pi- pi+ (J/psi(1S) -> pi- pi+)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+
+def maketuple_Dst2D0pi_D02pipimumu_WS(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02pipimumu_WS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToPimpPimpMumpMump_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> ([D0]CC -> [pi+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^([D0]CC -> [pi+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h1"    : "[D*(2010)+ -> ([D0]CC -> ^[pi+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h2"    : "[D*(2010)+ -> ([D0]CC -> [pi+]CC ^[pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> ([D0]CC -> [pi+]CC [pi+]CC ^(J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "l1"    : "[D*(2010)+ -> ([D0]CC -> [pi+]CC [pi+]CC (J/psi(1S) -> ^[mu+]CC [mu+]CC)) pi+]CC",
+        "l2"    : "[D*(2010)+ -> ([D0]CC -> [pi+]CC [pi+]CC (J/psi(1S) -> [mu+]CC ^[mu+]CC)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> ([D0]CC -> [pi+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) ^pi+]CC",
+    }
+    
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "h1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "h2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "l1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "l2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_Dst2D0pi_D02KKmumu_WS(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02KKmumu_WS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmpKmpMumpMump_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> ([D0]CC -> [K+]CC [K+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^([D0]CC -> [K+]CC [K+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h1"    : "[D*(2010)+ -> ([D0]CC -> ^[K+]CC [K+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h2"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC ^[K+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> ([D0]CC -> [K+]CC [K+]CC ^(J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "l1"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC [K+]CC (J/psi(1S) -> ^[mu+]CC [mu+]CC)) pi+]CC",
+        "l2"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC [K+]CC (J/psi(1S) -> [mu+]CC ^[mu+]CC)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> ([D0]CC -> [K+]CC [K+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) ^pi+]CC",
+    }
+    
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "h1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "h2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "l1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "l2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+    
+
+    
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_Dst2D0pi_D02Kpimumu_WS(options, pvs, rec_summary):
+    name = "Dst2D0pi_D02Kpimumu_WS"
+    turbo_line = "Hlt2Charm_DstpToD0Pip_D0ToKmpPimpMumpMump_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+
+    branches = {
+        "Dst"   : "[D*(2010)+ -> ([D0]CC -> [K+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "D0"    : "[D*(2010)+ -> ^([D0]CC -> [K+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h1"    : "[D*(2010)+ -> ([D0]CC -> ^[K+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "h2"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC ^[pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "Jpsi"  : "[D*(2010)+ -> ([D0]CC -> [K+]CC [pi+]CC ^(J/psi(1S) -> [mu+]CC [mu+]CC)) pi+]CC",
+        "l1"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC [pi+]CC (J/psi(1S) -> ^[mu+]CC [mu+]CC)) pi+]CC",
+        "l2"    : "[D*(2010)+ -> ([D0]CC -> [K+]CC [pi+]CC (J/psi(1S) -> [mu+]CC ^[mu+]CC)) pi+]CC",
+        "spip"  : "[D*(2010)+ -> ([D0]CC -> [K+]CC [pi+]CC (J/psi(1S) -> [mu+]CC [mu+]CC)) ^pi+]CC",
+    }
+
+    variables = {
+        "Dst"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_DeltaM_variable(options)+make_top_isolation_variables(turbo_line, input_data),
+        "D0"    : make_composite_variables_3body(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite3b")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "D0"),
+        "h1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "h2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "l1"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "l2"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "spip"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hhmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+    
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
diff --git a/rare_charm/options/d_to_hll.py b/rare_charm/options/d_to_hll.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa9a6dac4edcfabf5312402b9f87512cb4e8f4ae
--- /dev/null
+++ b/rare_charm/options/d_to_hll.py
@@ -0,0 +1,432 @@
+from .tupling import (
+    make_composite_variables,
+    make_basic_variables,
+    make_hlt2_event_variables,
+    make_basic_isolation_variables,
+    make_intermediate_isolation_variables,
+    make_top_isolation_variables,
+)
+from .rare_charm import (
+    make_dtf_variables_hmumu,
+    make_dtf_variables_KSh,
+)
+from DaVinci.algorithms import create_lines_filter
+from PyConf.reading import get_particles
+from PyConf.reading import get_particles
+from FunTuple import FunTuple_Particles as Funtuple
+
+
+
+def maketuple_D2pimumu_OS(options, pvs, rec_summary): 
+    name = "D2pimumu_OS"
+    turbo_line = "Hlt2Charm_DpDspToPipMumMup" 
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (J/psi(1S) -> mu- mu+) pi+]CC",
+        "Jpsi" : "[D+ -> ^(J/psi(1S) -> mu- mu+) pi+]CC",
+        "lm"   : "[D+ -> (J/psi(1S) -> ^mu- mu+) pi+]CC",
+        "lp"   : "[D+ -> (J/psi(1S) -> mu- ^mu+) pi+]CC",
+        "hp"   : "[D+ -> (J/psi(1S) -> mu- mu+) ^pi+]CC",
+    }
+
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2pimumu_SS(options, pvs, rec_summary): 
+    name = "D2pimumu_SS"
+    turbo_line = "Hlt2Charm_DpDspToPimMupMup"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) pi-]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> mu+ mu+) pi-]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^mu+ mu+) pi-]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> mu+ ^mu+) pi-]CC",
+        "hm"    : "[D+ -> (J/psi(1S) -> mu+ mu+) ^pi-]CC",
+    }
+
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+    
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2Kmumu_OS(options, pvs, rec_summary):
+    name = "D2Kmumu_OS"
+    turbo_line = "Hlt2Charm_DpDspToKpMumMup" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (J/psi(1S) -> mu- mu+) K+]CC",
+        "Jpsi" : "[D+ -> ^(J/psi(1S) -> mu- mu+) K+]CC",
+        "lm"   : "[D+ -> (J/psi(1S) -> ^mu- mu+) K+]CC",
+        "lp"   : "[D+ -> (J/psi(1S) -> mu- ^mu+) K+]CC",
+        "hp"   : "[D+ -> (J/psi(1S) -> mu- mu+) ^K+]CC",
+    }
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2Kmumu_SS(options, pvs, rec_summary):
+    name = "D2dKmumu_SS"
+    turbo_line = "Hlt2Charm_DpDspToKmMupMup" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) K-]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> mu+ mu+) K-]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^mu+ mu+) K-]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> mu+ ^mu+) K-]CC",
+        "hm"    : "[D+ -> (J/psi(1S) -> mu+ mu+) ^K-]CC",
+    }
+
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2piee_OS(options, pvs, rec_summary):
+    name = "D2piee_OS"
+    turbo_line = "Hlt2Charm_DpDspToPipEmEp" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> e+ e-) pi+]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> e+ e-) pi+]CC",
+        "lp"    : "[D+ -> (J/psi(1S) -> ^e+ e-) pi+]CC",
+        "lm"    : "[D+ -> (J/psi(1S) -> e+ ^e-) pi+]CC",
+        "hp"    : "[D+ -> (J/psi(1S) -> e+ e-) ^pi+]CC",
+    }
+
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_D2piee_SS(options, pvs, rec_summary):
+    name = "D2piee_SS"
+    turbo_line = "Hlt2Charm_DpDspToPimEpEp" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> e+ e+) pi-]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> e+ e+) pi-]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^e+ e+) pi-]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> e+ ^e+) pi-]CC",
+        "hm"    : "[D+ -> (J/psi(1S) -> e+ e+) ^pi-]CC",
+    }
+
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_D2Kee_OS(options, pvs, rec_summary):
+    name = "D2Kee_OS"
+    turbo_line = "Hlt2Charm_DpDspToKpEmEp" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> e+ e-) K+]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> e+ e-) K+]CC",
+        "lp"    : "[D+ -> (J/psi(1S) -> ^e+ e-) K+]CC",
+        "lm"    : "[D+ -> (J/psi(1S) -> e+ ^e-) K+]CC",
+        "hp"    : "[D+ -> (J/psi(1S) -> e+ e-) ^K+]CC",
+    }
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+def maketuple_D2Kee_SS(options, pvs, rec_summary):
+    name = "D2Kee_SS"
+    turbo_line = "Hlt2Charm_DpDspToKmEpEp" 
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> e+ e+) K-]CC",
+        "Jpsi"  : "[D+ -> ^(J/psi(1S) -> e+ e+) K-]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^e+ e+) K-]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> e+ ^e+) K-]CC",
+        "hm"    : "[D+ -> (J/psi(1S) -> e+ e+) ^K-]CC",
+    }
+
+    variables = {
+        "Dp"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi" : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"  : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hm"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data)
+
+    return [myfilter, mytuple]
+
+
+
+######################################################################################################################
+################################################## control channels ################################################## 
+######################################################################################################################
+
+
+
+def maketuple_D2pimumu_WS(options, pvs, rec_summary):
+    name = "D2pimumu_WS"
+    turbo_line = "Hlt2Charm_DpDspToPipMupMup_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) pi+]CC",
+        "Jpsi"  : "[D+ -> (J/psi(1S) -> mu+ mu+) pi+]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^mu+ mu+) pi+]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> mu+ ^mu+) pi+]CC",
+        "hp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) ^pi+]CC",
+    }
+
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2Kmumu_WS(options, pvs, rec_summary):
+    name = "D2Kmumu_WS"
+    turbo_line = "Hlt2Charm_DpDspToKpMupMup_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) K+]CC",
+        "Jpsi"  : "[D+ -> (J/psi(1S) -> mu+ mu+) K+]CC",
+        "lp1"   : "[D+ -> (J/psi(1S) -> ^mu+ mu+) K+]CC",
+        "lp2"   : "[D+ -> (J/psi(1S) -> mu+ ^mu+) K+]CC",
+        "hp"    : "[D+ -> (J/psi(1S) -> mu+ mu+) ^K+]CC",
+    }
+
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lp1"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp2"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2Kpipi(options, pvs, rec_summary):
+    name = "D2Kpipi"
+    turbo_line = "Hlt2Charm_DpDspToPipPimPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (J/psi(1S) -> pi- pi+) K+]CC",
+        "Jpsi" : "[D+ -> (J/psi(1S) -> pi- pi+) K+]CC",
+        "lm"   : "[D+ -> (J/psi(1S) -> ^pi- pi+) K+]CC",
+        "lp"   : "[D+ -> (J/psi(1S) -> pi- ^pi+) K+]CC",
+        "hp"   : "[D+ -> (J/psi(1S) -> pi- pi+) ^K+]CC",
+    }
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_D2pipipi(options, pvs, rec_summary, _NoCuts=False):
+    name = "D2pipipi"
+    turbo_line = "Hlt2Charm_DpDspToPipPimPip_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (J/psi(1S) -> pi- pi+) pi+]CC",
+        "Jpsi" : "[D+ -> (J/psi(1S) -> pi- pi+) pi+]CC",
+        "lm"   : "[D+ -> (J/psi(1S) -> ^pi- pi+) pi+]CC",
+        "lp"   : "[D+ -> (J/psi(1S) -> pi- ^pi+) pi+]CC",
+        "hp"   : "[D+ -> (J/psi(1S) -> pi- pi+) ^pi+]CC",
+    }
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "Jpsi"  : make_composite_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data),
+        "lm"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "lp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_hmumu(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, store_multiple_cand_info=True)
+
+    return [myfilter, mytuple]
+
+
+
+def maketuple_D2KSK_LL(options, pvs, rec_summary):
+    name = "D2KSK_LL"
+    turbo_line = "Hlt2Charm_DpDspToKsKp_LL_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (KS0 -> pi- pi+) K+]CC",
+        "KS0"  : "[D+ -> ^(KS0 -> pi- pi+) K+]CC",
+        "pim"  : "[D+ -> (KS0 -> ^pi- pi+) K+]CC",
+        "pip"  : "[D+ -> (KS0 -> pi- ^pi+) K+]CC",
+        "hp"   : "[D+ -> (KS0 -> pi- pi+) ^K+]CC",
+    }
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "KS0"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, use_loki_decay_finder=True)
+
+    return [myfilter, mytuple]
+
+
+def maketuple_D2KSpi_LL(options, pvs, rec_summary):
+    name = "D2KSpi_LL"
+    turbo_line = "Hlt2Charm_DpDspToKsPip_LL_RareCharmControl"
+
+    input_data = get_particles(f"/Event/HLT2/{turbo_line}/Particles")
+    myfilter = create_lines_filter(f"LineFilter_{turbo_line}_{{hash}}",[turbo_line],)
+
+    branches = {
+        "Dp"   : "[D+ -> (KS0 -> pi- pi+) pi+]CC",
+        "KS0"  : "[D+ -> ^(KS0 -> pi- pi+) pi+]CC",
+        "pim"  : "[D+ -> (KS0 -> ^pi- pi+) pi+]CC",
+        "pip"  : "[D+ -> (KS0 -> pi- ^pi+) pi+]CC",
+        "hp"   : "[D+ -> (KS0 -> pi- pi+) ^pi+]CC",
+    }
+
+
+    variables = {
+        "Dp"    : make_composite_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite")+make_top_isolation_variables(turbo_line, input_data),
+        "KS0"   : make_composite_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "composite")+make_intermediate_isolation_variables(turbo_line, input_data, composite_ID = "KS0"),
+        "pim"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "pip"   : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+        "hp"    : make_basic_variables(options, pvs, input_data)+make_dtf_variables_KSh(options, pvs, input_data, "basic")+make_basic_isolation_variables(turbo_line, input_data),
+    }
+
+    mytuple  = Funtuple(name=name, tuple_name="DecayTree", fields=branches, variables = variables,  event_variables=make_hlt2_event_variables(options, pvs, rec_summary), inputs=input_data, use_loki_decay_finder=True)
+
+    return [myfilter, mytuple]
+
+
diff --git a/rare_charm/options/rare_charm.py b/rare_charm/options/rare_charm.py
new file mode 100644
index 0000000000000000000000000000000000000000..8997b0ea5d343c78f52898d5bc300681db18a679
--- /dev/null
+++ b/rare_charm/options/rare_charm.py
@@ -0,0 +1,337 @@
+from .tupling import (
+    make_composite_dtf_variables,
+    make_composite_dtf_variables_3body,
+    make_basic_dtf_variables,
+)
+
+def make_dtf_variables_hmumu(options, pvs, input_data, ptype):
+
+    if ptype not in ["basic", "composite"]:
+        Exception(f"I want \'basic\' or \'composite\'. Got {ptype}")
+
+    from DecayTreeFitter import DecayTreeFitter
+    '''
+    DTF = DecayTreeFitter(
+        name=f'DTF_{{hash}}',
+        input_particles=input_data)
+    '''
+    DTFvtx = DecayTreeFitter(
+        name=f'DTFvtx_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs)
+
+    DTFmassDp = DecayTreeFitter(
+        name=f'DTFmassDp_{{hash}}',
+        input_particles=input_data,
+        mass_constraints=["D+"])
+
+    DTFvtxmassDp = DecayTreeFitter(
+        name=f'DTFvtxmassDp_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs,
+        mass_constraints=["D+"])
+
+    DTFmassDsp = DecayTreeFitter(
+        name=f'DTFmassDsp_{{hash}}',
+        input_particles=input_data,
+        substitutions = ['D+{{D_s+}}','D-{{D_s-}}'],
+        mass_constraints=["D_s+"])
+
+    DTFvtxmassDsp = DecayTreeFitter(
+        name=f'DTFvtxmassDsp_{{hash}}',
+        input_particles=input_data,
+        substitutions = ['D+{{D_s+}}','D-{{D_s-}}',"J/psi(1S){{J/psi(1S)}}"],#trick
+        mass_constraints=["D_s+"],
+        input_pvs=pvs,
+    )
+
+    if ptype == "basic":
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassDp,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Dp")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassDp,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Dp")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassDsp,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Dsp")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassDsp,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Dsp")
+        return dtf_vars
+
+    if ptype == "composite":
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassDp,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Dp")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassDp,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Dp")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassDsp,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Dsp")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassDsp,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Dsp")
+        return dtf_vars
+        
+
+
+def make_dtf_variables_pmumu(options, pvs, input_data, ptype):
+
+    if ptype not in ["basic", "composite"]:
+        Exception(f"I want \'basic\' or \'composite\'. Got {ptype}")
+
+    from DecayTreeFitter import DecayTreeFitter
+    '''
+    DTF = DecayTreeFitter(
+        name=f'DTF_{{hash}}',
+        input_particles=input_data)
+    '''
+    DTFvtx = DecayTreeFitter(
+        name=f'DTFvtx_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs)
+
+    DTFmass = DecayTreeFitter(
+        name=f'DTFmass_{{hash}}',
+        input_particles=input_data,
+        mass_constraints=["Lambda_c+"])
+
+    DTFvtxmass = DecayTreeFitter(
+        name=f'DTFvtxmass_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs,
+        mass_constraints=["Lambda_c+"])
+
+    if ptype == "basic":
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmass,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Lc")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmass,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Lc")
+        return dtf_vars
+
+    if ptype == "composite":
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmass,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="Lc")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmass,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="Lc")
+        return dtf_vars
+
+def make_dtf_variables_hhmumu(options, pvs, input_data, ptype):
+
+    if ptype not in ["basic", "composite","composite3b"]:
+        Exception(f"I want \'basic\' or \'composite\' or \'composite3b\. Got {ptype}")
+
+    from DecayTreeFitter import DecayTreeFitter
+    '''
+    DTF = DecayTreeFitter(
+        name=f'DTF_{{hash}}',
+        input_particles=input_data)
+    '''
+    DTFvtx = DecayTreeFitter(
+        name=f'DTFvtx_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs)
+
+    DTFmass = DecayTreeFitter(
+        name=f'DTFmass_{{hash}}',
+        input_particles=input_data,
+        mass_constraints=["D0"])
+
+    DTFvtxmass = DecayTreeFitter(
+        name=f'DTFvtxmass_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs,
+        mass_constraints=["D0"])
+
+    if ptype == "basic":
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmass,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="D0")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmass,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="D0")
+        return dtf_vars
+
+    if ptype == "composite3b":
+        '''
+        dtf_vars = make_composite_dtf_variables_3body(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_composite_dtf_variables_3body(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_composite_dtf_variables_3body(options, pvs, input_data,
+                                             DTF=DTFmass,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="D0")
+        dtf_vars += make_composite_dtf_variables_3body(options, pvs, input_data,
+                                             DTF=DTFvtxmass,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="D0")
+
+        return dtf_vars
+        
+    if ptype == "composite":
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmass,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="D0")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmass,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="D0")
+        return dtf_vars
+
+
+def make_dtf_variables_KSh(options, pvs, input_data, ptype):
+
+    if ptype not in ["basic", "composite"]:
+        Exception(f"I want \'basic\' or \'composite\'. Got {ptype}")
+
+    from DecayTreeFitter import DecayTreeFitter
+    '''
+    DTF = DecayTreeFitter(
+        name=f'DTF_{{hash}}',
+        input_particles=input_data)
+    '''
+    DTFvtx = DecayTreeFitter(
+        name=f'DTFvtx_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs)
+
+    DTFmassKS0 = DecayTreeFitter(
+        name=f'DTFmassKS0_{{hash}}',
+        input_particles=input_data,
+        mass_constraints=["KS0"])
+
+    DTFvtxmassKS0 = DecayTreeFitter(
+        name=f'DTFvtxmassKS0_{{hash}}',
+        input_particles=input_data,
+        input_pvs=pvs,
+        mass_constraints=["KS0"])
+
+    if ptype == "basic":
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_basic_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassKS0,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="KS0")
+        dtf_vars += make_basic_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassKS0,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="KS0")
+        return dtf_vars
+
+    if ptype == "composite":
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTF,
+                                            pv_constraint=False,
+                                            mass_constraint=False)
+        '''
+        dtf_vars = make_composite_dtf_variables(options, pvs, input_data,
+                                            DTF=DTFvtx,
+                                            pv_constraint=True,
+                                            mass_constraint=False)
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFmassKS0,
+                                             pv_constraint=False,
+                                             mass_constraint=True, particle_name="KS0")
+        dtf_vars += make_composite_dtf_variables(options, pvs, input_data,
+                                             DTF=DTFvtxmassKS0,
+                                             pv_constraint=True,
+                                             mass_constraint=True, particle_name="KS0")
+        return dtf_vars
+        
\ No newline at end of file
diff --git a/rare_charm/options/tupling.py b/rare_charm/options/tupling.py
new file mode 100644
index 0000000000000000000000000000000000000000..05772aa76d96e6299754c31d73a73aaf57ccd0e3
--- /dev/null
+++ b/rare_charm/options/tupling.py
@@ -0,0 +1,805 @@
+##############################################################################
+# (c) Copyright 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.                                       #
+###############################################################################
+
+import Functors as F
+from Functors.math import log
+import Functors.math as fmath
+
+from FunTuple import FunctorCollection
+from FunTuple.functorcollections import (
+    MCHierarchy,
+    MCPromptDecay,
+    Kinematics,
+    SelectionInfo,
+    HltTisTos,
+    MCVertexInfo,
+    MCKinematics,
+    ParticleID, #wrong variables PID_PI = 0, PROBNN_D = nan
+    EventInfo,
+    LHCInfo,
+    ParticleIsolation,
+    MCPrimaries,
+    MCReconstructed,
+    MCReconstructible,
+)
+from IsolationTools import VertexAndConeIsolation
+
+from DaVinciMCTools import MCTruthAndBkgCat, MCReconstructed, MCReconstructible
+from PyConf.Algorithms import ParticleToSubcombinationsAlg
+from DecayTreeFitter import DecayTreeFitter
+
+Hlt1_global_lines = [
+    "Hlt1ODINLumiDecision",  # 33 kHz
+]
+Hlt1_1track_lines = [
+    "Hlt1TrackMVADecision",
+    "Hlt1OneMuonTrackLineDecision",  # 18 kHz
+    "Hlt1TrackElectronMVA",  # 50 kHz
+    "Hlt1TrackMuonMVADecision",  # 37 kHz
+    "Hlt1LowPtMuonDecision", #to test
+]
+Hlt1_lines = Hlt1_1track_lines+[
+    "Hlt1D2Kshh",  # 24 kHz
+    "Hlt1DiElectronDisplaced",  # 25 kHz
+    "Hlt1DiMuonDisplaced",  # 38 kHz
+    "Hlt1DiMuonHighMass",  # 30 kHz
+    "Hlt1DiPhotonHighMass",  # 77 kHz
+    "Hlt1TwoTrackKs",  # 80 kHz
+    "Hlt1TwoTrackMVADecision",
+    "Hlt1D2KPiDecision",
+    "Hlt1D2KKDecision",
+    "Hlt1D2PiPiDecision",
+]
+
+
+Hlt2_lines = [
+    "Hlt2Charm_D0ToKmPip",
+]
+
+def make_composite_variables(options, pvs, data, add_truth=True, add_Hlt1TisTos=True):
+    if not options.simulation:
+        add_truth = False
+    variables = (
+        FunctorCollection(
+            {
+            # Endvertex-related info
+            "VCHI2DOF": F.CHI2DOF,  # Equal to SDOCACHI2 (2-track vertex -> 1 dof)
+            "MAXSDOCA": F.MAXSDOCA(), #MAXSDOCA == SDOCA(1,2)
+            "MAXDOCA": F.MAXDOCA(),
+            "MAXDOCACHI2": F.MAXDOCACHI2(),
+            "END_VX": F.END_VX,
+            "END_VY": F.END_VY,
+            "END_VZ": F.END_VZ,
+            "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,
+            # PV-related info
+            "OWNPVX": F.OWNPVX,
+            "OWNPVY": F.OWNPVY,
+            "OWNPVZ": F.OWNPVZ,
+            # FD/DIRA
+            "OWNPVDIRA": F.OWNPVDIRA,  # TODO needed for D*?
+            "OWNPVFD": F.OWNPVFD,  # TODO needed for D*? (can even be negative)
+            "OWNPVVDRHO": F.OWNPVVDRHO,  # TODO redundant
+            "OWNPVFDCHI2": F.OWNPVFDCHI2,  # TODO needed for D*?
+            "ALLPV_FD[nPVs]": F.ALLPV_FD(pvs),  # TODO redundant
+            "ALLPV_FDCHI2[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.VTX_FDCHI2).bind(F.TES(pvs), F.FORWARDARGS),
+            # IP/IPCHI2
+            "OWNPVIP": F.OWNPVIP,
+            "OWNPVIPCHI2": F.OWNPVIPCHI2,
+            "ALLPV_IP[nPVs]": F.ALLPV_IP(pvs),
+            "ALLPV_IPCHI2[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.IPCHI2).bind(F.TES(pvs), F.FORWARDARGS),
+            "OWNPVLTIME": F.OWNPVLTIME,
+            "OBJECT_KEY": F.OBJECT_KEY,
+            }
+        )
+        + Kinematics()
+    )
+
+    if add_Hlt1TisTos:
+        variables += HltTisTos(
+            selection_type="Hlt1", trigger_lines=Hlt1_lines, data=data
+        )
+
+    if add_truth:
+        variables = add_truth_matching_functors(
+            options,
+            variables,
+            data,
+            hierarchy=True,
+            kinematics=True,
+            vertex_info=True,
+            bkgcat=True,
+        )
+
+    return variables
+
+def make_tistoscombinations(options, pvs, data):
+    algo_output = ParticleToSubcombinationsAlg( Input=data )
+    relations = algo_output.OutputRelations
+
+    tistos_variables_extra = HltTisTos(
+        selection_type="Hlt1", trigger_lines=["Hlt1TwoTrackMVADecision"], data=algo_output.OutputParticles
+    )
+    tistos_combinations = {}
+    for k,v in tistos_variables_extra.get_thor_functors().items():
+        tistos_combinations[k + "_SUBCOMB" ] = F.MAP_INPUT_ARRAY( v, relations )
+    tistos_combinations = FunctorCollection( tistos_combinations )
+
+    return tistos_combinations
+
+def make_composite_variables_3body(options, pvs, data, add_truth=True):
+
+    variables = (
+        FunctorCollection(
+            {
+                #12
+                "M12": F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)),
+                "SDOCA12"     : F.SDOCA(Child1=1,Child2=2),
+                "SDOCACHI212" : F.SDOCACHI2(Child1=1,Child2=2),
+                "DOCA12"      : F.DOCA(Child1=1,Child2=2),
+                "DOCACHI212"  : F.DOCACHI2(Child1=1,Child2=2),
+                "COS12": F.ALV(1, 2),
+                #13
+                "M13": F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)),
+                "SDOCA13"     : F.SDOCA(Child1=1,Child2=3),
+                "SDOCACHI213" : F.SDOCACHI2(Child1=1,Child2=3),
+                "DOCA13"      : F.DOCA(Child1=1,Child2=3),
+                "DOCACHI213"  : F.DOCACHI2(Child1=1,Child2=3),
+                "COS13": F.ALV(1, 3),
+                #23
+                "M23": F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)),
+                "SDOCA23"     : F.SDOCA(Child1=2,Child2=3),
+                "SDOCACHI223" : F.SDOCACHI2(Child1=2,Child2=3),
+                "DOCA23"      : F.DOCA(Child1=2,Child2=3),
+                "DOCACHI223"  : F.DOCACHI2(Child1=2,Child2=3),
+                "COS23": F.ALV(2, 3),
+            }
+        )
+    )
+    return make_composite_variables(options, pvs, data, add_truth)+make_tistoscombinations(options, pvs, data)+variables
+
+def make_composite_variables_4body(options, pvs, data, add_truth=True):
+
+    variables = (
+        FunctorCollection(
+            {
+                #14
+                "M14": F.SUBCOMB(Functor=F.MASS, Indices=(1, 4)),
+                "SDOCA14"     : F.SDOCA(Child1=1,Child2=4),
+                "SDOCACHI214" : F.SDOCACHI2(Child1=1,Child2=4),
+                "DOCA14"      : F.DOCA(Child1=1,Child2=4),
+                "DOCACHI214"  : F.DOCACHI2(Child1=1,Child2=4),
+                "COS14": F.ALV(1, 4),
+                #24
+                "M24": F.SUBCOMB(Functor=F.MASS, Indices=(2, 4)),
+                "SDOCA24"     : F.SDOCA(Child1=2,Child2=4),
+                "SDOCACHI224" : F.SDOCACHI2(Child1=2,Child2=4),
+                "DOCA24"      : F.DOCA(Child1=2,Child2=4),
+                "DOCACHI224"  : F.DOCACHI2(Child1=2,Child2=4),
+                "COS24": F.ALV(2, 4),
+                #34
+                "M34": F.SUBCOMB(Functor=F.MASS, Indices=(3, 4)),
+                "SDOCA34"     : F.SDOCA(Child1=3,Child2=4),
+                "SDOCACHI234" : F.SDOCACHI2(Child1=3,Child2=4),
+                "DOCA34"      : F.DOCA(Child1=3,Child2=4),
+                "DOCACHI234"  : F.DOCACHI2(Child1=3,Child2=4),
+                "COS34": F.ALV(3, 4),
+            }
+        )
+    )
+    return make_composite_variables_3body(options, pvs, data, add_truth)+variables #make_tistoscombinations already included
+
+def make_b_composite_variables(options, pvs, data, add_truth=True):
+    
+    # define helper functors
+    get_child = F.CHILD(1, F.FORWARDARG0) # change here the index of the child
+    get_SV =  F.ENDVERTEX @ F.FORWARDARG0
+    get_SV_pos = F.TOLINALG @ F.POSITION @ get_SV # only if composite (i.e. has vertex)
+    get_child_endvtx_pos = F.ENDVERTEX_POS  @ get_child
+    get_fdvec_child = get_child_endvtx_pos - get_SV_pos
+
+    # define observables
+    IP_wrt_SV = F.VALUE_OR(-1) @F.IP.bind(get_SV_pos , get_child)
+    IPCHI2_wrt_SV = F.VALUE_OR(-1) @ F.IPCHI2.bind(get_SV , get_child) # only if child is composite (i.e. has vertex)
+    FD_wrt_SV = F.VALUE_OR(-1) @ F.MAGNITUDE @ get_fdvec_child
+    FDCHI2_wrt_SV = F.VALUE_OR(-1) @ F.VTX_FDCHI2.bind(get_SV, get_child)
+
+    
+    variables = FunctorCollection(
+        {       
+            "ID": F.PARTICLE_ID ,
+            "PT": F.PT,
+            "P": F.P,
+            "MASS": F.MASS,
+            "CHILD1_IPwrtSV": IP_wrt_SV,
+            "CHILD1_IPCHI2wrtSV": IPCHI2_wrt_SV,
+            "CHILD1_FDwrtSV": FD_wrt_SV,
+            "CHILD1_FDCHI2wrtSV": FDCHI2_wrt_SV,
+            "PX": F.PX,
+            "PY": F.PY,
+            "PZ": F.PZ,
+            "END_VCHI2DOF": F.VALUE_OR(-1) @F.CHI2DOF @ F.ENDVERTEX,
+            "BPVCHI2DOF": F.VALUE_OR(-1) @F.CHI2DOF @ F.BPV(pvs),
+            # B2OC generic B hadron NN Hlt2 algorithm,
+            # not planning to use it directly for B2OC EM
+            "MVA": F.MVA(
+                MVAType="SigmaNet",
+                Config={
+                    "File":
+                    "paramfile://data/Hlt2B2OC_B_SigmaNet_Run3-v1.json",
+                    "Name":
+                    "B2OC_SigmaNet_Generic",
+                    "Lambda":
+                    "2.0",
+                    "NLayers":
+                    "3",
+                    "InputSize":
+                    "6",
+                    "Monotone_Constraints":
+                    "[1,-1,-1,-1,-1,-1]",
+                    "Variables":
+                    "log_B_PT,B_ETA,log_B_DIRA,log_B_ENDVERTEX_CHI2,log_B_IPCHI2_OWNPV,log_B_IP_OWNPV",
+                },
+                Inputs={
+                    "log_B_PT": fmath.log(F.PT),
+                    "B_ETA": F.ETA,
+                    "log_B_DIRA": fmath.log(1. - F.BPVDIRA(pvs)),
+                    "log_B_ENDVERTEX_CHI2": fmath.log(F.CHI2DOF),
+                    "log_B_IPCHI2_OWNPV": fmath.log(F.BPVIPCHI2(pvs)),
+                    "log_B_IP_OWNPV": fmath.log(F.BPVIP(pvs)),
+                }),
+            #'SSPionBDT_Mistag': F.SSPionBDT_Mistag(sspionTagging.OutputFlavourTags),
+            #'SSPionBDT_Decision': F.SSPionBDT_Decision(sspionTagging.OutputFlavourTags),
+
+        }
+    )
+    return make_composite_variables(options, pvs, data, add_truth)+make_tistoscombinations(options, pvs, data)+variables
+
+def make_DeltaM_variable(options):
+    return FunctorCollection({"DM": F.MASS - F.CHILD(1, F.MASS)})
+
+def make_basic_variables(options, pvs, data, add_truth=True):
+    if not options.simulation:
+        add_truth = False
+    variables = (
+        FunctorCollection(
+            {
+                # Track fit quality
+                "TRGHOSTPROB": F.GHOSTPROB,
+                "TRCHI2DOF": F.CHI2DOF @ F.TRACK,
+                "NDOF": F.VALUE_OR(-1) @ F.NDOF @ F.TRACK,
+                "NVPHITS": F.VALUE_OR(-1) @ F.NVPHITS @ F.TRACK,
+                "NVPHITSA": F.VALUE_OR(-1) @ F.NVPHITSA @ F.TRACK,
+                "NVPHITSC": F.VALUE_OR(-1) @ F.NVPHITSC @ F.TRACK,
+                "NUTHITS": F.VALUE_OR(-1) @ F.NUTHITS @ F.TRACK,
+                "NFTHITS": F.VALUE_OR(-1) @ F.NFTHITS @ F.TRACK,
+                "ISMUON": F.ISMUON,
+                # IP and IPCHI2
+                "OWNPVIP": F.OWNPVIP,
+                "OWNPVIPCHI2": F.OWNPVIPCHI2,
+                "MINIPCHI2": F.MINIPCHI2(pvs),
+                "ISMUON"      : F.ISMUON,
+                "OBJECT_KEY": F.OBJECT_KEY,
+                "HASBREM": F.HASBREM,
+                "BREMENERGY": F.BREMENERGY,
+                "BREMBENDCORR": F.BREMBENDCORR,
+                # "TRACK_POSVEC_CLOSESTTOBEAM": F.TRACK_POSVEC_CLOSESTTOBEAM,  # To calculate the 2D IP
+                # For measuring the detection asymmetries in the T-stations
+                "X_TStationsBeg": F.POSITION_X @ F.EXTRAPOLATE_TRACK(7_500.) @ F.TRACK,
+                "Y_TStationsBeg": F.POSITION_Y @ F.EXTRAPOLATE_TRACK(7_500.) @ F.TRACK,
+                "X_TStationsEnd": F.POSITION_X @ F.EXTRAPOLATE_TRACK(9_410.) @ F.TRACK,
+                "Y_TStationsEnd": F.POSITION_Y @ F.EXTRAPOLATE_TRACK(9_410.) @ F.TRACK,
+            }
+        )
+        + Kinematics()
+        + ParticleID(extra_info=True)
+    )
+
+    
+    variables += HltTisTos(
+        selection_type="Hlt1", trigger_lines=Hlt1_1track_lines, data=data
+    )
+    
+    if add_truth:
+        variables = add_truth_matching_functors(
+            options,
+            variables,
+            data,
+            hierarchy=True,
+            kinematics=True,
+            vertex_info=True,
+            bkgcat=False,
+        )
+
+    return variables
+
+def make_hlt2_event_variables(options, pvs, rec_summary):
+    # define event level variables
+    evt_variables = EventInfo()
+    if not options.simulation:
+        evt_variables += LHCInfo() #FillNumber
+    evt_variables += SelectionInfo(selection_type="Hlt2", trigger_lines=Hlt2_lines)
+    evt_variables += SelectionInfo(selection_type="Hlt1", trigger_lines=Hlt1_global_lines)
+    evt_variables += FunctorCollection(
+        {
+            "ALLPVX": F.ALLPVX(pvs),
+            "ALLPVY": F.ALLPVY(pvs),
+            "ALLPVZ": F.ALLPVZ(pvs),
+            "ALLPVNDOF": F.MAP(F.VALUE_OR(-1) @ F.NDOF) @ F.TES(pvs),
+            "ALLPVCHI2": F.MAP(F.VALUE_OR(-1) @ F.CHI2) @ F.TES(pvs),
+            "nPVs": F.SIZE(pvs),
+            # No 3D vectors allowed, hence we save the value of each element of the covariance matrix
+            "ALLPV_COV00[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(0, 0) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV01[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(0, 1) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV02[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(0, 2) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV10[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(1, 0) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV11[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(1, 1) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV12[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(1, 2) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV20[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(2, 0) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV21[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(2, 1) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "ALLPV_COV22[nPVs]": F.MAP(F.VALUE_OR(F.NaN) @ F.CALL(2, 2) @ F.POS_COV_MATRIX) @ F.TES(pvs),
+            "nTracks": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nTracks"),
+            "nLongTracks": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nLongTracks"),
+            "nMuonTracks": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nMuonTracks"),
+            "nFTClusters": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nFTClusters"),
+            "nVPClusters": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nVPClusters"),
+            "nUTClusters": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nUTClusters"),
+            "nSPDhits": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nSPDhits"),
+            "nEcalClusters": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nEcalClusters"),
+            "nEcalClusters": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nEcalClusters"),
+            "eCalTot": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "eCalTot"),
+            "hCalTot": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "hCalTot"),
+            "nRich1Hits": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nRich1Hits"),
+            "nRich2Hits": F.VALUE_OR(-1) @ F.RECSUMMARY_INFO(rec_summary, "nRich2Hits"),
+        }
+    )
+    return evt_variables
+
+def add_truth_matching_functors(
+    options,
+    variables,
+    data,
+    hierarchy=True,
+    kinematics=True,
+    vertex_info=True,
+    bkgcat=False,
+    prompt_info=True,
+):
+    """Add MC truth matching functors to an existing FunctorCollection.
+
+    Args:
+        options (DaVinci.Options): DaVinci options object.
+        variables (FunctorCollection): FunctorCollection to modify
+        data: data handle
+        hierarchy (bool): Add MCHierarchy info (default True)
+        kinematics (bool): Add MCKinematics info (default True)
+        vertex_info (bool): Add MCVertexInfo (default True)
+        bkgcat (bool): Add TRUEKEY and BKGCAT functors - intended for composite particles (default False)
+        prompt_info (bool): Add MCPromptDecay info (default True)
+
+    Returns:
+        FunctorCollection: modified FunctorCollection with truth matched variables.
+    """
+    assert (
+        options.simulation
+    ), "options.simulation is set to False - it doesn't make sense to add truth matching."
+
+    MCTRUTH = MCTruthAndBkgCat(data)
+
+    if bkgcat:
+        variables += FunctorCollection(
+            {
+                # Important note: specify an invalid value for integer functors if there exists no truth info.
+                #                 The invalid value for floating point functors is set to nan.
+                "TRUEKEY": F.VALUE_OR(-1) @ MCTRUTH(F.OBJECT_KEY),
+                "BKGCAT": MCTRUTH.BkgCat,
+            }
+        )
+    if hierarchy:
+        variables += MCHierarchy(mctruth_alg=MCTRUTH)  # likely to change again!!
+    if vertex_info:
+        variables += MCVertexInfo(mctruth_alg=MCTRUTH)  # likely to change again!!
+    if kinematics:
+        variables += MCKinematics(mctruth_alg=MCTRUTH)  # likely to change again!!
+    if prompt_info:
+        variables += MCPromptDecay(mctruth_alg=MCTRUTH)
+
+    return variables
+
+### DTF variables ###
+
+def make_basic_dtf_variables(options, pvs, data, DTF=None, pv_constraint=False, mass_constraint=False, particle_name=""):
+    variables = Kinematics()
+
+    if(mass_constraint):
+        if(pv_constraint): # MASS + PV
+            dtf_variables_mass_pv = FunctorCollection({
+                        'DTF_PV_M'+ 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_M'+ 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(options, pvs, data, DTF=None, pv_constraint=False, mass_constraint=False, particle_name=""):
+    variables = Kinematics()
+
+    addstring = "DTF"
+    if(pv_constraint):
+            addstring += '_PV'
+    if(mass_constraint):
+            addstring += '_M'
+    addstring += particle_name
+
+    DTF_chi2ndof = FunctorCollection(
+            {
+                addstring+"_CHI2DOF": DTF.CHI2,
+                addstring+"_NDOF": 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_M'+ 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_M'+ 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_composite_dtf_variables_3body(options, pvs, data, DTF=None, pv_constraint=False, mass_constraint=False, particle_name=""):
+    variables = (
+        FunctorCollection(
+            {
+                "M12": F.SUBCOMB(Functor=F.MASS, Indices=(1, 2)),
+                "M13": F.SUBCOMB(Functor=F.MASS, Indices=(1, 3)),
+                "M23": F.SUBCOMB(Functor=F.MASS, Indices=(2, 3)),
+            }
+        )
+    )
+
+    if(mass_constraint):
+        if(pv_constraint): # MASS + PV
+            dtf_variables_mass_pv = FunctorCollection({
+                        'DTF_PV_M'+ particle_name + '_' + k: DTF(v)
+                        for k, v in variables.get_thor_functors().items()
+                    })
+            return dtf_variables_mass_pv+make_composite_dtf_variables(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+        else: # MASS
+            dtf_variables_mass = FunctorCollection(
+                {'DTF_M'+ particle_name + '_' + k: DTF(v)
+                 for k, v in variables.get_thor_functors().items()})
+        return dtf_variables_mass+make_composite_dtf_variables(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+    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+make_composite_dtf_variables(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+    else: # NO MASS/PV
+        dtf_variables = FunctorCollection(
+            {'DTF_' + k: DTF(v)
+             for k, v in variables.get_thor_functors().items()})
+
+    return dtf_variables+make_composite_dtf_variables(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+def make_composite_dtf_variables_4body(options, pvs, data, DTF=None, pv_constraint=False, mass_constraint=False, particle_name=""):
+    variables = (
+        FunctorCollection(
+            {
+                "M14": F.SUBCOMB(Functor=F.MASS, Indices=(1, 4)),
+                "M24": F.SUBCOMB(Functor=F.MASS, Indices=(2, 4)),
+                "M34": F.SUBCOMB(Functor=F.MASS, Indices=(3, 4)),
+            }
+        )
+    )
+
+    if(mass_constraint):
+        if(pv_constraint): # MASS + PV
+            dtf_variables_mass_pv = FunctorCollection({
+                        'DTF_PV_M'+ particle_name + '_' + k: DTF(v)
+                        for k, v in variables.get_thor_functors().items()
+                    })
+            return dtf_variables_mass_pv+make_composite_dtf_variables_3body(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+        else: # MASS
+            dtf_variables_mass = FunctorCollection(
+                {'DTF_M'+ particle_name + '_' + k: DTF(v)
+                 for k, v in variables.get_thor_functors().items()})
+        return dtf_variables_mass+make_composite_dtf_variables_3body(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+    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+make_composite_dtf_variables_3body(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+    else: # NO MASS/PV
+        dtf_variables = FunctorCollection(
+            {'DTF_' + k: DTF(v)
+             for k, v in variables.get_thor_functors().items()})
+    
+        return dtf_variables+make_composite_dtf_variables_3body(options,pvs,data,DTF,pv_constraint,mass_constraint, particle_name)
+
+
+def make_MC_basic_variables():
+    MC_MOTHER_ID = lambda gen: F.VALUE_OR(0) @ F.MC_MOTHER(gen, F.PARTICLE_ID)
+    MC_MOTHER_KEY = lambda gen: F.VALUE_OR(-1) @ F.MC_MOTHER(gen, F.OBJECT_KEY)
+
+    variables = (
+        FunctorCollection(
+            {
+                "END_VX": F.END_VX,
+                "END_VY": F.END_VY,
+                "END_VZ": F.END_VZ,
+                "OBJECT_KEY": F.OBJECT_KEY,
+                "ETA": F.ETA,
+                "PHI": F.PHI,
+                "ORIGIN_VX": F.ORIGIN_VX,
+                "ORIGIN_VY": F.ORIGIN_VY,
+                "ORIGIN_VZ": F.ORIGIN_VZ,
+                "FOURMOMENTUM": F.FOURMOMENTUM,
+                "TRUEID": F.PARTICLE_ID,
+                "MC_MOTHER_ID": MC_MOTHER_ID(1),
+                "MC_MOTHER_KEY": MC_MOTHER_KEY(1),
+                "MC_GD_MOTHER_ID": MC_MOTHER_ID(2),
+                "MC_GD_MOTHER_KEY": MC_MOTHER_KEY(2),
+                "MC_GD_GD_MOTHER_ID": MC_MOTHER_ID(3),
+                "MC_GD_GD_MOTHER_KEY": MC_MOTHER_KEY(3),
+            }
+        )
+        + Kinematics()
+    )
+
+
+    from PyConf.reading import get_mc_particles, get_pp2mcp_relations, get_mc_track_info
+    MC_data = get_mc_particles("/Event/HLT2/MC/Particles")
+    relations_charged = get_pp2mcp_relations("/Event/HLT2/Relations/ChargedPP2MCP")
+    relations_neutral = get_pp2mcp_relations("/Event/HLT2/Relations/NeutralPP2MCP")
+    mcreconstructed_all = MCReconstructed(
+        input_mcparticles=MC_data,
+        use_best_mcmatch=True,
+        relations_charged=relations_charged,
+        relations_neutral=relations_neutral,
+    )
+    mcreconstructible_all = MCReconstructible(
+        input_mctrackinfo=get_mc_track_info()
+    )
+    import FunTuple.functorcollections as FC
+    vars_reconstructed = FC.MCReconstructed(mcreconstructed_alg=mcreconstructed_all, extra_info=True)
+    vars_reconstructible = FC.MCReconstructible(mcreconstructible_alg=mcreconstructible_all, extra_info=True)
+
+
+    return variables+vars_reconstructed+vars_reconstructible
+
+def make_MC_composite_variables():
+    MC_MOTHER_ID = lambda gen: F.VALUE_OR(0) @ F.MC_MOTHER(gen, F.PARTICLE_ID)
+    MC_MOTHER_KEY = lambda gen: F.VALUE_OR(-1) @ F.MC_MOTHER(gen, F.OBJECT_KEY)
+
+    variables = (
+        FunctorCollection(
+            {
+                "END_VX": F.END_VX,
+                "END_VY": F.END_VY,
+                "END_VZ": F.END_VZ,
+                "LTIME": F.MC_LIFETIME,
+                "OBJECT_KEY": F.OBJECT_KEY,
+                "ETA": F.ETA,
+                "PHI": F.PHI,
+                "ORIGIN_VX": F.ORIGIN_VX,
+                "ORIGIN_VY": F.ORIGIN_VY,
+                "ORIGIN_VZ": F.ORIGIN_VZ,
+                "FOURMOMENTUM": F.FOURMOMENTUM,
+                "TRUEID": F.PARTICLE_ID,
+                "MC_MOTHER_ID": MC_MOTHER_ID(1),
+                "MC_MOTHER_KEY": MC_MOTHER_KEY(1),
+                "MC_GD_MOTHER_ID": MC_MOTHER_ID(2),
+                "MC_GD_MOTHER_KEY": MC_MOTHER_KEY(2),
+                "MC_GD_GD_MOTHER_ID": MC_MOTHER_ID(3),
+                "MC_GD_GD_MOTHER_KEY": MC_MOTHER_KEY(3),
+            }
+        )
+        + Kinematics()
+        + MCPromptDecay()
+        )
+
+    return variables
+
+def make_MC_event_variables(mc_header):
+    # define event level variables
+    evt_variables = EventInfo()
+    evt_variables += MCPrimaries(mc_header=mc_header)
+
+    return evt_variables
+
+
+
+
+
+def ParticleIsolation_reduced(
+    *,
+    isolation_alg: VertexAndConeIsolation,
+    array_indx_name: str,
+    sumcone_invalid_value=F.NaN,
+) -> FunctorCollection:
+    
+    prefix = "HEAD"
+    if isolation_alg.name:
+        prefix += f"_{isolation_alg.name}"
+
+    ParticleIsolationVariables = {
+        f"{prefix}_CMULT": isolation_alg.MULT,
+        f"{prefix}_PASY": isolation_alg.PASY,
+        f"{prefix}_PTASY": isolation_alg.PTASY,
+        f"{prefix}_PXASY": isolation_alg.PXASY,
+        f"{prefix}_PYASY": isolation_alg.PYASY,
+        f"{prefix}_PZASY": isolation_alg.PZASY,
+    }
+    return FunctorCollection(ParticleIsolationVariables)
+
+
+
+
+def make_top_isolation_variables(hlt2_line, input_data, locations = ["LongTrackIso","NeutralIso"], size="reduced"):
+    from PyConf.reading import get_particles
+    from IsolationTools import VertexAndConeIsolation
+
+    possible_charm_locations = ["LongTrackIso", "TTrackIso", "DownstreamTrackIso", "UpstreamTrackIso", "NeutralIso", "PizIso"]
+    coneangles = [0.25,0.5,1.,1.5,2.]
+
+    count = 0
+    for location in locations:
+        extra_particles = get_particles(f"/Event/HLT2/{hlt2_line}/{location}/Particles")
+
+        for coneangle in coneangles:
+            top_RTAlg = VertexAndConeIsolation(
+                name=location+"_"+str(coneangle),
+                reference_particles=input_data,
+                related_particles=extra_particles,
+                cut=F.DR2<coneangle)
+
+            if count == 0:
+                if size == "reduced":
+                    top_iso_variables = ParticleIsolation_reduced(isolation_alg=top_RTAlg,array_indx_name='indx')
+                else:
+                    top_iso_variables = ParticleIsolation(isolation_alg=top_RTAlg,array_indx_name='indx')
+            else:
+                if size == "reduced":
+                    top_iso_variables += ParticleIsolation_reduced(isolation_alg=top_RTAlg,array_indx_name='indx')
+                else:
+                    top_iso_variables += ParticleIsolation(isolation_alg=top_RTAlg,array_indx_name='indx')
+            count += 1
+
+
+    return top_iso_variables
+
+def make_basic_isolation_variables(hlt2_line, input_data, locations = ["LongTrackIso","NeutralIso"], size="reduced"):
+    variables = (FunctorCollection({}))
+    if 1:
+        return variables
+
+    from PyConf.reading import get_particles
+    from IsolationTools import VertexAndConeIsolation
+    from PyConf.Algorithms import ThOrParticleSelection
+
+    basic_code = (F.FILTER(F.ALL) @ F.GET_ALL_BASICS())
+    basic_particles = ThOrParticleSelection(InputParticles=input_data, Functor=basic_code).OutputSelection
+
+    possible_charm_locations = ["LongTrackIso", "TTrackIso", "DownstreamTrackIso", "UpstreamTrackIso", "NeutralIso", "PizIso"]
+    coneangles = [0.25,0.5,1.,1.5,2.]
+
+    count = 0
+    for location in locations:
+        extra_particles = get_particles(f"/Event/HLT2/{hlt2_line}/{location}/Particles")
+
+        for coneangle in coneangles:
+            basic_RTAlg = VertexAndConeIsolation(
+                name=location+"_"+str(coneangle),
+                reference_particles=basic_particles,
+                related_particles=extra_particles,
+                cut=F.DR2<coneangle)
+
+            if count == 0:
+                if size == "reduced":
+                    basic_iso_variables = ParticleIsolation_reduced(isolation_alg=basic_RTAlg,array_indx_name='indx')
+                else:
+                    basic_iso_variables = ParticleIsolation(isolation_alg=basic_RTAlg,array_indx_name='indx')
+            else:
+                if size == "reduced":
+                    basic_iso_variables += ParticleIsolation_reduced(isolation_alg=basic_RTAlg,array_indx_name='indx')
+                else:
+                    basic_iso_variables += ParticleIsolation(isolation_alg=basic_RTAlg,array_indx_name='indx')
+            count += 1
+
+
+    return basic_iso_variables
+
+
+def make_intermediate_isolation_variables(hlt2_line, input_data, locations = ["LongTrackIso","NeutralIso"], size="reduced", composite_ID = "J/psi(1S)"):
+    variables = (FunctorCollection({}))
+    if 1:
+        return variables
+
+    from PyConf.reading import get_particles
+    from IsolationTools import VertexAndConeIsolation
+    from PyConf.Algorithms import ThOrParticleSelection
+
+    intermediate_code = F.FILTER(F.IS_ABS_ID(composite_ID)) @ F.GET_ALL_DESCENDANTS()
+    intermediate_particles = ThOrParticleSelection(InputParticles=input_data, Functor=intermediate_code).OutputSelection
+
+    possible_charm_locations = ["LongTrackIso", "TTrackIso", "DownstreamTrackIso", "UpstreamTrackIso", "NeutralIso", "PizIso"]
+    coneangles = [0.25,0.5,1.,1.5,2.]
+
+    count = 0
+    for location in locations:
+        extra_particles = get_particles(f"/Event/HLT2/{hlt2_line}/{location}/Particles")
+
+        for coneangle in coneangles:
+            intermediate_RTAlg = VertexAndConeIsolation(
+                name=location+"_"+str(coneangle),
+                reference_particles=intermediate_particles,
+                related_particles=extra_particles,
+                cut=F.DR2<coneangle)
+
+            if count == 0:
+                if size == "reduced":
+                    intermediate_iso_variables = ParticleIsolation_reduced(isolation_alg=intermediate_RTAlg,array_indx_name='indx')
+                else:
+                    intermediate_iso_variables = ParticleIsolation(isolation_alg=intermediate_RTAlg,array_indx_name='indx')
+
+            else:
+                if size == "reduced":
+                    intermediate_iso_variables += ParticleIsolation_reduced(isolation_alg=intermediate_RTAlg,array_indx_name='indx')
+                else:
+                    intermediate_iso_variables += ParticleIsolation(isolation_alg=intermediate_RTAlg,array_indx_name='indx')
+            count += 1
+
+
+    return intermediate_iso_variables