-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcosThetaOpt_cl95.py
69 lines (63 loc) · 2.4 KB
/
cosThetaOpt_cl95.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from ROOT import *
from recheckOptimization import MCbgGetSoverRootB
from HgParameters import getMassWindows, getSamplesDirs
from calcCL95limits import getExpectedLimit
massWindows = getMassWindows()
samplesDirs = getSamplesDirs()
useCosTheta=False
usePtOverM = True
def scanCuts(mass, graph, compileOrLoad):
for i in range(0, 70):
cutValue = 0.3 + (i/float(100))
#for i in range(0, 2):
# cutValue = 0.3 + (i/float(100))
#bgMCsOverRootBinfo = MCbgGetSoverRootB(samplesDirs["small3sDir"], samplesDirs["ddDir", mass, massWindows[mass], -100.0, cosThetaCutValue, compileOrLoad)
#ss = bgMCsOverRootBinfo["S"]
#bb = bgMCsOverRootBinfo["B"]
expectedLimitInfo = getExpectedLimit(samplesDirs["small3sDir"], samplesDirs["ddDir"], mass, massWindows[mass], -100.0, cutValue, 0, compileOrLoad)
graph.SetPoint(graph.GetN(), cutValue, expectedLimitInfo["expectedLimit"])
compileOrLoad = "load"
outfile = TFile("noBtagCut_m%i.root"%mass, "RECREATE")
outfile.cd()
graph.Write()
outfile.Close()
return compileOrLoad
def scanCuts_ptOverM(mass, graph, compileOrLoad):
for i in range(0, 60):
pToverMcutValue = i/float(100)
#bgMCsOverRootBinfo = MCbgGetSoverRootB(samplesDirs["small3sDir"], samplesDirs["ddDir", mass, massWindows[mass], -100.0, cosThetaCutValue, compileOrLoad)
#ss = bgMCsOverRootBinfo["S"]
#bb = bgMCsOverRootBinfo["B"]
expectedLimitInfo = getExpectedLimit(samplesDirs["small3sDir"], samplesDirs["ddDir"], mass, massWindows[mass], -100.0, 2, pToverMcutValue, compileOrLoad)
graph.SetPoint(graph.GetN(), pToverMcutValue, expectedLimitInfo["expectedLimit"])
compileOrLoad = "load"
outfile = TFile("noBtag_pToverM_m%i.root"%mass, "RECREATE")
outfile.cd()
graph.Write()
outfile.Close()
return compileOrLoad
graphs = []
compileOrLoad = "compile"
first = True
gStyle.SetPalette(kRainBow)
canvas = TCanvas()
canvas.cd()
iColor = 0
massWindows.pop(750)
massWindows.pop(1000)
for mass in massWindows.keys():
graphs.append(TGraph())
graphs[-1].SetNameTitle("M=%i GeV" % mass, "M=%i GeV" % mass)
graphs[-1].SetLineColor(kRed+iColor)
iColor +=1
if useCosTheta:
compileOrLoad = scanCuts(mass, graphs[-1], compileOrLoad)
elif usePtOverM:
compileOrLoad = scanCuts_ptOverM(mass, graphs[-1], compileOrLoad)
if first:
graphs[-1].Draw()
first = False
else:
graphs[-1].Draw("SAME")
canvas.Draw()
canvas.SaveAs("testcanvas.pdf")