{ vector vec, prob1, prob2; double sigma; while(sigma<4.5) { vec.push_back(sigma); prob1.push_back(1.-TMath::Prob(sigma*sigma,1)); prob2.push_back(1.-TMath::Prob(sigma*sigma,2)); sigma += 0.05; } TCanvas *c1 = new TCanvas(); c1->SetGrid(); TGraph *g1 = new TGraph(vec.size(),vec.data(),prob1.data()); g1->SetLineWidth(2); g1->GetXaxis()->SetTitleSize(0.05); g1->GetYaxis()->SetTitleSize(0.05); g1->GetXaxis()->SetTitle("n (#sigma)"); g1->GetYaxis()->SetTitle("Probability"); g1->Draw(); TGraph *g2 = new TGraph(vec.size(),vec.data(),prob2.data()); g2->SetLineWidth(2); g2->SetLineColor(kRed); g2->Draw("same"); TLegend *leg1 = new TLegend(0.55,0.2,0.88,0.33); leg1->AddEntry(g1,"g1 p(n) in 1D","L"); leg1->AddEntry(g2,"g2 p(n) in 2D","L"); leg1->Draw(); }