Area inside a contour in TF2 draw

Hello experts

I have copied the code bellow. In the code I have two contour at (f2->GetMaximum()-0.5) and (f2->GetMaximum()-2). Could you please help to find the area enclosed by these two contours and their semi major and semi minor axis(i.e r1 and r2 of ellipse).

``````void test1()
{
TF2 *f2= new TF2("f2","(-(8.83+x*0.2169+y*0.8139)+(10*log(8.83+x*0.2169+y*0.8139))-(10*log(10))+10-(6.342+x*0.05957+y*2.5286)+(6*log(6.342+x*0.05957+y*2.5286))-(6*log(6))+6)",-20,50,-2.,2.);
TF2 *f2_= new TF2("f2_","(((-8.83-x*0.2169)+(10*log(8.83+x*0.2169))-(10*log(10))+10)+((-6.34195-y*2.529)+(6*log(6.34195+y*2.529))-(6*log(6))+6))",-20,50,-2.5,3);
//f2->Draw();

Double_t co=-0.1;
Double_t coh=2;
cout<<"GetMaximum=  "<<f2->GetMaximum()<<endl;
cout<<"GetMaximumXY=  "<<f2->GetMaximumXY(co,coh)<<endl;
std::cout << "GetMaximumXY = " << f2->GetMaximumXY(co, coh) << " at ( " << co << " , " << coh << " )" << std::endl;
Double_t maximum = f2->GetMaximum();
double contours[2];
contours[0] = (maximum-2);
contours[1] = (maximum-0.5);
int colors[2] = {1,1};
//likelihood_2d_->SetPalette(2,colors);
f2->SetContour(2,contours);

Double_t maximum_ = f2_->GetMaximum();
double contours_[2];
contours_[0] = (maximum_-2);
contours_[1] = (maximum_-0.5);
int colors_[2] = {1,1};
//likelihood_2d_->SetPalette(2,colors);
f2_->SetContour(2,contours_);

TCanvas* c=new TCanvas("c","c",400,600);
c->Divide(2,2);
c->cd(1);
f2->Draw("cont1");
c->cd(2);
f2_->Draw("cont1");
}
``````

_ROOT Version: ROOT 6.14/00
Platform: Not Provided
Compiler: Not Provided

Hi @prsaha

Our graphics expert @couet will answer your question as soon as he is back from vacation, thank you for your patience!

Hi
For more clarity in my question I am adding this google drive link: https://drive.google.com/file/d/1P45vCwHUTod8oeR4CxSJjN555vkAUzxP/view?usp=sharing

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

May be you can get the list of contours as shown here:
You will then have the corresponding TGraph …