NAN error when fiting the extended PDF

Dear all,

I’m trying to fit a multidimensional PDF defined as:
RooGenericPdf fce(“fce”,“fce”,"(Accept*(1+acos(PhiS)+bcos(2PhiS)+MeanPdilution*(csin(PhiS)+Depolarization1(dsin(PhiCS+PhiS)+esin(PhiCS-PhiS))+Depolarization2*(fsin(2PhiCS+PhiS)+gsin(2PhiCS-PhiS)))))^(320/Nsubpercell)",fitset);

Where Accept, a, b, c, d, e, f, and g are fitting parameters, and PhiS, PhiCS, MeanP, dilution, Depolarization1, Depolarization2, and Nsubpercell are arguments of the data read from a TTree.

Extended PDF is created as follows:
RooExtendPdf efce(“efce”,“extended DY UML”,fce,Nsig);

And fitted to the dataset d1 (sample from original dataset “euml” for certain category bin and period):
RooFitResult* r = efce.fitTo(*d1,NumCPU(4), Extended(), SumW2Error(true));

And this is the sample of the outcome from the terminal:

RooDataSet::euml[MeanP,dilution,Depolarization1,Depolarization2,PhiCS,PhiS,bin,period,Nsubpercell] = 1374 entries
[#1] INFO:Minization – RooMinimizer::optimizeConst: activating const optimization
[#1] INFO:NumericIntegration – RooRealIntegral::init(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]) using numeric integrator RooAdaptiveIntegratorND to calculate Int(MeanP,dilution,Depolarization1,Depolarization2,PhiCS,PhiS,Nsubpercell)
[#1] INFO:NumericIntegration – RooRealIntegral::init(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]) evaluation requires 7-D numeric integration step. Evaluation may be slow, sufficient numeric precision for fitting & minimization is not guaranteed
[#0] WARNING:NumericIntegration – RooAdaptiveIntegratorND::dtor(fce) WARNING: Number of suppressed warningings about integral evaluations where target precision was not reached is 3
[#1] INFO:Eval – RooAbsTestStatistic::initMPMode: started 4 remote server process.


** 1 **SET PRINT 1



** 2 **SET NOGRAD


PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 Accept 2.00000e+02 1.00000e+02 0.00000e+00 3.00000e+03
2 Nsig 1.37400e+03 6.82000e+02 1.00000e+01 1.00000e+04
3 a 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
4 b 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
5 c 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
6 d 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
7 e 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
8 f 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00
9 g 0.00000e+00 2.00000e-01 -1.00000e+00 1.00000e+00


** 3 **SET ERR 0.5



** 4 **SET PRINT 1



** 5 **SET STR 1


NOW USING STRATEGY 1: TRY TO BALANCE SPEED AGAINST RELIABILITY


** 6 **MIGRAD 4500 1


FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.
[#0] WARNING:Minization – RooMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
Parameter values: Accept=200, Nsig=1374, a=0, b=0, c=0, d=0, e=0, f=0, g=0
PID40616/RooRealMPFE::nll_efce_euml_7fb34d90b800_MPFE2[ arg=nll_efce_euml_GOF2 vars=(Accept,Nsig,a,b,c,d,e,f,g) ]
function value is NAN @ !sumList=(bin = qt1(idx = 1)
,period = P07(idx = 1)
), !intList=(MeanP = 0,dilution = 0.25,Depolarization1 = 0,Depolarization2 = 0.5,PhiCS = 0,PhiS = 0,Nsubpercell = 5000), !anaList=(), !jacList=(), !facList=(), !func=fce=1.40367, !sumCat=(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]_sumCat = {qt1;P07}(idx = 0)
)
function value is NAN @ !sumList=(bin = qt1(idx = 1)
,period = P07(idx = 1)
), !intList=(MeanP = 0,dilution = 0.25,Depolarization1 = 0,Depolarization2 = 0.5,PhiCS = 0,PhiS = 0,Nsubpercell = 5000), !anaList=(), !jacList=(), !facList=(), !func=fce=1.40367, !sumCat=(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]_sumCat = {qt1;P07}(idx = 0)
)
function value is NAN @ !sumList=(bin = qt1(idx = 1)
,period = P07(idx = 1)
), !intList=(MeanP = 0,dilution = 0.25,Depolarization1 = 0,Depolarization2 = 0.5,PhiCS = 0,PhiS = 0,Nsubpercell = 5000), !anaList=(), !jacList=(), !facList=(), !func=fce=1.40367, !sumCat=(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]_sumCat = {qt1;P07}(idx = 0)
)
PID40617/RooRealMPFE::nll_efce_euml_7fb34d90b800_MPFE3[ arg=nll_efce_euml_GOF3 vars=(Accept,Nsig,a,b,c,d,e,f,g) ]
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)
RooNLLVar::nll_efce_euml[ paramSet=(Accept,Nsig,a,b,c,d,e,f,g) ]
function value is NAN @ paramSet=(Accept = 200,Nsig = 1374,a = 0,b = 0,c = 0,d = 0,e = 0,f = 0,g = 0)

START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM .LT. 1.00e-03
[#1] INFO:NumericIntegration – RooRealIntegral::init(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]) using numeric integrator RooAdaptiveIntegratorND to calculate Int(MeanP,dilution,Depolarization1,Depolarization2,PhiCS,PhiS,Nsubpercell)
[#1] INFO:NumericIntegration – RooRealIntegral::init(fce_Int[Depolarization1,Depolarization2,MeanP,Nsubpercell,PhiCS,PhiS,bin,dilution,period]) evaluation requires 7-D numeric integration step. Evaluation may be slow, sufficient numeric precision for fitting & minimization is not guaranteed

Only the power exponent (320/Nsubpercell) is making the problem, when erased, the fitting works fine. Btw. the Nsubpercell is an integer number with 12 possible values varying from 100 to 500, I checked that none of them is 0. I tried to play with the function to ensure that it’s higher than zero, by inserting absolute value. Even then it gives the same errors. It seems to me that the issue might be with the numerical integration…
Does anyone please has any idea what might be the problem?

Thank you for any help!

Did you initialize the parameters to values that sort of match your distribution?

Can you send code (with the necessary data) that we can run and that shows the problem?

Axel.

I restrained the fitting parametres from -1 to 1, and initialized to zero.
I attach the code and data:

EUML_test.C (4.3 KB)
P07new.root (159.7 KB)

Thanks!

You’re initializing Nsubpercell to 0 and then doing ^(320/Nsubpercell). That’s probably going to hurt…

Axel.

You mean this initialization: RooRealVar Nsc (“Nsubpercell”,“Nsubpercell”, 0, 10000); ?
I thought that if there are given values taken from the tree, then it doesn’t care for the initial limits, but obviously it does… Ok, now it seems to work now!
Thanks a lot :slight_smile:

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