{ Int_t endfCheck,exforCheck; Double_t xK[11],x[300],xC[300]; Double_t yK[11],y[300],yC[300]; Double_t dxK[11],dx[300]; Double_t dyK[11],dy[300]; Int_t i,j,k; i=0;j=0;k=0; cout<<"Plot World Data? (1 for yes): "; cin>>exforCheck; cout<<"Plot JENDL Calc? (1 for yes): "; cin>>endfCheck; // READ IN KNOWN DATA AND ASSIGN TO xK(nown), etc ifstream fp("KnownData.log",ios::in); char line[1000]; while (!fp.eof()){ fp.getline(line,1000); sscanf(line,"%lf %lf %lf %lf",&xK[j],&dxK[j],&yK[j],&dyK[j]); //DEBUG printf("%lf %lf %lf %lf\n",xK[j],dxK[j],yK[j],dyK[j]); j++; } fp.close(); //READ IN MY DATA ifstream fp2("MyData.log",ios::in); while (!fp2.eof()) { fp2.getline(line,1000); sscanf(line,"%lf %lf %lf %lf",&x[i],&dx[i],&y[i],&dy[i]); //DEBUG printf("%lf %lf %lf %lf\n",x[i],dx[i],y[i],dy[i]); i++; } fp2.close(); // READ IN JENDL Calculation ifstream fp3("CalcData.log",ios::in); while (!fp3.eof()) { fp3.getline(line,1000); sscanf(line,"%lf %lf",&xC[k],&yC[k]); //DEBUG printf("%lf %lf %lf %lf\n",x[i],dx[i],y[i],dy[i]); k++; } fp3.close(); /// Invoke Canvas, Draw Frame, Set Titles, etc TCanvas *c1 = new TCanvas("c1","Graph Title",200,10,700,500); TH1F *hr = c1->DrawFrame(95,0,305,2.5); hr->SetXTitle("Incoming Neutron Energy (MeV)"); hr->SetYTitle("Cross-Section (barns)"); hr->SetTitle("U-238 n,Fiss Cross-Section"); hr->GetXaxis()->CenterTitle(1); hr->GetYaxis()->CenterTitle(1); c1->GetFrame()->SetFillColor(kWhite); c1->GetFrame()->SetBorderSize(12); /// Define Data Sets into plottable functions, set draw options TGraphErrors *grK = new TGraphErrors(j-1,xK,yK,dxK,dyK); TGraphErrors *gr = new TGraphErrors(i-1,x,y,dx,dy); TGraphErrors *grC = new TGraphErrors(k,xC,yC); gr->SetMarkerStyle(20); gr->SetMarkerSize(1); gr->SetLineColor(2); gr->SetMarkerColor(2); gr->SetFillColor(2); gr->SetTitle("U-238 n,fiss Cross-Section"); grC->SetLineColor(8); grC->SetMarkerColor(8); grC->SetLineWidth(4); grK->SetMarkerStyle(22); grK->SetMarkerSize(1); grK->SetMarkerColor(4); grK->SetLineColor(4); grK->SetFillColor(4); gr->Draw("p"); if(exforCheck==1) grK->Draw("p"); if(endfCheck==1) grC->Draw("l"); /// Define Legend, Set Options, etc TLegend *leg = new TLegend(0.12,0.75,0.3,0.9); leg->AddEntry("gr","UKy Prelim Data","p"); if(exforCheck==1) leg->AddEntry("grK","World Data (EXFOR)","p"); if(endfCheck==1) leg->AddEntry("grC","JENDL Calculation","l"); leg->SetFillColor(kWhite); leg->Draw(); //c1->Update(); }