auto tobject_style = RStyle::Parse("tgraph { line_width: 3; line_color: red; }");
void tobject()
{
static constexpr int npoints = 10;
static constexpr int nth1points = 100;
static constexpr int nth2points = 40;
double x[npoints] = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10. };
double y[npoints] = { .1, .2, .3, .4, .3, .2, .1, .2, .3, .4 };
auto th1 =
new TH1I(
"gaus",
"Example of TH1", nth1points, -5, 5);
th1->FillRandom(
"gaus", 5000);
auto th2 = std::make_shared<TH2I>(
"gaus2",
"Example of TH2", 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 TObject-derived classes");
auto subpads = canvas->Divide(2,2);
drawth1->
line =
RAttrLine(RColor::kBlue, 3., RAttrLine::kDashed);
canvas->Show();
}
R__EXTERN TStyle * gStyle
Drawing line attributes for different objects.
virtual void UseStyle(const std::shared_ptr< RStyle > &style)
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
RAttrLine line
! object line attributes
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with an int per channel (see TH1 documentation)}
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.