|
ATLAS Offline Software
|
|
def | protect (obj) |
|
def | drawAxisFrame (xmin, xmax, ymin, ymax, title='', xTitleOffset=None, yTitleOffset=None, doPlot=True, protectFrame=True) |
|
def | drawHorizontalBand (xmin, xmax, y, ywidth, color=33, protectBand=True, centralLine=False) |
|
def | drawText (x=0.74, y=0.87, dy=0.06, text='', font=62, color=1, align=11, linesep=';') |
|
def | drawLegend (x1, y1, x2, y2, legendList=[], fillColor=0, lineColor=0, textSize=None, protectLegend=True) |
|
def | moveStats (h, dx, dy, xw=0, yw=0, label='') |
|
def | atlasLabel (x, y, isPreliminary=False, color=1, offset=0.115, isForApproval=False, energy=8, customstring="", size=0.05) |
|
def | atlasStyle (protectStyle=True) |
|
def | setStyle (style=None) |
|
◆ atlasLabel()
def python.ROOTUtils.atlasLabel |
( |
|
x, |
|
|
|
y, |
|
|
|
isPreliminary = False , |
|
|
|
color = 1 , |
|
|
|
offset = 0.115 , |
|
|
|
isForApproval = False , |
|
|
|
energy = 8 , |
|
|
|
customstring = "" , |
|
|
|
size = 0.05 |
|
) |
| |
Definition at line 300 of file python/ROOTUtils.py.
300 def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False,energy=8,customstring="",size=0.05):
301 if x
is None or y
is None:
302 print (
"Must set (x,y) position using --atlasx and --atlasy to add labels. No ATLAS labels created.")
304 offset = offset/0.05*size
309 l.SetTextColor(color)
310 l.DrawLatex(x,y,
"ATLAS")
316 p.SetTextColor(color)
318 if customstring !=
"":
319 p.DrawLatex(x+offset,y,customstring)
322 p.DrawLatex(x+offset,y,
"Preliminary")
325 p.DrawLatex(x+offset,y,
"Internal")
329 p.DrawLatex(x, y-(0.07/0.05*size),
"#sqrt{s} = %s TeV" % energy)
331 p.DrawLatex(x, y-(0.07/0.05*size),
"#sqrt{s} = %s GeV" % energy)
◆ atlasStyle()
def python.ROOTUtils.atlasStyle |
( |
|
protectStyle = True | ) |
|
Definition at line 335 of file python/ROOTUtils.py.
336 s = ROOT.TStyle(
'ATLAS',
'ATLAS Style V2.02')
340 s.SetFrameBorderMode(icol)
341 s.SetFrameFillColor(icol)
342 s.SetCanvasBorderMode(icol)
343 s.SetCanvasColor(icol)
344 s.SetPadBorderMode(icol)
350 s.SetPaperSize(20,26)
351 s.SetPadTopMargin(0.05)
352 s.SetPadRightMargin(0.05)
353 s.SetPadBottomMargin(0.16)
354 s.SetPadLeftMargin(0.16)
357 s.SetTitleXOffset(1.4)
358 s.SetTitleYOffset(1.4)
367 s.SetLabelFont(font,
"x")
368 s.SetTitleFont(font,
"x")
369 s.SetLabelFont(font,
"y")
370 s.SetTitleFont(font,
"y")
371 s.SetLabelFont(font,
"z")
372 s.SetTitleFont(font,
"z")
374 s.SetLabelSize(tsize,
"x")
375 s.SetTitleSize(tsize,
"x")
376 s.SetLabelSize(tsize,
"y")
377 s.SetTitleSize(tsize,
"y")
378 s.SetLabelSize(tsize,
"z")
379 s.SetTitleSize(tsize,
"z")
384 s.SetHistLineWidth(2)
385 s.SetLineStyleString(2,
"[12 12]")
391 s.SetEndErrorSize(0.)
◆ drawAxisFrame()
def python.ROOTUtils.drawAxisFrame |
( |
|
xmin, |
|
|
|
xmax, |
|
|
|
ymin, |
|
|
|
ymax, |
|
|
|
title = '' , |
|
|
|
xTitleOffset = None , |
|
|
|
yTitleOffset = None , |
|
|
|
doPlot = True , |
|
|
|
protectFrame = True |
|
) |
| |
Definition at line 210 of file python/ROOTUtils.py.
210 def drawAxisFrame(xmin,xmax,ymin,ymax,title='',xTitleOffset=None,yTitleOffset=None,doPlot=True,protectFrame=True):
211 frame = ROOT.TH2F(
'axisFrame',title,100,xmin,xmax,100,ymin,ymax)
212 frame.SetStats(
False)
213 if xTitleOffset
is not None:
214 frame.GetXaxis().SetTitleOffset(xTitleOffset)
215 if yTitleOffset
is not None:
216 frame.GetYaxis().SetTitleOffset(yTitleOffset)
◆ drawHorizontalBand()
def python.ROOTUtils.drawHorizontalBand |
( |
|
xmin, |
|
|
|
xmax, |
|
|
|
y, |
|
|
|
ywidth, |
|
|
|
color = 33 , |
|
|
|
protectBand = True , |
|
|
|
centralLine = False |
|
) |
| |
Draw a horizontal band of width +-ywidth. Nice colors are 19 and 33.
Definition at line 224 of file python/ROOTUtils.py.
224 def drawHorizontalBand(xmin,xmax,y,ywidth,color=33,protectBand=True,centralLine=False):
225 """Draw a horizontal band of width +-ywidth. Nice colors are 19 and 33."""
226 b = ROOT.TH1F(
'band',
'band',1,xmin,xmax)
228 b.SetBinError(1,ywidth)
229 b.SetFillColor(color)
230 b.SetMarkerColor(color)
231 b.SetMarkerSize(0.01)
◆ drawLegend()
def python.ROOTUtils.drawLegend |
( |
|
x1, |
|
|
|
y1, |
|
|
|
x2, |
|
|
|
y2, |
|
|
|
legendList = [] , |
|
|
|
fillColor = 0 , |
|
|
|
lineColor = 0 , |
|
|
|
textSize = None , |
|
|
|
protectLegend = True |
|
) |
| |
Draw a legend with one or more entries. legendList is a list of lists,
where each inner list defines the object, text and option of a legend entry.
NOTE: Must store returned TLegend, otherwise legend will disappear!
Definition at line 256 of file python/ROOTUtils.py.
256 def drawLegend(x1,y1,x2,y2,legendList=[],fillColor=0,lineColor=0,textSize=None,protectLegend=True):
257 """Draw a legend with one or more entries. legendList is a list of lists,
258 where each inner list defines the object, text and option of a legend entry.
259 NOTE: Must store returned TLegend, otherwise legend will disappear!"""
260 nlines = len(legendList)
262 print (
"ERROR: drawLegend called w/o any legend entries")
267 l = ROOT.TLegend(x1,y1,x2,y2)
268 l.SetFillColor(fillColor)
269 l.SetLineColor(lineColor)
270 l.SetShadowColor(lineColor)
272 l.SetTextSize(textSize)
274 l.AddEntry(e[0],e[1],e[2])
◆ drawText()
def python.ROOTUtils.drawText |
( |
|
x = 0.74 , |
|
|
|
y = 0.87 , |
|
|
|
dy = 0.06 , |
|
|
|
text = '' , |
|
|
|
font = 62 , |
|
|
|
color = 1 , |
|
|
|
align = 11 , |
|
|
|
linesep = ';' |
|
) |
| |
Draw a variable number of lines of text.
Definition at line 240 of file python/ROOTUtils.py.
240 def drawText(x=0.74,y=0.87,dy=0.06,text='',font=62,color=1,align=11,linesep=';'):
241 """Draw a variable number of lines of text."""
245 t.SetTextColor(color)
246 t.SetTextAlign(align)
247 t.SetTextSize(dy/1.2)
248 for line
in text.split(linesep):
249 t.DrawLatex(x,y,line)
◆ moveStats()
def python.ROOTUtils.moveStats |
( |
|
h, |
|
|
|
dx, |
|
|
|
dy, |
|
|
|
xw = 0 , |
|
|
|
yw = 0 , |
|
|
|
label = '' |
|
) |
| |
Definition at line 281 of file python/ROOTUtils.py.
281 def moveStats(h,dx,dy,xw=0,yw=0,label=''):
285 st = h.GetListOfFunctions().FindObject(
'stats')
287 print (
'ERROR: No stats found - cannot move it')
289 st.SetTextColor(h.GetLineColor())
290 st.SetX1NDC(st.GetX1NDC()+dx)
291 st.SetY1NDC(st.GetY1NDC()+dy)
292 st.SetX2NDC(st.GetX2NDC()+xw
if xw!=0
else st.GetX2NDC()+dx)
293 st.SetY2NDC(st.GetY2NDC()+yw
if yw!=0
else st.GetY2NDC()+dy)
◆ protect()
def python.ROOTUtils.protect |
( |
|
obj | ) |
|
Utility function to prevent ROOT objects from being garbage-collected,
(thus disappearing from plots) when they go out of scope.
Definition at line 14 of file python/ROOTUtils.py.
15 """Utility function to prevent ROOT objects from being garbage-collected,
16 (thus disappearing from plots) when they go out of scope."""
17 protectedObjectList.append(obj)
◆ setStyle()
def python.ROOTUtils.setStyle |
( |
|
style = None | ) |
|
Definition at line 410 of file python/ROOTUtils.py.
413 print (
'\nApplying style %s (%s) ...\n' % (style.GetName(),style.GetTitle()))
414 ROOT.gROOT.SetStyle(style.GetName())
415 ROOT.gROOT.ForceStyle()
◆ __author__
string python.ROOTUtils.__author__ = 'Juerg Beringer' |
|
private |
◆ __version__
string python.ROOTUtils.__version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $' |
|
private |
◆ myCanvasSizes
dictionary python.ROOTUtils.myCanvasSizes |
Initial value: 1 = {
'default': (700, 500),
2 'default2d': (545, 500),
5 'slide2text': (400,500),
9 'landscape': (1600,1000),
11 'extrawide': (1500,500),
Definition at line 22 of file python/ROOTUtils.py.
◆ protectedObjectList
list python.ROOTUtils.protectedObjectList = [] |
def drawText(x=0.74, y=0.87, dy=0.06, text='', font=62, color=1, align=11, linesep=';')
def drawLegend(x1, y1, x2, y2, legendList=[], fillColor=0, lineColor=0, textSize=None, protectLegend=True)
def atlasStyle(protectStyle=True)
def atlasLabel(x, y, isPreliminary=False, color=1, offset=0.115, isForApproval=False, energy=8, customstring="", size=0.05)
def drawAxisFrame(xmin, xmax, ymin, ymax, title='', xTitleOffset=None, yTitleOffset=None, doPlot=True, protectFrame=True)
def moveStats(h, dx, dy, xw=0, yw=0, label='')
def drawHorizontalBand(xmin, xmax, y, ywidth, color=33, protectBand=True, centralLine=False)