Logo ROOT   6.07/09
Reference Guide
glbox.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_gl
3 /// Display a 3D histogram using GL (box option).
4 ///
5 /// \macro_image(nobatch)
6 /// \macro_code
7 ///
8 /// \author Timur Pocheptsov
9 
10 void glbox()
11 {
13  TCanvas *c = new TCanvas("glc","TH3 Drawing", 100, 10, 850, 400);
14  TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
15  "\"glbox\" and \"glbox1\" options for TH3.");
16  title->SetFillColor(32);
17  title->Draw();
18 
19  TPad *boxPad = new TPad("box", "box", 0.02, 0.02, 0.48, 0.82);
20  TPad *box1Pad = new TPad("box1", "box1", 0.52, 0.02, 0.98, 0.82);
21  boxPad->Draw();
22  box1Pad->Draw();
23 
24  TH3F *h31 = new TH3F("h31", "h31", 10, -1, 1, 10, -1, 1, 10, -1, 1);
25  h31->FillRandom("gaus");
26  h31->SetFillColor(2);
27  boxPad->cd();
28  h31->Draw("glbox");
29 
30  TH3F *h32 = new TH3F("h32", "h32", 10, -2, 2, 10, -1, 1, 10, -3, 3);
31  h32->FillRandom("gaus");
32  h32->SetFillColor(4);
33  box1Pad->cd();
34  h32->Draw("glbox1");
35 }
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH3.cxx:658
tomato 3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:271
return c
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:526
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1208
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:332
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:24
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2853
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:42
The most important graphics class in the ROOT system.
Definition: TPad.h:37
The Canvas class.
Definition: TCanvas.h:41
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
THist< 3, float, THistStatContent, THistStatUncertainty > TH3F
Definition: THist.hxx:314
const Bool_t kTRUE
Definition: Rtypes.h:91