13 <input>MCvalidationCharged.root</input>
14 <output>MultiplicityPlotsCharged.root</output>
15 <contact>Swagato Banerjee; swagato.banerjee@gmail.com</contact>
16 <description>Comparing generated particle multiplicities</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=
'MCvalidationCharged.root', help=
'The name of the input root file')
37 parser.add_argument(
'--output', type=str, default=
'MultiplicityPlotsCharged.root', help=
'The name of the output root file')
42def PlottingHistos(particle):
43 ''' Plotting function'''
45 nbins = int(range_dic[particle][1] - (range_dic[particle][0]))
47 hist = rdf.Histo1D((var, var, nbins, range_dic[particle][0], range_dic[particle][1]), var)
48 hist.SetTitle(f
";{axis_dic[particle]}; Events")
49 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Description', f
'{axis_dic[particle]} multiplicity'))
50 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Check',
'Shape should not change drastically.'))
51 hist.GetListOfFunctions().Add(ROOT.TNamed(
'Contact',
'swagato.banerjee@gmail.com'))
52 hist.GetListOfFunctions().Add(ROOT.TNamed(
'MetaOptions',
'nostats'))
56if __name__ ==
'__main__':
58 parser = get_argument_parser()
59 args = parser.parse_args()
62 rdf = ROOT.RDataFrame(
"Multiplicities", args.input)
65 colnames = rdf.GetColumnNames()
66 all_list = [str(x)
for x
in colnames
if x[0] ==
"n"]
67 all_list.remove(
"nB0")
68 all_list.remove(
"nBp")
71 range_dic = {
'nPIp': [-0.5, 25.5],
74 'nETAprim': [-0.5, 2.5],
81 'nKstar0': [-0.5, 4.5],
82 'nKstarp': [-0.5, 4.5],
86 'nELECTRON': [-0.5, 6.5],
87 'nENEUTRINO': [-0.5, 4.5],
89 'nMNEUTRINO': [-0.5, 4.5],
90 'nTAUON': [-0.5, 2.5],
91 'nTNEUTRINO': [-0.5, 4.5],
92 'nPHOTON': [-0.5, 35.5]
95 axis_dic = {
'nPIp':
'#pi^{+}',
105 'nKstar0':
'K^{*,0}',
106 'nKstarp':
'K^{*,+}',
110 'nELECTRON':
'e^{#minus}',
111 'nENEUTRINO':
'#nu_{e}^{#minus}',
112 'nMUON':
'#mu^{#minus}',
113 'nMNEUTRINO':
'#nu_{#mu}^{#minus}',
114 'nTAUON':
'#tau^{#minus}',
115 'nTNEUTRINO':
'#nu_{#tau}^{#minus}',
118 outputFile = ROOT.TFile(args.output,
"RECREATE")
119 ROOT.gROOT.SetBatch(
True)