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