Dear Rooters,
I would like to draw a convergence ellipse for a certain intervall (for example 1,2,3 sigma) in 2 dimensions on a set of x/y-coordinates. Let me provide you most important part of the code:
int nevt = tree->Draw("y:x","","goff");
double *Xt = tree->GetV2();
double *Yt = tree->GetV1();
double_t x0 = TMath::Mean(nevt,Xt);
double_t sx = TMath::StdDev(nevt,Xt);
double_t y0 = TMath::Mean(nevt,Yt);
double_t sy = TMath::StdDev(nevt,Yt);
TF2 *f = new TF2("f", "ROOT::Math::bigaussian_pdf(x, y, [1], [3], [4], [0], [2])", -0.1, 0.1, -0.1, 0.1);
f->SetParNames("x0", "sigmax", "y0", "sigmay", "rho"); // note: -1 < rho < 1
f->SetParameter(0, x0);
f->SetParameter(1, sx);
f->SetParameter(2, y0);
f->SetParameter(3, sy);
f->SetParameter(4, 0.01);
f->SetParLimits(4,-1,1);
//[Doing the fit routine... not important here... I used a unbinned likelihood fit here... but this is not important....this part is working]
f->SetNpx(100); f->SetNpy(100);
x0 = f->GetParameter(0);
y0 = f->GetParameter(2);
Double_t sigmax = f->GetParameter(1);
Double_t sigmay = f->GetParameter(3);
Double_t rho = f->GetParameter(4);
double factor = 1./(2*3.1415*sigmax*sigmay*sqrt(1-(rho*rho)));
//Here is the point... which parameters do I have to use for a certain intervall?
double contours[] = {0.0001*factor, 0.001*factor, 0.01*factor, 0.1*factor,1*factor};
f->SetContour(5, contours);
f->Draw("cont1z");
tree->Draw("y:x","","same *");
As you can see, I can draw the ellipses from the contour-plot, but I’m not sure how to calculate a certain z-height for my wished confidence intervall…
Of course I can setup the convergence matrix, calculate the eigenvectors and so on, but there is no easy way to draw the ellipse either…
any hint?
Additional info:
Of course I know, that bigaussian_pdf is a pdf-function, that means that the integral inside by ellipse must be equal to the given confidence interval (e.g. 0.95)
The area of an ellipse is
A=PI*a*b.
But this doesn’t help me either, as the parameters sigmax and sigmay of the bigaussian_pdf are with respect to the coordinate system, not with respect to rho
Is there a way to calculate the principal axes from sigmax, sigmay and rho?
Thanks
Georg
_ROOT Version: 6.28/06
_Platform: Windows