29 from matplotlib.ticker
import FormatStrFormatter
30 import matplotlib.pyplot
as plt
32 from ROOT
import Belle2
35 import matplotlib
as mpl
37 mpl.rcParams.update({
'font.size': 22})
38 mpl.rcParams[
'text.usetex'] =
True
39 mpl.rcParams[
'text.latex.preamble'] = [
r"\usepackage{amsmath}"]
41 if len(sys.argv) != 3:
42 sys.exit(
"Must provide 2 arguments: [Belle or Belle2] [samplesWildCards]"
45 belleOrBelle2 = sys.argv[1]
46 samplesWildCards = sys.argv[2]
49 workingDirectory =
'.'
51 if not b2.find_file(
'GenLevelVariablesPlots', silent=
True):
52 os.mkdir(workingDirectory +
'/GenLevelVariablesPlots')
54 sourceFiles = glob.glob(str(samplesWildCards))
56 tree = ROOT.TChain(
"tree")
57 for Inputfile
in sourceFiles:
58 tree.AddFile(Inputfile)
61 ROOT.TH1.SetDefaultSumw2()
65 HistoBelle2_PtMC = ROOT.TH1F(
'PtMCBelle2',
'MC Transverse Momentum', binsPt, 0, 5)
66 HistoBelle2_PtFit = ROOT.TH1F(
'PtFitBelle2',
'TrackFitResult Transverse Momentum', binsPt, 0, 5)
68 HistoBelle2_pseudoPD0MC = ROOT.TH1F(
'pseudoPD0MCBelle2',
'MC pseudo Momentum for D0', binsPt, 0, 5)
69 HistoBelle2_pseudoPD0Fit = ROOT.TH1F(
'pseudoPD0FitBelle2',
'Fit pseudo Momentum for D0', binsPt, 0, 5)
71 HistoBelle2_pseudoPZ0MC = ROOT.TH1F(
'pseudoPZ0MCBelle2',
'MC pseudo Momentum for Z0', binsPt, 0, 5)
72 HistoBelle2_pseudoPZ0Fit = ROOT.TH1F(
'pseudoPZ0FitBelle2',
'Fit pseudo Momentum for Z0', binsPt, 0, 5)
74 HistoBelle2_d0Error = ROOT.TH1F(
'd0ErrorBelle2',
'TrackFitResult Error on d0', binsPt, 0, 0.03)
75 HistoBelle2_z0Error = ROOT.TH1F(
'z0ErrorBelle2',
'TrackFitResult Error on z0', binsPt, 0, 0.03)
77 D0 =
'abs(TrackFitResults.m_tau[0][0])'
78 Z0 =
'abs(TrackFitResults.m_tau[0][3])'
79 X0 =
'sqrt(TrackFitResults.m_tau[0][0]**2 + TrackFitResults.m_tau[0][3]**2)'
81 mcX =
"MCParticles.m_productionVertex_x"
82 mcY =
"MCParticles.m_productionVertex_y"
83 mcZ =
"MCParticles.m_productionVertex_z"
85 mcD0 =
"sqrt(MCParticles.m_productionVertex_x*MCParticles.m_productionVertex_x + " + \
86 " MCParticles.m_productionVertex_y*MCParticles.m_productionVertex_y)"
87 mcZ0 =
"abs(MCParticles.m_productionVertex_z)"
88 mcX0 =
"sqrt(MCParticles.m_productionVertex_x*MCParticles.m_productionVertex_x + " + \
89 "MCParticles.m_productionVertex_y*MCParticles.m_productionVertex_y + " + \
90 "MCParticles.m_productionVertex_z*MCParticles.m_productionVertex_z)"
92 ptMC =
'sqrt(MCParticles.m_momentum_x**2 + MCParticles.m_momentum_y**2)'
93 ptFit =
'abs(0.003*1.5/TrackFitResults.m_tau[0][2])'
95 pMC =
'sqrt(MCParticles.m_momentum_x**2 + MCParticles.m_momentum_y**2 + + MCParticles.m_momentum_z**2)'
96 pFit =
'(abs(0.003*1.5/TrackFitResults.m_tau[0][2])*sqrt(1+TrackFitResults.m_tau[0][4]**2))'
97 chiProb =
'TrackFitResults.m_pValue'
99 pseudoPD0MC =
'sqrt(' + ptMC +
'**3/(' + pMC +
'*(1+(MCParticles.m_mass[0]/' + pMC +
')**2)))'
100 pseudoPD0Fit =
'sqrt(' + ptFit +
'**3/(' + pFit +
'*(1+(MCParticles.m_mass[0]/' + pFit +
')**2)))'
102 pseudoPZ0MC =
'sqrt(' + ptMC +
'**5/(' + pMC +
'**3*(1+(MCParticles.m_mass[0]/' + pMC +
')**2)))'
103 pseudoPZ0Fit =
'sqrt(' + ptFit +
'**5/(' + pFit +
'**3*(1+(MCParticles.m_mass[0]/' + pFit +
')**2)))'
110 particleConditions = {
111 'Electron': [
'e',
"11 ",
" MCParticles.m_pdg > 0 ",
" MCParticles.m_pdg < 0 "],
112 'Muon': [
r'\mu',
"13 ",
" MCParticles.m_pdg > 0 ",
" MCParticles.m_pdg < 0 "],
113 'Kaon': [
'K',
"321 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "],
114 'Pion': [
r'\pi',
"211 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "],
115 'Proton': [
'p',
"2212 ",
" MCParticles.m_pdg < 0 ",
" MCParticles.m_pdg > 0 "]}
118 Particles = [
"Electron",
"Muon",
"Kaon",
"Pion",
"Proton"]
123 def makePlotsForEachParticleKind(cutOnUpsilonFourS=""):
125 Makes plots showing the distribution of the impact parameters and vertices
126 for positively and negatively charged particles.
131 variablesPlotParamsDict = {
'ImpactXY': [D0, dBw, 0, 0.5,
r'$d_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
132 'z0': [Z0, dBw, 0, 1.0,
r'$z_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
133 'distance': [X0, dBw, 0, 1.5,
r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
134 'mcGenX': [mcX, dBw, -0.05, 0.15,
r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
135 r"{\rm " + unitImp +
r"}\, "],
136 'mcGenY': [mcY, dBw, -0.075, 0.075,
r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
137 r"{\rm " + unitImp +
r"}\, "],
138 'mcGenZ': [mcZ, dBw, -0.6, 1,
r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
139 r"{\rm " + unitImp +
r"}\, "],
140 'mcGenImpactXY': [mcD0, dBw, 0, 0.1,
141 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
142 r"{\rm " + unitImp +
r"}\, "],
143 'mcGenz0': [mcZ0, dBw, 0, 1,
r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
144 r"{\rm " + unitImp +
r"}\, "],
145 'mcGendistance': [mcX0, dBw, 0, 1,
146 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
147 r"{\rm " + unitImp +
r"}\, "],
150 if belleOrBelle2 ==
"Belle":
153 variablesPlotParamsDict = {
159 r'$d_0\ [{\rm ' + unitImp +
'}]$',
160 r"{\rm " + unitImp +
r"}\, "],
166 r'$z_0\ [{\rm ' + unitImp +
'}]$',
167 r"{\rm " + unitImp +
r"}\, "],
173 r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
174 r"{\rm " + unitImp +
r"}\, "],
180 r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
181 r"{\rm " + unitImp +
r"}\, "],
187 r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
188 r"{\rm " + unitImp +
r"}\, "],
194 r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
195 r"{\rm " + unitImp +
r"}\, "],
201 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
202 r"{\rm " + unitImp +
r"}\, "],
208 r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
209 r"{\rm " + unitImp +
r"}\, "],
215 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
216 r"{\rm " + unitImp +
r"}\, "],
219 withOrWithoutCut =
""
220 if cutOnUpsilonFourS !=
"":
221 withOrWithoutCut =
"WithUpsilonFourSCut"
223 variablesPlotParamsDict = {
'ImpactXY': [D0, dBw, 0, 1.0,
r'$d_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
224 'z0': [Z0, dBw, 0, 1.0,
r'$z_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
225 'distance': [X0, dBw, 0, 1.5,
r'$\xi_0\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
226 'mcGenX': [mcX, dBw, 0, 1,
r'$x_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
227 r"{\rm " + unitImp +
r"}\, "],
228 'mcGenY': [mcY, dBw, -1, 1,
r'$y_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
229 r"{\rm " + unitImp +
r"}\, "],
230 'mcGenZ': [mcZ, dBw, -0.5, 1,
r'$z_{\rm MC}\ [{\rm ' + unitImp +
'}]$',
231 r"{\rm " + unitImp +
r"}\, "],
232 'mcGenImpactXY': [mcD0, dBw, 0, 1.0,
233 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2}\ [{\rm ' + unitImp +
'}]$',
234 r"{\rm " + unitImp +
r"}\, "],
235 'mcGenz0': [mcZ0, dBw, 0, 0.4,
236 r'$|z_{\rm MC}|\ [{\rm ' + unitImp +
'}]$',
r"{\rm " + unitImp +
r"}\, "],
237 'mcGendistance': [mcX0, dBw, 0, 1.5,
238 r'$\sqrt{x_{\rm MC}^2 + y_{\rm MC}^2 + z_{\rm MC}^2}\ [{\rm ' +
240 r"{\rm " + unitImp +
r"}\, "],
243 for Particle
in Particles:
245 for inputVariable
in variablesPlotParamsDict:
249 nBins = variablesPlotParamsDict[inputVariable][1]
250 limXmin = variablesPlotParamsDict[inputVariable][2]
251 limXmax = variablesPlotParamsDict[inputVariable][3]
261 condition =
"MCParticles.m_status%2==1 && abs(MCParticles.m_pdg) == " + particleConditions[Particle][1] +
" && "
262 condition = condition + cutOnUpsilonFourS
263 condition = condition +
" abs(MCParticles.m_pdg[MCParticles.m_mother - 1])==511 && "
265 factorMultiplication = str()
267 if belleOrBelle2 !=
"Belle" or (belleOrBelle2 ==
"Belle" and cutOnUpsilonFourS !=
""):
268 factorMultiplication =
"*10 "
270 tree.Draw(variablesPlotParamsDict[inputVariable][0] +
271 factorMultiplication +
275 particleConditions[Particle][2])
277 tree.Draw(variablesPlotParamsDict[inputVariable][0] +
278 factorMultiplication +
282 particleConditions[Particle][3])
284 negativeScalingFactor = negativeHistogram.Integral()
285 positiveScalingFactor = positiveHistogram.Integral()
287 if negativeScalingFactor == 0:
288 negativeScalingFactor = 1
290 if positiveScalingFactor == 0:
291 positiveScalingFactor = 1
293 negativeHistogram.Scale(1 / negativeScalingFactor)
294 positiveHistogram.Scale(1 / positiveScalingFactor)
296 negativeArray = np.zeros((negativeHistogram.GetNbinsX(), 2))
297 positiveArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
299 asymmetryArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
300 asymmetryArrayUncertainties = np.zeros((positiveHistogram.GetNbinsX(), 2))
302 for i
in range(0, negativeHistogram.GetNbinsX()):
303 negativeArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), negativeHistogram.GetBinContent(i + 1)])
304 positiveArray[i] = np.array([positiveHistogram.GetBinCenter(i + 1), positiveHistogram.GetBinContent(i + 1)])
306 numerator = float(positiveArray[i][1] - negativeArray[i][1])
307 denominator = float(positiveArray[i][1] + negativeArray[i][1])
310 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
311 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
313 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), float(numerator / denominator)])
315 uncertainty = 2 * math.sqrt((negativeArray[i][1] * negativeHistogram.GetBinError(i + 1))**2 +
316 (positiveArray[i][1] * positiveHistogram.GetBinError(i + 1))**2) / \
317 (negativeArray[i][1] + positiveArray[i][1])**2
319 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), uncertainty])
321 fig1 = plt.figure(1, figsize=(11, 11))
323 ax1 = plt.axes([0.19, 0.37, 0.76, 0.60])
326 negativeArray[:, 0], weights=negativeArray[:, 1], bins=negativeHistogram.GetNbinsX(),
327 histtype=
'step', edgecolor=
'b', linewidth=4.5, linestyle=
'dashed',
329 label=
r'$' + particleConditions[Particle][0] +
'^{-} $')
331 ax1.hist(positiveArray[:, 0], weights=positiveArray[:, 1], bins=positiveHistogram.GetNbinsX(),
332 histtype=
'step', edgecolor=
'r', linewidth=4, alpha=0.9,
333 label=
r'$' + particleConditions[Particle][0] +
'^{+} $')
335 p1, = ax1.plot([], label=
r'$' + particleConditions[Particle][0] +
'^{-} $', linewidth=5.5, linestyle=
'dashed', c=
'b')
336 p2, = ax1.plot([], label=
r'$' + particleConditions[Particle][0] +
337 '^{+} $', linewidth=5, linestyle=
'solid', alpha=0.9, c=
'r')
339 binWidth = negativeHistogram.GetBinWidth(2)
341 binWidth =
'{:8.3f}'.format(binWidth)
344 ax1.set_ylabel(
r'${\rm Fraction\hspace{0.25em} of\hspace{0.25em} Events}\, /\, (\, ' + binWidth +
r'\, ' +
345 variablesPlotParamsDict[inputVariable][5] +
r')$', fontsize=35)
346 if inputVariable ==
'p' or inputVariable ==
'pt':
349 ax1.yaxis.set_major_formatter(FormatStrFormatter(
r'$%.2f$'))
351 ax1.set_xlim(limXmin, limXmax)
353 locs, labels = plt.xticks()
355 empty_string_labels = [
''] * len(labels)
356 plt.locator_params(axis=
'x', nbins=len(labels))
357 ax1.set_xticklabels(empty_string_labels)
358 ax1.tick_params(axis=
'y', labelsize=37)
360 ax1.legend([p1, p2], [
r'$' +
361 particleConditions[Particle][0] +
363 particleConditions[Particle][0] +
364 '^{+} $'], prop={
'size': 50}, loc=legendLocation, numpoints=1, handlelength=1)
367 ax2 = plt.axes([0.19, 0.15, 0.76, 0.2])
369 ax2.errorbar(asymmetryArray[:, 0], asymmetryArray[:, 1], xerr=float(negativeHistogram.GetBinWidth(2) / 2),
370 yerr=asymmetryArrayUncertainties[:, 1], elinewidth=2, mew=2, ecolor=
'k',
371 fmt=
'o', mfc=
'k', mec=
'k', markersize=6, label=
r'${\rm Data}$')
373 ax2.set_ylabel(
r'$\frac{f^{+}\; -\;\, f^{-}}{f^{+}\; +\;\, f^{-}}$', fontsize=50, labelpad=20)
374 ax2.yaxis.labelpad = 8
376 plt.yticks([-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75],
377 [
r'',
r'$-0.5$',
r'',
r'$0.0$',
r'',
r'$0.5$',
r''], rotation=0, size=25)
378 ax2.set_ylim(-0.75, 0.75)
380 plt.axhline(y=0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
381 plt.axhline(y=0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
382 plt.axhline(y=0, linewidth=2, color=
'tab:gray', linestyle=
'-')
383 plt.axhline(y=-0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
384 plt.axhline(y=-0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
386 xLabel = variablesPlotParamsDict[inputVariable][4]
388 ax2.xaxis.labelpad = 15
389 plt.locator_params(axis=
'x', nbins=len(labels))
390 ax2.tick_params(axis=
'x', labelsize=40)
392 ax2.set_xlim(limXmin, limXmax)
394 if inputVariable ==
'mcGenY' and belleOrBelle2 ==
"Belle2":
395 plt.xticks([-0.06, -0.04, -0.02, 0, 0.02, 0.04, 0.06],
396 [
'',
r'$-0.04$',
'',
r'$0.00$',
'',
r'$0.04$',
''], rotation=0, size=40)
398 ax2.set_xlabel(xLabel, fontsize=50)
399 plt.savefig(workingDirectory +
'/GenLevelVariablesPlots' +
'/' + belleOrBelle2 + withOrWithoutCut +
403 negativeHistogram.Delete()
404 positiveHistogram.Delete()
407 DecZ =
"MCParticles.m_decayVertex_z"
409 if belleOrBelle2 ==
"Belle2":
411 variablesPlotB0tag = {
'DecZ': [DecZ, dBw, -0.6, 1.5,
r"{\rm " + unitImp +
r"}\, "],
416 variablesPlotB0tag = {
'DecZ': [DecZ, dBw, -1.5, 1.5,
r"{\rm " + unitImp +
r"}\, "],
419 particleCondsB0tag = {
423 " MCParticles.m_pdg < 0 ",
424 " MCParticles.m_pdg > 0 ",
425 " !(MCParticles.m_pdg[MCParticles.m_firstDaughter-1] == 310 && MCParticles.m_pdg[MCParticles.m_firstDaughter] == 443) && ",
426 r'$(z_{\rm tag}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
'}]$'],
430 " MCParticles.m_pdg < 0 ",
431 " MCParticles.m_pdg > 0 ",
432 " (MCParticles.m_pdg[MCParticles.m_firstDaughter-1] == 310 && MCParticles.m_pdg[MCParticles.m_firstDaughter] == 443) && ",
433 r'$(z_{\rm sig}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
'}]$']}
436 def makeZtagDecayPlot(cutOnUpsilonFourS="", asymplot=True):
438 Plots the distribution of the decay z-vertex of the tag-side B0 meson.
441 withOrWithoutCut =
""
443 if cutOnUpsilonFourS !=
"":
444 withOrWithoutCut =
"WithUpsilonFourSCut"
446 variablesPlotB0tag[
'DecZ'] = [DecZ, dBw, -0.6, 1.5,
r"{\rm " + unitImp +
r"}\, "]
447 particleCondsB0tag[
'B0tag'][5] =
r'$(z_{\rm tag}^{\rm dec})^{\rm gen}\ [{\rm ' + unitImp +
r'}]$'
449 for Particle
in particleCondsB0tag:
450 inputVariable =
"DecZ"
452 print(
"Plotting " + Particle +
" z-decay Vertex")
454 nBins = variablesPlotB0tag[inputVariable][1]
455 limXmin = variablesPlotB0tag[inputVariable][2]
456 limXmax = variablesPlotB0tag[inputVariable][3]
466 condition =
"abs(MCParticles.m_pdg) == " + particleCondsB0tag[Particle][1] +
" && "
467 condition = condition + cutOnUpsilonFourS
468 condition = condition + particleCondsB0tag[Particle][4]
470 factorMultiplication = str()
472 if belleOrBelle2 !=
"Belle" or (belleOrBelle2 ==
"Belle" and cutOnUpsilonFourS !=
""):
473 factorMultiplication =
"*10 "
475 tree.Draw(variablesPlotB0tag[inputVariable][0] + factorMultiplication +
">> negative" + Particle +
478 tree.Draw(variablesPlotB0tag[inputVariable][0] + factorMultiplication +
">> positive" + Particle +
481 negativeScalingFactor = negativeHistogram.Integral()
482 positiveScalingFactor = positiveHistogram.Integral()
484 if negativeScalingFactor == 0:
485 negativeScalingFactor = 1
487 if positiveScalingFactor == 0:
488 positiveScalingFactor = 1
490 negativeHistogram.Scale(1 / negativeScalingFactor)
491 positiveHistogram.Scale(1 / positiveScalingFactor)
493 negativeArray = np.zeros((negativeHistogram.GetNbinsX(), 2))
494 positiveArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
496 asymmetryArray = np.zeros((positiveHistogram.GetNbinsX(), 2))
497 asymmetryArrayUncertainties = np.zeros((positiveHistogram.GetNbinsX(), 2))
499 for i
in range(0, negativeHistogram.GetNbinsX()):
500 negativeArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), negativeHistogram.GetBinContent(i + 1)])
501 positiveArray[i] = np.array([positiveHistogram.GetBinCenter(i + 1), positiveHistogram.GetBinContent(i + 1)])
503 numerator = float(positiveArray[i][1] - negativeArray[i][1])
504 denominator = float(positiveArray[i][1] + negativeArray[i][1])
507 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
508 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), 0])
510 asymmetryArray[i] = np.array([negativeHistogram.GetBinCenter(i + 1), float(numerator / denominator)])
512 uncertainty = 2 * math.sqrt((negativeArray[i][1] * negativeHistogram.GetBinError(i + 1))**2 + (
513 positiveArray[i][1] * positiveHistogram.GetBinError(i + 1))**2) / (negativeArray[i][1] + positiveArray[i][1])**2
515 asymmetryArrayUncertainties[i] = np.array([negativeHistogram.GetBinCenter(i + 1), uncertainty])
517 fig1 = plt.figure(1, figsize=(11, 11))
519 ax1 = plt.axes([0.19, 0.37, 0.76, 0.60])
522 negativeArray[:, 0], weights=negativeArray[:, 1], bins=negativeHistogram.GetNbinsX(),
523 histtype=
'step', edgecolor=
'b', linewidth=4.5, linestyle=
'dashed',
525 label=
r'$' + particleCondsB0tag[Particle][0] +
'^{-} $')
527 ax1.hist(positiveArray[:, 0], weights=positiveArray[:, 1], bins=positiveHistogram.GetNbinsX(),
528 histtype=
'step', edgecolor=
'r', linewidth=4, alpha=0.9,
529 label=
r'$' + particleCondsB0tag[Particle][0] +
'^{+} $')
531 p1, = ax1.plot([], label=
r'$\bar{B}^0$', linewidth=4.5, linestyle=
'dashed', c=
'b')
532 p2, = ax1.plot([], label=
r'$B^0$', linewidth=4, linestyle=
'solid', alpha=0.9, c=
'r')
534 binWidth = negativeHistogram.GetBinWidth(2)
536 binWidth =
'{:8.3f}'.format(binWidth)
539 ax1.set_ylabel(
r'${\rm Fraction\hspace{0.25em} of\hspace{0.25em} Events}\, /\, (\, ' + binWidth +
r'\, ' +
540 variablesPlotB0tag[inputVariable][4] +
r')$', fontsize=35)
541 if inputVariable ==
'p' or inputVariable ==
'pt':
544 ax1.yaxis.set_major_formatter(FormatStrFormatter(
r'$%.2f$'))
546 ax1.set_xlim(limXmin, limXmax)
548 locs, labels = plt.xticks()
549 ax1.tick_params(axis=
'y', labelsize=37)
551 ax1.legend([p1, p2], [
r'$\bar{B}^0$',
r'$B^0$'], prop={
'size': 50}, loc=legendLocation, numpoints=1, handlelength=1)
553 xLabel = particleCondsB0tag[Particle][5]
556 ax1.xaxis.labelpad = 15
557 plt.locator_params(axis=
'x', nbins=len(labels))
558 ax1.tick_params(axis=
'x', labelsize=40)
559 ax1.set_xlim(limXmin, limXmax)
560 ax1.set_xlabel(xLabel, fontsize=50)
564 empty_string_labels = [
''] * len(labels)
565 plt.locator_params(axis=
'x', nbins=len(labels))
566 ax1.set_xticklabels(empty_string_labels)
568 ax2 = plt.axes([0.19, 0.15, 0.76, 0.2])
570 ax2.errorbar(asymmetryArray[:, 0], asymmetryArray[:, 1], xerr=float(negativeHistogram.GetBinWidth(2) / 2),
571 yerr=asymmetryArrayUncertainties[:, 1], elinewidth=2, mew=2, ecolor=
'k',
572 fmt=
'o', mfc=
'k', mec=
'k', markersize=6, label=
r'${\rm Data}$')
575 r'$\frac{f^{B^0}\; -\;\, f^{\overline{B}^0}}{f^{B^0}\; +\;\, f^{\overline{B}^0}}$',
578 ax2.yaxis.labelpad = 0
580 plt.yticks([-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75],
581 [
r'',
r'$-0.5$',
r'',
r'$0.0$',
r'',
r'$0.5$',
r''], rotation=0, size=25)
582 ax2.set_ylim(-0.75, 0.75)
584 plt.axhline(y=0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
585 plt.axhline(y=0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
586 plt.axhline(y=0, linewidth=2, color=
'tab:gray', linestyle=
'-')
587 plt.axhline(y=-0.25, linewidth=2, color=
'tab:gray', linestyle=
'-')
588 plt.axhline(y=-0.5, linewidth=2, color=
'tab:gray', linestyle=
'-')
590 ax2.xaxis.labelpad = 15
591 plt.locator_params(axis=
'x', nbins=len(labels))
592 ax2.tick_params(axis=
'x', labelsize=40)
593 ax2.set_xlim(limXmin, limXmax)
594 ax2.set_xlabel(xLabel, fontsize=50)
596 plt.savefig(workingDirectory +
'/GenLevelVariablesPlots' +
'/' +
597 belleOrBelle2 + withOrWithoutCut +
"_" + Particle +
"_" +
601 negativeHistogram.Delete()
602 positiveHistogram.Delete()
605 makePlotsForEachParticleKind(
"")
607 if belleOrBelle2 ==
"Belle":
608 makeZtagDecayPlot(
"")
609 makeZtagDecayPlot(
" abs(MCParticles.m_decayVertex_z[MCParticles.m_mother-1]) < 0.04 && ")
610 makePlotsForEachParticleKind(
" abs(MCParticles.m_decayVertex_z[MCParticles.m_mother[MCParticles.m_mother - 1]-1]) < 0.04 && ")
612 makeZtagDecayPlot(
"")
std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.