void danilo() { TCanvas *c1 = new TCanvas("c1","Data",200,10,700,500); c1->SetFillColor(42); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); c1->GetFrame()->SetBorderMode(-1); TFile *hfile = (TFile*)gROOT->FindObject("daten.root"); if (hfile) hfile->Close(); hfile = new TFile("daten.root","RECREATE","DATA"); //Create the points const Int_t n = 42; Double_t x[n] = {0.458,0.354,0.425,0.374,0.420,0.372,0.378,0.453,0.465,0.498,0.655,0.4,0.615,0.480,0.450,0.388,0.570,0.490,0.495,0.656,0.828,0.450,0.430,0.580,0.763,0.526,0.172,0.619,0.592,0.550,0.180,0.374,0.472,0.430,0.657,0.612,0.320,0.579,0.450,0.581,0.416,0.830}; Double_t y[n] = {23.11,22.38,22.13,21.72,22.55,22.26,22.58,23.17,23.33,23.71,23.27,22.36,23.19,22.96,22.51,22.65,23.27,23.10,22.83,23.57,24.65,23.17,23.13,23.46,24.47,23.15,20.17,23.80,24.42,23.51,20.43,23.52,23.11,22.57,23.83,23.69,21.86,23.48,22.83,23.09,22.57,24.32}; //create the width of errors in x and y direction Double_t ex[n] = {0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.005,0.001,0.001,0.03,0.001,0.001,0.001,0.001,0.001,0.01,0.001,0.001,0.001,0.01,0.01,0.001,0.001,0.001,0.001,0.001,0.001,0.01,0.001,0.001,0.001,0.01,0.001,0.001,0.01,0.001,0.01,0.001,0.001,0.01}; Double_t ey[n] = {0.46,0.33,0.49,0.22,0.25,0.20,0.37,0.25,0.30,0.25,0.21,0.19,0.25,0.24,0.23,0.2,0.22,0.2,0.19,0.28,0.54,0.23,0.22,0.23,0.53,0.20,0.18,0.28,0.37,0.25,0.17,0.24,0.19,0.18,0.23,0.21,0.18,0.22,0.3,0.22,0.2,0.22}; //create the TGraphErrors and draw TGraphErrors *gr = new TGraphErrors(n,x,y,ex,ey); gr->SetName("data"); gr->SetTitle("Data-file"); gr->SetMarkerColor(4); gr->SetMarkerStyle(20); gr->Draw("AP"); gr->Write(); hfile->Close(); }