void example2dGausContour() { // draw 1-sigma and 2 s-gma contour of a 2d correlated gaussian // Definition of 1 sigma contour is the contour which has a prob content of 0.708 // which is normal_cdf(1,1)^2 // TCanvas *c = new TCanvas("c","Contours",0,0,800,700); TF2 *f2 = new TF2("f1","bigaus"); //TF2 *f2 = new TF2("f2","std::log(bigaus)"); f2->SetFillStyle(1000); f2->SetLineWidth(1); f2->SetRange(-5,-5,5,5); f2->SetParameters(1,0,1,0,1,0); f2->SetNpx(1000); f2->SetNpy(1000); double contours[2]; // determine level of gaussian at 1 and 2 sigma using a non-correlated 2d gaussian // corr factor needed because the constant term is different in the case of a correlated 2d-gaussian double corr = f2->Eval(0,0)/ROOT::Math::bigaussian_pdf(0,0,1,1,0); contours[0] = corr*ROOT::Math::bigaussian_pdf(2,2,1,1,0); //0.05; contours[1] = corr*ROOT::Math::bigaussian_pdf(1,1,1,1,0); f2->SetContour(2,contours); Int_t colors[2] = {kYellow, kGreen}; gStyle->SetPalette(2,colors); f2->Draw("cont0 z"); f2->Draw("cont3 same"); }