Belle II Software light-2406-ragdoll
inclusiveDstarReconstruction.py
1
8
9"""
10An example script showing how to reconstruct D* mesons inclusively from slow
11pions.
12"""
13
14# Doxygen should skip this script
15# @cond
16
17import basf2
18import modularAnalysis as mA
19import stdPi0s
20
21
22main_path = basf2.create_path()
23
24mA.inputMdstList(
25 filelist=[basf2.find_file("analysis/tests/mdst.root")],
26 path=main_path,
27)
28
29list_tree_tuples = list()
30
31# MC Truth
32mA.fillParticleListFromMC("pi+:from_mc", cut="[dr < 2] and [abs(dz) < 4]", addDaughters=True, path=main_path)
33mA.addInclusiveDstarReconstruction(
34 "D*+:Dstcharged_slowPicharged_MC -> pi+:from_mc",
35 slowPionCut="[useCMSFrame(p) < 2]",
36 DstarCut="useCMSFrame(p) < 2",
37 path=main_path)
38
39mA.fillParticleListFromMC("pi0:from_mc", "", addDaughters=True, path=main_path)
40mA.addInclusiveDstarReconstruction(
41 "D*+:Dstcharged_slowPizero_MC -> pi0:from_mc",
42 slowPionCut="[useCMSFrame(p) < 2]",
43 DstarCut="useCMSFrame(p) < 2",
44 path=main_path)
45mA.addInclusiveDstarReconstruction(
46 "D*0:Dstzero_slowPizero_MC -> pi0:from_mc",
47 slowPionCut="[useCMSFrame(p) < 2]",
48 DstarCut="useCMSFrame(p) < 2",
49 path=main_path)
50mA.matchMCTruth("D*+:Dstcharged_slowPizero_MC", path=main_path)
51mA.matchMCTruth("D*0:Dstzero_slowPizero_MC", path=main_path)
52mA.matchMCTruth("D*+:Dstcharged_slowPicharged_MC", path=main_path)
53
54list_tree_tuples.append(("D*+:Dstcharged_slowPicharged_MC", "Dstcharged_slowPicharged_MC"))
55list_tree_tuples.append(("D*+:Dstcharged_slowPizero_MC", "Dstcharged_slowPizero_MC"))
56list_tree_tuples.append(("D*0:Dstzero_slowPizero_MC", "Dstzero_slowPizero_MC"))
57
58# Reco Level
59mA.fillParticleList("pi+:slow", cut="[dr < 2] and [abs(dz) < 4]", path=main_path)
60mA.matchMCTruth("pi+:slow", path=main_path)
61
62mA.addInclusiveDstarReconstruction(
63 "D*+:Dstcharged_slowPicharged -> pi+:slow",
64 slowPionCut="[useCMSFrame(p) < 2]",
65 DstarCut="useCMSFrame(p) < 2",
66 path=main_path)
67mA.matchMCTruth("D*+:Dstcharged_slowPicharged", path=main_path)
68
69mA.addInclusiveDstarReconstruction(
70 "D*-:Dstcharged_slowPicharged_negative -> pi-:slow",
71 slowPionCut="[useCMSFrame(p) < 2]",
72 DstarCut="useCMSFrame(p) < 2",
73 path=main_path)
74mA.matchMCTruth("D*-:Dstcharged_slowPicharged_negative", path=main_path)
75
76stdPi0s.stdPi0s("eff60_May2020", path=main_path)
77mA.matchMCTruth("pi0:eff60_May2020", path=main_path)
78
79mA.addInclusiveDstarReconstruction(
80 "D*+:Dstcharged_slowPizero -> pi0:eff60_May2020",
81 slowPionCut="[useCMSFrame(p) < 2]",
82 DstarCut="useCMSFrame(p) < 2",
83 path=main_path)
84mA.matchMCTruth("D*+:Dstcharged_slowPizero", path=main_path)
85
86mA.addInclusiveDstarReconstruction(
87 "D*0:Dstzero_slowPizero -> pi0:eff60_May2020",
88 slowPionCut="[useCMSFrame(p) < 2]",
89 DstarCut="useCMSFrame(p) < 2",
90 path=main_path)
91mA.matchMCTruth("D*0:Dstzero_slowPizero", path=main_path)
92
93list_tree_tuples.append(("D*+:Dstcharged_slowPicharged", "Dstcharged_slowPicharged"))
94list_tree_tuples.append(("D*-:Dstcharged_slowPicharged_negative", "Dstcharged_slowPicharged_negative"))
95list_tree_tuples.append(("D*+:Dstcharged_slowPizero", "Dstcharged_slowPizero"))
96list_tree_tuples.append(("D*0:Dstzero_slowPizero", "Dstzero_slowPizero"))
97
98dstar_variables = [
99 "isSignal",
100 "PDG",
101 "daughter(0, PDG)",
102 "E",
103 "p",
104 "pt",
105 "useCMSFrame(p)",
106 "useCMSFrame(E)",
107 "matchedMC(p)",
108 "matchedMC(pt)",
109 "matchedMC(E)",
110 "matchedMC(useCMSFrame(p))",
111 "matchedMC(PDG)",
112 "px",
113 "py",
114 "pz",
115 "M",
116 "InvM",
117 "daughter(0, isSignal)",
118 "daughter(0, E)",
119 "daughter(0, p)",
120 "daughter(0, useCMSFrame(p))",
121 "daughter(0, matchedMC(p))",
122 "daughter(0, matchedMC(E))",
123 "daughter(0, matchedMC(useCMSFrame(p)))",
124 "daughter(0, matchedMC(PDG))",
125 "daughter(0, daughter(0, matchedMC(PDG)))",
126 "daughter(0, daughter(1, matchedMC(PDG)))",
127 "daughter(0, mcMother(PDG))",
128 "daughter(0, mcMother(p))",
129 "daughter(0, mcMother(useCMSFrame(p)))",
130 "daughter(0, mcMother(E))",
131 "daughter(0, mcMother(mcDaughter(0, PDG)))",
132 "daughter(0, mcMother(mcDaughter(0, p)))",
133 "daughter(0, mcMother(mcDaughter(0, E)))",
134 "daughter(0, mcMother(mcDaughter(0, useCMSFrame(p))))",
135 "daughter(0, mcMother(mcDaughter(1, PDG)))",
136 "daughter(0, mcMother(mcDaughter(1, p)))",
137 "daughter(0, mcMother(mcDaughter(1, E)))",
138 "daughter(0, mcMother(mcDaughter(1, useCMSFrame(p))))",
139 "daughter(0, mcMother(mcMother(mcDaughter(0, PDG))))",
140 "daughter(0, mcMother(mcMother(mcDaughter(1, PDG))))",
141]
142
143for list_tree_tuple in list_tree_tuples:
144 mA.variablesToNtuple(
145 decayString=list_tree_tuple[0],
146 variables=dstar_variables,
147 treename=list_tree_tuple[1],
148 path=main_path
149 )
150
151basf2.process(main_path)
152print(basf2.statistics)
153
154# @endcond
def stdPi0s(listtype="eff60_May2020", path=None, beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="")
Definition: stdPi0s.py:22