//2D gaussian function Double_t Gaus2D(Double_t *x, Double_t *par) { Double_t r1 = Double_t((x[0]-par[1])/par[2]); Double_t r2 = Double_t((x[1]-par[3])/par[4]); return par[0]*TMath::Exp(-0.5*(r1*r1+(par[5]*r1*r2)+r2*r2)); } //Draw circle with holes TCanvas *circle_with_holes(){ TCanvas *c1 = new TCanvas("c1", "c1", 500, 500); c1->cd(); //define 2D gaussian function TF2* fgaus2d = new TF2("gaussian_fill", &Plotters::Gaus2D, -3, 3, -3, 3, 6); fgaus2d->SetParameters(1.,0,1,0,1,0); fgaus2d->SetParNames("norm","xmean","xsigma","ymean","ysigma","orientation"); //fill random gaussian histogram TH2D* hist = new TH2D("hist","2D gaussian",100,-2,2,100,-2,2); hist->FillRandom("gaussian_fill", 100000); hist->Draw("colz"); TEllipse *circle = new TEllipse(0.5, 0.5, 0.4); circle->SetLineWidth(6); circle->SetFillStyle(1001); //solid circle->SetFillColor(kGray); circle->Draw("Lf"); TEllipse *hole1 = new TEllipse(0.4, 0.4, 0.1); hole1->SetLineWidth(6); hole1->SetFillStyle(0); //hollow hole1->Draw("L"); TEllipse *hole2 = new TEllipse(0.6, 0.6, 0.1); hole2->SetLineWidth(6); hole2->SetFillStyle(0); //hollow hole2->Draw("L"); return c1; }