Cannot set parameters for TF2 function

I defined a TF2 function with 12 parameters, which I want to use in a histogram fit, but I cannot set the parameters using the ->SetParameters(…) method.

I used the following to define the function:
TF2 *fit_back_ridge = new TF2(“fit_back_ridge”, gauss2d_back_ridge, 1330, 1390, 1330, 1390, 12);

Then,
fit_back_ridge->SetParameters(2, 5, 1362, 4, 5, 1362, 4, 80, 1362, 4, 1362, 4);

but I get

Error: Can’t call TF2::SetParameters(2,5,1362,4,5,1362,4,80,1362,4,1362,4) in current scope (tmpfile):1:
Possible candidates are…
(in TF2)
(in TF1)
(in TFormula)
/opt/root/lib/libHist.so -1:-1 0 public: virtual void TFormula::SetParameters(const Double_t* params);
/opt/root/lib/libHist.so -1:-1 0 public: virtual void TFormula::SetParameters(Double_t p0,Double_t p1,Double_t p2=0,Double_t p3=0,Double_t p4=0,Double_t p5=0,Double_t p6=0,Double_t p7=0,Double_t p8=0,Double_t p9=0,Double_t p10=0); //MENU
*** Interpreter error recovered ***

Is there a limit for parameters? I do not understand what causes the error.

As the compiler correctly reports, the 2 prototypes for SetParameters are

virtual void SetParameters(const Double_t *params); virtual void SetParameters(Double_t p0,Double_t p1,Double_t p2=0,Double_t p3=0,Double_t p4=0, Double_t p5=0,Double_t p6=0,Double_t p7=0,Double_t p8=0, Double_t p9=0,Double_t p10=0); // *MENU*
If you have more than 10 parameters you should use the first form.

Rene

I was able to set the parameters now using a Double_t array and can verify the parameters with the GetParameter(…) method, but when I try to Draw(), I get a plot with value zero everywhere. Histogram’s Fit() method also doesn’t seem to work. Are these also limited in parameters?

Our usual request: post teh shortest possible script reproducing your problem?
and check the calls to your functions in the header files.

Rene

When I tried to reproduce the error, after starting and exiting root many times, it can’t reproduce the error and things seem to work. I’m not sure what caused the problem before.

Thanks for your help!