-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_toy.py
More file actions
32 lines (18 loc) · 706 Bytes
/
plot_toy.py
File metadata and controls
32 lines (18 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--toysfile',dest='toysfile',default="higgsCombineTest.GoodnessOfFit.mH120.123456.root")
parser.add_argument('--toy',dest='toy',default=1)
parser.add_argument('--channel',dest='channel',default=1)
parser.add_argument('--outfile',dest='outfile',default="toy.png")
args = parser.parse_args()
f=ROOT.TFile.Open(args.toysfile)
d=f.GetDirectory("toys")
toy=d.Get("toy_"+str(args.toy))
cmsth1x=toy.get(1)[0]
frame=cmsth1x.frame()
toy.plotOn(frame,ROOT.RooFit.Cut("CMS_channel == CMS_channel::ch"+str(args.channel)))
c=ROOT.TCanvas()
frame.Draw()
c.SaveAs(args.outfile)