From 477c47510b6271c3328e03e76d41e197b239edcd Mon Sep 17 00:00:00 2001
From: Xiaocheng Song <xiaocheng.song@cern.ch>
Date: Mon, 2 Dec 2024 10:10:33 +0100
Subject: [PATCH 1/5] add DaVinci script for Lb2LcMuNuX Data/MC line

---
 .gitignore                           |   1 +
 Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py | 264 +++++++++++++++++++++++
 Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py   | 302 +++++++++++++++++++++++++++
 Lb2LcMuNuX/info.yaml                 |  29 +++
 4 files changed, 596 insertions(+)
 create mode 100644 Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
 create mode 100644 Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
 create mode 100644 Lb2LcMuNuX/info.yaml

diff --git a/.gitignore b/.gitignore
index 01bafe423b..1060cad2f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,4 @@ CMakeLists.txt.user
 /AnalysisProductions.xenvc
 /dynamic
 /local-tests/
+/starterkit/
diff --git a/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py b/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
new file mode 100644
index 0000000000..5e12bf76ce
--- /dev/null
+++ b/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
@@ -0,0 +1,264 @@
+
+# *: This file is going to scan data for Lb-->Lc+ miu- nu X
+  # DaVinci version: v44r4
+  # environment: default
+
+the_year = '2018' # the year must be string
+_simulation = False
+  # the above setting can be ignored in AP production, but neccessary in Ganga jobs
+
+# tag: import packages
+# ---------------------------------------------------------------------------- #
+
+
+import os, re, sys
+
+# *: import DaVinci packages
+
+from Gaudi.Configuration import *
+from GaudiKernel import SystemOfUnits as Units
+
+from Configurables import DecayTreeTuple, MCDecayTreeTuple # basic Tuple package
+from Configurables import CombineParticles, FilterDesktop# the package needed to reconstruct particles
+from Configurables import TupleToolDecay, TupleToolDecayTreeFitter
+from Configurables import TupleToolTrigger, TupleToolMCTruth, TupleToolTISTOS
+from Configurables import LoKi__Hybrid__TupleTool, LoKi__Hybrid__TupleTool
+  # above are common package tools
+from DecayTreeTuple.Configuration import *
+from Configurables import CheckPV # the package to check PV
+from Configurables import DaVinci # the package to configure DaVinci options
+
+# the packages define the sequences to be used
+from Configurables import GaudiSequencer
+from PhysConf.Selections import SelectionSequence
+
+# additional packages
+from Configurables import TupleToolRecoStats, MessageSvc # packages for information output
+from Configurables import OfflineVertexFitter
+
+# the packages maybe needed in other DaVinci version
+from PhysSelPython.Wrappers import AutomaticData, Selection, FilterSelection, DataOnDemand
+from PhysConf.Selections import TupleSelection, CombineSelection, RebuildSelection
+from Configurables import TriggerTisTos, TupleToolVtxIsoln
+
+
+# tag: pre-define the tuple tools and triggers in list
+# ---------------------------------------------------------------------------- #
+
+myToolList = [
+    "TupleToolAngles",
+    "TupleToolEventInfo",
+    "TupleToolKinematic",
+    "TupleToolPrimaries",
+    "TupleToolRecoStats",
+    "TupleToolPid",
+    "TupleToolANNPID",
+    "TupleToolGeometry",
+    "TupleToolPropertime",
+    "TupleToolTrackInfo",
+    "TupleToolTrigger",
+    "TupleToolL0Data"
+    ]
+
+
+myTriggerList = [
+    # L0
+    "L0GlobalDecision",
+    "L0PhysDecision",
+    "L0CALODecision",
+    "L0HadronDecision",
+    "L0MuonDecision", # muon
+    "L0DiMuonDecision",
+    "L0MuonHighDecision",
+    "L0PhotonDecision",
+    "L0PhotonHiDecision",
+    "L0PhotonNoSPDDecision",
+    "L0ElectronDecision",
+
+    # HLT1
+    "Hlt1TrackMVADecision",
+    "Hlt1TrackMVALooseDecision",
+    "Hlt1TwoTrackMVADecision",
+    "Hlt1TwoTrackMVALooseDecision",
+    "Hlt1L0AnyDecision",
+    "Hlt1MBNoBiasDecision",
+    "Hlt1GlobalDecision",
+    "Hlt1TrackAllL0Decision",
+    "Hlt1TrackMuonDecision",
+    "Hlt1SingelMuonNoIPDecision",
+    "Hlt1DiMuonHighMassDecision",
+    "Hlt1TrackPhotonDecision",
+
+    # Hlt2
+    "Hlt2Topo2BodyDecision",
+    "Hlt2Topo3BodyDecision",
+    "Hlt2Topo4BodyDecision",
+    "Hlt2Topo2BodySimpleDecision",
+    "Hlt2Topo3BodySimpleDecision",
+    "Hlt2Topo4BodySimpleDecision",
+    "Hlt2Topo2BodyBBDTDecision",
+    "Hlt2Topo3BodyBBDTDecision",
+    "Hlt2Topo4BodyBBDTDecision",
+    "Hlt2TopoE2BodyBBDTDecision",
+    "Hlt2TopoE3BodyBBDTDecision",
+    "Hlt2TopoE4BodyBBDTDecision",
+    "Hlt2IncPhiSidebandsDecision",
+    "Hlt2IncPhiDecision",
+    "Hlt2TopoRad2BodyBBDTDecision",
+    "Hlt2TopoRad2plus1BodyBBDTDecision"
+    ]
+
+
+# tag: define a function to fill the Tuple
+# ---------------------------------------------------------------------------- #
+
+
+def fillTuple(tuple, tools_list, triggers):
+    # add the ToolList
+    tuple.ToolList = tools_list
+
+    # *: add PV information
+
+    tuple.addTool(TupleToolDecay, name='Lb')
+
+    # not constraint to PV
+    tuple.Lb.ToolList += ["TupleToolDecayTreeFitter/PVFit"]
+    tuple.Lb.addTool(TupleToolDecayTreeFitter("PVFit"))
+    tuple.Lb.PVFit.Verbose = True
+    tuple.Lb.PVFit.UpdateDaughters = True
+
+    # PV fit
+    tuple.Lb.ToolList += ["TupleToolDecayTreeFitter/PVFit1"]
+    tuple.Lb.addTool(TupleToolDecayTreeFitter("PVFit1"))
+    tuple.Lb.PVFit1.Verbose = True
+    tuple.Lb.PVFit1.constrainToOriginVertex = True
+    tuple.Lb.PVFit1.UpdateDaughters = True
+
+
+    # *: add TupleToolTISTOS, which contain triggers
+    tuple.ToolList+=[ "TupleToolTISTOS" ]
+    tuple.addTool(TupleToolTISTOS, name="TupleToolTISTOS" )
+    tuple.TupleToolTISTOS.Verbose=True
+    tuple.TupleToolTISTOS.TriggerList = triggers
+    ## myTriggerList was defined in following lines
+
+    # *: add LoKi variables
+
+    from Configurables import LoKi__Hybrid__TupleTool
+    LoKi_All=LoKi__Hybrid__TupleTool("LoKi_All")
+    LoKi_All.Variables = {
+        "ETA"                  : "ETA",
+        "Y"                    : "Y"  ,
+        "LOKI_IPCHI2"          : "BPVIPCHI2()",
+        "LOKI_DIRA"    : "BPVDIRA"
+        }
+    tuple.addTool(LoKi_All)
+    tuple.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_All"]
+
+    LoKi_Lb=LoKi__Hybrid__TupleTool("LoKi_Lb")
+    LoKi_Lb.Variables = {
+      "AMAXDOCA"     : "PFUNA(AMAXDOCA('LoKi::DistanceCalculator'))",
+      "ADOCACHI2max" : "LoKi.Particles.PFunA(ADOCACHI2('LoKi::TrgDistanceCalculator'))",
+      "DOCACHI2"     : "DOCACHI2MAX",
+      "BPVVDCHI2"    : "BPVVDCHI2",
+      "DTF_CHI2NDOF" : "DTF_CHI2NDOF (     True , strings ( [ 'Lambda_c+' ] ) )",
+      "DTF_M"        : "DTF_FUN      ( M , True , strings ( [ 'Lambda_c+' ] ) )",
+      "DTF_DM"       : "(DTF_FUN( M , True ) - DTF_FUN( CHILD(1,M) , True ))"
+      }
+    tuple.Lb.addTool(LoKi_Lb)
+    tuple.Lb.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Lb"]
+
+
+# tag: basic DecayTreeTuple definition
+# ---------------------------------------------------------------------------- #
+
+# Stream and stripping line where our particles are
+stream = "Semileptonic"
+line = "B2DMuNuX_Lc"
+
+# decay mode and branch
+decay_str = "[Lambda_b0 -> ^(Lambda_c+ -> ^p+ ^K- ^pi+) ^mu-]CC"
+branch_list = {
+                "p": "[Lambda_b0 -> (Lambda_c+ -> ^p+ K- pi+) mu-]CC",
+                "K": "[Lambda_b0 -> (Lambda_c+ -> p+ ^K- pi+) mu-]CC",
+                "pi": "[Lambda_b0 -> (Lambda_c+ -> p+ K- ^pi+) mu-]CC",
+                "Lc": "[Lambda_b0 -> ^(Lambda_c+ -> p+ K- pi+) mu-]CC",
+                "mu": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) ^mu-]CC",
+                "Lb": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) mu-]CC"
+              }
+
+# Create an nTuple to capture decays from the StrippingLine line
+dtt          = DecayTreeTuple("Lb2LcMuNuX")  # DecayTree name
+dtt.Inputs   = ["/Event/{0}/Phys/{1}/Particles".format(stream, line)]
+dtt.Decay    = decay_str
+dtt.Branches = branch_list
+
+fillTuple(dtt, myToolList, myTriggerList)
+
+
+# tag: check PV
+# ---------------------------------------------------------------------------- #
+
+checkPV = CheckPV("checkPV")
+checkPV.MinPVs = 1
+
+
+# tag: set sequence algorithm
+# ---------------------------------------------------------------------------- #
+
+
+Lb_SeqPhys = GaudiSequencer("Lb_SeqPhys")
+
+# The algorithms to the nTuple
+Lb_SeqPhys.Members += [checkPV]
+Lb_SeqPhys.Members += [dtt]
+
+
+# tag: configure DaVinci setting
+# ---------------------------------------------------------------------------- #
+
+
+# basic DaVinci options
+dv = DaVinci(
+    EvtMax      = 10000,         # please set number to -1 if you need all events
+#    SkipEvents  = 45000,          # if you want to skip events, please open this configuration
+    PrintFreq   = 10000,
+#    HistogramFile = "DVHistos.root",
+    TupleFile   = 'Tuple.root'    # Name of the ntuple
+    )
+
+# default configuration in AnalysisProduction
+'''
+dv.DataType    = the_year,       #year
+dv.InputType   = 'DST',          # DST or MDST
+dv.Turbo       = False,          # Turbo line or stripping line
+dv.Simulation  = _simulation,    # MC or Data
+dv.Lumi        = not dv.Simulation, # Only True for Data
+# Magnet Conditions
+dv.CondDBtag = 'cond-20180202'
+dv.DDDBtag   = 'dddb-20171030-3'
+'''
+
+# *: choose the UserAlgorithms
+dv.UserAlgorithms = [ Lb_SeqPhys ]
+
+# additional options
+#dv.EventPreFilters = TriFilters.filters('TriFilters')
+
+
+###########################################
+
+##########################################
+
+
+# local test functions
+if 0:
+    from GaudiConf import IOHelper
+
+    # Use the local input data
+    # Data
+    dst_file = 'LFN:/lhcb/LHCb/Collision18/SEMILEPTONIC.DST/00076476/0000/00076476_00000815_1.semileptonic.dst'
+    IOHelper().inputFiles([dst_file], clear=True)
+
+    FileCatalog().Catalogs = [ 'xmlcatalog_file:{}_Data_test/pool_xml_catalog.xml'.format(the_year) ]
+
diff --git a/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py b/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
new file mode 100644
index 0000000000..836d303e1f
--- /dev/null
+++ b/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
@@ -0,0 +1,302 @@
+
+# *: This file is going to scan data for Lb-->Lc+ miu- nu X
+  # DaVinci version: v44r7
+  # environment: default
+
+the_year = '2018' # the year must be string
+_simulation = True
+  # the above setting can be ignored in AP production, but neccessary in Ganga jobs
+
+# tag: import packages
+# ---------------------------------------------------------------------------- #
+
+import os, re, sys
+
+# *: import DaVinci packages
+
+from Gaudi.Configuration import *
+from GaudiKernel import SystemOfUnits as Units
+
+from Configurables import DecayTreeTuple, MCDecayTreeTuple # basic Tuple package
+from Configurables import CombineParticles, FilterDesktop# the package needed to reconstruct particles
+from Configurables import TupleToolDecay, TupleToolDecayTreeFitter
+from Configurables import TupleToolTrigger, TupleToolMCTruth, TupleToolTISTOS
+from Configurables import LoKi__Hybrid__TupleTool, LoKi__Hybrid__TupleTool
+  # above are common package tools
+from DecayTreeTuple.Configuration import *
+from Configurables import CheckPV # the package to check PV
+from Configurables import DaVinci # the package to configure DaVinci options
+
+# the packages define the sequences to be used
+from Configurables import GaudiSequencer
+from PhysConf.Selections import SelectionSequence
+
+# additional packages
+from Configurables import TupleToolRecoStats, MessageSvc # packages for information output
+from Configurables import OfflineVertexFitter
+
+# the packages maybe needed in other DaVinci version
+from PhysSelPython.Wrappers import AutomaticData, Selection, FilterSelection, DataOnDemand
+from PhysConf.Selections import TupleSelection, CombineSelection, RebuildSelection
+from Configurables import TriggerTisTos, TupleToolVtxIsoln
+
+
+# tag: pre-define the tuple tools and triggers in list
+# ---------------------------------------------------------------------------- #
+
+myToolList = [
+    "TupleToolAngles",
+    "TupleToolEventInfo",
+    "TupleToolKinematic",
+    "TupleToolPrimaries",
+    "TupleToolRecoStats",
+    "TupleToolPid",
+    "TupleToolANNPID",
+    "TupleToolGeometry",
+    "TupleToolPropertime",
+    "TupleToolTrackInfo",
+    "TupleToolTrigger",
+    "TupleToolL0Data"
+    ]
+
+
+myTriggerList = [
+    # L0
+    "L0GlobalDecision",
+    "L0PhysDecision",
+    "L0CALODecision",
+    "L0HadronDecision",
+    "L0MuonDecision", # muon
+    "L0DiMuonDecision",
+    "L0MuonHighDecision",
+    "L0PhotonDecision",
+    "L0PhotonHiDecision",
+    "L0PhotonNoSPDDecision",
+    "L0ElectronDecision",
+
+    # HLT1
+    "Hlt1TrackMVADecision",
+    "Hlt1TrackMVALooseDecision",
+    "Hlt1TwoTrackMVADecision",
+    "Hlt1TwoTrackMVALooseDecision",
+    "Hlt1L0AnyDecision",
+    "Hlt1MBNoBiasDecision",
+    "Hlt1GlobalDecision",
+    "Hlt1TrackAllL0Decision",
+    "Hlt1TrackMuonDecision",
+    "Hlt1SingelMuonNoIPDecision",
+    "Hlt1DiMuonHighMassDecision",
+    "Hlt1TrackPhotonDecision",
+
+    # Hlt2
+    "Hlt2Topo2BodyDecision",
+    "Hlt2Topo3BodyDecision",
+    "Hlt2Topo4BodyDecision",
+    "Hlt2Topo2BodySimpleDecision",
+    "Hlt2Topo3BodySimpleDecision",
+    "Hlt2Topo4BodySimpleDecision",
+    "Hlt2Topo2BodyBBDTDecision",
+    "Hlt2Topo3BodyBBDTDecision",
+    "Hlt2Topo4BodyBBDTDecision",
+    "Hlt2TopoE2BodyBBDTDecision",
+    "Hlt2TopoE3BodyBBDTDecision",
+    "Hlt2TopoE4BodyBBDTDecision",
+    "Hlt2IncPhiSidebandsDecision",
+    "Hlt2IncPhiDecision",
+    "Hlt2TopoRad2BodyBBDTDecision",
+    "Hlt2TopoRad2plus1BodyBBDTDecision"
+    ]
+
+
+# tag: define a function to fill the Tuple
+# ---------------------------------------------------------------------------- #
+
+
+def fillTuple(tuple, tools_list, triggers):
+    # add the ToolList
+    tuple.ToolList = tools_list
+
+    # *: add PV information
+
+    tuple.addTool(TupleToolDecay, name='Lb')
+
+    # not constraint to PV
+    tuple.Lb.ToolList += ["TupleToolDecayTreeFitter/PVFit"]
+    tuple.Lb.addTool(TupleToolDecayTreeFitter("PVFit"))
+    tuple.Lb.PVFit.Verbose = True
+    tuple.Lb.PVFit.UpdateDaughters = True
+
+    # PV fit
+    tuple.Lb.ToolList += ["TupleToolDecayTreeFitter/PVFit1"]
+    tuple.Lb.addTool(TupleToolDecayTreeFitter("PVFit1"))
+    tuple.Lb.PVFit1.Verbose = True
+    tuple.Lb.PVFit1.constrainToOriginVertex = True
+    tuple.Lb.PVFit1.UpdateDaughters = True
+
+
+    # *: add TupleToolTISTOS, which contain triggers
+    tuple.ToolList+=[ "TupleToolTISTOS" ]
+    tuple.addTool(TupleToolTISTOS, name="TupleToolTISTOS" )
+    tuple.TupleToolTISTOS.Verbose=True
+    tuple.TupleToolTISTOS.TriggerList = triggers
+    ## myTriggerList was defined in following lines
+
+    # *: add LoKi variables
+
+    from Configurables import LoKi__Hybrid__TupleTool
+    LoKi_All=LoKi__Hybrid__TupleTool("LoKi_All")
+    LoKi_All.Variables = {
+        "ETA"                  : "ETA",
+        "Y"                    : "Y"  ,
+        "LOKI_IPCHI2"          : "BPVIPCHI2()",
+        "LOKI_DIRA"    : "BPVDIRA"
+        }
+    tuple.addTool(LoKi_All)
+    tuple.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_All"]
+
+    LoKi_Lb=LoKi__Hybrid__TupleTool("LoKi_Lb")
+    LoKi_Lb.Variables = {
+      "AMAXDOCA"     : "PFUNA(AMAXDOCA('LoKi::DistanceCalculator'))",
+      "ADOCACHI2max" : "LoKi.Particles.PFunA(ADOCACHI2('LoKi::TrgDistanceCalculator'))",
+      "DOCACHI2"     : "DOCACHI2MAX",
+      "BPVVDCHI2"    : "BPVVDCHI2",
+      "DTF_CHI2NDOF" : "DTF_CHI2NDOF (     True , strings ( [ 'Lambda_c+' ] ) )",
+      "DTF_M"        : "DTF_FUN      ( M , True , strings ( [ 'Lambda_c+' ] ) )",
+      "DTF_DM"       : "(DTF_FUN( M , True ) - DTF_FUN( CHILD(1,M) , True ))"
+      }
+    tuple.Lb.addTool(LoKi_Lb)
+    tuple.Lb.ToolList += ["LoKi::Hybrid::TupleTool/LoKi_Lb"]
+
+    # add tool which is usful for MC data only
+    tuple.addTool(TupleToolMCTruth)
+    tuple.TupleToolMCTruth.ToolList = [
+          "MCTupleToolAngles",
+          "MCTupleToolKinematic",
+          "MCTupleToolHierarchy", # mother id
+          "MCTupleToolDecayType",
+          "MCTupleToolReconstructed",
+          "MCTupleToolPID"
+    ]
+
+
+# tag: basic DecayTreeTuple definition
+# ---------------------------------------------------------------------------- #
+
+# Stream and stripping line where our particles are
+stream = "AllStreams"
+line = "B2DMuNuX_Lc"
+
+# decay mode and branch
+decay_str = "[Lambda_b0 -> ^(Lambda_c+ -> ^p+ ^K- ^pi+) ^mu-]CC"
+branch_list = {
+                "p": "[Lambda_b0 -> (Lambda_c+ -> ^p+ K- pi+) mu-]CC",
+                "K": "[Lambda_b0 -> (Lambda_c+ -> p+ ^K- pi+) mu-]CC",
+                "pi": "[Lambda_b0 -> (Lambda_c+ -> p+ K- ^pi+) mu-]CC",
+                "Lc": "[Lambda_b0 -> ^(Lambda_c+ -> p+ K- pi+) mu-]CC",
+                "mu": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) ^mu-]CC",
+                "Lb": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) mu-]CC"
+              }
+
+# Create an nTuple to capture decays from the StrippingLine line
+dtt          = DecayTreeTuple("Lb2LcMuNuX")  # DecayTree name
+dtt.Inputs   = ["/Event/{0}/Phys/{1}/Particles".format(stream, line)]
+dtt.Decay    = decay_str
+dtt.Branches = branch_list
+
+fillTuple(dtt, myToolList, myTriggerList)
+
+
+# tag: create MCDecayTreeTuple
+# ---------------------------------------------------------------------------- #
+
+
+mcdtt          = MCDecayTreeTuple("mcTuple")  # root directory
+mcdtt.Decay    = "[Lambda_b0 -> ^(Lambda_c+ -> ^p+ ^K- ^pi+) ^mu- ^nu_mu~]CC"
+mcdtt.Branches = {
+                  "p": "[Lambda_b0 -> (Lambda_c+ -> ^p+ K- pi+) mu- nu_mu~]CC",
+                  "K": "[Lambda_b0 -> (Lambda_c+ -> p+ ^K- pi+) mu- nu_mu~]CC",
+                  "pi": "[Lambda_b0 -> (Lambda_c+ -> p+ K- ^pi+) mu- nu_mu~]CC",
+                  "Lc": "[Lambda_b0 -> ^(Lambda_c+ -> p+ K- pi+) mu- nu_mu~]CC",
+                  "mu": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) ^mu- nu_mu~]CC",
+                  "nu_mu~": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) mu- ^nu_mu~]CC",
+                  "Lb": "[Lambda_b0 -> (Lambda_c+ -> p+ K- pi+) mu- nu_mu~]CC"
+                }
+
+mcdtt.ToolList = [
+        'MCTupleToolAngles',
+        'MCTupleToolKinematic',
+        'TupleToolEventInfo',
+        'MCTupleToolHierarchy',
+        'MCTupleToolPrimaries',
+        'MCTupleToolReconstructed',
+        'MCTupleToolPID'
+        ]
+
+
+# tag: check PV
+# ---------------------------------------------------------------------------- #
+
+checkPV = CheckPV("checkPV")
+checkPV.MinPVs = 1
+
+
+# tag: set sequence algorithm
+# ---------------------------------------------------------------------------- #
+
+
+Lb_SeqPhys = GaudiSequencer("Lb_SeqPhys")
+
+# The algorithms to the nTuple
+Lb_SeqPhys.Members += [checkPV]
+Lb_SeqPhys.Members += [dtt]
+
+
+# tag: configure DaVinci setting
+# ---------------------------------------------------------------------------- #
+
+
+# basic DaVinci options
+dv = DaVinci(
+    EvtMax      = 10000,          # please set number to -1 if you need all events
+#    SkipEvents  = 45000,          # if you want to skip events, please open this configuration
+    PrintFreq   = 10000,
+#    HistogramFile = "DVHistos.root",
+    TupleFile   = 'Tuple.root'    # Name of the ntuple
+    )
+
+# default configuration in AnalysisProduction
+'''
+dv.DataType    = the_year,       #year
+dv.InputType   = 'DST',          # DST or MDST
+dv.Turbo       = False,          # Turbo line or stripping line
+dv.Simulation  = _simulation,    # MC or Data
+dv.Lumi        = not dv.Simulation, # Only True for Data
+# Magnet Conditions
+dv.CondDBtag = 'sim-20190430-vc-mu100'
+dv.DDDBtag   = 'dddb-20170721-3'
+'''
+
+# *: choose the UserAlgorithms
+dv.UserAlgorithms = [ Lb_SeqPhys, mcdtt ]
+#dv.UserAlgorithms = [ Lb_SeqPhys ]
+
+# additional options
+#dv.EventPreFilters = TriFilters.filters('TriFilters')
+
+
+###########################################
+
+##########################################
+
+
+# local test functions
+if 0:
+    from GaudiConf import IOHelper
+
+    # Use the local input data
+    # MC
+    dst_file = 'LFN:/lhcb/MC/2018/ALLSTREAMS.DST/00104096/0000/00104096_00000001_7.AllStreams.dst'
+    IOHelper().inputFiles([dst_file], clear=True)
+
+    FileCatalog().Catalogs = [ 'xmlcatalog_file:{}_MC_test/pool_xml_catalog.xml'.format(the_year) ]
+
diff --git a/Lb2LcMuNuX/info.yaml b/Lb2LcMuNuX/info.yaml
new file mode 100644
index 0000000000..3acb02c1f3
--- /dev/null
+++ b/Lb2LcMuNuX/info.yaml
@@ -0,0 +1,29 @@
+defaults:
+#  application: DaVinci/v44r4
+  wg: Charm
+  automatically_configure: yes
+  turbo: no
+  output: Tuple.root
+  inform:
+    - xiaocheng.song@cern.ch
+{%- set datasets = [
+  (),
+]%}Jinja
+
+{%- for polarity in ['MagDown','MagUp'] %}
+
+my_{{polarity}}_job_for_2018_Data:
+  application: DaVinci/v44r4
+  input:
+    bk_query: "/LHCb/Collision18/Beam6500GeV-VeloClosed-{{polarity}}/Real Data/Reco18/Stripping34/90000000/SEMILEPTONIC.DST"
+  options:
+    - DaVinci_Data_Lb2LcMuNu.py
+
+my_{{polarity}}_job_for_2018_MC:
+  application: DaVinci/v44r7
+  input:
+    bk_query: "/MC/2018/Beam6500GeV-2018-{{polarity}}-Nu1.6-25ns-Pythia8/Sim09h/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/15874041/ALLSTREAMS.DST"
+  options:
+    - DaVinci_MC_Lb2LcMuNu.py
+
+{%- endfor %}
-- 
GitLab


From dc548e8f8659c2a5b3afdb023ef3f33378f2392b Mon Sep 17 00:00:00 2001
From: Xiaocheng Song <xiaocheng.song@cern.ch>
Date: Mon, 2 Dec 2024 12:38:39 +0100
Subject: [PATCH 2/5] 12

---
 .gitignore | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 1060cad2f7..01bafe423b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,4 +52,3 @@ CMakeLists.txt.user
 /AnalysisProductions.xenvc
 /dynamic
 /local-tests/
-/starterkit/
-- 
GitLab


From be747aa08323f6d617ca7f5307006b1b3efc1a57 Mon Sep 17 00:00:00 2001
From: Xiaocheng Song <xiaocheng.song@cern.ch>
Date: Mon, 2 Dec 2024 14:27:13 +0100
Subject: [PATCH 3/5] change the Max evt setting

---
 Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py | 2 +-
 Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py b/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
index 5e12bf76ce..c4c9e11e12 100644
--- a/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
+++ b/Lb2LcMuNuX/DaVinci_Data_Lb2LcMuNu.py
@@ -220,7 +220,7 @@ Lb_SeqPhys.Members += [dtt]
 
 # basic DaVinci options
 dv = DaVinci(
-    EvtMax      = 10000,         # please set number to -1 if you need all events
+    EvtMax      = -1,         # please set number to -1 if you need all events
 #    SkipEvents  = 45000,          # if you want to skip events, please open this configuration
     PrintFreq   = 10000,
 #    HistogramFile = "DVHistos.root",
diff --git a/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py b/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
index 836d303e1f..98a3492a0f 100644
--- a/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
+++ b/Lb2LcMuNuX/DaVinci_MC_Lb2LcMuNu.py
@@ -257,7 +257,7 @@ Lb_SeqPhys.Members += [dtt]
 
 # basic DaVinci options
 dv = DaVinci(
-    EvtMax      = 10000,          # please set number to -1 if you need all events
+    EvtMax      = -1,          # please set number to -1 if you need all events
 #    SkipEvents  = 45000,          # if you want to skip events, please open this configuration
     PrintFreq   = 10000,
 #    HistogramFile = "DVHistos.root",
-- 
GitLab


From 518ac2b0b106b644561306336b1f62cd021ae956 Mon Sep 17 00:00:00 2001
From: Xiaocheng Song <xiaocheng.song@cern.ch>
Date: Tue, 3 Dec 2024 03:12:34 +0100
Subject: [PATCH 4/5] remove MagDown for MC which can't access from stage

---
 Lb2LcMuNuX/info.yaml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Lb2LcMuNuX/info.yaml b/Lb2LcMuNuX/info.yaml
index 3acb02c1f3..ea403b6d5d 100644
--- a/Lb2LcMuNuX/info.yaml
+++ b/Lb2LcMuNuX/info.yaml
@@ -19,11 +19,12 @@ my_{{polarity}}_job_for_2018_Data:
   options:
     - DaVinci_Data_Lb2LcMuNu.py
 
-my_{{polarity}}_job_for_2018_MC:
+{%- endfor %}
+
+my_MagUp_job_for_2018_MC:
   application: DaVinci/v44r7
   input:
-    bk_query: "/MC/2018/Beam6500GeV-2018-{{polarity}}-Nu1.6-25ns-Pythia8/Sim09h/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/15874041/ALLSTREAMS.DST"
+    bk_query: "/MC/2018/Beam6500GeV-2018-MagUp-Nu1.6-25ns-Pythia8/Sim09h/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/15874041/ALLSTREAMS.DST"
   options:
     - DaVinci_MC_Lb2LcMuNu.py
 
-{%- endfor %}
-- 
GitLab


From b14793f2e9735af35dfaa540f31c4202da3877a7 Mon Sep 17 00:00:00 2001
From: Xiaocheng Song <xiaocheng.song@cern.ch>
Date: Tue, 3 Dec 2024 03:20:14 +0100
Subject: [PATCH 5/5] all test is ok for local test

---
 Lb2LcMuNuX/info.yaml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Lb2LcMuNuX/info.yaml b/Lb2LcMuNuX/info.yaml
index ea403b6d5d..3acb02c1f3 100644
--- a/Lb2LcMuNuX/info.yaml
+++ b/Lb2LcMuNuX/info.yaml
@@ -19,12 +19,11 @@ my_{{polarity}}_job_for_2018_Data:
   options:
     - DaVinci_Data_Lb2LcMuNu.py
 
-{%- endfor %}
-
-my_MagUp_job_for_2018_MC:
+my_{{polarity}}_job_for_2018_MC:
   application: DaVinci/v44r7
   input:
-    bk_query: "/MC/2018/Beam6500GeV-2018-MagUp-Nu1.6-25ns-Pythia8/Sim09h/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/15874041/ALLSTREAMS.DST"
+    bk_query: "/MC/2018/Beam6500GeV-2018-{{polarity}}-Nu1.6-25ns-Pythia8/Sim09h/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/15874041/ALLSTREAMS.DST"
   options:
     - DaVinci_MC_Lb2LcMuNu.py
 
+{%- endfor %}
-- 
GitLab