10An example script showing how to reconstruct D* mesons inclusively from slow
18import modularAnalysis
as mA
22main_path = basf2.create_path()
25 filelist=[basf2.find_file(
"analysis/tests/mdst.root")],
29list_tree_tuples = list()
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",
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",
45mA.addInclusiveDstarReconstruction(
46 "D*0:Dstzero_slowPizero_MC -> pi0:from_mc",
47 slowPionCut=
"[useCMSFrame(p) < 2]",
48 DstarCut=
"useCMSFrame(p) < 2",
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)
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"))
59mA.fillParticleList(
"pi+:slow", cut=
"[dr < 2] and [abs(dz) < 4]", path=main_path)
60mA.matchMCTruth(
"pi+:slow", path=main_path)
62mA.addInclusiveDstarReconstruction(
63 "D*+:Dstcharged_slowPicharged -> pi+:slow",
64 slowPionCut=
"[useCMSFrame(p) < 2]",
65 DstarCut=
"useCMSFrame(p) < 2",
67mA.matchMCTruth(
"D*+:Dstcharged_slowPicharged", path=main_path)
69mA.addInclusiveDstarReconstruction(
70 "D*-:Dstcharged_slowPicharged_negative -> pi-:slow",
71 slowPionCut=
"[useCMSFrame(p) < 2]",
72 DstarCut=
"useCMSFrame(p) < 2",
74mA.matchMCTruth(
"D*-:Dstcharged_slowPicharged_negative", path=main_path)
77mA.matchMCTruth(
"pi0:eff60_May2020", path=main_path)
79mA.addInclusiveDstarReconstruction(
80 "D*+:Dstcharged_slowPizero -> pi0:eff60_May2020",
81 slowPionCut=
"[useCMSFrame(p) < 2]",
82 DstarCut=
"useCMSFrame(p) < 2",
84mA.matchMCTruth(
"D*+:Dstcharged_slowPizero", path=main_path)
86mA.addInclusiveDstarReconstruction(
87 "D*0:Dstzero_slowPizero -> pi0:eff60_May2020",
88 slowPionCut=
"[useCMSFrame(p) < 2]",
89 DstarCut=
"useCMSFrame(p) < 2",
91mA.matchMCTruth(
"D*0:Dstzero_slowPizero", path=main_path)
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"))
110 "matchedMC(useCMSFrame(p))",
117 "daughter(0, isSignal)",
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))))",
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],
151basf2.process(main_path)
152print(basf2.statistics)
def stdPi0s(listtype="eff60_May2020", path=None, beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="")