19 from ROOT
import Belle2
23 import matplotlib
as mpl
25 mpl.rcParams.update({
'font.size': 22})
26 mpl.rcParams[
'text.usetex'] =
True
27 mpl.rcParams[
'text.latex.preamble'] = [
r"\usepackage{amsmath}"]
28 import matplotlib.pyplot
as plt
29 from matplotlib.ticker
import FormatStrFormatter
35 if len(sys.argv) != 3:
36 sys.exit(
"Must provide 2 arguments: [Belle or Belle2] [samplesWildCards]"
39 belleOrBelle2 = sys.argv[1]
40 samplesWildCards = sys.argv[2]
43 workingDirectory =
'.'
46 os.mkdir(workingDirectory +
'/GenLevelVariablesPlots')
48 sourceFiles = glob.glob(str(samplesWildCards))
50 tree = ROOT.TChain(
"tree")
51 for Inputfile
in sourceFiles:
52 tree.AddFile(Inputfile)
55 ROOT.TH1.SetDefaultSumw2()
59 HistoBelle2_PtMC = ROOT.TH1F(
'PtMCBelle2',
'MC Transverse Momentum', binsPt, 0, 5)
60 HistoBelle2_PtFit = ROOT.TH1F(
'PtFitBelle2',
'TrackFitResult Transverse Momentum', binsPt, 0, 5)
62 HistoBelle2_pseudoPD0MC = ROOT.TH1F(
'pseudoPD0MCBelle2',
'MC pseudo Momentum for D0', binsPt, 0, 5)
63 HistoBelle2_pseudoPD0Fit = ROOT.TH1F(
'pseudoPD0FitBelle2',
'Fit pseudo Momentum for D0', binsPt, 0, 5)
65 HistoBelle2_pseudoPZ0MC = ROOT.TH1F(
'pseudoPZ0MCBelle2',
'MC pseudo Momentum for Z0', binsPt, 0, 5)
66 HistoBelle2_pseudoPZ0Fit = ROOT.TH1F(
'pseudoPZ0FitBelle2',
'Fit pseudo Momentum for Z0', binsPt, 0, 5)
68 HistoBelle2_d0Error = ROOT.TH1F(
'd0ErrorBelle2',
'TrackFitResult Error on d0', binsPt, 0, 0.03)
69 HistoBelle2_z0Error = ROOT.TH1F(
'z0ErrorBelle2',
'TrackFitResult Error on z0', binsPt, 0, 0.03)
71 D0 =
'abs(TrackFitResults.m_tau[0][0])'
72 Z0 =
'abs(TrackFitResults.m_tau[0][3])'
73 X0 =
'sqrt(TrackFitResults.m_tau[0][0]**2 + TrackFitResults.m_tau[0][3]**2)'
75 mcX =
"MCParticles.m_productionVertex_x"
76 mcY =
"MCParticles.m_productionVertex_y"
77 mcZ =
"MCParticles.m_productionVertex_z"
79 mcD0 =
"sqrt(MCParticles.m_productionVertex_x*MCParticles.m_productionVertex_x + " + \
80 " MCParticles.m_productionVertex_y*MCParticles.m_productionVertex_y)"
81 mcZ0 =
"abs(MCParticles.m_productionVertex_z)"
82 mcX0 =
"sqrt(MCParticles.m_productionVertex_x*MCParticles.m_productionVertex_x + " + \
83 "MCParticles.m_productionVertex_y*MCParticles.m_productionVertex_y + " + \
84 "MCParticles.m_productionVertex_z*MCParticles.m_productionVertex_z)"
86 ptMC =
'sqrt(MCParticles.m_momentum_x**2 + MCParticles.m_momentum_y**2)'
87 ptFit =
'abs(0.003*1.5/TrackFitResults.m_tau[0][2])'
89 pMC =
'sqrt(MCParticles.m_momentum_x**2 + MCParticles.m_momentum_y**2 + + MCParticles.m_momentum_z**2)'
90 pFit =
'(abs(0.003*1.5/TrackFitResults.m_tau[0][2])*sqrt(1+TrackFitResults.m_tau[0][4]**2))'
91 chiProb =
'TrackFitResults.m_pValue'
93 pseudoPD0MC =
'sqrt(' + ptMC +
'**3/(' + pMC +
'*(1+(MCParticles.m_mass[0]/' + pMC +
')**2)))'
94 pseudoPD0Fit =
'sqrt(' + ptFit +
'**3/(' + pFit +
'*(1+(MCParticles.m_mass[0]/' + pFit +
')**2)))'
96 pseudoPZ0MC =
'sqrt(' + ptMC +
'**5/(' + pMC +
'**3*(1+(MCParticles.m_mass[0]/' + pMC +
')**2)))'
97 pseudoPZ0Fit =
'sqrt(' + ptFit +
'**5/(' + pFit +
'**3*(1+(MCParticles.m_mass[0]/' + pFit +
')**2)))'
104 particleConditions = {
105 'Electron': [
'e',
"11 ",
" MCParticles.m_pdg > 0 ",
" MCParticles.m_pdg < 0 "],
106 'Muon': [
r'\mu',
"13 ",
" MCParticles.m_pdg > 0 ",
" MCParticles.m_pdg < 0 "],
107 'Kaon': [
'K',
"321 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "],
108 'Pion': [
r'\pi',
"211 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "],
109 'Proton': [
'p',
"2212 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "]}
112 Particles = [
"Electron",
"Muon",
"Kaon",
"Pion",
"Proton"]
117 def makePlotsForEachParticleKind(cutOnUpsilonFourS=""):
119 Makes plots showing the distribution of the impact parameters and vertices
120 for positively and negatively charged particles.
125 variablesPlotParamsDict = {
'ImpactXY': [D0, dBw, 0, 0.5,
r'$d_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
126 'z0': [Z0, dBw, 0, 1.0,
r'$z_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
127 'distance': [X0, dBw, 0, 1.5,
r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
128 'mcGenX': [mcX, dBw, -0.05, 0.15,
r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
129 r"{\rm " + unitImp +
r"}\, "],
130 'mcGenY': [mcY, dBw, -0.075, 0.075,
r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
131 r"{\rm " + unitImp +
r"}\, "],
132 'mcGenZ': [mcZ, dBw, -0.6, 1,
r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
133 r"{\rm " + unitImp +
r"}\, "],
134 'mcGenImpactXY': [mcD0, dBw, 0, 0.1,
135 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
136 r"{\rm " + unitImp +
r"}\, "],
137 'mcGenz0': [mcZ0, dBw, 0, 1,
r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
138 r"{\rm " + unitImp +
r"}\, "],
139 'mcGendistance': [mcX0, dBw, 0, 1,
140 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
141 r"{\rm " + unitImp +
r"}\, "],
144 if belleOrBelle2 ==
"Belle":
147 variablesPlotParamsDict = {
153 r'$d_0\ [{\rm ' + unitImp +
'}]$',
154 r"{\rm " + unitImp +
r"}\, "],
160 r'$z_0\ [{\rm ' + unitImp +
'}]$',
161 r"{\rm " + unitImp +
r"}\, "],
167 r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
168 r"{\rm " + unitImp +
r"}\, "],
174 r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
175 r"{\rm " + unitImp +
r"}\, "],
181 r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
182 r"{\rm " + unitImp +
r"}\, "],
188 r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
189 r"{\rm " + unitImp +
r"}\, "],
195 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
196 r"{\rm " + unitImp +
r"}\, "],
202 r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
203 r"{\rm " + unitImp +
r"}\, "],
209 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
210 r"{\rm " + unitImp +
r"}\, "],
213 withOrWithoutCut =
""
214 if cutOnUpsilonFourS !=
"":
215 withOrWithoutCut =
"WithUpsilonFourSCut"
217 variablesPlotParamsDict = {
'ImpactXY': [D0, dBw, 0, 1.0,
r'$d_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
218 'z0': [Z0, dBw, 0, 1.0,
r'$z_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
219 'distance': [X0, dBw, 0, 1.5,
r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
220 'mcGenX': [mcX, dBw, 0, 1,
r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
221 r"{\rm " + unitImp +
r"}\, "],
222 'mcGenY': [mcY, dBw, -1, 1,
r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
223 r"{\rm " + unitImp +
r"}\, "],
224 'mcGenZ': [mcZ, dBw, -0.5, 1,
r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
225 r"{\rm " + unitImp +
r"}\, "],
226 'mcGenImpactXY': [mcD0, dBw, 0, 1.0,
227 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
228 r"{\rm " + unitImp +
r"}\, "],
229 'mcGenz0': [mcZ0, dBw, 0, 0.4,
230 r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
231 'mcGendistance': [mcX0, dBw, 0, 1.5,
232 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' +
234 r"{\rm " + unitImp +
r"}\, "],
237 for Particle
in Particles:
239 for inputVariable
in variablesPlotParamsDict:
243 nBins = variablesPlotParamsDict[inputVariable][1]
244 limXmin = variablesPlotParamsDict[inputVariable][2]
245 limXmax = variablesPlotParamsDict[inputVariable][3]
255 condition =
"MCParticles.m_status%2==1 && abs(MCParticles.m_pdg) == " + particleConditions[Particle][1] +
" && "
256 condition = condition + cutOnUpsilonFourS
257 condition = condition +
" abs(MCParticles.m_pdg[MCParticles.m_mother - 1])==511 && "
259 factorMultiplication = str()
261 if belleOrBelle2 !=
"Belle" or (belleOrBelle2 ==
"Belle" and cutOnUpsilonFourS !=
""):
262 factorMultiplication =
"*10 "
264 tree.Draw(variablesPlotParamsDict[inputVariable][0] +
265 factorMultiplication +
269 particleConditions[Particle][2])
271 tree.Draw(variablesPlotParamsDict[inputVariable][0] +
272 factorMultiplication +
276 particleConditions[Particle][3])
278 negativeScalingFactor = negativeHistogram.Integral()
279 positiveScalingFactor = positiveHistogram.Integral()
281 if negativeScalingFactor == 0:
282 negativeScalingFactor = 1
284 if positiveScalingFactor == 0:
285 positiveScalingFactor = 1
287 negativeHistogram.Scale(1 / negativeScalingFactor)
288 positiveHistogram.Scale(1 / positiveScalingFactor)
290 negativeArray = np.zeros((negativeHistogram.GetNbinsX(), 2))
291 positiveArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
293 asymmetryArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
294 asymmetryArrayUncertainties = np.zeros((positiveHistogram.GetNbinsX(), 2))
296 for i
in range(0, negativeHistogram.GetNbinsX()):
297 negativeArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), negativeHistogram.GetBinContent(i + 1)])
298 positiveArray[i] = np.array([positiveHistogram.GetBinCenter(i + 1), positiveHistogram.GetBinContent(i + 1)])
300 numerator = float(positiveArray[i][1] - negativeArray[i][1])
301 denominator = float(positiveArray[i][1] + negativeArray[i][1])
304 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
305 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
307 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), float(numerator / denominator)])
309 uncertainty = 2 * math.sqrt((negativeArray[i][1] * negativeHistogram.GetBinError(i + 1))**2 +
310 (positiveArray[i][1] * positiveHistogram.GetBinError(i + 1))**2) / \
311 (negativeArray[i][1] + positiveArray[i][1])**2
313 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), uncertainty])
315 fig1 = plt.figure(1, figsize=(11, 11))
317 ax1 = plt.axes([0.19, 0.37, 0.76, 0.60])
320 negativeArray[:, 0], weights=negativeArray[:, 1], bins=negativeHistogram.GetNbinsX(),
321 histtype=
'step', edgecolor=
'b', linewidth=4.5, linestyle=
'dashed',
323 label=
r'$' + particleConditions[Particle][0] +
'^{-} $')
325 ax1.hist(positiveArray[:, 0], weights=positiveArray[:, 1], bins=positiveHistogram.GetNbinsX(),
326 histtype=
'step', edgecolor=
'r', linewidth=4, alpha=0.9,
327 label=
r'$' + particleConditions[Particle][0] +
'^{+} $')
329 p1, = ax1.plot([], label=
r'$' + particleConditions[Particle][0] +
'^{-} $', linewidth=5.5, linestyle=
'dashed', c=
'b')
330 p2, = ax1.plot([], label=
r'$' + particleConditions[Particle][0] +
331 '^{+} $', linewidth=5, linestyle=
'solid', alpha=0.9, c=
'r')
333 binWidth = negativeHistogram.GetBinWidth(2)
335 binWidth =
'{:8.3f}'.format(binWidth)
338 ax1.set_ylabel(
r'${\rm Fraction\hspace{0.25em} of\hspace{0.25em} Events}\, /\, (\, ' + binWidth +
r'\, ' +
339 variablesPlotParamsDict[inputVariable][5] +
r')$', fontsize=35)
340 if inputVariable ==
'p' or inputVariable ==
'pt':
343 ax1.yaxis.set_major_formatter(FormatStrFormatter(
r'$%.2f$'))
345 ax1.set_xlim(limXmin, limXmax)
347 locs, labels = plt.xticks()
349 empty_string_labels = [
''] * len(labels)
350 plt.locator_params(axis=
'x', nbins=len(labels))
351 ax1.set_xticklabels(empty_string_labels)
352 ax1.tick_params(axis=
'y', labelsize=37)
354 ax1.legend([p1, p2], [
r'$' +
355 particleConditions[Particle][0] +
357 particleConditions[Particle][0] +
358 '^{+} $'], prop={
'size': 50}, loc=legendLocation, numpoints=1, handlelength=1)
361 ax2 = plt.axes([0.19, 0.15, 0.76, 0.2])
363 ax2.errorbar(asymmetryArray[:, 0], asymmetryArray[:, 1], xerr=float(negativeHistogram.GetBinWidth(2) / 2),
364 yerr=asymmetryArrayUncertainties[:, 1], elinewidth=2, mew=2, ecolor=
'k',
365 fmt=
'o', mfc=
'k', mec=
'k', markersize=6, label=
r'${\rm Data}$')
367 ax2.set_ylabel(
r'$\frac{f^{+}\; -\;\, f^{-}}{f^{+}\; +\;\, f^{-}}$', fontsize=50, labelpad=20)
368 ax2.yaxis.labelpad = 8
370 plt.yticks([-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75],
371 [
r'',
r'$-0.5$',
r'',
r'$0.0$',
r'',
r'$0.5$',
r''], rotation=0, size=25)
372 ax2.set_ylim(-0.75, 0.75)
374 plt.axhline(y=0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
375 plt.axhline(y=0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
376 plt.axhline(y=0, linewidth=2, color=
'tab:gray', linestyle=
'-')
377 plt.axhline(y=-0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
378 plt.axhline(y=-0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
380 xLabel = variablesPlotParamsDict[inputVariable][4]
382 ax2.xaxis.labelpad = 15
383 plt.locator_params(axis=
'x', nbins=len(labels))
384 ax2.tick_params(axis=
'x', labelsize=40)
386 ax2.set_xlim(limXmin, limXmax)
388 if inputVariable ==
'mcGenY' and belleOrBelle2 ==
"Belle2":
389 plt.xticks([-0.06, -0.04, -0.02, 0, 0.02, 0.04, 0.06],
390 [
'',
r'$-0.04$',
'',
r'$0.00$',
'',
r'$0.04$',
''], rotation=0, size=40)
392 ax2.set_xlabel(xLabel, fontsize=50)
393 plt.savefig(workingDirectory +
'/GenLevelVariablesPlots' +
'/' + belleOrBelle2 + withOrWithoutCut +
397 negativeHistogram.Delete()
398 positiveHistogram.Delete()
401 DecZ =
"MCParticles.m_decayVertex_z"
403 if belleOrBelle2 ==
"Belle2":
405 variablesPlotB0tag = {
'DecZ': [DecZ, dBw, -0.6, 1.5,
r"{\rm " + unitImp +
r"}\, "],
410 variablesPlotB0tag = {
'DecZ': [DecZ, dBw, -1.5, 1.5,
r"{\rm " + unitImp +
r"}\, "],
413 particleCondsB0tag = {
417 " MCParticles.m_pdg < 0 ",
418 " MCParticles.m_pdg > 0 ",
419 " !(MCParticles.m_pdg[MCParticles.m_firstDaughter-1] == 310 && MCParticles.m_pdg[MCParticles.m_firstDaughter] == 443) && ",
420 r'$(z_{\rm tag}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
'}]$'],
424 " MCParticles.m_pdg < 0 ",
425 " MCParticles.m_pdg > 0 ",
426 " (MCParticles.m_pdg[MCParticles.m_firstDaughter-1] == 310 && MCParticles.m_pdg[MCParticles.m_firstDaughter] == 443) && ",
427 r'$(z_{\rm sig}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
'}]$']}
430 def makeZtagDecayPlot(cutOnUpsilonFourS="", asymplot=True):
432 Plots the distribution of the decay z-vertex of the tag-side B0 meson.
435 withOrWithoutCut =
""
437 if cutOnUpsilonFourS !=
"":
438 withOrWithoutCut =
"WithUpsilonFourSCut"
440 variablesPlotB0tag[
'DecZ'] = [DecZ, dBw, -0.6, 1.5,
r"{\rm " + unitImp +
r"}\, "]
441 particleCondsB0tag[
'B0tag'][5] =
r'$(z_{\rm tag}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
r'}]$'
443 for Particle
in particleCondsB0tag:
444 inputVariable =
"DecZ"
446 print(
"Plotting " + Particle +
" z-decay Vertex")
448 nBins = variablesPlotB0tag[inputVariable][1]
449 limXmin = variablesPlotB0tag[inputVariable][2]
450 limXmax = variablesPlotB0tag[inputVariable][3]
460 condition =
"abs(MCParticles.m_pdg) == " + particleCondsB0tag[Particle][1] +
" && "
461 condition = condition + cutOnUpsilonFourS
462 condition = condition + particleCondsB0tag[Particle][4]
464 factorMultiplication = str()
466 if belleOrBelle2 !=
"Belle" or (belleOrBelle2 ==
"Belle" and cutOnUpsilonFourS !=
""):
467 factorMultiplication =
"*10 "
469 tree.Draw(variablesPlotB0tag[inputVariable][0] + factorMultiplication +
">> negative" + Particle +
472 tree.Draw(variablesPlotB0tag[inputVariable][0] + factorMultiplication +
">> positive" + Particle +
475 negativeScalingFactor = negativeHistogram.Integral()
476 positiveScalingFactor = positiveHistogram.Integral()
478 if negativeScalingFactor == 0:
479 negativeScalingFactor = 1
481 if positiveScalingFactor == 0:
482 positiveScalingFactor = 1
484 negativeHistogram.Scale(1 / negativeScalingFactor)
485 positiveHistogram.Scale(1 / positiveScalingFactor)
487 negativeArray = np.zeros((negativeHistogram.GetNbinsX(), 2))
488 positiveArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
490 asymmetryArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
491 asymmetryArrayUncertainties = np.zeros((positiveHistogram.GetNbinsX(), 2))
493 for i
in range(0, negativeHistogram.GetNbinsX()):
494 negativeArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), negativeHistogram.GetBinContent(i + 1)])
495 positiveArray[i] = np.array([positiveHistogram.GetBinCenter(i + 1), positiveHistogram.GetBinContent(i + 1)])
497 numerator = float(positiveArray[i][1] - negativeArray[i][1])
498 denominator = float(positiveArray[i][1] + negativeArray[i][1])
501 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
502 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
504 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), float(numerator / denominator)])
506 uncertainty = 2 * math.sqrt((negativeArray[i][1] * negativeHistogram.GetBinError(i + 1))**2 + (
507 positiveArray[i][1] * positiveHistogram.GetBinError(i + 1))**2) / (negativeArray[i][1] + positiveArray[i][1])**2
509 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), uncertainty])
511 fig1 = plt.figure(1, figsize=(11, 11))
513 ax1 = plt.axes([0.19, 0.37, 0.76, 0.60])
516 negativeArray[:, 0], weights=negativeArray[:, 1], bins=negativeHistogram.GetNbinsX(),
517 histtype=
'step', edgecolor=
'b', linewidth=4.5, linestyle=
'dashed',
519 label=
r'$' + particleCondsB0tag[Particle][0] +
'^{-} $')
521 ax1.hist(positiveArray[:, 0], weights=positiveArray[:, 1], bins=positiveHistogram.GetNbinsX(),
522 histtype=
'step', edgecolor=
'r', linewidth=4, alpha=0.9,
523 label=
r'$' + particleCondsB0tag[Particle][0] +
'^{+} $')
525 p1, = ax1.plot([], label=
r'$\bar{B}^0$', linewidth=4.5, linestyle=
'dashed', c=
'b')
526 p2, = ax1.plot([], label=
r'$B^0$', linewidth=4, linestyle=
'solid', alpha=0.9, c=
'r')
528 binWidth = negativeHistogram.GetBinWidth(2)
530 binWidth =
'{:8.3f}'.format(binWidth)
533 ax1.set_ylabel(
r'${\rm Fraction\hspace{0.25em} of\hspace{0.25em} Events}\, /\, (\, ' + binWidth +
r'\, ' +
534 variablesPlotB0tag[inputVariable][4] +
r')$', fontsize=35)
535 if inputVariable ==
'p' or inputVariable ==
'pt':
538 ax1.yaxis.set_major_formatter(FormatStrFormatter(
r'$%.2f$'))
540 ax1.set_xlim(limXmin, limXmax)
542 locs, labels = plt.xticks()
543 ax1.tick_params(axis=
'y', labelsize=37)
545 ax1.legend([p1, p2], [
r'$\bar{B}^0$',
r'$B^0$'], prop={
'size': 50}, loc=legendLocation, numpoints=1, handlelength=1)
547 xLabel = particleCondsB0tag[Particle][5]
550 ax1.xaxis.labelpad = 15
551 plt.locator_params(axis=
'x', nbins=len(labels))
552 ax1.tick_params(axis=
'x', labelsize=40)
553 ax1.set_xlim(limXmin, limXmax)
554 ax1.set_xlabel(xLabel, fontsize=50)
558 empty_string_labels = [
''] * len(labels)
559 plt.locator_params(axis=
'x', nbins=len(labels))
560 ax1.set_xticklabels(empty_string_labels)
562 ax2 = plt.axes([0.19, 0.15, 0.76, 0.2])
564 ax2.errorbar(asymmetryArray[:, 0], asymmetryArray[:, 1], xerr=float(negativeHistogram.GetBinWidth(2) / 2),
565 yerr=asymmetryArrayUncertainties[:, 1], elinewidth=2, mew=2, ecolor=
'k',
566 fmt=
'o', mfc=
'k', mec=
'k', markersize=6, label=
r'${\rm Data}$')
569 r'$\frac{f^{B^0}\; -\;\, f^{\overline{B}^0}}{f^{B^0}\; +\;\, f^{\overline{B}^0}}$',
572 ax2.yaxis.labelpad = 0
574 plt.yticks([-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75],
575 [
r'',
r'$-0.5$',
r'',
r'$0.0$',
r'',
r'$0.5$',
r''], rotation=0, size=25)
576 ax2.set_ylim(-0.75, 0.75)
578 plt.axhline(y=0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
579 plt.axhline(y=0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
580 plt.axhline(y=0, linewidth=2, color=
'tab:gray', linestyle=
'-')
581 plt.axhline(y=-0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
582 plt.axhline(y=-0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
584 ax2.xaxis.labelpad = 15
585 plt.locator_params(axis=
'x', nbins=len(labels))
586 ax2.tick_params(axis=
'x', labelsize=40)
587 ax2.set_xlim(limXmin, limXmax)
588 ax2.set_xlabel(xLabel, fontsize=50)
590 plt.savefig(workingDirectory +
'/GenLevelVariablesPlots' +
'/' +
591 belleOrBelle2 + withOrWithoutCut +
"_" + Particle +
"_" +
595 negativeHistogram.Delete()
596 positiveHistogram.Delete()
599 makePlotsForEachParticleKind(
"")
601 if belleOrBelle2 ==
"Belle":
602 makeZtagDecayPlot(
"")
603 makeZtagDecayPlot(
" abs(MCParticles.m_decayVertex_z[MCParticles.m_mother-1]) < 0.04 && ")
604 makePlotsForEachParticleKind(
" abs(MCParticles.m_decayVertex_z[MCParticles.m_mother[MCParticles.m_mother - 1]-1]) < 0.04 && ")
606 makeZtagDecayPlot(
"")