Using MOFIA root trees -Jim Musser, 11 September 2003. I am carefully documenting each step as I learn to use MOFIA root trees in order to produce a document designed to help others begin simple histogramming. Thanks are due to Blair for taking the time to get me started. It doesn't take long to produce simple plots. I encourage you to try this simple tutorial. (The variables in the ROOT Tree are described at the top of the file $MOFIA_USER/helixtree.f90 in your Mofia installation.) I. Enabling root tree production in MOFIA. A. Add the following lines to your kcm file or enter them at the MOFIA prompt. Name RootTree EnableRootTree = T & B. Use the executable "photo" which contains the required root libraries not available in "mofia". This will produce a file named "tree[run number].root" that contains the root tree. II. Beginning a root session. Note that entering "root" in a terminal on the cluster will bring up an old version of root that is used for photo. The old version is "buggy" according to more experienced users. Do the following to use the "preferred" executable (instructions from Konstantin Olchanski): Set ROOTSYS in your login script: > setenv ROOTSYS /twist/local/root.gcc32.new then start ROOT: > $ROOTSYS/bin/root -l (This dance avoids a mismatch between the ROOT executable and ROOT libraries accessed using ROOTSYS.) III. Opening the tree in root. A. At the prompt enter: new TBrowser This produces a window labeled "ROOT Object Browser". B. In the "ROOT Object Browser" window select the directory containing your root tree file. (Double click) C. Select your root tree file, "tree[run number].root". This will make the tree available in the directory, "ROOT Files". D. Select the directory "ROOT Files". (Double click) E. Select your root tree file, "tree[run number].root". This reveals a directory named "T;1" IV. Viewing variables. A. Select the directory named "T;1". This reveals a list of variables next to leaf icons. B. Select "Details" from the "View" pull-down menu. Two columns are given. The first is the variable name. The second, labeled "Title" includes some additional information. Dimensions of arrays are shown in square brackets. Variable type (I-integer, F-floating point) is shown after a "/" V. Producing histograms. A. Select the directory of your root tree file within "ROOT Files". Right click on the directory, "T", and select "StartViewer". This will open a window labeled "TreeViewer". [Method 1] B. Double click on a variable name or it's leaf icon. (Try "Event_m12width".) Congratulations. You have plotted your first histogram in root. [Method 2] C. Click and drag the variable to the "X:" (Try "Track_ptot".) D. Click on the graph icon in the bottom left corner of the "TreeViewer" window. Note that if you chose an array (like "Track_ptot") there is no evidence that it is an array without consulting the detailed view we saw earlier in the "ROOT Object Browser" window. Root simply plots all elements of the array unless given specific instructions otherwise (in the tradition of PAW). E. Right click on the variable name beside "X:" and select "EditExpression". Append the array element index within square brackets to the end of the expression. For example: Track_ptot[Event_idktr] Click "Done". Click on graph icon. F. Drag a second variable to the "Y:" (Try "Track_costh" and edit the expression to use element "Event_idktr". Click on graph icon. You have now produced a two dimensional plot. VI. Adding cuts. Right click on scissors icon and select "EditExpression". Enter "Selection" based on tree variables. Such as: Event_idktr>-1 Give the cut a name in the "Alias" box. ie. decay_cut Click "Done" and graph icon. VII. Manipulating plots. There are many advanced features that control presentation. Several of these are easily accessible with panels called from pull-down menus. A. Right clicking on canvas will reveal one of several pull-down menus. I found the following: 1. Canvas 2. Title 3. Histogram ("htemp" in my case) 4. xaxis 5. yaxis 6. Frame 7. Stats B. From the histogram pull-down menu choose "DrawPanel" or "FitPanel". C. From the Edit pull-down menu choose "Editor". D. Now play and have fun!