GetRange is protected witihin this context

Hey there,

The official TF1 class reference says, that there is a public member function of TF1 called GetRange(), which takes two pointers to doubles. For me calling this results an error message of "GetRange() is protected within the context". Is this a bug? There is a version of this very same function taking two variables by reference, that works just fine.

Cheers,
Adam Hunyadi

Which version of ROOT are you using? It works for me with the master. For example:

   Double_t x, y;
   TF1 *fit_x = new TF1("fit_x", "gaus", -2.0, 2.0);
   fit_x->GetRange(&x, &y);
   cout << "GetRange(&x, &y): x = " << x << "; y = " << y << endl;
   fit_x->GetRange(x, y);
   cout << "GetRange(x, y): x = " << x << "; y = " << y << endl;

gives:

GetRange(&x, &y): x = -2; y = 2
GetRange(x, y): x = -2; y = 2

Using ROOT 6.08/07 this produces an error:

void fun_test(const TF1* t_fun) // This should be fun, but it is not :(
{
   double keyMin = 0;
   double keyMax = 0;
   t_fun -> GetRange(&keyMin, &keyMax);
   // According to the ref. I should be able to call this from within const context
}

Yes, in ROOT v6.08 the GetRange(Double_t * xmin, Double_t * xmax) method is declared as protected. (you can check in $(ROOTSYS)/include/TF1.h)

Shouldn’t the doxygen class reference remove it from the public interface too?

https://root.cern.ch/doc/master/classTF1.html#ad2982f3c071ee38f903a6c2c7c2d4203

Nope, because in the master it is public… :wink:
The documentation for the 6.08 version is:
https://root.cern.ch/doc/v608/classTF1.html

2 Likes

Ah, I did not realize there was a new release since then :smiley:

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