12 TGraph *grxy, *grin, *grout;
14 void DrawSmooth(Int_t pad,
const char *title,
const char *xt,
const char *yt)
17 TH1F *vFrame = gPad->DrawFrame(0,0,15,150);
18 vFrame->SetTitle(title);
19 vFrame->SetTitleSize(0.2);
20 vFrame->SetXTitle(xt);
21 vFrame->SetYTitle(yt);
22 grxy->SetMarkerColor(kBlue);
23 grxy->SetMarkerStyle(21);
24 grxy->SetMarkerSize(0.5);
26 grin->SetMarkerColor(kRed);
27 grin->SetMarkerStyle(5);
28 grin->SetMarkerSize(0.7);
30 grout->DrawClone(
"LP");
37 Double_t x[] = {1,2,3,4,5,6,6,6,8,9,10};
38 Double_t y[] = {1,4,9,16,25,25,36,49,64,81,100};
39 grxy =
new TGraph(n,x,y);
44 {1.2,1.7,2.5,3.2,4.4,5.2,5.7,6.5,7.6,8.3,9.7,10.4,11.3,13};
47 vC1 =
new TCanvas(
"vC1",
"square",200,10,700,700);
51 grin =
new TGraph(n,x,y);
53 TGraphSmooth *gs =
new TGraphSmooth(
"normal");
54 grout = gs->Approx(grin,
"linear");
55 DrawSmooth(1,
"Approx: ties = mean",
"X-axis",
"Y-axis");
59 grin =
new TGraph(n,x,y);
61 grout = gs->Approx(grin,
"linear", 14, xout, 0, 130);
62 DrawSmooth(2,
"Approx: ties = mean",
"",
"");
65 Int_t vNout = grout->GetN();
66 Double_t vXout, vYout;
67 for (Int_t k=0;k<vNout;k++) {
68 grout->GetPoint(k, vXout, vYout);
69 cout <<
"k= " << k <<
" vXout[k]= " << vXout
70 <<
" vYout[k]= " << vYout << endl;
74 grin =
new TGraph(n,x,y);
77 grout = gs->Approx(grin,
"constant", 50, 0, 0, 0, 1, 0.5,
"min");
78 DrawSmooth(3,
"Approx: ties = min",
"",
"");
81 grin =
new TGraph(n,x,y);
83 grout = gs->Approx(grin,
"linear", 14, xout, 0, 0, 2, 0,
"max");
84 DrawSmooth(4,
"Approx: ties = max",
"",
"");