エラーバー付きのグラフしたい(TGraphErrors

 1const int npoints = 10;
 2double x[npoints] = {1, 2, 4, 8, 16, 3, 9, 18, 5, 25};
 3
 4TGraphErrors *gre;
 5gre = new TGraphErrors(npoints);
 6
 7for (int i = 0; i < npoints; i++){
 8    gre->SetPoint(i, x[i], 3*x[i]-x[i]);
 9    gre->SetPointError(i, 0.5, TMath::Sqrt(x[i]));
10}
11
12gre->Draw("ap");