Hi,
I want to determine the distance minimum between a point and a function. I do this to in a view to test if the cinematic lines (E = f(Theta) ) I get experimentally match with the expected ones.
I don’t get why the simple code below doesn’t work.
TCanvas *c1 = new TCanvas("c1","c1",100,100);
TF1 *f1 = new TF1("f1","pol1",100,180);
f1->SetParameter(0,1000);
f1->SetParameter(1,-1);
c1->cd();
f1->Draw();
c1->Update();
Float_t MM_E = 880;
Float_t angl = 110;
Int_t pixelY = c1->YtoPixel(MM_E);
Int_t pixelX = c1->XtoPixel(angl);
cout<<endl<<angl<<" "<<MM_E<<" "<<f1->Eval(angl)<<" # "<<pixelX<<" "<<pixelY<<" "<<c1->YtoPixel(f1->Eval(angl))<<endl;
cout<<f1->GetObjectInfo(pixelX,pixelY)<<endl;
cout<<f1->DistancetoPrimitive(pixelX,pixelY)<<endl;
It breaks when I call the DistancetoPrimitive function.
thanks for your help,
jo