Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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, Sergey Linev
9
10void glbox(bool gl = true)
11{
13 TCanvas *c = new TCanvas("glbox", "TH3 Drawing", 100, 10, 850, 400);
14
15 if (!c->UseGL() && !c->IsWeb())
16 ::Warning("glbox",
17 "To use glbox draw option, you need either OpenGL or Web rendering enabled");
18
19 TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98, "\"glbox\" and \"glbox1\" options for TH3.");
20 title->SetFillColor(32);
21 title->Draw();
22
23 TPad *boxPad = new TPad("box", "box", 0.02, 0.02, 0.48, 0.82);
24 TPad *box1Pad = new TPad("box1", "box1", 0.52, 0.02, 0.98, 0.82);
25 boxPad->Draw();
26 box1Pad->Draw();
27
28 TH3F *h31 = new TH3F("h31", "h31", 10, -1, 1, 10, -1, 1, 10, -1, 1);
29 TF3 *gxy = new TF3("gaus2", "xygaus");
30 gxy->SetParameters(1, 0, 1, 0, 0.3);
31 h31->FillRandom("gaus2");
32 h31->SetFillColor(2);
33 boxPad->cd();
34 h31->Draw("glbox");
35
36 TH3F *h32 = new TH3F("h32", "h32", 10, -2, 2, 10, -1, 1, 10, -3, 3);
37 TF3 *g3 = new TF3("gaus3", "xyzgaus");
38 g3->SetParameters(1, 0, 1, 0, 1, 0, 1);
39 h32->FillRandom("gaus3");
40 h32->SetFillColor(4);
41 box1Pad->cd();
42 h32->Draw("glbox1");
43}
#define c(i)
Definition RSha256.hxx:101
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
The Canvas class.
Definition TCanvas.h:23
TF3 defines a 3D Function with Parameters.
Definition TF3.h:28
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:369
The most important graphics class in the ROOT system.
Definition TPad.h:28
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition TStyle.h:345