From 4770d76c81c394e69e83a3faf8a3ceccdfac9e7d Mon Sep 17 00:00:00 2001
From: yajing <yajing.wei@cern.ch>
Date: Thu, 12 Dec 2024 07:33:00 +0000
Subject: [PATCH 1/5] Initial commit.

---
 B2Dh_D2Kspi0hh/info.yaml                      |  34 ++
 .../options/B2Dh_D2Kshhpi0_options.py         | 463 ++++++++++++++++++
 B2Dh_D2Kspi0hh/options/config/MC_2011.py      |   4 +
 B2Dh_D2Kspi0hh/options/config/MC_2012.py      |   4 +
 B2Dh_D2Kspi0hh/options/config/MC_2015.py      |   4 +
 B2Dh_D2Kspi0hh/options/config/MC_2016.py      |   4 +
 B2Dh_D2Kspi0hh/options/config/MC_2017.py      |   4 +
 B2Dh_D2Kspi0hh/options/config/MC_2018.py      |   4 +
 .../options/config/MC_desc_11166503.py        |   3 +
 .../options/config/MC_desc_11166504.py        |   3 +
 .../options/config/MC_desc_12165514.py        |   3 +
 .../options/config/MC_desc_12165518.py        |   3 +
 .../options/config/MC_desc_12165519.py        |   3 +
 .../options/config/MC_desc_12165571.py        |   3 +
 .../options/config/MC_desc_12165572.py        |   3 +
 .../options/config/MC_desc_12165750.py        |   3 +
 .../options/config/MC_desc_12165751.py        |   3 +
 17 files changed, 548 insertions(+)
 create mode 100644 B2Dh_D2Kspi0hh/info.yaml
 create mode 100644 B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2011.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2012.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2015.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2016.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2017.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_2018.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
 create mode 100644 B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py

diff --git a/B2Dh_D2Kspi0hh/info.yaml b/B2Dh_D2Kspi0hh/info.yaml
new file mode 100644
index 0000000000..759acb83ce
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/info.yaml
@@ -0,0 +1,34 @@
+defaults:
+    wg: B2OC
+    automatically_configure: yes
+    inform:
+        - yajing.wei@cern.ch
+    output: MC_Bu2Dh_D2Kspipipi0.ROOT
+    application: DaVinci/v46r11
+
+
+# year, energy, nu, sim09 version, trigger, reco, turbo, strip,
+{%- set MC_datasets = [
+  (11, 3500, 'Nu2',        '09m', 'Trig0x40760037', '14c', '',                     '21r1p2'),
+  (12, 4000, 'Nu2.5',        '09m', 'Trig0x409f0045', '14c', '',                     '21r0p2'),
+
+  (15, 6500, 'Nu1.6-25ns', '09m', 'Trig0x411400a2', '15a', '/Turbo02',             '24r2'),
+  (16, 6500, 'Nu1.6-25ns', '09m', 'Trig0x6139160F', '16',  '/Turbo03a',            '28r2'),
+  (17, 6500, 'Nu1.6-25ns', '09m', 'Trig0x62661709', '17',  '/Turbo04a-WithTurcal', '29r2p1'),
+  (18, 6500, 'Nu1.6-25ns', '09m', 'Trig0x617d18a4', '18',  '/Turbo05-WithTurcal',  '34r0p1'),
+]%}
+
+
+{%- for year, energy, nu, sim, trig, reco, turbo, strip in MC_datasets %}
+  {% for polarity in ["MagDown", "MagUp"] %}
+    {% for evt_type in ["12165518", "12165519", "11166503", "11166504", "12165750", "12165751", "12165571", "12165572", "12165514"] %}
+MC_20{{year}}_{{polarity}}_Bu2Dh_D2Kspipipi0_{{evt_type}}:
+    input:
+      bk_query: "/MC/20{{year}}/Beam{{energy}}GeV-20{{year}}-{{polarity}}-{{nu}}-Pythia8/Sim{{sim}}-ReDecay01/{{trig}}/Reco{{reco}}{{turbo}}/Stripping{{strip}}Filtered/{{evt_type}}/B2D0HD2KSPI0HH.STRIP.MDST"
+    options:
+      - options/config/MC_20{{year}}.py
+      - options/config/MC_desc_{{evt_type}}.py
+      - options/B2Dh_D2Kshhpi0_options.py
+    {% endfor %}
+  {% endfor %}
+{% endfor %}
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
new file mode 100644
index 0000000000..7f3e36e052
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
@@ -0,0 +1,463 @@
+from Gaudi.Configuration import *
+from Configurables import DaVinci
+from Configurables import EventTuple
+from Configurables import (DecayTreeTuple, PrintMCTree,)
+from Configurables import MCDecayTreeTuple
+from Configurables import TriggerTisTos
+from DecayTreeTuple.Configuration import *
+from PhysConf.Filters import LoKi_Filters
+import os
+#=========================#
+#=== Configure DaVinci ===#
+#=========================#
+# DaVinci().EvtMax = 2000
+
+simulation = (os.getenv("MC", 'False') == 'True') 
+year = os.getenv("YEAR") 
+
+if simulation:
+    input_type = "MDST"
+    stream = "B2D0HD2KSPi0HH.Strip"
+
+else:
+# for data, make sure the correct stream is used
+    DaVinci().Lumi = True
+    stream = "Bhadron"
+    input_type = "MDST"
+    if input_type=="MDST":
+        stream = "Bhadron"
+    else:
+        stream = "BhadronCompleteEvent"
+
+# set input TES and location predix based in inputs
+if input_type=="MDST":
+    DaVinci().RootInTES = '/Event/%s' % stream
+    location_prefix = ""
+else:
+    location_prefix = "/Event/{}".format(stream)
+    if simulation:
+        location_prefix = "/Event"
+
+ 
+#=====================================#
+#=== Stripping candidate locations ===#
+#=====================================#
+
+b_decs = ['D0Pi', 'D0K']
+if simulation:
+    d_decs = ['KsPiPiPi0']
+else:
+    d_decs = ['KsPiPiPi0', 'KsKKPi0']
+tracks = ['LL', 'DD']
+loc = {}
+for b in b_decs:
+    for t in tracks:
+        loc['{}_{}'.format(b, t)] = ["{}/Phys/B2{}D2KSPi0HH{}ResolvedBeauty2CharmLine/Particles" \
+            .format(location_prefix, b, t)]
+
+#=========================#
+#=== Decay descriptors ===#
+#=========================#
+
+decay_desc = {}
+
+decay_desc['D0Pi_KsPiPiPi0']    = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC"
+decay_desc['D0Pi_KsKKPi0']      = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}K+  ${h2}K-  ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC"
+decay_desc['D0K_KsPiPiPi0']     = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC"
+decay_desc['D0K_KsKKPi0']       = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}K+  ${h2}K-  ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC"
+decay_desc['MC_D0h_KsPiPiPi0'] = os.getenv("MC_desc")
+
+#=============================#
+#=== List of trigger lines ===#
+#=============================#
+
+triggerListL0 = [ "L0HadronDecision", 'L0PhotonDecision', 'L0ElectronDecision' ]
+
+# both YYYY and YY to avoid mixups if modifying options ...
+if year not in ['2011', '2012', '11', '12']: 
+    # run 2 triggers
+    triggerListHlt1 = [ "Hlt1TrackMVADecision",
+                        "Hlt1TwoTrackMVADecision",
+                        "Hlt1TrackMuonDecision",
+                        "Hlt1TrackPhotonDecision",
+                        "Hlt1TrackForwardPassThroughDecision",
+                        "Hlt1TrackForwardPassThroughLooseDecision" ]
+
+    triggerListHlt2 = [ "Hlt2Topo2BodyDecision",
+                        "Hlt2Topo3BodyDecision",
+                        "Hlt2Topo4BodyDecision" ]
+else:
+    # run 1 triggers
+    triggerListHlt1 = [ "Hlt1TrackAllL0Decision",
+                        "Hlt1TrackMuonDecision",
+                        "Hlt1TrackPhotonDecision",
+                        "Hlt1TrackForwardPassThroughDecision",
+                        "Hlt1TrackForwardPassThroughLooseDecision"] 
+
+    triggerListHlt2 = [ "Hlt2Topo2BodyBBDTDecision",
+                        "Hlt2Topo3BodyBBDTDecision",
+                        "Hlt2Topo4BodyBBDTDecision" ]
+
+triggerListAll = triggerListL0 + triggerListHlt1 + triggerListHlt2
+
+#===============================#
+#=== List of stripping lines ===#
+#===============================#
+
+stripping_list = []
+strip_code = ""
+for b in b_decs:
+    for t in tracks:
+        stripping = "StrippingB2{}D2KSPi0HH{}ResolvedBeauty2CharmLineDecision".format(b, t)
+        stripping_list.append(stripping)
+        if strip_code: strip_code += " | "
+        strip_code += "HLT_PASS_RE('{}')".format(stripping)
+
+# Make sure DaVinci filters on stripping and HLT2 as first thing (saves time)
+filters = LoKi_Filters(
+    HLT2_Code = " HLT_PASS_RE('Hlt2Topo.*Decision') ",
+    STRIP_Code = strip_code
+    )
+if not simulation:
+    # don't apply for simulation, since we use number of events in eventTuple
+    # for efficiency calculations, so there we need to run over ALL events
+    DaVinci.EventPreFilters = filters.filters("Filters")
+
+#=========================#
+#=== Set up EventTuple ===#
+#=========================#
+
+eventTuple = EventTuple("AllEventsTuple")
+eventTuple.ToolList = [ "TupleToolEventInfo", "MCTupleToolRedecay", "TupleToolRecoStats" ] 
+
+
+tuples = {}
+mc_tuples = []
+from collections import defaultdict
+tuple_lists = defaultdict(list)
+for b in b_decs:
+    for t in tracks:
+        if simulation:
+            d = 'KsPiPiPi0'
+            name = "B2{}_D2{}".format(b.replace("0",""), d)
+            mctuple = MCDecayTreeTuple("MC_"+name)
+            mctuple.setDescriptorTemplate(decay_desc["MC_{}_{}".format(b, d)])
+            mctuple.ToolList = [
+                "MCTupleToolHierarchy",
+                "TupleToolRecoStats" ,
+                "TupleToolEventInfo",
+                "LoKi::Hybrid::MCTupleTool/LoKi_Photos",
+                "MCTupleToolRedecay",
+            ]
+            # Add a 'number of photons' branch
+            mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True
+            mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {
+                "nPhotos": "MCNINTREE(('gamma' == MCABSID))"
+            }
+            mc_tuples.append(mctuple)
+        for d in d_decs:
+            # replace 0 to have consistent naming with 15+16 B2DK GGSZ analysis
+            name = "B2{}_D2{}_{}".format(b.replace("0",""), d, t)
+            tuples[name] = DecayTreeTuple(name)
+            tuples[name].Inputs = loc["{}_{}".format(b, t)]
+            tuples[name].setDescriptorTemplate(decay_desc["{}_{}".format(b, d)])
+
+            tuple_lists["{}_{}".format(b, d)].append(tuples[name])
+            tuple_lists["all"].append(tuples[name])
+
+            
+
+
+                
+#======================#
+#=== LoKi variables ===#
+#======================#
+
+#=== LoKi variables for Bach, h1, h2, Ksh1, Ksh2 ===#
+
+LoKih = {
+    "Q"           : "Q"
+    ,"MIP_PV"      : "MIPDV(PRIMARY)"
+    ,"MIPCHI2_PV"  : "MIPCHI2DV(PRIMARY)"
+    ,"TRCHI2DOF"   : "TRCHI2DOF"
+    ,"TRGHOSTPROB" : "TRGHP"
+    ,"TRTYPE"      : "TRTYPE"
+    ,"ETA"         : "ETA"
+    ,"Y"           : "Y"
+    }
+
+#=== Common LoKi variables for Bach, h1, h2, Ksh1, Ksh2 ===#
+LoKiBDK = {
+    "Q"              : "Q"
+    ,"DIRA_BPV"      : "BPVDIRA"
+    ,"MAXDOCA"       : "DOCAMAX"
+    ,"AMAXDOCA"      : "PFUNA(AMAXDOCA(''))"
+    ,"AMINDOCA"      : "PFUNA(AMINDOCA(''))"
+    ,"MIP_PV"        : "MIPDV(PRIMARY)"
+    ,"MIPCHI2_PV"    : "MIPCHI2DV(PRIMARY)"
+    ,"IP_BPV"        : "BPVIP()"
+    ,"IPCHI2_BPV"    : "BPVIPCHI2()"
+    ,"FD_BPV"        : "BPVVD"
+    ,"FD_BPV_SIGNED" : "BPVVDSIGN"
+    ,"FDCHI2_BPV"    : "BPVVDCHI2"
+    ,"RHO_BPV"       : "BPVVDRHO"
+    ,"Z_BPV"         : "BPVVDZ"
+    ,"VTXCHI2DOF"    : "VFASPF(VCHI2/VDOF)"
+    ,"ENDVTX_X"      : "VFASPF(VX)"
+    ,"ENDVTX_Y"      : "VFASPF(VY)"
+    ,"ENDVTX_Z"      : "VFASPF(VZ)"
+    # ,"LT_BPV"        : "BPVLTIME('PropertimeFitter/ProperTime    ::PUBLIC')"
+    # ,"LTCHI2_BPV"    : "BPVLTCHI2('PropertimeFitter/ProperTime   ::PUBLIC')"
+    # ,"LTFITCHI2_BPV" : "BPVLTFITCHI2('PropertimeFitter/ProperTime::PUBLIC')"    
+    ,"ETA"           : "ETA"
+    ,"Y"             : "Y"
+    }
+
+#=== LoKi variables for Ks ===#
+
+LoKiKs = {
+    "DM"            : "DMASS('KS0')"
+    }
+
+#=== LoKi variables for Bu ===#
+
+LoKiBu = {
+    "DM" : "DMASS('B+')"
+    ,"LV01" : "LV01"
+    ,"LV02" : "LV02",
+    'BPVMCORR' : 'BPVCORRM',
+    'DOCA'     : 'DOCA(1,2)',
+}
+
+#=== LoKi variables for D0 ===#
+
+LoKiD0 = {
+    "DM" : "DMASS('D0')",
+    'DOCACHI2_PipPim': 'DOCACHI2(1,2)',
+    'DOCA_PipPim': 'DOCA(1,2)',
+    'DOCACHI2_KSPip': 'DOCACHI2(3,1)',
+    'DOCA_KSPip': 'DOCA(3,1)',
+    'DOCACHI2_KSPim': 'DOCACHI2(3,2)',
+    'DOCA_KSPim': 'DOCA(3,2)',
+    }
+
+#=== LoKi variables for the event ===#
+
+LoKiEvt = {
+    #track information
+    "LoKi_nTracks" : "RECSUMMARY(LHCb.RecSummary.nTracks     , -1)"
+    , "LoKi_nLong" : "RECSUMMARY(LHCb.RecSummary.nLongTracks , -1)"
+    #RICH multiplities
+    , "LoKi_nRICH1Hits" : "switch(HASRECSUMMARY(20),RECSUMMARY(20, -1),-1)"
+    , "LoKi_nRICH2Hits" : "switch(HASRECSUMMARY(21),RECSUMMARY(21, -1),-1)"
+    }
+
+
+
+for ntp in tuple_lists["all"]:
+    ntp.ToolList = []
+    ntp.ToolList += [ "TupleToolAngles",
+                        "TupleToolEventInfo",
+                        "TupleToolGeometry",
+                        "TupleToolKinematic",
+                        "TupleToolPrimaries",
+                        # "TupleToolPropertime",
+                        "TupleToolRecoStats",
+    #                  "TupleToolRICHPid",
+                        "TupleToolTrackInfo",
+                        "TupleToolEventInfo",
+                        "TupleToolANNPID",
+                    #   "TupleToolDalitz",
+                        ]
+    for composite in [ntp.Bu, ntp.D0, ntp.Ks]:
+        composite.addTupleTool("TupleToolPropertime")
+    
+    ntp.Pi0.addTupleTool("TupleToolPi0Info")
+    for gamma in [ntp.gamma1, ntp.gamma2]:
+        gamma.addTupleTool('TupleToolPhotonInfo')
+        gamma.addTupleTool('TupleToolCaloHypo')
+        mytool = gamma.addTupleTool('TupleToolProtoPData')
+        mytool.DataList = ["IsPhoton", "IsNotE", "IsNotH"  ,  "CaloNeutralID", "CaloNeutralSpd"] 
+
+    if simulation:
+        ntp.ToolList += ["TupleToolMCBackgroundInfo", "MCTupleToolRedecay"]
+        ttMCt = ntp.addTupleTool("TupleToolMCTruth/ttMCt")
+        ttMCt.ToolList = [
+                "MCTupleToolDecayType",
+                "MCTupleToolHierarchy",
+                "MCTupleToolKinematic",
+                # 'MCTupleToolDalitz'
+                ]
+        if input_type != "MDST":
+            ttMCt.ToolList += [ "MCTupleToolReconstructed",]
+
+    ttpid = ntp.addTupleTool("TupleToolPid/ttpid")
+    ttpid.Verbose = True
+
+    tttt = ntp.addTupleTool("TupleToolTISTOS/tttt")
+    tttt.VerboseL0 = True
+    tttt.VerboseHlt1 = True
+    tttt.VerboseHlt2 = True
+    tttt.TriggerList = triggerListAll
+    if True:
+        tttt.addTool(TriggerTisTos())
+        tttt.TriggerTisTos.TOSFracEcal = 0.
+        tttt.TriggerTisTos.TOSFracHcal = 0.
+    if True:
+        tttt.addTool(TriggerTisTos())
+        tttt.TriggerTisTos.TOSFracMuon = 0.
+
+    #TupleToolTrigger
+    ttt = ntp.addTupleTool("TupleToolTrigger/ttt")
+    ttt.Verbose = True
+    ttt.TriggerList = triggerListAll
+
+    #TupleToolStripping
+    tts = ntp.addTupleTool("TupleToolStripping/tts")
+    tts.StrippingList = stripping_list
+
+    # DecayTreeFitter refits
+    ntp.Bu.addTupleTool("TupleToolDecayTreeFitter/constD0KSPI0PV_swapBachToK")
+    ntp.Bu.constD0KSPI0PV_swapBachToK.constrainToOriginVertex = True
+    ntp.Bu.constD0KSPI0PV_swapBachToK.Verbose = False
+    ntp.Bu.constD0KSPI0PV_swapBachToK.daughtersToConstrain = ['D0', 'KS0', 'pi0']
+    ntp.Bu.constD0KSPI0PV_swapBachToK.UpdateDaughters = False
+    ntp.Bu.constD0KSPI0PV_swapBachToK.Substitutions = {
+        'B+ ->  Charm ^Meson' : 'K+',
+        'B- ->  Charm ^Meson' : 'K-'
+    }
+
+    ntp.Bu.addTupleTool("TupleToolDecayTreeFitter/constD0KSPI0PV_swapBachToPi")
+    ntp.Bu.constD0KSPI0PV_swapBachToPi.constrainToOriginVertex = True
+    ntp.Bu.constD0KSPI0PV_swapBachToPi.Verbose = False
+    ntp.Bu.constD0KSPI0PV_swapBachToPi.daughtersToConstrain = ['D0', 'KS0', 'pi0']
+    ntp.Bu.constD0KSPI0PV_swapBachToPi.UpdateDaughters = False
+    ntp.Bu.constD0KSPI0PV_swapBachToPi.Substitutions = {
+        'B+ ->  Charm  ^Meson' : 'pi+',
+        'B- ->  Charm  ^Meson' : 'pi-'
+    }
+    
+    def add_DTF(ntp, constrain_pv = False, constrain_D0 = False, constrain_Ks = False, constrain_pi0 = False, swap = None):
+        name = 'const{0}{1}{2}{3}'.format( 
+            'D0' if constrain_D0 else '', 
+            'KS' if constrain_Ks else '', 
+            'PI0' if constrain_pi0 else '',
+            'PV' if constrain_pv else '',)
+        constrain_ls = []
+        if constrain_D0:
+            constrain_ls.append('D0')
+        if constrain_Ks:
+            constrain_ls.append('KS0')
+        if constrain_pi0:
+            constrain_ls.append('pi0')
+        
+        head_particle = getattr(ntp, 'Bu')
+        head_particle.addTupleTool("TupleToolDecayTreeFitter/{}".format(name))
+        dtf = getattr(head_particle, name)
+        dtf.constrainToOriginVertex = constrain_pv
+        dtf.Verbose = True
+        dtf.daughtersToConstrain = constrain_ls
+        dtf.UpdateDaughters = True
+        
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = True, constrain_Ks = True, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = True, constrain_Ks = True, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = False, constrain_Ks = True, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = True, constrain_Ks = False, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = True, constrain_Ks = False, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = False, constrain_Ks = True, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = False, constrain_Ks = False, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = True, constrain_D0 = False, constrain_Ks = False, constrain_pi0 = False)
+    
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = True, constrain_Ks = True, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = True, constrain_Ks = True, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = False, constrain_Ks = True, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = True, constrain_Ks = False, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = True, constrain_Ks = False, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = False, constrain_Ks = True, constrain_pi0 = False)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = False, constrain_Ks = False, constrain_pi0 = True)
+    add_DTF(ntp, constrain_pv = False, constrain_D0 = False, constrain_Ks = False, constrain_pi0 = False)
+
+
+
+    LoKi_Bu = ntp.Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu")
+    LoKi_Bu.Variables = dict(list(LoKiBu.items()) + list(LoKiBDK.items()))
+
+    LoKi_D0 = ntp.D0.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_D0")
+    LoKi_D0.Variables =  dict(list(LoKiD0.items()) + list(LoKiBDK.items()))
+
+    LoKi_Ks = ntp.Ks.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Ks")
+    LoKi_Ks.Variables =  dict(list(LoKiKs.items()) + list(LoKiBDK.items()))
+
+    LoKi_Bach = ntp.Bach.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bach")
+    LoKi_Bach.Preambulo = ["from LoKiTracks.decorators import *"]
+    LoKi_Bach.Variables = LoKih
+
+    LoKi_h1 = ntp.h1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_h1")
+    LoKi_h1.Preambulo = ["from LoKiTracks.decorators import *"]
+    LoKi_h1.Variables = LoKih
+
+    LoKi_h2 = ntp.h2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_h2")
+    LoKi_h2.Preambulo = ["from LoKiTracks.decorators import *"]
+    LoKi_h2.Variables = LoKih
+    
+    LoKi_Ksh1 = ntp.Ksh1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Ksh1")
+    LoKi_Ksh1.Preambulo = ["from LoKiTracks.decorators import *"]
+    LoKi_Ksh1.Variables = LoKih
+
+    LoKi_Ksh2 = ntp.Ksh2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Ksh2")
+    LoKi_Ksh2.Preambulo = ["from LoKiTracks.decorators import *"]
+    LoKi_Ksh2.Variables = LoKih
+
+    LoKi_evt = ntp.addTupleTool("LoKi::Hybrid::EvtTupleTool/LoKi_evt")
+    LoKi_evt.Preambulo = ['from LoKiTracks.decorators import *',
+                            'from LoKiNumbers.decorators import *',
+                            'from LoKiCore.functions import *']
+    LoKi_evt.VOID_Variables = LoKiEvt
+
+
+
+# === Cone variables ===#
+# RELINFO('/Event/Bhadron/Phys/<MyLine>/P2ConeVar1' ... 
+cone_vars = {}
+for b in b_decs:
+    for t in tracks:
+        cone_vars["{}_{}".format(b, t)] = {
+            # Cone variables
+                "PTASY_1.5"       : "RELINFO('{}/Phys/B2{}D2KSPi0HH{}ResolvedBeauty2CharmLine/P2ConeVar1','CONEPTASYM',-1000.)".format(location_prefix, b, t)
+            , "PTASY_1.7"       : "RELINFO('{}/Phys/B2{}D2KSPi0HH{}ResolvedBeauty2CharmLine/P2ConeVar2','CONEPTASYM',-1000.)".format(location_prefix,b, t)
+            , "PTASY_1.0"       : "RELINFO('{}/Phys/B2{}D2KSPi0HH{}ResolvedBeauty2CharmLine/P2ConeVar3','CONEPTASYM',-1000.)".format(location_prefix,b, t)
+        }
+
+
+# Cone variables for different lines
+for b in b_decs:
+    for d in d_decs:
+        for t in tracks:
+                name = "B2{}_D2{}_{}".format(b.replace("0",""), d, t)
+                LoKi_Bu = tuples[name].Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu_CONE")
+                LoKi_Bu.Variables = cone_vars["{}_{}".format(b, t)]
+
+def MomentumCorrection(simulation=False):
+    """
+    Returns the momentum scale correction algorithm for data tracks or the
+    momentum smearing algorithm for MC tracks
+    """
+    if not simulation:
+        from Configurables import TrackScaleState as SCALE
+        scaler = SCALE('StateScale')
+        return scaler
+    else:
+        from Configurables import TrackSmearState as SMEAR
+        smear = SMEAR('StateSmear')
+        return smear
+    return
+#========================================#
+#=== Add tuples to list of algorithms ===#
+#========================================#
+
+DaVinci().UserAlgorithms += [eventTuple]
+DaVinci().UserAlgorithms += [MomentumCorrection(DaVinci().Simulation)]
+DaVinci().UserAlgorithms += tuple_lists["all"]
+
+if simulation:
+    DaVinci().UserAlgorithms += mc_tuples
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2011.py b/B2Dh_D2Kspi0hh/options/config/MC_2011.py
new file mode 100644
index 0000000000..29f8d47bd4
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2011.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2011'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2012.py b/B2Dh_D2Kspi0hh/options/config/MC_2012.py
new file mode 100644
index 0000000000..c7a816cfa6
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2012.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2012'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2015.py b/B2Dh_D2Kspi0hh/options/config/MC_2015.py
new file mode 100644
index 0000000000..735e11f937
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2015.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2015'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2016.py b/B2Dh_D2Kspi0hh/options/config/MC_2016.py
new file mode 100644
index 0000000000..faadb9ff40
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2016.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2016'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2017.py b/B2Dh_D2Kspi0hh/options/config/MC_2017.py
new file mode 100644
index 0000000000..9642800ca7
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2017.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2017'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_2018.py b/B2Dh_D2Kspi0hh/options/config/MC_2018.py
new file mode 100644
index 0000000000..e45b6fed23
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_2018.py
@@ -0,0 +1,4 @@
+import os
+
+os.environ['MC'] = "True"
+os.environ['YEAR'] = '2018'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
new file mode 100644
index 0000000000..30d8851b3c
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc']  = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}pi-  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
new file mode 100644
index 0000000000..219bb9f2ac
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc']   = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}K-  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
new file mode 100644
index 0000000000..2950553b24
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc'] = "${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${rho}(rho(770)+ => ${rho_pi}pi+ ${rho_pi0}pi0)  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
new file mode 100644
index 0000000000..14116beee2
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc'] = '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
new file mode 100644
index 0000000000..4ac17f636f
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc'] =  '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
new file mode 100644
index 0000000000..3802bcdc77
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc']= "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}pi+ )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
new file mode 100644
index 0000000000..0127d88414
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc']= "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}K+  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
new file mode 100644
index 0000000000..03f9681a8a
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc'] = "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}pi+ )]CC"
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py
new file mode 100644
index 0000000000..cd1f4e4970
--- /dev/null
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py
@@ -0,0 +1,3 @@
+import os
+
+os.environ['MC_desc']  = "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}K+  )]CC"
\ No newline at end of file
-- 
GitLab


From d2d341cf6d725134d799d816e002672eabe1dfc9 Mon Sep 17 00:00:00 2001
From: yajing <yajing.wei@cern.ch>
Date: Thu, 12 Dec 2024 08:16:36 +0000
Subject: [PATCH 2/5] Fix bug.

---
 B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
index 7f3e36e052..c6574ab440 100644
--- a/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
+++ b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
@@ -141,7 +141,7 @@ for b in b_decs:
             d = 'KsPiPiPi0'
             name = "B2{}_D2{}".format(b.replace("0",""), d)
             mctuple = MCDecayTreeTuple("MC_"+name)
-            mctuple.setDescriptorTemplate(decay_desc["MC_{}_{}".format(b, d)])
+            mctuple.setDescriptorTemplate(decay_desc['MC_D0h_KsPiPiPi0'])
             mctuple.ToolList = [
                 "MCTupleToolHierarchy",
                 "TupleToolRecoStats" ,
-- 
GitLab


From 96880121cebb5b4f7eec302d2186646c787dcde6 Mon Sep 17 00:00:00 2001
From: yajing <yajing.wei@cern.ch>
Date: Thu, 12 Dec 2024 13:55:42 +0000
Subject: [PATCH 3/5] Fix MCDecayTree descriptor

---
 B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py  | 5 +++--
 B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py | 3 ++-
 B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py | 3 ++-
 10 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
index c6574ab440..63bfd4eed1 100644
--- a/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
+++ b/B2Dh_D2Kspi0hh/options/B2Dh_D2Kshhpi0_options.py
@@ -65,7 +65,8 @@ decay_desc['D0Pi_KsPiPiPi0']    = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${
 decay_desc['D0Pi_KsKKPi0']      = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}K+  ${h2}K-  ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC"
 decay_desc['D0K_KsPiPiPi0']     = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC"
 decay_desc['D0K_KsKKPi0']       = "${Bu}[(B+ -> ${D0}([D~0]cc -> ${Ks}(KS0 -> ${Ksh1}pi+ ${Ksh2}pi-) ${h1}K+  ${h2}K-  ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC"
-decay_desc['MC_D0h_KsPiPiPi0'] = os.getenv("MC_desc")
+decay_desc['MC_D0K_KsPiPiPi0'] = os.getenv("MC_desc_dk")
+decay_desc['MC_D0Pi_KsPiPiPi0'] = os.getenv("MC_desc_dpi")
 
 #=============================#
 #=== List of trigger lines ===#
@@ -141,7 +142,7 @@ for b in b_decs:
             d = 'KsPiPiPi0'
             name = "B2{}_D2{}".format(b.replace("0",""), d)
             mctuple = MCDecayTreeTuple("MC_"+name)
-            mctuple.setDescriptorTemplate(decay_desc['MC_D0h_KsPiPiPi0'])
+            mctuple.setDescriptorTemplate(decay_desc['MC_{}_{}'.format(b, d)])
             mctuple.ToolList = [
                 "MCTupleToolHierarchy",
                 "TupleToolRecoStats" ,
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
index 30d8851b3c..f8fd28b5bc 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166503.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc']  = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}pi-  )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi']  = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}pi-  )]CC"
+os.environ['MC_desc_dk']   = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}K-  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
index 219bb9f2ac..f8fd28b5bc 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_11166504.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc']   = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}K-  )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi']  = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}pi-  )]CC"
+os.environ['MC_desc_dk']   = "${Bd}[([B0]cc => ${Dst}(D*(2010)+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi}pi+ ) ${Bach}K-  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
index 2950553b24..e3f97ced5a 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165514.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc'] = "${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${rho}(rho(770)+ => ${rho_pi}pi+ ${rho_pi0}pi0)  )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi'] = "${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${rho}(rho(770)+ => ${rho_pi}pi+ ${rho_pi0}pi0)  )]CC"
+os.environ['MC_desc_dk'] = "${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${rho}(rho(770)+ => ${rho_pi}pi+ ${rho_pi0}pi0)  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
index 14116beee2..40e0b4c406 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165518.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc'] = '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC'
\ No newline at end of file
+os.environ['MC_desc_dpi'] = '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC'
+os.environ['MC_desc_dk'] =  '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
index 4ac17f636f..40e0b4c406 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165519.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc'] =  '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC'
\ No newline at end of file
+os.environ['MC_desc_dpi'] = '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}pi+  )]CC'
+os.environ['MC_desc_dk'] =  '${Bu}[(B+ => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Bach}K+   )]CC'
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
index 3802bcdc77..f299a39a3d 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165571.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc']= "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}pi+ )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi']= "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}pi+ )]CC"
+os.environ['MC_desc_dk'] = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}K+  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
index 0127d88414..f299a39a3d 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165572.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc']= "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}K+  )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi']= "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}pi+ )]CC"
+os.environ['MC_desc_dk'] = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_pi0}pi0 ) ${Bach}K+  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
index 03f9681a8a..8e184353b8 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165750.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc'] = "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}pi+ )]CC"
+os.environ['MC_desc_dpi'] = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}pi+ )]CC"
+os.environ['MC_desc_dk']  = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}K+  )]CC"
\ No newline at end of file
diff --git a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py
index cd1f4e4970..8e184353b8 100644
--- a/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py
+++ b/B2Dh_D2Kspi0hh/options/config/MC_desc_12165751.py
@@ -1,3 +1,4 @@
 import os
 
-os.environ['MC_desc']  = "${Bu}[(B+ => ${Dst}(D*(2007)0 => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}K+  )]CC"
\ No newline at end of file
+os.environ['MC_desc_dpi'] = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}pi+ )]CC"
+os.environ['MC_desc_dk']  = "${Bu}[(B+ => ${Dst}([D*(2007)~0]cc => ${D0}([D~0]cc => ${Ks}(KS0 => ${Ksh1}pi+ ${Ksh2}pi-) ${h1}pi+ ${h2}pi- ${Pi0}(pi0 -> ${gamma1}gamma ${gamma2}gamma)) ${Dst_gamma}gamma ) ${Bach}K+  )]CC"
\ No newline at end of file
-- 
GitLab


From e82b9ca66d4dd5694917a45b2261c6488835e84a Mon Sep 17 00:00:00 2001
From: yajing <yajing.wei@cern.ch>
Date: Fri, 13 Dec 2024 03:20:46 +0000
Subject: [PATCH 4/5] Remove some channels because it seems the pipeline
 doesn't start with too many jobs.

---
 B2Dh_D2Kspi0hh/info.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/B2Dh_D2Kspi0hh/info.yaml b/B2Dh_D2Kspi0hh/info.yaml
index 759acb83ce..8b1b7a6cba 100644
--- a/B2Dh_D2Kspi0hh/info.yaml
+++ b/B2Dh_D2Kspi0hh/info.yaml
@@ -18,10 +18,10 @@ defaults:
   (18, 6500, 'Nu1.6-25ns', '09m', 'Trig0x617d18a4', '18',  '/Turbo05-WithTurcal',  '34r0p1'),
 ]%}
 
-
+#"12165750", "12165751", "12165571", "12165572", "12165514" are removed for now
 {%- for year, energy, nu, sim, trig, reco, turbo, strip in MC_datasets %}
   {% for polarity in ["MagDown", "MagUp"] %}
-    {% for evt_type in ["12165518", "12165519", "11166503", "11166504", "12165750", "12165751", "12165571", "12165572", "12165514"] %}
+    {% for evt_type in ["12165518", "12165519", "11166503", "11166504"] %} 
 MC_20{{year}}_{{polarity}}_Bu2Dh_D2Kspipipi0_{{evt_type}}:
     input:
       bk_query: "/MC/20{{year}}/Beam{{energy}}GeV-20{{year}}-{{polarity}}-{{nu}}-Pythia8/Sim{{sim}}-ReDecay01/{{trig}}/Reco{{reco}}{{turbo}}/Stripping{{strip}}Filtered/{{evt_type}}/B2D0HD2KSPI0HH.STRIP.MDST"
-- 
GitLab


From 31c6aa3c3082f9820fe4ac6b58b78acee4254e95 Mon Sep 17 00:00:00 2001
From: yajing <yajing.wei@cern.ch>
Date: Fri, 13 Dec 2024 03:36:48 +0000
Subject: [PATCH 5/5] Initial commit.

---
 B2Dh_D2Kspi0hh/info.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/B2Dh_D2Kspi0hh/info.yaml b/B2Dh_D2Kspi0hh/info.yaml
index 8b1b7a6cba..20b71bc4de 100644
--- a/B2Dh_D2Kspi0hh/info.yaml
+++ b/B2Dh_D2Kspi0hh/info.yaml
@@ -18,10 +18,10 @@ defaults:
   (18, 6500, 'Nu1.6-25ns', '09m', 'Trig0x617d18a4', '18',  '/Turbo05-WithTurcal',  '34r0p1'),
 ]%}
 
-#"12165750", "12165751", "12165571", "12165572", "12165514" are removed for now
+
 {%- for year, energy, nu, sim, trig, reco, turbo, strip in MC_datasets %}
   {% for polarity in ["MagDown", "MagUp"] %}
-    {% for evt_type in ["12165518", "12165519", "11166503", "11166504"] %} 
+    {% for evt_type in ["12165750", "12165751", "12165571", "12165572", "12165514"] %} 
 MC_20{{year}}_{{polarity}}_Bu2Dh_D2Kspipipi0_{{evt_type}}:
     input:
       bk_query: "/MC/20{{year}}/Beam{{energy}}GeV-20{{year}}-{{polarity}}-{{nu}}-Pythia8/Sim{{sim}}-ReDecay01/{{trig}}/Reco{{reco}}{{turbo}}/Stripping{{strip}}Filtered/{{evt_type}}/B2D0HD2KSPI0HH.STRIP.MDST"
-- 
GitLab