{ TCanvas* c1=new TCanvas("c1","damage table",1200,800); c1->Divide(3,2); double par[8]; TF1 *fcn=0; std::ofstream fout("damagefcn.txt"); c1->cd(1); TGraph *gr_n=new TGraph("n.dat","%lg %lg"); gr_n->SetTitle("neutron; Momentum (GeV) ; Eequivalent-Damage-to-1MeV-Neutron"); gr_n->SetMarkerStyle(4); gr_n->SetMarkerColor(1); gr_n->Draw("AP"); gr_n->Fit("pol7","R","",0.02,1.05); fcn=(TF1*) gr_n->GetListOfFunctions()->FindObject("pol7"); fcn->GetParameters(par); fout<<"static double n_par[]={\n\t"; for(int i=0;i<7;i++) fout<cd(2); TGraph *gr_n_low=new TGraph("n_low.dat","%lg %lg"); gr_n_low->SetTitle("low energy neutron; Momentum (GeV) ; Eequivalent-Damage-to-1MeV-Neutron"); gr_n_low->SetMarkerStyle(4); gr_n_low->SetMarkerColor(3); gr_n_low->Draw("AP"); gr_n_low->Fit("pol7","R","",0.0001,0.02); fcn=(TF1*) gr_n_low->GetListOfFunctions()->FindObject("pol7"); fcn->GetParameters(par); fout<<"static double n_low_par[]={\n\t"; for(int i=0;i<7;i++) fout<cd(3); TGraph *gr_e=new TGraph("electron.dat","%lg %lg"); gr_e->SetTitle("electron; Momentum (GeV) ; Eequivalent-Damage-to-1MeV-Neutron"); gr_e->SetMarkerStyle(4); gr_e->SetMarkerColor(2); gr_e->Draw("AP"); gPad->SetLogx(); //gr_e->Fit("pol7","R","",0.0001,0.5); //fcn=(TF1*) gr_e->GetListOfFunctions()->FindObject("pol7"); fcn->GetParameters(par); fout<<"static double electron_par[]={\n\t"; for(int i=0;i<7;i++) fout<cd(4); TGraph *gr_pi=new TGraph("pion.dat","%lg %lg"); gr_pi->SetTitle("pion; Momentum (GeV) ; Eequivalent-Damage-to-1MeV-Neutron"); gr_pi->SetMarkerStyle(4); gr_pi->SetMarkerColor(4); gr_pi->Draw("AP"); gPad->SetLogx(); gr_pi->Fit("pol7","R","",0.0001,0.98); fcn=(TF1*) gr_pi->GetListOfFunctions()->FindObject("pol7"); fcn->GetParameters(par); fout<<"static double pion_par[]={\n\t"; for(int i=0;i<7;i++) fout<cd(5); TGraph *gr_pr=new TGraph("proton.dat","%lg %lg"); gr_pr->SetTitle("proton; Momentum (GeV) ; Eequivalent-Damage-to-1MeV-Neutron"); gr_pr->SetMarkerStyle(4); gr_pr->SetMarkerColor(6); gPad->SetLogx(); //gr_pr->Fit("pol7","R","",0.0001,10.0); //fcn=(TF1*) gr_pr->GetListOfFunctions()->FindObject("pol7"); fcn->GetParameters(par); fout<<"static double proton_par[]={\n\t"; for(int i=0;i<7;i++) fout<DrawClone("AP"); c1->cd(6); gr_pr->SetTitle("all"); gPad->SetLogx(); gPad->SetLogy(); gr_pr->Draw("AP"); gr_n->Draw("psame"); gr_n_low->Draw("psame"); gr_e->Draw("psame"); gr_pi->Draw("psame"); c1->cd(0); c1->SaveAs("Damage.png"); }