diff --git a/DaVinciTests/python/DaVinciTests/DTF_test.py b/DaVinciTests/python/DaVinciTests/DTF_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..0aabcd3914005e6843e638c28f3810406c7c646e
--- /dev/null
+++ b/DaVinciTests/python/DaVinciTests/DTF_test.py
@@ -0,0 +1,68 @@
+###############################################################################
+# (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.                                       #
+###############################################################################
+"""
+Example of a typical DaVinci job:
+ - selection of two detached opposite-charge muons
+ - tuple of the selected candidates
+ - runs DecayTreeFitterAlg and stores some output
+"""
+import Functors as F
+from Hlt2Conf.standard_particles import make_detached_mumu
+from RecoConf.reconstruction_objects import upfront_reconstruction
+from FunTuple import FunctorCollection
+from FunTuple import FunTuple_Particles as Funtuple
+from DecayTreeFitter import DTFAlg
+from DaVinci import Options, make_config
+
+
+def main(options: Options):
+    # Prepare the node with the selection
+    dimuons = make_detached_mumu()
+
+    # DecayTreeFitter Algorithm.
+    # One with PV constraint and one without
+
+    DTF = DTFAlg(
+        Input=dimuons, MassConstraints=["J/psi(1S)", "psi(2S)"], OutputLevel=3)
+    # DTFParts = DTF.Output  # Particles
+    DTFRelations = DTF.OutputRelations  # Relations
+
+    #FunTuple: Jpsi info
+    fields = {}
+    fields['Jpsi'] = 'J/psi(1S) -> mu+ mu-'
+
+    #make collection of functors for Jpsi
+    variables_jpsi = FunctorCollection({
+        'THOR_MASS':
+        F.MASS,
+        'DTF_PT':
+        F.MAP_INPUT(Functor=F.PT, Relations=DTFRelations),
+        'DTF_MASS':
+        F.MAP_INPUT(Functor=F.MASS, Relations=DTFRelations),
+    })
+
+    #associate FunctorCollection to field (branch) name
+    variables = {}
+    variables['Jpsi'] = variables_jpsi
+
+    #FunTuple: define list of preambles for loki
+    loki_preamble = ['TRACK_MAX_PT = MAXTREE(ISBASIC & HASTRACK, PT, -1)']
+
+    #Configure Funtuple algorithm
+    tuple_dimuons = Funtuple(
+        name="DimuonsTuple",
+        tuple_name="DecayTree",
+        fields=fields,
+        variables=variables,
+        loki_preamble=loki_preamble,
+        inputs=dimuons)
+
+    return make_config(options, upfront_reconstruction() + [tuple_dimuons])
diff --git a/DaVinciTests/tests/qmtest/davinci.qms/test_DTF.qmt b/DaVinciTests/tests/qmtest/davinci.qms/test_DTF.qmt
new file mode 100755
index 0000000000000000000000000000000000000000..3c1ea606b5bda9d804461ec7db3f344ae4a7ca8a
--- /dev/null
+++ b/DaVinciTests/tests/qmtest/davinci.qms/test_DTF.qmt
@@ -0,0 +1,35 @@
+<?xml version="1.0" ?>
+<!--
+###############################################################################
+# (c) Copyright 2020-2021 CERN for the benefit of the LHCb Collaboration      #
+#                                                                             #
+# This software is distributed under the terms of the GNU General Public      #
+# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
+#                                                                             #
+# In applying this licence, CERN does not waive the privileges and immunities #
+# granted to it by virtue of its status as an Intergovernmental Organization  #
+# or submit itself to any jurisdiction.                                       #
+###############################################################################
+-->
+<!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
+<extension class="GaudiTest.GaudiExeTest" kind="test">
+  <argument name="program"><text>lbexec</text></argument>
+  <argument name="args"><set>
+    <text>DaVinciTests.DTF_test:main</text>
+  </set></argument>
+  <argument name="options_yaml_fn"><text>$DAVINCIEXAMPLESROOT/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml</text></argument>
+  <argument name="extra_options_yaml"><text>
+    enable_unpack: False
+    evt_max: 10
+    histo_file: DV-example-tupling-DTF-his.root
+    input_raw_format: 4.3
+    ntuple_file: DV-example-tupling-DTF-ntp.root
+    process: Turbo
+  </text></argument>
+<argument name="exit_code"><integer>3</integer></argument>
+<argument name="exit_value"><text>Failed</text></argument>
+<argument name="validator"><text>
+findReferenceBlock("""DecayTreeFitterAlg                    ERROR DecayTreeFitter::DecayChain : To-be constrained particle is not in chain.""")
+countErrorLines({"FATAL":14, "ERROR":9})
+</text></argument>
+</extension>