1 |
import ROOT, numpy, re, sys
|
2 |
import ScanGrid_cff as SG
|
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 |
|
7 |
#### only for tanBeta == 40
|
8 |
|
9 |
def makeStandardGraph( xList, yList, fColor=None, lColor=None, fStyle=None, lWidth=None, hlWidth=None ):
|
10 |
argx = numpy.array( xList, 'd' )
|
11 |
argy = numpy.array( yList, 'd' )
|
12 |
gr = ROOT.TGraph( len( xList ), argx, argy )
|
13 |
if not fColor == None:
|
14 |
gr.SetFillColor( fColor )
|
15 |
pass
|
16 |
if not lWidth == None:
|
17 |
gr.SetLineWidth( lWidth )
|
18 |
pass
|
19 |
if not lColor == None:
|
20 |
gr.SetLineColor( lColor )
|
21 |
pass
|
22 |
if not fStyle == None:
|
23 |
gr.SetFillStyle( fStyle )
|
24 |
pass
|
25 |
if not hlWidth == None:
|
26 |
ROOT.gStyle.SetHatchesLineWidth( hlWidth )
|
27 |
pass
|
28 |
return gr
|
29 |
|
30 |
### only for tanb == 10 ?
|
31 |
### but this one is for 40!
|
32 |
def makeLepCH( histDict ):
|
33 |
#return makeStandardGraph( xList=[ 0,240, 400, 500.,700.,800.,1000,1200., 1300., 1400., 1450., 1500., 1550., 1600., 1650., 1700., 1750., 1800., 2150., 2150.,0 ],
|
34 |
# yList=[ 140, 140, 139, 138, 137, 136, 136, 137, 138, 139, 140, 142, 143, 145, 147, 150, 154, 158, 134, 0, 0 ],
|
35 |
# fColor=3,
|
36 |
# lColor=3,
|
37 |
# fStyle=1001 )
|
38 |
SG.getChiLEP( histDict )
|
39 |
|
40 |
def makeTevStau( histDict ):
|
41 |
#SG.stauLSPGrid( histDict )
|
42 |
#histDict[ "tshist" ] = histDict[ "ts" ].Clone()
|
43 |
ci = ROOT.TColor.GetColor( "#666666" )
|
44 |
return makeStandardGraph( xList=[ 215, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 580, 600, 620, 640, 660, 680, 700,
|
45 |
720, 740, 760, 780, 800, 820, 840, 860, 880, 0, 0 ],
|
46 |
yList=[ 100, 186, 256, 329, 400, 470, 537, 603, 666, 727, 787, 845, 902, 958, 1013, 1067, 1121, 1174, 1226, 1278, 1330, 1381, 1431,
|
47 |
1481, 1531, 1581, 1630, 1679, 1728, 1779, 1825, 1874, 1920, 1971, 1971, 0 ],
|
48 |
fColor=ci,
|
49 |
fStyle=1001 )
|
50 |
|
51 |
def makeNoEWSB():
|
52 |
return makeStandardGraph( xList=[ 0, 70, 90, 80, 60, 1000, 1090, 1170, 1240, 1320, 1370, 1440, 1500, 1550, 1610, 1660, 1720, 1780, 1830, 1860, 1920, 1970 , 2000, 2000, 0 ],
|
53 |
yList=[ 10.,10.,20., 30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 130., 140., 150., 160., 170., 180., 190., 200., 210., 220, 0, 0 ],
|
54 |
fColor=40,
|
55 |
fStyle=1001 )
|
56 |
|
57 |
### only for tanb==10 || tanb == 3 ?
|
58 |
def makeLepSL( histDict ):
|
59 |
#return makeStandardGraph( xList=[ 0, 0, 11, 20, 24, 49, 70, 82,88,90 ],
|
60 |
# yList=[ 0,240,237,233,230,200,150,100,50,0 ],
|
61 |
# fColor=5,
|
62 |
# lColor=5,
|
63 |
# fStyle=1001 )
|
64 |
SG.getSleptonLEP( histDict )
|
65 |
tsClone = histDict[ "lslhist" ].Clone()
|
66 |
tsClone.SetContour( 3 )
|
67 |
### needed
|
68 |
tsClone.Draw( "CONT Z List" )
|
69 |
### needed, else the contous object is not found
|
70 |
ROOT.gPad.Update()
|
71 |
contours = ROOT.gROOT.GetListOfSpecials().FindObject( "contours" )
|
72 |
#print "contours size: ", contours.GetSize()
|
73 |
resultingGraphs = []
|
74 |
for i in range( 0, contours.GetSize() ):
|
75 |
cList = contours.At( i )
|
76 |
#print "i=", i, "cList size=", cList.GetSize()
|
77 |
curve = cList.First()
|
78 |
if curve:
|
79 |
#print type( curve )
|
80 |
resultingGraphs.append( curve.Clone() )
|
81 |
pass
|
82 |
for j in range( 0, cList.GetSize() ):
|
83 |
curve = cList.After( curve )
|
84 |
if curve:
|
85 |
#print type( curve )
|
86 |
resultingGraphs.append( curve.Clone() )
|
87 |
pass
|
88 |
pass
|
89 |
pass
|
90 |
#curv.Draw( "AP" )
|
91 |
#histDict[ "test" ] = obsClone
|
92 |
### sorting ...
|
93 |
## not done yet
|
94 |
#print resultingGraphs
|
95 |
histDict[ "contourList" + "lsl" ] = resultingGraphs
|
96 |
indexPoints = 0
|
97 |
nPoints = 0
|
98 |
for j in range( 0, len( histDict[ "contourList" + "lsl" ] ) ):
|
99 |
#print type( histDict[ "contourList" + hist ][ j ] )
|
100 |
if histDict[ "contourList" + "lsl" ][ j ].GetN() > nPoints:
|
101 |
nPoints = histDict[ "contourList" + "lsl" ][ j ].GetN()
|
102 |
indexPoints = j
|
103 |
pass
|
104 |
pass
|
105 |
histDict[ "cont" + "lsl" ] = histDict[ "contourList" + "lsl" ][ indexPoints ]
|
106 |
histDict[ "lsl" ] = histDict[ "cont" + "lsl" ].Clone()
|
107 |
ci = ROOT.TColor.GetColor( "#ffff00" );
|
108 |
histDict[ "lsl" ].SetFillColor(ci);
|
109 |
histDict[ "lsl" ].SetLineColor(ci);
|
110 |
|
111 |
### both for tanBeta == 10
|
112 |
def makeTevSgCDF():
|
113 |
return makeStandardGraph( xList=[ 0, 0, 30, 75,150,185,225,310,360,400,430,500,600,600 ],
|
114 |
yList=[ 0,162,168,170,160,150,130,120,109,108,100, 96, 95, 0 ],
|
115 |
fColor=2,
|
116 |
lColor=2,
|
117 |
fStyle=1001 )
|
118 |
def makeTevSgD0():
|
119 |
return makeStandardGraph( xList=[ 0, 0, 30, 80,150,240,320,400,500,600,600,0 ],
|
120 |
yList=[ 0,167,166,162,156,138,121,109,105,105, 0,0 ],
|
121 |
fColor=ROOT.kMagenta + 3,
|
122 |
lColor=ROOT.kMagenta + 3,
|
123 |
fStyle=3335,
|
124 |
lWidth=3,
|
125 |
hlWidth=3 )
|
126 |
|
127 |
def makeEmptyHist( graphs, title="" ):
|
128 |
### empty hist
|
129 |
#m0min = 400
|
130 |
m0min = 220
|
131 |
#m0min = 100
|
132 |
#m0max = 2000
|
133 |
m0max = 1000
|
134 |
#xscale = ( m0max - m0min ) / xscale
|
135 |
#hist = ROOT.TH2D( "h", "h", 100, m0min, m0max, 100, 120, 700);
|
136 |
hist = ROOT.TH2D( "h", "h", 100, m0min, m0max, 100, 100, 700); ### 120-->100?
|
137 |
hist.SetTitle( title )
|
138 |
#hist->Draw();
|
139 |
hist.GetXaxis().SetTitle( "m_{0} (GeV/c^{2})" )
|
140 |
hist.GetYaxis().SetTitle( "m_{1/2} (GeV/c^{2})" )
|
141 |
#hist.GetXaxis().SetTitleOffset( .9 )
|
142 |
#hist.GetXaxis().SetTitleSize( 0.06 )
|
143 |
#hist.GetYaxis().SetTitleOffset( 1.0 )
|
144 |
#hist.GetYaxis().SetTitleSize( 0.06 )
|
145 |
hist.GetXaxis().SetNdivisions( 506 )
|
146 |
hist.GetYaxis().SetNdivisions( 506 )
|
147 |
graphs[ "hist" ] = hist
|
148 |
pass
|
149 |
|
150 |
def getConstantMassGraph( mass, massGraph ):
|
151 |
if mass > massGraph.GetZmax() or mass < massGraph.GetZmin():
|
152 |
return 0
|
153 |
#print "a ", mass
|
154 |
theGraph = massGraph.GetContourList( mass ).At( 0 )
|
155 |
#print "b ", mass
|
156 |
theGraph.SetLineWidth( 1 )
|
157 |
theGraph.SetLineColor( ROOT.kGray )
|
158 |
#print "c ", mass
|
159 |
return theGraph
|
160 |
|
161 |
def getConstantSquarkText( mass, massLineGraph ):
|
162 |
if massLineGraph == 0 :
|
163 |
return 0
|
164 |
text ="#font[92]{#tilde{q}(" + str( mass ) + ")GeV}"
|
165 |
placeX = 180 + 100
|
166 |
if placeX + 0.16 * mass < 400 or massLineGraph.Eval( placeX + 0.16 * mass ) + 10 < 100 :
|
167 |
return 0
|
168 |
t = ROOT.TLatex( placeX + 0.16 * mass, massLineGraph.Eval( placeX + 0.16 * mass ) + 10, text )
|
169 |
t.SetTextSize( 0.03 )
|
170 |
t.SetTextAngle( -25 )
|
171 |
t.SetTextColor( ROOT.kGray+2 )
|
172 |
return t
|
173 |
|
174 |
|
175 |
def getConstantGluinoText( mass, massLineGraph ):
|
176 |
if massLineGraph == 0:
|
177 |
return 0
|
178 |
text = "#font[12]{#tilde{g}}#font[92]{(" + str( mass ) + ")GeV}"
|
179 |
|
180 |
placeX = 800 ### was 1600
|
181 |
if 25 + massLineGraph.Eval( placeX ) < 200: ### was 100
|
182 |
return 0
|
183 |
t = ROOT.TLatex( placeX, 25 + massLineGraph.Eval( placeX ),text )
|
184 |
t.SetTextSize( 0.03 )
|
185 |
t.SetTextAlign( 13 )
|
186 |
t.SetTextColor( ROOT.kGray+2 )
|
187 |
|
188 |
return t
|
189 |
|
190 |
def constantLineGraphs( graphs ):
|
191 |
nGridPoints = 3350
|
192 |
|
193 |
m0List = [ 0 ] * nGridPoints ### initialize list with nGridPoints entrys of 0
|
194 |
m12List = [ 0 ] * nGridPoints
|
195 |
squarkMassList = [ 0 ] * nGridPoints
|
196 |
gluinoMassList = [ 0 ] * nGridPoints
|
197 |
SG.susyGrid( m0List, m12List, squarkMassList, gluinoMassList )
|
198 |
|
199 |
argm0 = numpy.array( m0List, 'd' )
|
200 |
argm12 = numpy.array( m12List, 'd' )
|
201 |
argmsquark = numpy.array( squarkMassList, 'd' )
|
202 |
argmgluino = numpy.array( gluinoMassList, 'd' )
|
203 |
|
204 |
squarkMassesGraph = ROOT.TGraph2D( "squarkMasses", "", nGridPoints, argm0, argm12, argmsquark )
|
205 |
gluinoMassesGraph = ROOT.TGraph2D( "gluinoMasses", "", nGridPoints, argm0, argm12, argmgluino )
|
206 |
|
207 |
gluinoMassesGraph.GetHistogram()
|
208 |
squarkMassesGraph.GetHistogram()
|
209 |
gluinoMassesGraph.SetDirectory( 0 )
|
210 |
squarkMassesGraph.SetDirectory( 0 )
|
211 |
|
212 |
### keep in memory
|
213 |
### important, else python will delete it and root will
|
214 |
### produce an segmentation fault, because of its own
|
215 |
### memory handling
|
216 |
graphs[ "quarkMassesHelper" ] = squarkMassesGraph
|
217 |
graphs[ "gluinoMassesHelper" ] = gluinoMassesGraph
|
218 |
|
219 |
#print type( squarkMassesGraph )
|
220 |
|
221 |
for i in range( 0,15 ):
|
222 |
#print type( getConstantMassGraph( i * 250, squarkMassesGraph ) )
|
223 |
graphs[ "squarkMasses" + str( i ) ] = getConstantMassGraph( i * 250, squarkMassesGraph )
|
224 |
graphs[ "gluinoMasses" + str( i ) ] = getConstantMassGraph( i * 250, gluinoMassesGraph )
|
225 |
graphs[ "squarkMasses" + str( i ) + "Text" ] = getConstantSquarkText( i * 250, graphs[ "squarkMasses" + str( i ) ] )
|
226 |
graphs[ "gluinoMasses" + str( i ) + "Text" ] = getConstantGluinoText( i * 250, graphs[ "gluinoMasses" + str( i ) ] )
|
227 |
pass
|
228 |
pass
|
229 |
|
230 |
def makeExclLegend( xmin, xmax, ymin, ymax, angle, text ):
|
231 |
leg = ROOT.TLegend( xmin, ymin, xmax, ymax )
|
232 |
leg.SetHeader( text )
|
233 |
leg.SetFillStyle( 0 )
|
234 |
leg.SetBorderSize( 0 )
|
235 |
leg.SetTextSize( 0.03 )
|
236 |
leg.SetTextAngle( angle )
|
237 |
|
238 |
return leg
|
239 |
|
240 |
def makeExpLegend( graphList, textList, colorList, textsize ):
|
241 |
#leg = ROOT.TLegend( 0.55, 0.70, 0.99, 0.92, "", "brNDC" )
|
242 |
#leg.SetFillColor( 0 )
|
243 |
#leg.SetShadowColor( 0 )
|
244 |
#leg.SetTextSize( textsize )
|
245 |
#leg.SetBorderSize( 0 )
|
246 |
#for i in range( 0, len( graphList ) ):
|
247 |
# if not colorList[ i ] == None:
|
248 |
# graphList[ i ].SetLineColor( colorList[ i ] )
|
249 |
# pass
|
250 |
# leg.AddEntry( graphList[ i ], textList[ i ], "f" )
|
251 |
# pass
|
252 |
leg = ROOT.TLegend( 0.1900719, 0.158, 0.334964, 0.302, "","NDCbr" )
|
253 |
leg.SetBorderSize(1)
|
254 |
leg.SetTextFont(62)
|
255 |
leg.SetTextSize(0.02)
|
256 |
leg.SetLineColor(1)
|
257 |
leg.SetLineStyle(1)
|
258 |
leg.SetLineWidth(1)
|
259 |
leg.SetFillColor(0)
|
260 |
leg.SetFillStyle(1001)
|
261 |
entry = leg.AddEntry( "GridSleptonLEP", "#scale[1.3]{LEP2 } #scale[1.5]{#tilde{#font[12]{l}}^{ #pm}}","F" )
|
262 |
|
263 |
ci = ROOT.TColor.GetColor("#ffff00")
|
264 |
entry.SetFillColor(ci)
|
265 |
entry.SetFillStyle(1001)
|
266 |
entry.SetLineColor(1)
|
267 |
entry.SetLineWidth(1)
|
268 |
entry.SetMarkerColor(1)
|
269 |
entry.SetMarkerStyle(21)
|
270 |
entry.SetMarkerSize(1)
|
271 |
entry=leg.AddEntry( "GridCharginoLEP","#scale[1.3]{LEP2 } #scale[1.5]{#tilde{#chi}_{1}^{ #pm}}","F" )
|
272 |
|
273 |
ci = ROOT.TColor.GetColor("#009900")
|
274 |
entry.SetFillColor(ci)
|
275 |
entry.SetFillStyle(1001)
|
276 |
entry.SetLineColor(1)
|
277 |
entry.SetLineWidth(1)
|
278 |
entry.SetMarkerColor(1)
|
279 |
entry.SetMarkerStyle(21)
|
280 |
entry.SetMarkerSize(1)
|
281 |
return leg
|
282 |
|
283 |
def makeText( x, y, text ):
|
284 |
t = ROOT.TLatex( x, y, text )
|
285 |
t.SetTextSize( 0.025 )
|
286 |
#t.SetTextAlign( 13 )
|
287 |
t.SetTextColor( ROOT.kBlack )
|
288 |
return t
|
289 |
|
290 |
def makeStandardPlots( graphs, title ):
|
291 |
makeEmptyHist( graphs, title )
|
292 |
#graphs[ "lch" ] = makeLepCH()
|
293 |
graphs[ "ts" ] = makeTevStau( graphs )
|
294 |
makeLepCH( graphs )
|
295 |
makeTevStau( graphs )
|
296 |
graphs[ "newsb" ] = makeNoEWSB()
|
297 |
constantLineGraphs( graphs )
|
298 |
#graphs[ "lsl" ] = makeLepSL( graphs )
|
299 |
makeLepSL( graphs )
|
300 |
graphs[ "tscdf" ] = makeTevSgCDF()
|
301 |
graphs[ "tsd0" ] = makeTevSgD0()
|
302 |
### stau/ no ewsb text
|
303 |
graphs[ "stauLeg" ] = makeExclLegend( 0.21 + 0.025, 0.22 + 0.025, 0.76, 0.78, 80, "#tilde{#tau} = LSP" )
|
304 |
graphs[ "newsbLeg" ] = makeExclLegend( 0.85, 0.95, 0.10, 0.20, 60, "NoEWSB" )
|
305 |
### get the experiments legend
|
306 |
#graphList = [ graphs[ "tscdf" ].Clone(), graphs[ "tsd0" ].Clone(), graphs[ "lch" ].Clone(), graphs[ "lsl" ].Clone() ]
|
307 |
#graphList = [ graphs[ "tscdf" ].Clone(), graphs[ "tsd0" ].Clone(), graphs[ "lch" ].Clone() ]
|
308 |
graphList = [ graphs[ "lsl" ].Clone(), graphs[ "lch" ].Clone() ]
|
309 |
graphs[ "ExpLegHelper" ] = graphList
|
310 |
textList = []
|
311 |
#textList.append( "CDF #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=5, #mu<0}" )
|
312 |
#textList.append( "D0 #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=3, #mu<0}" )
|
313 |
#textList.append( "LEP2 #tilde{#chi}_{1}^{#pm}" )
|
314 |
textList.append( "LEP2 #tilde{#font[12]{l}}^{#pm}" )
|
315 |
textList.append( "LEP2 #tilde{#chi}_{1}^{#pm}" )
|
316 |
#colorList = [ 1,None, 1, 1 ]
|
317 |
colorList = [ 1, 1 ]
|
318 |
graphs[ "expLeg" ] = makeExpLegend( graphList, textList, colorList, 0.027 )
|
319 |
graphs[ "expLeg" ].SetLineColor( 1 )
|
320 |
graphs[ "expLeg" ].SetLineWidth( 1 )
|
321 |
graphs[ "expLeg" ].SetBorderSize( 1 )
|
322 |
graphs[ "text1" ] = makeText( 630, 480, "#font[42]{tan#beta=40, A_{0}=-500 GeV}" )
|
323 |
graphs[ "text2" ] = makeText( 630, 440, "#font[42]{#mu>0, m_{t}=173.2 GeV}" )
|
324 |
|
325 |
pass
|
326 |
|
327 |
def drawStandardPlot( graphs, cDict, histList, optionList, hListLeg, legList, title="", name="" ):
|
328 |
|
329 |
plotsArePresent = False
|
330 |
for key in cDict.keys():
|
331 |
if re.search( "Limit", key ):
|
332 |
plotsArePresent = True
|
333 |
pass
|
334 |
pass
|
335 |
|
336 |
if not plotsArePresent:
|
337 |
makeStandardPlots( graphs, title )
|
338 |
pass
|
339 |
graphs[ "hist" + name ] = graphs[ "hist" ].Clone()
|
340 |
graphs[ "hist" + name ].SetTitle( title )
|
341 |
cDict[ "Limit" + name ] = ROOT.TCanvas( "Limit" + name, "Limit" + name )
|
342 |
cDict[ "Limit" + name ].cd()
|
343 |
graphs[ "hist" + name ].Draw()
|
344 |
Style.setHistStyle( graphs[ "lsl" ],
|
345 |
xTitle="",
|
346 |
yTitle="",
|
347 |
title="" )
|
348 |
Style.setHistStyle( graphs[ "ts" ],
|
349 |
xTitle="",
|
350 |
yTitle="",
|
351 |
title="" )
|
352 |
#graphs[ "ts" ].Draw()
|
353 |
#graphs[ "hist" + name ].Draw( "BOXAXIG" )
|
354 |
## constant lines of masses + text
|
355 |
for i in range( 0, 15 ):
|
356 |
if i < 7:
|
357 |
if i == 1 or i == 3 or i == 5:
|
358 |
continue
|
359 |
if not graphs[ "gluinoMasses" + str( i ) ] == 0:
|
360 |
graphs[ "gluinoMasses" + str( i ) ].Draw( "samec" )
|
361 |
if not graphs[ "gluinoMasses" + str( i ) + "Text" ] == 0:
|
362 |
graphs[ "gluinoMasses" + str( i ) + "Text" ].Draw()
|
363 |
pass
|
364 |
pass
|
365 |
pass
|
366 |
if i == 3 or i == 5:
|
367 |
continue
|
368 |
if not graphs[ "squarkMasses" + str( i ) ] == 0:
|
369 |
graphs[ "squarkMasses" + str( i ) ].Draw( "samec" )
|
370 |
if i < 6 and not graphs[ "squarkMasses" + str( i ) + "Text" ] == 0:
|
371 |
graphs[ "squarkMasses" + str( i ) + "Text" ].Draw()
|
372 |
pass
|
373 |
pass
|
374 |
pass
|
375 |
### my own limits
|
376 |
for hist in histList:
|
377 |
ind = histList.index( hist )
|
378 |
graphs[ hist ].Draw( optionList[ ind ] )
|
379 |
pass
|
380 |
|
381 |
|
382 |
### lep exclusion chargino
|
383 |
#graphs[ "lch" ].Draw( "fsame" )
|
384 |
graphs[ "ts" ].Draw( "fsame" )
|
385 |
graphs[ "stauLeg" ].Draw()
|
386 |
#graphs[ "lch" ].Draw( "same e3" )
|
387 |
graphs[ "lsl" ].Draw( "fsame" )
|
388 |
graphs[ "lch" ].Draw( "samee3" )
|
389 |
### for tanbeta == 10 only ??
|
390 |
#graphs[ "lsl" ].Draw( "BOX same" )
|
391 |
#graphs[ "tscdf" ].Draw( "fsame" )
|
392 |
### draw this twice for getting the outer line
|
393 |
### as well as the hatched filled space
|
394 |
#graphs[ "tsd0" ].Draw( "same" )
|
395 |
#graphs[ "tsd0" ].Draw( "fsame" )
|
396 |
### forbidden regions
|
397 |
#graphs[ "ts" ].Draw( "fsame" )
|
398 |
### not needed if m0 < 1000
|
399 |
#graphs[ "newsb" ].Draw( "fsame" )
|
400 |
#graphs[ "newsbLeg" ].Draw()
|
401 |
### now the legend for other experiments
|
402 |
#graphs[ "expLeg" ].Draw()
|
403 |
### describing text: tanbeta = 40, A0=-500, ...
|
404 |
#graphs[ "text1" ].Draw()
|
405 |
#graphs[ "text2" ].Draw()
|
406 |
|
407 |
graphs[ "hist" + name ].Draw( "axissame" )
|
408 |
#graphs[ "lsl" ].Draw( "axissame" )
|
409 |
pass
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|