Switching from PAW to ROOT

Many of us struggling to learn ROOT are trying to switch from PAW.

I’m wondering if anyone has ever written a document describing equivalent commands between PAW and ROOT. For example, I notice that many of the PAW “opt XXXX YY” commands seem to be replaced by “gStyle->SetXXXX(YY)” commands e.g. “opt stat 1111” becomes “gStyle->SetOptStat(1111)”. For us (hoping-to-be) former PAW users, of which I suspect there are many, it would greatly speed the transition to have a list a equivalent commands.

So far, I have not been able to figure out how to even find out what all the available gStyle commands are. There are several ancedotally mentioned in the ROOT Users Guide, and the tutorials, but I’m sure there are more, but so far I have not been able to find a list.

The above constitutes my question (i.e. is there a cheatsheet of PAW-to-ROOT commands). What follows is comments/bellyaching about my first impressions of ROOT.

So far it is not obvious to me that ROOT is particularly easier to use than PAW. It would seem that most PAW commands, while short and perhaps arcane (but fast to type once you memorize them through frequent use), are replaced with long, and case-sensitive commands (resulting in frequent re-typing and cryptic error messages). For example: To put axis labels on a plot in PAW one types:
atit “X_NAME” "Y_NAME"
In ROOT one gets to type:

histo->GetXaxis()->SetTitle(“X_NAME”);
histo->GetYaxis()->SetTitle(“Y_NAME”);

Forgive me if I fail to understand why this would be considered an improvement. However, maybe this does not matter too much because, in both PAW and ROOT I will probably just write macros to do everything, rather than typing interactively, so it does not matter too much, because once I figure out the cryptic command needed to do a certain operation, I’ll just cut and paste it from a previous macro I’ve written.

Some things which are quite easy in PAW seem to become rather complex in ROOT. For example, if I want to several plots on one page in PAW I can do something like this:

zone 2 3
his/plot 10
… [plot all my histograms]

In ROOT, so far as I can tell (and maybe there is a shortcut I don’t know about yet) I have to: (1) explictly create a canvas, (2) create a number of pads (for which I have to compute the sizes and locations myself), (3) Explictly draw the pads on the canvas, (4) Go though my histograms cd()-ing to each pad and drawing the histogram in it. So my ROOT code ends up looking like:

c1 = new TCanvas(“c1”,“canvas name”,200,10,900,700);

pad1 = new TPad(“pad1”,“pad1”,0.02,0.70,0.24,0.88);
… [define a bunch more pads]

pad1->Draw();
… [Draw all my pads on the canvas]

pad1->cd(); [change my focus to a particular pad]
histo->DrawCopy(); [draw my histogram on the pad]
… [do this for all pads/histograms]

Maybe there is an easier way to do this, but this is the way I have initially figured out. Its a good thing ROOT use a high level computer language as its interface, because you seem to need to make full use of it to do relatively simple (at least what was in PAW) operations.

There is several converstion tables on the web. A quik google search will give you several addresses. I have put one in my personal pages (I copied the orignal from the web). Here it is:

couet.home.cern.ch/couet/root/ht05.html

It iis not a full list. It should be completed. But it guves some ideas.

Thanks for the link it is extremely helpful. I would recommend adding such links to the root webpage because there are a lot of PAW users who would benefit.

gStyle is a pointer to TStyle object. All "the available gStyle commands " could be found in ROOT Reference Guide
. For TStyle look here:
http://root.cern.ch/root/htmldoc/TStyle.html
Another way to look for some possible class methods is to type
the class name in interactive ROOT session comand prompt, then :: then TAB button. It tries to compleet your inputr by displaing all possible completions. Once the method name is completed it will show you the argument list.

root [0] TStyle::SetMarker              <- press TAB here
SetMarkerAttributes                        <- list of possible completions
SetMarkerColor
SetMarkerStyle
SetMarkerSize

To organize some subpads inside same mother-pad you could do:

c1 = new TCanvas("c1","canvas name",200,10,900,700); 
c1 ->Divide(2,3);
c1 ->cd(somePadNumber_startingFromOne);
obj ->Draw();

So, if you do need some sub-pads of equal size - just divide yor main pad - all subpads are created by root itself.

Have fun