12 An example script showing how to reconstruct D* mesons inclusively from slow
17 import modularAnalysis
as mA
21 main_path = basf2.create_path()
24 filelist=[basf2.find_file(
"analysis/tests/mdst.root")],
28 list_tree_tuples = list()
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",
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",
44 mA.addInclusiveDstarReconstruction(
45 "D*0:Dstzero_slowPizero_MC -> pi0:from_mc",
46 slowPionCut=
"[useCMSFrame(p) < 2]",
47 DstarCut=
"useCMSFrame(p) < 2",
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)
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"))
58 mA.fillParticleList(
"pi+:slow", cut=
"[dr < 2] and [abs(dz) < 4]", path=main_path)
59 mA.matchMCTruth(
"pi+:slow", path=main_path)
61 mA.addInclusiveDstarReconstruction(
62 "D*+:Dstcharged_slowPicharged -> pi+:slow",
63 slowPionCut=
"[useCMSFrame(p) < 2]",
64 DstarCut=
"useCMSFrame(p) < 2",
66 mA.matchMCTruth(
"D*+:Dstcharged_slowPicharged", path=main_path)
68 mA.addInclusiveDstarReconstruction(
69 "D*-:Dstcharged_slowPicharged_negative -> pi-:slow",
70 slowPionCut=
"[useCMSFrame(p) < 2]",
71 DstarCut=
"useCMSFrame(p) < 2",
73 mA.matchMCTruth(
"D*-:Dstcharged_slowPicharged_negative", path=main_path)
76 mA.matchMCTruth(
"pi0:eff60_May2020", path=main_path)
78 mA.addInclusiveDstarReconstruction(
79 "D*+:Dstcharged_slowPizero -> pi0:eff60_May2020",
80 slowPionCut=
"[useCMSFrame(p) < 2]",
81 DstarCut=
"useCMSFrame(p) < 2",
83 mA.matchMCTruth(
"D*+:Dstcharged_slowPizero", path=main_path)
85 mA.addInclusiveDstarReconstruction(
86 "D*0:Dstzero_slowPizero -> pi0:eff60_May2020",
87 slowPionCut=
"[useCMSFrame(p) < 2]",
88 DstarCut=
"useCMSFrame(p) < 2",
90 mA.matchMCTruth(
"D*0:Dstzero_slowPizero", path=main_path)
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"))
109 "matchedMC(useCMSFrame(p))",
116 "daughter(0, isSignal)",
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))))",
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],
150 basf2.process(main_path)
151 print(basf2.statistics)
def stdPi0s(listtype="eff60_May2020", path=None, beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="")