|
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 ROOTUtils.atlasLabel |
( |
|
x, |
|
|
|
y, |
|
|
|
isPreliminary = False , |
|
|
|
color = 1 , |
|
|
|
offset = 0.115 , |
|
|
|
isForApproval = False , |
|
|
|
energy = 8 , |
|
|
|
customstring = "" , |
|
|
|
size = 0.05 |
|
) |
| |
Definition at line 303 of file roofit/ROOTUtils.py.
303 def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False,energy=8,customstring="",size=0.05):
304 if x==
None or y==
None:
305 print "Must set (x,y) position using --atlasx and --atlasy to add labels. No ATLAS labels created."
307 offset = offset/0.05*size
312 l.SetTextColor(color)
313 l.DrawLatex(x,y,
"ATLAS")
319 p.SetTextColor(color)
321 if customstring !=
"":
322 p.DrawLatex(x+offset,y,customstring)
325 p.DrawLatex(x+offset,y,
"Preliminary")
328 p.DrawLatex(x+offset,y,
"Internal")
332 p.DrawLatex(x, y-(0.07/0.05*size),
"#sqrt{s} = %s TeV" % energy)
334 p.DrawLatex(x, y-(0.07/0.05*size),
"#sqrt{s} = %s GeV" % energy)
◆ atlasStyle()
def ROOTUtils.atlasStyle |
( |
|
protectStyle = True | ) |
|
Definition at line 338 of file roofit/ROOTUtils.py.
339 s = ROOT.TStyle(
'ATLAS',
'ATLAS Style V2.02')
343 s.SetFrameBorderMode(icol);
344 s.SetFrameFillColor(icol);
345 s.SetCanvasBorderMode(icol);
346 s.SetCanvasColor(icol);
347 s.SetPadBorderMode(icol);
349 s.SetStatColor(icol);
353 s.SetPaperSize(20,26);
354 s.SetPadTopMargin(0.05);
355 s.SetPadRightMargin(0.05);
356 s.SetPadBottomMargin(0.16);
357 s.SetPadLeftMargin(0.16);
360 s.SetTitleXOffset(1.4)
361 s.SetTitleYOffset(1.4)
369 s.SetTextSize(tsize);
370 s.SetLabelFont(font,
"x");
371 s.SetTitleFont(font,
"x");
372 s.SetLabelFont(font,
"y");
373 s.SetTitleFont(font,
"y");
374 s.SetLabelFont(font,
"z");
375 s.SetTitleFont(font,
"z");
377 s.SetLabelSize(tsize,
"x");
378 s.SetTitleSize(tsize,
"x");
379 s.SetLabelSize(tsize,
"y");
380 s.SetTitleSize(tsize,
"y");
381 s.SetLabelSize(tsize,
"z");
382 s.SetTitleSize(tsize,
"z");
385 s.SetMarkerStyle(20);
386 s.SetMarkerSize(1.2);
387 s.SetHistLineWidth(2);
388 s.SetLineStyleString(2,
"[12 12]");
394 s.SetEndErrorSize(0.);
◆ drawAxisFrame()
def ROOTUtils.drawAxisFrame |
( |
|
xmin, |
|
|
|
xmax, |
|
|
|
ymin, |
|
|
|
ymax, |
|
|
|
title = '' , |
|
|
|
xTitleOffset = None , |
|
|
|
yTitleOffset = None , |
|
|
|
doPlot = True , |
|
|
|
protectFrame = True |
|
) |
| |
Definition at line 213 of file roofit/ROOTUtils.py.
213 def drawAxisFrame(xmin,xmax,ymin,ymax,title='',xTitleOffset=None,yTitleOffset=None,doPlot=True,protectFrame=True):
214 frame = ROOT.TH2F(
'axisFrame',title,100,xmin,xmax,100,ymin,ymax)
215 frame.SetStats(
False)
216 if xTitleOffset!=
None:
217 frame.GetXaxis().SetTitleOffset(xTitleOffset)
218 if yTitleOffset!=
None:
219 frame.GetYaxis().SetTitleOffset(yTitleOffset)
◆ drawHorizontalBand()
def 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 227 of file roofit/ROOTUtils.py.
227 def drawHorizontalBand(xmin,xmax,y,ywidth,color=33,protectBand=True,centralLine=False):
228 """Draw a horizontal band of width +-ywidth. Nice colors are 19 and 33."""
229 b = ROOT.TH1F(
'band',
'band',1,xmin,xmax)
231 b.SetBinError(1,ywidth)
232 b.SetFillColor(color)
233 b.SetMarkerColor(color)
234 b.SetMarkerSize(0.01)
◆ drawLegend()
def 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 259 of file roofit/ROOTUtils.py.
259 def drawLegend(x1,y1,x2,y2,legendList=[],fillColor=0,lineColor=0,textSize=None,protectLegend=True):
260 """Draw a legend with one or more entries. legendList is a list of lists,
261 where each inner list defines the object, text and option of a legend entry.
262 NOTE: Must store returned TLegend, otherwise legend will disappear!"""
263 nlines = len(legendList)
265 print "ERROR: drawLegend called w/o any legend entries"
270 l = ROOT.TLegend(x1,y1,x2,y2)
271 l.SetFillColor(fillColor)
272 l.SetLineColor(lineColor)
273 l.SetShadowColor(lineColor)
275 l.SetTextSize(textSize)
277 l.AddEntry(e[0],e[1],e[2])
◆ drawText()
def 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 243 of file roofit/ROOTUtils.py.
243 def drawText(x=0.74,y=0.87,dy=0.06,text='',font=62,color=1,align=11,linesep=';'):
244 """Draw a variable number of lines of text."""
248 t.SetTextColor(color)
249 t.SetTextAlign(align)
250 t.SetTextSize(dy/1.2)
251 for line
in text.split(linesep):
252 t.DrawLatex(x,y,line)
◆ moveStats()
def ROOTUtils.moveStats |
( |
|
h, |
|
|
|
dx, |
|
|
|
dy, |
|
|
|
xw = 0 , |
|
|
|
yw = 0 , |
|
|
|
label = '' |
|
) |
| |
Definition at line 284 of file roofit/ROOTUtils.py.
284 def moveStats(h,dx,dy,xw=0,yw=0,label=''):
288 st = h.GetListOfFunctions().FindObject(
'stats')
290 print 'ERROR: No stats found - cannot move it'
292 st.SetTextColor(h.GetLineColor())
293 st.SetX1NDC(st.GetX1NDC()+dx)
294 st.SetY1NDC(st.GetY1NDC()+dy)
295 st.SetX2NDC(st.GetX2NDC()+xw
if xw!=0
else st.GetX2NDC()+dx)
296 st.SetY2NDC(st.GetY2NDC()+yw
if yw!=0
else st.GetY2NDC()+dy)
◆ protect()
def 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 17 of file roofit/ROOTUtils.py.
18 """Utility function to prevent ROOT objects from being garbage-collected,
19 (thus disappearing from plots) when they go out of scope."""
20 protectedObjectList.append(obj)
◆ setStyle()
def ROOTUtils.setStyle |
( |
|
style = None | ) |
|
Definition at line 413 of file roofit/ROOTUtils.py.
416 print '\nApplying style %s (%s) ...\n' % (style.GetName(),style.GetTitle())
417 ROOT.gROOT.SetStyle(style.GetName())
418 ROOT.gROOT.ForceStyle()
◆ __author__
string ROOTUtils.__author__ = 'Juerg Beringer' |
|
private |
◆ __version__
string ROOTUtils.__version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $' |
|
private |
◆ myCanvasSizes
dictionary 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 25 of file roofit/ROOTUtils.py.
◆ protectedObjectList
list ROOTUtils.protectedObjectList = [] |
def drawText(x=0.74, y=0.87, dy=0.06, text='', font=62, color=1, align=11, linesep=';')
def moveStats(h, dx, dy, xw=0, yw=0, label='')
def drawAxisFrame(xmin, xmax, ymin, ymax, title='', xTitleOffset=None, yTitleOffset=None, doPlot=True, protectFrame=True)
def atlasLabel(x, y, isPreliminary=False, color=1, offset=0.115, isForApproval=False, energy=8, customstring="", size=0.05)
def drawHorizontalBand(xmin, xmax, y, ywidth, color=33, protectBand=True, centralLine=False)
def atlasStyle(protectStyle=True)
def drawLegend(x1, y1, x2, y2, legendList=[], fillColor=0, lineColor=0, textSize=None, protectLegend=True)