1 |
#!/usr/bin/env python
|
2 |
from ROOT import *
|
3 |
|
4 |
import os,sys
|
5 |
|
6 |
Lint = 36.
|
7 |
|
8 |
fileList = {}
|
9 |
fileList["Data"] = TFile("merged_Data/36.15pb-1_v5/Data_Sel5_PF_TCHEM.root");
|
10 |
fileList["RevData"] = TFile("merged_Data/36.15pb-1_v5/Data_Sel5_Relisogt0p15lt0p7ORd0gt0p025_PF_TCHEM.root");
|
11 |
fileList["TTbar"] = TFile("skimmed_MC/V00-01-05_v5_PF/TTbar_Sel5_PF_TCHEM.root");
|
12 |
fileList["WJets"] = TFile("skimmed_MC/V00-01-05_v5_PF/WJets_Sel5_PF_TCHEM.root");
|
13 |
fileList["ZJets"] = TFile("skimmed_MC/V00-01-05_v5_PF/ZJets_Sel5_PF_TCHEM.root");
|
14 |
fileList["STtch"] = TFile("skimmed_MC/V00-01-05_v5_PF/STtch_Sel5_PF_TCHEM.root");
|
15 |
fileList["QCD"] = TFile("skimmed_MC/V00-01-05_v5_PF/QCD_Sel5_PF_TCHEM.root");
|
16 |
fileList["RevQCD"] = TFile("skimmed_MC/V00-01-05_v5_PF/QCD_Sel5_Relisogt0p15lt0p7ORd0gt0p025_PF_TCHEM.root");
|
17 |
fileList["RevWJets"] = TFile("skimmed_MC/V00-01-05_v5_PF/WJets_Sel5_Relisogt0p15lt0p7ORd0gt0p025_PF_TCHEM.root");
|
18 |
fileList["RevZJets"] = TFile("skimmed_MC/V00-01-05_v5_PF/ZJets_Sel5_Relisogt0p15lt0p7ORd0gt0p025_PF_TCHEM.root");
|
19 |
|
20 |
weight = {}
|
21 |
weight["Data"] = 1.;
|
22 |
weight["RevData"] = 1.;
|
23 |
weight["TTbar"] = 157.5*Lint
|
24 |
weight["WJets"] = 31314.0*Lint
|
25 |
weight["ZJets"] = 3048.0*Lint
|
26 |
weight["STtch"] = 20.93*Lint
|
27 |
weight["STtWch"]= 10.6*Lint
|
28 |
weight["QCD"] = 84679.3*Lint;
|
29 |
weight["RevQCD"]= weight["QCD"];
|
30 |
weight["RevWJets"]= weight["WJets"];
|
31 |
weight["RevZJets"]= weight["ZJets"];
|
32 |
|
33 |
desDir = "DeltaPhiComparison/Incl1/"
|
34 |
if not os.path.exists(desDir):
|
35 |
print "Creating output directory: " + desDir
|
36 |
os.makedirs(desDir)
|
37 |
|
38 |
gROOT.Reset()
|
39 |
## Plot Style
|
40 |
gROOT.ProcessLine('.L TopStyle/tdrstyle.C')
|
41 |
ROOT.setTDRStyle()
|
42 |
gROOT.ProcessLine('.L TopStyle/CMSTopStyle.cc+')
|
43 |
style = CMSTopStyle()
|
44 |
style.setupICHEPv1()
|
45 |
hs = {}
|
46 |
cvs = {}
|
47 |
|
48 |
gStyle.SetErrorX(0.)
|
49 |
for fname, ifile in fileList.iteritems():
|
50 |
totNevt = ifile.Get("cutFlowTable").GetBinContent(1);
|
51 |
print "Total number of " + fname + " = " + str(totNevt)
|
52 |
if fname.lower().find("data") == -1:
|
53 |
weight[fname] /= totNevt;
|
54 |
|
55 |
print "Processing sample: "+fname + "; weight = "+str(weight[fname])
|
56 |
cvs[fname] = TCanvas(fname,fname,600,600)
|
57 |
hs[fname+"_orig"] = ifile.Get("h_mt_1")
|
58 |
hs[fname+"_b2b"] = ifile.Get("h_mt_b2b_1")
|
59 |
hs[fname+"_subs"] = TH1F(fname+"_subs",fname+"_subs",hs[fname+"_orig"].GetNbinsX(),hs[fname+"_orig"].GetXaxis().GetXmin(),hs[fname+"_orig"].GetXaxis().GetXmax());
|
60 |
hs[fname+"_subs"].Add(hs[fname+"_orig"],1.);
|
61 |
hs[fname+"_subs"].Add(hs[fname+"_b2b"],-1.);
|
62 |
|
63 |
hs[fname+"_orig"].Scale(weight[fname])
|
64 |
hs[fname+"_b2b"].Scale(weight[fname])
|
65 |
hs[fname+"_subs"].Scale(weight[fname])
|
66 |
|
67 |
leg1 = TLegend(0.22, 0.65, 0.45, 0.88)
|
68 |
leg1.SetFillColor(0)
|
69 |
leg1.SetFillStyle(0)
|
70 |
|
71 |
hs[fname+"_orig"].GetXaxis().SetRangeUser(0.,120.)
|
72 |
hs[fname+"_orig"].SetMinimum(0.)
|
73 |
hs[fname+"_orig"].GetXaxis().SetTitleOffset(1.2)
|
74 |
hs[fname+"_orig"].GetXaxis().SetLabelSize(0.035)
|
75 |
hs[fname+"_orig"].GetYaxis().SetTitleOffset(1.8)
|
76 |
hs[fname+"_orig"].GetYaxis().SetLabelSize(0.035)
|
77 |
hs[fname+"_orig"].GetYaxis().SetTitle("Number of Events")
|
78 |
hs[fname+"_orig"].SetLineColor(2)
|
79 |
hs[fname+"_orig"].SetMarkerColor(2)
|
80 |
hs[fname+"_orig"].SetMarkerStyle(24)
|
81 |
hs[fname+"_orig"].SetMarkerSize(1.2)
|
82 |
hs[fname+"_orig"].Draw("e")
|
83 |
leg1.AddEntry(hs[fname+"_orig"],"All")
|
84 |
|
85 |
hs[fname+"_b2b"].SetLineColor(3)
|
86 |
hs[fname+"_b2b"].SetMarkerColor(3)
|
87 |
hs[fname+"_b2b"].SetMarkerStyle(22)
|
88 |
hs[fname+"_b2b"].SetMarkerSize(1.)
|
89 |
hs[fname+"_b2b"].Draw("samese")
|
90 |
leg1.AddEntry(hs[fname+"_b2b"],"#Delta#varphi(#mu,#slash{E}_{T}) > 2.0")
|
91 |
|
92 |
hs[fname+"_subs"].SetLineColor(4)
|
93 |
hs[fname+"_subs"].SetMarkerColor(4)
|
94 |
hs[fname+"_subs"].SetMarkerStyle(20)
|
95 |
hs[fname+"_subs"].SetMarkerSize(1.)
|
96 |
hs[fname+"_subs"].Draw("samese")
|
97 |
leg1.AddEntry(hs[fname+"_subs"],"#Delta#varphi(#mu,#slash{E}_{T}) #leq 2.0")
|
98 |
leg1.Draw()
|
99 |
cvs[fname].Print(desDir.rstrip("/")+"/"+fname+".png")
|
100 |
cvs[fname].Print(desDir.rstrip("/")+"/"+fname+".pdf")
|
101 |
|
102 |
var = raw_input("Enter anything to quit: ")
|
103 |
print "Done!", var
|