1 |
nowak |
1.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 |
|
|
|
8 |
|
|
if __name__ == "__main__":
|
9 |
|
|
|
10 |
|
|
Def.SetGlobalStyles( withTitle=True )
|
11 |
|
|
|
12 |
|
|
lumi = 1000.
|
13 |
|
|
|
14 |
|
|
fileName = "_cxix"
|
15 |
|
|
|
16 |
|
|
removeSamplesAcc = []
|
17 |
|
|
#removeSamplesAcc.append( "TTbar" )
|
18 |
|
|
removeSamplesAcc.append( "GVJets" )
|
19 |
|
|
#removeSamplesAcc.append( "WWJets" )
|
20 |
|
|
removeSamplesAcc.append( "Zinv" )
|
21 |
|
|
#removeSamplesAcc.append( "ZJets" )
|
22 |
|
|
#removeSamplesAcc.append( "WJets" )
|
23 |
|
|
#removeSamplesAcc.append( "QCDFlat" )
|
24 |
|
|
removeSamplesAcc.append( "Data" )
|
25 |
|
|
|
26 |
|
|
addSample = []
|
27 |
|
|
#addSample.append( "LM13" )
|
28 |
|
|
#addSample.append( "LM2" )
|
29 |
|
|
|
30 |
|
|
fileDir = "/scratch/hh/lustre/cms/user/nowaf/2011Data/VersionII/Plots/RealTauEst/"
|
31 |
|
|
#dir = "finalPlotMT/"
|
32 |
|
|
dir = "finalPlotMTPre/"
|
33 |
|
|
|
34 |
|
|
histList = []
|
35 |
|
|
histList.append( "MuonVetoMuonMTW" )
|
36 |
|
|
|
37 |
|
|
rebinDict = {}
|
38 |
|
|
|
39 |
|
|
accReadIn = RT.ReadIn( fileDir, fileName, lumi, rebinDict )
|
40 |
|
|
accReadIn.removeSamples( removeSamplesAcc )
|
41 |
|
|
accReadIn.addSamples( addSample )
|
42 |
|
|
accReadIn.removeHists( [ "MHT" ] )
|
43 |
|
|
accReadIn.addHists( histList ) #accReadIn.dontScale()
|
44 |
|
|
histDict = accReadIn.getHists( dir )
|
45 |
|
|
|
46 |
|
|
hist = "MuonVetoMuonMTW"
|
47 |
|
|
sumLeft = 0
|
48 |
|
|
errallLeft = 0
|
49 |
|
|
sumRight = 0
|
50 |
|
|
errallRight = 0
|
51 |
|
|
cut = 100.
|
52 |
|
|
for sample in accReadIn.sampleList:
|
53 |
|
|
bin = histDict[ hist ][ sample ].FindBin( cut )
|
54 |
|
|
maxbin = histDict[ hist ][ sample ].FindBin( histDict[ hist ][ sample ].GetXaxis().GetXmax() )
|
55 |
|
|
print sample, " cutbin=", bin, " maxbin=", maxbin
|
56 |
|
|
err = ROOT.Double( 0 )
|
57 |
|
|
val = histDict[ hist ][ sample ].IntegralAndError( 0, bin, err )
|
58 |
|
|
print sample, " Left: ", val, " +- ", round( err, 2 )
|
59 |
|
|
sumLeft += val
|
60 |
|
|
errallLeft += err**2
|
61 |
|
|
|
62 |
|
|
err = ROOT.Double( 0 )
|
63 |
|
|
val = histDict[ hist ][ sample ].IntegralAndError( bin, maxbin, err )
|
64 |
|
|
print sample, " Right: ", val, " +- ", round( err, 2 )
|
65 |
|
|
sumRight += val
|
66 |
|
|
errallRight += err**2
|
67 |
|
|
|
68 |
|
|
pass
|
69 |
|
|
|
70 |
|
|
print "-----------------------------------------"
|
71 |
|
|
print "Sum Left : ", sumLeft, " +- ", round( math.sqrt( errallLeft ), 2 )
|
72 |
|
|
print "Sum Right: ", sumRight, " +- ", round( math.sqrt( errallRight ), 2 )
|
73 |
|
|
print
|
74 |
|
|
all = sumLeft + sumRight
|
75 |
|
|
print "Fraction of all cutted away: ", round( sumRight/all, 2 )
|
76 |
|
|
print
|
77 |
|
|
### L * f = L*( ( 1 + R )/L ) = All
|
78 |
|
|
f = ( sumRight + 1 )/sumLeft
|
79 |
|
|
ferr = math.sqrt( ( errallRight/sumLeft )**2 + ( ( 1 + sumRight ) * errallLeft /sumLeft**2 )**2 )
|
80 |
|
|
print "Scaling factor= ", 1 + f, " +- ", round( ferr, 2 )
|