Skip to content
Snippets Groups Projects
Commit 496b5436 authored by Olivier Couet's avatar Olivier Couet
Browse files

Make it work with ROOT 6. Include the pictures in the ref guide.

parent 19f0e47f
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/// \notebook /// \notebook
/// Display the various 2-d drawing options /// Display the various 2-d drawing options
/// ///
/// \macro_image
/// \macro_code /// \macro_code
/// ///
/// \author Rene Brun /// \author Rene Brun
...@@ -15,80 +16,80 @@ void draw2dopt() ...@@ -15,80 +16,80 @@ void draw2dopt()
TF2 *f2 = new TF2("f2","xygaus + xygaus(5) + xylandau(10)",-4,4,-4,4); TF2 *f2 = new TF2("f2","xygaus + xygaus(5) + xylandau(10)",-4,4,-4,4);
Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3}; Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3};
f2->SetParameters(params); f2->SetParameters(params);
TH2F h2("h2","xygaus + xygaus(5) + xylandau(10)",20,-4,4,20,-4,4); auto h2 = new TH2F("h2","xygaus + xygaus(5) + xylandau(10)",20,-4,4,20,-4,4);
h2.SetFillColor(46); h2->SetFillColor(46);
h2.FillRandom("f2",40000); h2->FillRandom("f2",40000);
TPaveLabel pl; auto pl = new TPaveLabel();
//basic 2-d options //basic 2-d options
Float_t xMin=0.67, yMin=0.875, xMax=0.85, yMax=0.95; Float_t xMin=0.67, yMin=0.875, xMax=0.85, yMax=0.95;
Int_t cancolor = 17; Int_t cancolor = 17;
TCanvas c2h("c2h","2-d options",10,10,800,600); auto c2h = new TCanvas("c2h","2-d options",10,10,800,600);
c2h.Divide(2,2); c2h->Divide(2,2);
c2h.SetFillColor(cancolor); c2h->SetFillColor(cancolor);
c2h.cd(1); c2h->cd(1);
h2.Draw(); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"SCAT","brNDC"); h2->Draw(); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"SCAT","brNDC");
c2h.cd(2); c2h->cd(2);
h2.Draw("box"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"BOX","brNDC"); h2->Draw("box"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"BOX","brNDC");
c2h.cd(3); c2h->cd(3);
h2.Draw("arr"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"ARR","brNDC"); h2->Draw("arr"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"ARR","brNDC");
c2h.cd(4); c2h->cd(4);
h2.Draw("colz"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"COLZ","brNDC"); h2->Draw("colz"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"COLZ","brNDC");
c2h.Update(); c2h->Update();
//text option //text option
TCanvas ctext("ctext","text option",50,50,800,600); auto ctext = new TCanvas("ctext","text option",50,50,800,600);
gPad->SetGrid(); gPad->SetGrid();
ctext.SetFillColor(cancolor); ctext->SetFillColor(cancolor);
ctext.SetGrid(); ctext->SetGrid();
h2.Draw("text"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"TEXT","brNDC"); h2->Draw("text"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"TEXT","brNDC");
ctext.Update(); ctext->Update();
//contour options //contour options
TCanvas cont("contours","contours",100,100,800,600); auto cont = new TCanvas("contours","contours",100,100,800,600);
cont.Divide(2,2); cont->Divide(2,2);
gPad->SetGrid(); gPad->SetGrid();
cont.SetFillColor(cancolor); cont->SetFillColor(cancolor);
cont.cd(1); cont->cd(1);
h2.Draw("contz"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"CONTZ","brNDC"); h2->Draw("contz"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"CONTZ","brNDC");
cont.cd(2); cont->cd(2);
gPad->SetGrid(); gPad->SetGrid();
h2.Draw("cont1"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT1","brNDC"); h2->Draw("cont1"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT1","brNDC");
cont.cd(3); cont->cd(3);
gPad->SetGrid(); gPad->SetGrid();
h2.Draw("cont2"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT2","brNDC"); h2->Draw("cont2"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT2","brNDC");
cont.cd(4); cont->cd(4);
gPad->SetGrid(); gPad->SetGrid();
h2.Draw("cont3"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT3","brNDC"); h2->Draw("cont3"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"CONT3","brNDC");
cont.Update(); cont->Update();
//lego options //lego options
TCanvas lego("lego","lego options",150,150,800,600); auto lego = new TCanvas("lego","lego options",150,150,800,600);
lego.Divide(2,2); lego->Divide(2,2);
lego.SetFillColor(cancolor); lego->SetFillColor(cancolor);
lego.cd(1); lego->cd(1);
h2.Draw("lego"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"LEGO","brNDC"); h2->Draw("lego"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"LEGO","brNDC");
lego.cd(2); lego->cd(2);
h2.Draw("lego1"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"LEGO1","brNDC"); h2->Draw("lego1"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"LEGO1","brNDC");
lego.cd(3); lego->cd(3);
gPad->SetTheta(61); gPad->SetPhi(-82); gPad->SetTheta(61); gPad->SetPhi(-82);
h2.Draw("surf1pol"); pl.DrawPaveLabel(xMin,yMin,xMax+0.05,yMax,"SURF1POL","brNDC"); h2->Draw("surf1pol"); pl->DrawPaveLabel(xMin,yMin,xMax+0.05,yMax,"SURF1POL","brNDC");
lego.cd(4); lego->cd(4);
gPad->SetTheta(21); gPad->SetPhi(-90); gPad->SetTheta(21); gPad->SetPhi(-90);
h2.Draw("surf1cyl"); pl.DrawPaveLabel(xMin,yMin,xMax+0.05,yMax,"SURF1CYL","brNDC"); h2->Draw("surf1cyl"); pl->DrawPaveLabel(xMin,yMin,xMax+0.05,yMax,"SURF1CYL","brNDC");
lego.Update(); lego->Update();
//surface options //surface options
TCanvas surf("surfopt","surface options",200,200,800,600); auto surf = new TCanvas("surfopt","surface options",200,200,800,600);
surf.Divide(2,2); surf->Divide(2,2);
surf.SetFillColor(cancolor); surf->SetFillColor(cancolor);
surf.cd(1); surf->cd(1);
h2.Draw("surf1"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF1","brNDC"); h2->Draw("surf1"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF1","brNDC");
surf.cd(2); surf->cd(2);
h2.Draw("surf2z"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF2Z","brNDC"); h2->Draw("surf2z"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF2Z","brNDC");
surf.cd(3); surf->cd(3);
h2.Draw("surf3"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF3","brNDC"); h2->Draw("surf3"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF3","brNDC");
surf.cd(4); surf->cd(4);
h2.Draw("surf4"); pl.DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF4","brNDC"); h2->Draw("surf4"); pl->DrawPaveLabel(xMin,yMin,xMax,yMax,"SURF4","brNDC");
surf.Update(); surf->Update();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment