I think my issue comes from the
RooLinearVar to get my function in the range of definition of vavilov function. I tried to fit a vavilov to a gaussian but could not manage to. So lets take this example of a gaussian
Double_t mean = 10;
Double_t sigma = 4 ;
Double_t minX= 0;
Double_t maxX = 40;
RooRealVar x("E","E", minX, maxX);
RooRealVar mg2("mean2","mean2",mean) ;
RooRealVar sg2("sigma2","sigma2",sigma) ;
RooGaussian gauss2("gauss2","gauss2",x,mg2,sg2) ;
RooDataSet* data = gauss2.generate(x,10000) ;
RooRealVar kappa("kappa","kappa vavilov",1,0.01,10);
RooRealVar beta2("beta2","beta2 vavilov",0.2,0,1);
RooFunctorPdfBinding vaviPdf("vavi", "Bound vavilov", vaviFunc,RooArgList(y,kappa,beta2));
From plotting the Tmath::Vavilov I found out that the function is defined on -5,50 (see attached VavilovTmath.pdf (13.8 KB) ) which comes from precision requirement if i am not wrong. Actually, those limits vary depending on kappa and beta2 -5,50 is the biggest range, and outstide the pdf becomes 0. For gaussian limits it would be worse as vavilov function in root is defined only on a limited range.
As vavilov’s limit is gaussian for kappa>10, fitting a gaussian by another close to gaussian should work well… However, vavilov gaussian limit fits only in a certain range thus, as we discussed quite early on, using the
RooLinearVar as solution.
RooLinearVar y("xbis", "x shifted", x,slope,offset);
But I can’t manage to find a & b adequate for Gaussian (would be worse in the case of my own data) as I get the following error:
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: beta2=0.260287, kappa=9
RooNLLVar::nll_vavi_gauss2Data[ paramSet=(beta2,kappa) ]
getLogVal() top-level p.d.f evaluates to zero
and a failed to fit. By cheating I would need to make the gaussian parameters through the RooLinearVar, to equals the expected Vavilov gaussian one:
But even then those varies depending of the parameters of the vavilov function trying to fit.
Is there a way to get passed this issue ? Am I doing it the wrong way? please correct me