#include <iostream>
void draw_v6()
{
static constexpr int npoints = 10;
double x[npoints] = { 0., 1., 2., 3., 4., 5., 6., 7., 8., 9. };
double y[npoints] = { .1, .2, .3, .4, .3, .2, .1, .2, .3, .4 };
auto gr = std::make_shared<TGraph>(npoints,
x,
y);
static constexpr int nth1points = 100;
auto th1 = std::make_shared<TH1I>(
"gaus",
"Example of TH1", nth1points, -5, 5);
th1->SetDirectory(
nullptr);
for (
int n=0;
n<nth1points;++
n) {
double x = 10.*
n/nth1points-5.;
}
static constexpr int nth2points = 40;
auto th2 = std::make_shared<TH2I>(
"gaus2",
"Example of TH1", nth2points, -5, 5, nth2points, -5, 5);
th2->SetDirectory(
nullptr);
for (
int n=0;
n<nth2points;++
n) {
for (int k=0;k<nth2points;++k) {
double x = 10.*
n/nth2points-5.;
double y = 10.*k/nth2points-5.;
}
}
auto canvas = RCanvas::Create("RCanvas showing a v6 objects");
auto subpads = canvas->Divide(2,2);
canvas->Show();
canvas->Update(false, [](bool res) { std::cout << "First sync update done = " << (res ? "true" : "false") << std::endl; });
canvas->Modified();
canvas->Update(true, [](bool res) { std::cout << "Second async update done = " << (res ? "true" : "false") << std::endl; });
std::cout << "This message appear normally before second async update" << std::endl;
}
R__EXTERN TStyle * gStyle
Provides v7 drawing facilities for TObject types (TGraph etc).
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.