//Graph constructor reading input from filename. //filename is assumed to contain at least two columns of numbers. //the string format is by default "%lg %lg". //this is a standard c formatting for scanf. If columns of numbers should be //skipped, a "%*lg" or "%*s" for each column can be added, //e.g. "%lg %*lg %lg" would read x-values from the first and y-values from //the third column. //For files separated by a specific delimiter different from ' ' and '\t' (e.g. ';' in csv files) //you can avoid using %*s to bypass this delimiter by explicitly specify the "option" argument, //e.g. option=" \t,;" for columns of figures separated by any of these characters (' ', '\t', ',', ';') //used once (e.g. "1;1") or in a combined way (" 1;,;; 1"). //Note in that case, the instanciation is about 2 times slower. { TFile f("Plot_DataThief.root","RECREATE"); TCanvas c("c", "Grafico Random", 700, 500); TTree t("t","a simple tree"); TGraphErrors g("Christensen_1977.txt", "%lg %lg %lg %lg"); TGraphErrors h("Patterson_1971.txt", "%lg %lg %lg %lg"); g.GetXaxis()->SetTitle("E_{c.m.} [MeV]"); g.GetYaxis()->SetRangeUser(1e19,2e20); g.GetYaxis()->SetTitle("S(E) [MeV barn]"); g.SetTitle("Plot DataThief"); g.SetMarkerStyle(25); g.SetMarkerColor(3); g.Draw("ap"); h.SetMarkerStyle(27); h.SetMarkerColor(4); h.Draw("P"); h.Draw("E1"); t.Write(); f.Close(); }