PAW |
ROOT |
|
|
|
| histo/file 10 histos.hbook
histo/file 10 histos.hbook ! N histo/file 10 histos.hbook ! U |
TFile *hfile = new TFile("histos.root");
TFile *hfile = new TFile("histos.root","new"); TFile *hfile = new TFile("histos.root","update"); |
| histo/list 10 | hfile.ls(); (or just .ls) |
| cd //lun10 | hfile.cd(); |
| hrout 10 | hfile->Write(); |
| close 10 | hfile->Close(); |
|
|
|
| 1-dim: | 1-dim: |
| 1d/crea 10 'title' nbins xlow xup | TH1F *h10 = new TH1F("h10","title",nbins,xlow,xup); |
| histo/plot 10 | h10->Draw(); |
| histo/plot 10 e1,s | h10->Draw("e1same"); |
| null xmin xmax ymin ymax
histo/plot 10 s |
TH2F frame = new TH2F("frame","",ncx,xmin,xmax,ncy,ymin,ymax);
frame->Draw(); h10->Draw("same") |
| histo/plot 10(20.:50.) |
h10->GetXaxis()->SetRange(20,50); h10->Draw(); |
| set hcol 5 | h10.SetLineColor(5); |
| histo/op/add 10 11 12 a b | TH1F *h12 = new TH1F(*h10);
h12->Add(h10,h11,a,b); |
| histo/fit 10 chopt (chopt=G/pN/func/myfit.for/...) | h10->Fit("opt"); (opt=gaus/pN/myfunc/myfit.C/...) |
| histo/fit 10(15.:25.) chopt (chopt=G/pN/func/myfit.for/...) | h10->Fit("opt","R","",15,25); (opt=gaus/pN/myfunc/myfit.C/...) |
| loca -i | h10->Integral(); |
| histo/del 10 | h10->Delete(); |
| 2-dim: | 2-dim: |
| 2d/crea 20 'title' ncx xmin xmax ncy ymin ymax | TH2F *h20 = new TH2F("h20","title",ncx,xmin,xmax,ncy,ymin,ymax); |
| histo/plot 20 chopt (chopt=box/col/cont/...) | h20->Draw("opt"); (opt = box/col/cont/...) |
| min 20 5
max 20 10 |
h20->SetMinimum(5);
h20->SetMaximum(10); |
| prox 20
histo/proj 20 histo/plot 20.prox |
h20->ProjectionX("Xproj",); |
|
|
|
| ntuple/create 100 ' ' 3 ' ' 1024 x y z | TTree *t100 = new TTree("t100","Tree 100","z:y:x"); |
| ntuple/print 100 | t100->Print(); |
| ntuple/scan 100 | t100->Scan(); |
| ntuple/plot 100.x | t100->Draw("x"); |
| ntuple/plot 100.x x>0 | t100->Draw("x","x>0"); |
| ntuple/plot 100.x ! ! ! ! s | t100->Draw("x","","same"); |
| ntuple/plot 100.y%x | t100->Draw("y:x"); |
| ntuple/plot 100.z%y%x | t100->Draw("z:y:x"); |
| ntuple/plot 100.x*x+y*y | t100->Draw("x*x+y*y"); |
| ntuple/proj 10 100.x | t100->Draw("x>>h10"); |
| ntuple/uwfnc 100 file.for | t100->MakeCode("file.root"); |
| cut 20 mass.lt.90 nt/pl 10.foo $20 |
char mycut[]="mass<90"; rntp->Draw("foo",mycut); |
|
|
|
| fun/plot sin(x) 100 0. 3.14
histo/plot 12345 |
TF1 *f1 = new TF1("f1","sin(x)",0,10);
f1->Draw(); (f1->GetHistogram())->Draw(); |
| fun2 10 sin(x)*sin(y) 100 0. 3.14 100 0. 3.14
histo/plot 10 surf4 |
TF2 *fun2 = new TF2("fun2","sin(x)*sin(y)",0.,3.14,0.,3.14);
fun2->Draw("surf4"); |
|
|
|
| set stat 1111 | gStyle->SetOptStat(1111); |
| set csiz 0.5 | gStyle->SetStatFontSize(0.5); |
| opt logy
opt liny |
c1->SetLogy();
c1->SetLogy(0); |
|
|
|
| (Open HIGZ window) | TCanvas *c1 = new TCanvas("c1","title",sizex,sizey); |
| next | c1->Clear(); |
| (Refresh changes in window) | c1->Update(); |
| zone 1 2
histo/plot 1 histo/plot 2 |
c1->Divide(1,2);
this clears and divides canvas into 2 pads named c1_1 and c1_2 c1_1->cd(); h1->Draw(); c1_2->Draw(); c1_2->cd(); h2->Draw(); |
| fortran/file 66 graph.ps (or:
graph.eps)
meta -66 -111 (or: -113) picture/plot fortran/close 66 |
c1->Draw();
c1->Print("graph.ps"); or: c1->Print("graph.eps"); |
| (Create "last.kumac") | c1->Print("graph.C");
c1->Print("graph.root"); |
|
|
|
| Add a legend to a histogram. You might do this with symbol and/or itx commands in Paw. |
leg = new TLegend(0.6,0.7,0.89,0.89); //coords are fractions of pad dimensions
leg->SetHeader("The Legend Title"); leg->AddEntry(h11,"First histo","l"); // "l" means line; use "f" for a box leg->SetTextSize(0.04); // set size of text leg->SetMarkerSize(1.4); // increase markersize so that they are visible leg->SetFillColor(0); // Have a white background leg->AddEntry(h1, "text 1", "p"); // p shows points, leg->Draw(); |
| text 0.5 0.5 "TEXT" 0.35 45 | TText *t1 = new TText(0.5,0.5,"TEXT");
t1->SetTextSize(0.35); t1->SetTextAngle(45); t1->Draw(); |
| line 0.05 0.05 0.95 0.95 | TLine *line1 = new TLine(0.05,0.05,0.95,0.95);
line1->Draw(); |
| arrow 5. 5. 10. 10. 0.3 | TArrow *arrow1 = new TArrow(5.,5.,10.,10.,0.03,">");
arrow1->Draw(); |
|
|
|
| exec macro.kumac | .x macro.kumac |
| shell (command) | .! (command) |
| exit | .q |
| ldir | .ls |
| cd | .pwd() |
| mdir subdir | dir.mkdir("subdir") (dir=gROOT,hfile, ...) |
| cd dir | dir.cd() or .cd("hfile.root"); |
| cd //PAWC | gROOT.cd() |
| lcdir | .which |
| mess "Welcome" | printf("Welcome\n"); |
| (Load a file) | .L myfit.C |
| trace on | .s |
| (PAW++ mode) | TBrowser *b = new TBrowser |