1 |
import ROOT
|
2 |
import sys, re, math
|
3 |
sys.path.append("/afs/naf.desy.de/user/n/nowaf/UserCode/nowaf/PythonScripts/")
|
4 |
import definitions as Def
|
5 |
import styles as Style
|
6 |
import MakeRealTauEst_cff as RT
|
7 |
from copy import deepcopy
|
8 |
|
9 |
if __name__ == "__main__":
|
10 |
Def.SetGlobalStyles()
|
11 |
|
12 |
samples = [
|
13 |
"Data",
|
14 |
"WJets",
|
15 |
"ZJets",
|
16 |
"WWJets",
|
17 |
"TTbar"
|
18 |
]
|
19 |
scaleDict = {}
|
20 |
scaleDict[ "Data" ] = 1.
|
21 |
scaleDict[ "ZJets" ] = 3048/( 36277961 *1. )
|
22 |
scaleDict[ "WWJets" ] = 43. / ( 1197558. * 1. )
|
23 |
scaleDict[ "WJets" ] = 31314. / ( 81352581 )
|
24 |
scaleDict[ "TTbar" ] = 165 / ( 3701947. * 1. )
|
25 |
filedir = "/scratch/hh/lustre/cms/user/nowaf/2011Data/VersionII/Plots/RealTauEst/"
|
26 |
fileappdata = "_clxix"
|
27 |
fileapp = "_clxx"
|
28 |
|
29 |
hists = {}
|
30 |
histdir = "MuonTemplateAnalyzerPre/"
|
31 |
histnames = [
|
32 |
"G",
|
33 |
"C",
|
34 |
"GC",
|
35 |
"GPt",
|
36 |
"CPt",
|
37 |
"GCPt"
|
38 |
]
|
39 |
for h in histnames:
|
40 |
hists[ h ] = {}
|
41 |
for sample in samples:
|
42 |
#print sample
|
43 |
a = fileapp
|
44 |
if sample == "Data":
|
45 |
a = fileappdata
|
46 |
pass
|
47 |
rootfile = ROOT.TFile.Open( filedir + sample + a + ".root" )
|
48 |
hist = rootfile.Get( histdir + h ).Clone()
|
49 |
hist.SetDirectory( 0 )
|
50 |
hist.Scale( scaleDict[ sample ] )
|
51 |
hist.UseCurrentStyle()
|
52 |
if sample == "Data":
|
53 |
hists[ h ][ "Data" ] = hist
|
54 |
hists[ h ][ "Data" ].SetMarkerStyle( 22 )
|
55 |
else:
|
56 |
if not "MC" in hists[ h ].keys():
|
57 |
hists[ h ][ "MC" ] = hist
|
58 |
hists[ h ][ "MC" ].SetLineWidth( 2 )
|
59 |
hists[ h ][ "MC" ].SetLineColor( 8 )
|
60 |
else:
|
61 |
hists[ h ][ "MC" ].Add( hist )
|
62 |
pass
|
63 |
pass
|
64 |
rootfile.Close()
|
65 |
pass
|
66 |
pass
|
67 |
|
68 |
cDict = {}
|
69 |
for h in histnames:
|
70 |
inte = hists[ h ][ "MC" ].Integral()
|
71 |
hists[ h ][ "MC" ].Scale( 1/inte )
|
72 |
inte = hists[ h ][ "Data" ].Integral()
|
73 |
hists[ h ][ "Data" ].Scale( 1/inte )
|
74 |
|
75 |
#print h, " ", hists[ h ].keys()
|
76 |
cDict[ h ] = ROOT.TCanvas( h , h )
|
77 |
cDict[ h ].cd()
|
78 |
hists[ h ][ "MC" ].Draw( "hist" )
|
79 |
hists[ h ][ "Data" ].Draw( "same" )
|
80 |
print h, " KS=", hists[ h ][ "MC" ].KolmogorovTest( hists[ h ][ "Data" ] )
|
81 |
|
82 |
ROOT.gPad.SetLogy()
|
83 |
pass
|
84 |
|
85 |
Def.DontQuit()
|