ERROR:Eval -- RooAbsReal::logEvalError(xxx) evaluation error

Hello RooFit experts,

I have constructed a RooAbsPdf class by “RooClassFactory”. It is named RooPwaveBW which is a P-wave Breit-Wigner formula, and the code as follow. When I do fitting data, I got the error reminder:
[#0] ERROR:Eval – RooAbsReal::logEvalError(Q_pdf_sig) evaluation error,
origin : RooPwaveBW::Q_pdf_sig[ x=massQ mean0=Q_mean1 width0=Q_sigma1 ]
message : p.d.f value is Not-a-Number (nan), forcing value to zero
server values: x=massQ=0, mean0=Q_mean1=0.00424075 +/- 0.00141225, width0=Q_sigma1=0.000153 +/- 0.00222838

Then, I tried to only plot RooPwaveBW with mean0 and sigma0 fixed, but I still get the same error reminder:
[#0] ERROR:Eval – RooAbsReal::logEvalError(Q_pdf_sig) evaluation error,
origin : RooPwaveBW::Q_pdf_sig[ x=massQ mean0=Q_mean1 width0=Q_sigma1 ]
message : p.d.f value is Not-a-Number (nan), forcing value to zero
server values: x=massQ=0, mean0=Q_mean1=0.00585, width0=Q_sigma1=0.000153

The error claims that I use a non-number pdf. But I have checked the P-wave Breit_Wigner formula several times, and it is right. So I don’t know how to resolve the bug. Do you have any advice? Thank you!

#include "RooPwaveBW.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include <math.h>
#include "TMath.h"

ClassImp(RooPwaveBW)

 RooPwaveBW::RooPwaveBW(const char *name, const char *title,
                        RooAbsReal& _x,
                        RooAbsReal& _mean0,
                        RooAbsReal& _width0) :
   RooAbsPdf(name,title),
   x("x","x",this,_x),
   mean0("mean0","mean0",this,_mean0),
   width0("width0","width0",this,_width0)
 { 
 } 

 RooPwaveBW::RooPwaveBW(const RooPwaveBW& other, const char* name) :   
   RooAbsPdf(other,name), 
   x("x",this,other.x),
   mean0("mean0",this,other.mean0),
   width0("width0",this,other.width0)
 { 
 } 

 Double_t RooPwaveBW::evaluate() const 
 { 
   // ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE 
   //return 1.0 ; 

   Double_t Md0 = 1.86486;
   Double_t Mpi = 0.13957;
   Double_t Mpl = Md0 + Mpi;
   Double_t Mmi = Md0 - Mpi;

   //Double_t Mdst0 = 2.01028;
   Double_t Mdst0 = mean0 + Mpl;
   Double_t Pdst0 = TMath::Sqrt((Mdst0*Mdst0-Mpl*Mpl)*(Mdst0*Mdst0-Mmi*Mmi))/(2.0*Mdst0);
   Double_t Mdst  = x + Mpl;
   Double_t Pdst  = TMath::Sqrt((Mdst*Mdst-Mpl*Mpl)*(Mdst*Mdst-Mmi*Mmi))/(2.0*Mdst);

   Double_t width = width0*TMath::Power((Pdst/Pdst0),3)*TMath::Power((Mdst0/Mdst),2);
   Double_t Arg = x - mean0;
   Double_t BW_Value = width/(Arg*Arg+0.25*width*width);

   return BW_Value;
 }

Hi,

The claim of this message is very specific: if you choose your observables
and parameters as follows

massQ=0
Q_mean1 = 0.00424075
Q_sigma1= 0.000153

the normalized evaluates to not-a-number. This can be either because the
expression returned by RooPwaveBW::evaluate() is a NaN expression,
or the normalization integral over the observable (massQ I presume) comes
out to zero so that the normalized pdf expression (=evaluate() / [numeric] integral of evaluate() over massQ ]
becomes a NaN.

You should be able to reproduce this by hand in your macro by setting the above parameter and observable values
and then calling pdf.getVal(RooArgSet(massQ)) to obtain the normalized pdf value w.r.t observable
massQ. Can you check that?

Wouter

Hi, Wouter,

Thank you very much! According to your suggestion, I do fitting from 0.001 avoiding to include massQ=0, then the bug eliminated.

Sheridan