Exercises For "IntrodUCtion to ROOT"

Setup:

1. Log on to cdfsga, fnalu, fnpat1, or d02ka

2. On cdfsga type:

         :>source ~cdfsoft/.cshrc

                  :>setup root v2_23_11 –q KCC_3_3

 

  On fcdfsgi2, root should be already setup

 

   On fnalu type:

         :>setup root v2_23_11

  On d02ka type:

:> setup n32
:> setup kai
:> setup root v2_23_11 -q KCC_3_3:exception

  On fnpat1 type:

       :>setup kai

       :>setup root v2_23_11 –q KCC_3_3

 

3. Use Netscape to get the example files: Example.root, Example.C, and toyz.rz:

                       

      www-pat.fnal.gov/root/101

 

4. Startup root by typing at the system prompt

         :> root

5. Quit root by typing .q at the root prompt

         root:> .q

 

 

 

 

 

Exercise #1


 


Display this canvas. The main histogram ( in blue) has error bars, a gaussian fit, and a fill with a pattern. It's x-axis has been zoomed to -2 to 2.  The smaller histogram is also a plot of xmain. It has not been zoomed of fitted.

 

Exercise 1B

If you have extra time, try these extra credit exercises:


Display the fit statistics for the histogram above:

 


Add a line of text and change the font to Greek.


 

 


Exercise #2


 


Create this 2D lego plot of xs1 and xmain with the Tree Viewer. Add the cut xs1>0. Rotate the plot to view different angles.

 

 

Exercise #2B:

If you have extra time, try these extra credit exercise:

Create a new variable xs1 * xmain and display the new variable and xs1 with a surface using Gouraud shading as shown below.

 


 


Exercise #2C   

If you have extra time, try these extra credit exercise:

Save the canvas you have created in Exercise 2B as a .root file. Quit the current root session and start another session. Display the saved canvas.

 

Save the canvas you created as a .C macro and save the histogram in a file. Quit the current root session and start another session. Display the saved canvas by executing the macro you saved.

 

Exercise #3

Find the draw options on the histogram.

 

Exercise #3b

If you have extra time, convert the file toyz.rz to a root file. The file toyz.rz can be downloaded from http://www-pat/root/101.

Exercise #4

 

Modify the Example.C macro by adding another histogram (the blue one above). The new histogram plots a Random number with a Landau distribution. When filling the histogram add a weight of 0.2.  Also add this new variable to the total histogram. Do not add it to the tree at this time.