Logo ROOT   6.21/01
Reference Guide
glh3c.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 glh3c()
11 {
13 
14 
16  TH3F * h1 = new TH3F("h1", "h1", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
17  TF3 * g3 = new TF3("gaus3","xyzgaus");
18  g3->SetParameters(1,0,1,0,1,0,1);
19  h1->FillRandom("gaus3");
21  TH3F * h2 = new TH3F("h2", "h2", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
22  TF3 * l3 = new TF3("landau3","landau(x,[0],[1],[2])*gaus(y,1,[3],[4])*gaus(z,1,[3],[4])");
23  l3->SetParameters(1,0,1,0.,0.5);
24  h2->FillRandom("landau3");
25  h2->SetFillColor(kGreen);
26  TH3F * h3 = new TH3F("h3", "h3", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
27  TF3 * gx = new TF3("gaus1","gaus(x)");
28  gx->SetParameters(1,0,1);
29  h3->FillRandom("gaus1");
30  h3->SetFillColor(kBlue);
31 
32  comp->AddTH3(h1);
34  comp->AddTH3(h3);
35 
36  comp->Draw();
37 
38  TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
39  "TH3 composition.");
40  title->SetFillColor(32);
41  title->Draw();
42 }
virtual void SetParameters(const Double_t *params)
Definition: TF1.h:638
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH3.cxx:668
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:267
Definition: Rtypes.h:64
R__EXTERN TStyle * gStyle
Definition: TStyle.h:410
Definition: Rtypes.h:64
TH1F * h1
Definition: legend1.C:5
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:323
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:20
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH1.cxx:3428
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2981
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
A 3-Dim function with parameters.
Definition: TF3.h:28
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
void AddTH3(const TH3 *hist, ETH3BinShape shape=kBox)
Add TH3 into collection.
Definition: Rtypes.h:64
const Bool_t kTRUE
Definition: RtypesCore.h:87