Exercise 1: Detective work
(10 minutes)
Duplicate the following plot:1
Figure 9: Some detective work is required to duplicate this plot.
Hints
Take another look at the TF1 command. If class TF1 will generate a
one-dimensional function, what class might generate a two-dimensional
function?
If TF1 takes a function name, formula, and x-limits in its
constructor, what arguments might a two-dimensional function class use?
Where could you check your guess?
With your first try, you probably got a contour plot, not a surface
plot. Here’s another hint: you want the give the option “surf1” (with
quotes) to the Draw method.
If youre wondering how to figure out that “surf1” was an valid option
to give to Draw(): Unfortunately, this is not obvious in the current
ROOT web site or documentation.
Near the top of the
TF1description, it states “TF1 graphics function is via theTH1andTGraphdrawing functions.”If you go to the
TH1class and look at theDraw()method, it says “Histograms are drawn via theTHistPainterclass.”If you go to the
THistPainterclass, you’ll see all the availableDraw()options.
It’s a long chain of references, and I didn’t expect you to figure it out on your own. The point is to prepare you for the kind of documentation searches you often have to do to accomplish something in ROOT; for example, Advanced Exercises and Expert Exercises in this tutorial. Finding the “surf1” option is trivial by comparison!
- 1
The colors don’t have to be the same, since the default colors change in different ROOT versions.