Difference: SummerStudents2011 (7 vs. 8)

Revision 82011-06-07 - EvanWulf

Line: 1 to 1

Getting Started with Atlas

Line: 373 to 373
 Your .eps file should appear. You can try opening it with ghostview:
gv your_plot_name.eps
Once you have this working, you can try sprucing up your plot by adding a legend (in an appropriate place in your script):
legend = TLegend(0.60,0.61,0.92,0.91)
legend.AddEntry(your_data_plot, "data")
legend.AddEntry(your_zee_mc_plot, "zee mc")

For more information on TLegend, TCanvas, TH1F, etc. etc., the root documentation is onvaluable. See, for instance: http://root.cern.ch/root/html/TLegend.html. I find that a quick search with google usually pulls up the appropriate page at root.cern.ch.

You might find the following script useful, both to include and as a python/root example:


(or in your own AnalysisUtilities directory, if you can run svn update)

If you copy this script to you local directory or otherwise include it in sys.path, by, for instance, adding:

import sys

(where you've checked that ../AnalysisUtilities/python contains makeFigure.py)

you can then do:

import makeFigure
from makeFigure import SetColor

then you can use:

SetColor(your_histogram, "blue")

to set the line/marker/fill color of your histogram to blue in one line (look over the script to see how its done)

I've also added a function that you might find handy for making TLegends:

from makeFigure import MakeLegend
legend = MakeLegend( plots = {"data" : your_data_plot, 
                              "zee mc" : your_zee_plot} )

Try running over some of the other MC ntuples, so you have a few mc plot files to play with. To represent the sum of the backgrounds, while still distinguishing sthe contributions from each component, THStack is very useful. In you script, you can do something like:

your_stack = THStack("your_stack", "invariant mass of MC backgrounds")

then you can draw it (along with the data we are comparing it to) with, say:



where we redraw the data plot to make sure the axes are visible (try not doing this, maybe it isn't always necessary?)

if you have axis drawing issues, you might also find that adding the following after histogram drawing but before canvas printing is helpful:


One nice thing about python's speedy interpreter and concise syntax is that you can play around with different ways of doing things without wasting to much time. Since ROOT can be finiky (and at times poorly documented), this is useful.


Boosted W's

This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback