16 TFormula form1(
"form1",
"abs(sin(x)/x)");
19 double rangeMin = 0.0;
20 double rangeMax = 10.0;
21 TF1 sqroot(
"sqroot",
"x*gaus(0) + [3]*form1", rangeMin, rangeMax);
22 sqroot.SetLineColor(4);
23 sqroot.SetLineWidth(6);
25 double gausScale = 10.0;
26 double gausMean = 4.0;
28 double form1Scale = 20.0;
29 sqroot.SetParameters(gausScale, gausMean, gausVar, form1Scale);
33 TH1D h1d(
"h1d",
"Test random numbers", nBins, rangeMin, rangeMax);
36 h1d.FillRandom(
"sqroot", 10000);
39 auto myFile = std::unique_ptr<TFile>(
TFile::Open(
"fillrandom_userfunc.root",
"RECREATE"));
40 myFile->WriteObject(&form1, form1.GetName());
41 myFile->WriteObject(&sqroot, sqroot.GetName());
42 myFile->WriteObject(&h1d, h1d.GetName());
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a double per channel (see TH1 documentation)