Hi,

I’ve been writing a RooFit class with three variables defined as follows

RooFunction_1::RooFunction_1(const char *name, const char *title,

RooAbsReal& _var1, RooAbsReal& _var2, RooAbsReal& _var3,

RooAbsReal& _par1, RooAbsReal& _par2, RooAbsReal& _par3, RooAbsReal& _par4)

(the analytical integral has been evaluated to help the fitter).

Then I generated toy experiments from this formula and I tried to fit on them to test

my fitter. Both fixing some parameters to the generated values and leaving all of them free to float, the fit always converged.

Unfortunately, the real formula has an additional dependence on a fourth variable

RooFunction_2::RooFunction_2(const char *name, const char *title,

RooAbsReal& _var1, RooAbsReal& _var2, RooAbsReal& _var3, RooAbsReal& _var4,

RooAbsReal& _par1, RooAbsReal& _par2, RooAbsReal& _par3, RooAbsReal& _par4)

Then I generated toy experiments from this class and I tried to fit. In this case, I never have convergence for the fit. Even if I fix all the parameters to the generated values but one.

Where is the difference between defining a class with three or four variables? Did anyone find something similar before? Am I making any trivial mistake?

Thanks a lot for hints or help

ciao

giordano

When I defined the getAnalyticalIntegral I didn’t declare all the variables in matchArgs:

Int_t RooFunction_2::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const

{

if (matchArgs(allVars,analVars,var1,var2,var3,var4)) return 1;

else

return 0 ;

}

The weird thing is: I only declared one variable even for the three variables roofit class but everything was working…

I am testing more now to figure out if this is the real problem or not!

thanks for asking

ciao

giordano

Hi Giordano,

In general, the getAnalyticalIntegral() function can advertise multiple intergals including partial integrals. So if you ‘forget’ one, what you are really doing is advertising a lower dimensional analytical integral that is complemented by a numeric integral by RooFit.

Fits that require normalizations which involve numeric integration over two or more

observables are typically more difficult in convergence because multi-dimensional numeric integrals are difficult.

To help you debug such things in the future you should activate the INFO level output string on the integration to see exactly what considerations RooFit makes in its integral construction

RooMsgService::instance().addStream(RooMsgService::INFO,Topic(RooMsgService::Integration)) ;

You can see additional examples on how to control the message service here

```
$ROOTSYS/tutorials/roofit/rf506_msgservice.C
```

Wouter