void hist020_TH2_draw()
{
gStyle->SetFrameFillColor(18);
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};
auto h2 =
new TH2F(
"h2",
"xygaus + xygaus(5) + xylandau(10)", 20, -4, 4, 20, -4, 4);
h2->SetFillColor(46);
h2->FillRandom("f2", 40000);
Float_t xMin = 0.67, yMin = 0.875, xMax = 0.85, yMax = 0.95;
auto c2h =
new TCanvas(
"c2h",
"2-d options", 10, 10, 800, 600);
c2h->Divide(2, 2);
c2h->SetFillColor(cancolor);
c2h->cd(1);
h2->Draw();
c2h->cd(2);
c2h->cd(3);
c2h->cd(4);
c2h->Update();
auto ctext =
new TCanvas(
"ctext",
"text option", 50, 50, 800, 600);
ctext->SetFillColor(cancolor);
ctext->SetGrid();
h2->Draw("text");
ctext->Update();
auto cont =
new TCanvas(
"contours",
"contours", 100, 100, 800, 600);
cont->Divide(2, 2);
cont->SetFillColor(cancolor);
cont->cd(1);
h2->Draw("contz");
cont->cd(2);
h2->Draw("cont1");
cont->cd(3);
h2->Draw("cont2");
cont->cd(4);
h2->Draw("cont3");
cont->Update();
auto lego =
new TCanvas(
"lego",
"lego options", 150, 150, 800, 600);
lego->SetFillColor(cancolor);
h2->Draw("lego");
h2->Draw("lego1");
h2->Draw("surf1pol");
pl.
DrawPaveLabel(xMin, yMin, xMax + 0.05, yMax,
"SURF1POL",
"brNDC");
h2->Draw("surf1cyl");
pl.
DrawPaveLabel(xMin, yMin, xMax + 0.05, yMax,
"SURF1CYL",
"brNDC");
auto surf =
new TCanvas(
"surfopt",
"surface options", 200, 200, 800, 600);
surf->Divide(2, 2);
surf->SetFillColor(cancolor);
surf->cd(1);
h2->Draw("surf1");
surf->cd(2);
surf->cd(3);
surf->cd(4);
surf->Update();
}
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
virtual void SetParameters(const Double_t *params)
2-D histogram with a float per channel (see TH1 documentation)
A Pave (see TPave) with a text centered in the Pave.
virtual TPaveLabel * DrawPaveLabel(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *label, Option_t *option="")
Draw this pavelabel with new coordinates.
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.