Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
10void glh3c()
11{
12 gStyle->SetCanvasPreferGL(kTRUE);
13
15 TH3F *h1 = new TH3F("h1", "h1", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
16 TF3 *g3 = new TF3("gaus3", "xyzgaus");
17 g3->SetParameters(1, 0, 1, 0, 1, 0, 1);
18 h1->FillRandom("gaus3");
19 h1->SetFillColor(kRed);
20 TH3F *h2 = new TH3F("h2", "h2", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
21 TF3 *l3 = new TF3("landau3", "landau(x,[0],[1],[2])*gaus(y,1,[3],[4])*gaus(z,1,[3],[4])");
22 l3->SetParameters(1, 0, 1, 0., 0.5);
23 h2->FillRandom("landau3");
25 TH3F *h3 = new TH3F("h3", "h3", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
26 TF3 *gx = new TF3("gaus1", "gaus(x)");
27 gx->SetParameters(1, 0, 1);
28 h3->FillRandom("gaus1");
30
31 comp->AddTH3(h1);
33 comp->AddTH3(h3);
34
35 comp->Draw();
36
38 title->SetFillColor(32);
39 title->Draw();
40}
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
@ kRed
Definition Rtypes.h:67
@ kGreen
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
externTStyle * gStyle
Definition TStyle.h:442
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
virtual void SetParameters(const Double_t *params)
Definition TF1.h:618
Definition TF3.h:28
void AddTH3(const TH3 *hist, ETH3BinShape shape=kBox)
Add TH3 into collection.
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3097
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:369
void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH3.cxx:862
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
TH1F * h1
Definition legend1.C:5