13 <input>MCvalidationMixed.root</input>
14 <output>SplitMultiplicityPlotsMixed.root</output>
15 <contact>Swagato Banerjee; swagato.banerjee@gmail.com</contact>
16 <description>Comparing generated kaon multiplicities, optionally split by charge
and originating B meson flavor</description>
24def get_argument_parser():
26 Parses the command line options and returns the corresponding arguments.
29 parser = argparse.ArgumentParser(
30 description=__doc__.split("--examples--")[0],
32 formatter_class=argparse.RawDescriptionHelpFormatter,
36 parser.add_argument(
'--input', type=str, default=
'MCvalidationMixed.root', help=
'The name of the input root file')
37 parser.add_argument(
'--output', type=str, default=
'SplitMultiplicityPlotsMixed.root', help=
'The name of the output root file')
42def PlottingHistos(particle, pos, neg):
43 ''' Plotting function'''
45 nbins = int(2*range_dic[particle])
47 hist = rdf_fix.Histo1D((particle, particle, nbins, -range_dic[particle], range_dic[particle]), pos)
48 hist_neg = rdf_fix.Histo1D((f
"{particle}_neg", f
"{particle}_neg", nbins, -range_dic[particle], range_dic[particle]), neg)
49 hist.Add(hist_neg.GetPtr())
50 hist.SetTitle(f
";{axis_dic[particle]}; Events")
51 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Description', f
'{axis_dic[particle]} multiplicity'))
52 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Check',
'Shape should not change drastically.'))
53 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Contact',
'swagato.banerjee@gmail.com'))
54 hist.GetListOfFunctions().Add(ROOT.TNamed(
'MetaOptions',
'nostats'))
59if __name__ ==
'__main__':
61 parser = get_argument_parser()
62 args = parser.parse_args()
65 rdf = ROOT.RDataFrame(
"Split", args.input)
66 rdf_fix = rdf.Define(
"gen_Kn",
"-gen_Km").Define(
"gen_K0bar",
"-gen_antiK0")
68 axis_dic = {
'Kpm':
'K^{+} / K^{#minus} from both B',
69 'K0':
'K^{0} / #bar{K}^{0} from both B'
72 range_dic = {
'Kpm': 4.5,
80 outputFile = ROOT.TFile(args.output,
"RECREATE")
81 ROOT.gROOT.SetBatch(
True)
83 PlottingHistos(
"Kpm",
"gen_Kp",
"gen_Kn")
84 PlottingHistos(
"K0",
"gen_K0",
"gen_K0bar")
85 axis_dic[
'Kpm_same'] =
'K^{+} from B^{0} / K^{#minus} from #bar{B}^{0}'
86 axis_dic[
'Kpm_diff'] =
'K^{+} from #bar{B}^{0} / K^{#minus} from B^{0}'
87 axis_dic[
'K0_same'] =
'K^{0} from B^{0} / #bar{K}^{0} from #bar{B}^{0}'
88 axis_dic[
'K0_diff'] =
'K^{0} from #bar{B}^{0} / #bar{K}^{0} from B^{0}'
89 rdf_fix = rdf.Define(
"gen_Kp_B0bar",
"-gen_Kp_antiB0")\
90 .Define(
"gen_Km_B0bar",
"-gen_Km_antiB0")\
91 .Define(
"gen_K0_B0bar",
"-gen_K0_antiB0")\
92 .Define(
"gen_antiK0_B0bar",
"-gen_antiK0_antiB0")
93 PlottingHistos(
"Kpm_same",
"gen_Kp_B0",
"gen_Km_B0bar")
94 PlottingHistos(
"Kpm_diff",
"gen_Kp_B0bar",
"gen_Km_B0")
95 PlottingHistos(
"K0_same",
"gen_K0_B0",
"gen_antiK0_B0bar")
96 PlottingHistos(
"K0_diff",
"gen_K0_B0bar",
"gen_antiK0_B0")