Integral of a subpart of a pdf

Hello,

*i tried to have a integral under the pdf of a given range, but i didn’t success. Would you know what is the problem ?

here is an example :
let’s consider the RooRealVar EtCone40_over_pt which is defined in the range -0.5 and 1.5 :

EtCone40_over_pt->setRange(“mywindow”,-0.5,1.5);

//i have a pdf, which is a RooKeysPdfs : Pdf_Photon
//i would like to know the integral under the values 0.6 and 0.7 : it should much more below 1 since integral over the whole range is 1 :

EtCone40_over_pt->setRange(“integralRange”,0.6,0.7);

RooAbsReal *fractionOfInt=Pdf_Photon->createIntegral(*EtCone40_over_pt,RooFit::NormSet(*EtCone40_over_pt),RooFit::Range(“integralRange”));

cout << “normalizeIntegral=” << fractionOfInt->getVal() << endl;

// when launching the program, i obtain 1 exactly for the subrange integral : impossible

would you know what i did wrong ?

*i tried to follow the recipe of RooFit Users manual v2.91-33, page 21, 22
of the RooExtendPdf

but when doing the fit, i obtain crazy results. By looking at the log, i see some “Blind” text, so maybe, i am wondering if by default a blind stuff is done. In this case, how to remove it ?

thank you

Hi,

The code you show looks correct to me. I created this small test macro to do what you do on a KeysPdf

void ktest()
{
RooWorkspace w(“w”,1) ;
w.factory(“Gaussian::g(x[-10,10],0,3)”) ;

RooDataSet* d = w::g.generate(w::x,1000) ;
RooKeysPdf k(“k”,“k”,w::x,*d) ;
w::x.setRange(“r”,-3,3) ;

RooAbsReal* frac = k.createIntegral(w::x,NormSet(w::x),Range(“r”)) ;
frac->Print() ;
}

and I get the correct answer:

RooRealIntegral::k_Int[x|r]_Norm[x][ Int k_Norm(x) dNum ] = 0.663637

What ROOT version are you using?

Wouter