void chi2Draw(double r=1., double x0=0.) { gSystem->Load("libMathCore"); //Double_t r=4.; //Double_t x0=0.; TCanvas* c1 = new TCanvas("c1", "chi", 100, 10, 700, 700); TF1 *pdf1 = new TF1("pdf1", "ROOT::Math::chisquared_pdf(x, [0], [1])",0,13); TF1 *pdf2 = new TF1("pdf2", "ROOT::Math::chisquared_pdf(x, [0], [1])",0,13); TF1 *pdf3 = new TF1("pdf3", "ROOT::Math::chisquared_pdf(x, [0], [1])",0,13); TF1 *pdf4 = new TF1("pdf4", "ROOT::Math::chisquared_pdf(x, [0], [1])",0,13); TF1 *pdf8 = new TF1("pdf8", "ROOT::Math::chisquared_pdf(x, [0], [1])",0,13); pdf1->SetParameters(r,x0); pdf1 -> SetLineColor(kBlack); pdf1 -> Draw(); pdf1->GetYaxis()->SetRangeUser(0.,0.5); r+=1; pdf2->SetParameters(r,x0); pdf2 -> SetLineColor(2); pdf2 -> Draw("SAME"); r+=1; pdf3->SetParameters(r,x0); pdf3 -> SetLineColor(3); pdf3 -> Draw("SAME"); r+=1; pdf4->SetParameters(r,x0); pdf4 -> SetLineColor(4); pdf4 -> Draw("SAME"); r=8; pdf8->SetParameters(r,x0); pdf8 -> SetLineColor(6); pdf8 -> Draw("SAME"); TLegend* tL = new TLegend(); tL->AddEntry(pdf1,"ndf=1","L"); tL->AddEntry(pdf2,"ndf=2","L"); tL->AddEntry(pdf3,"ndf=3","L"); tL->AddEntry(pdf4,"ndf=4","L"); tL->AddEntry(pdf8,"ndf=8","L"); tL->Draw(); }