Integrate over a subrange from a fitted function in RooFit

Dear all,
I have done a fit in roo fit using the following:

RooRealVar m(“m”, “m”, 90, 80, 100);
RooRealVar s(“s”, “s”, 3, 0, 10);
RooRealVar a(“a”, “a”, 5, 0, 10);
RooRealVar n(“n”, “n”, 100, -200, 200);
RooRealVar c1(“c1”, “c1”, -0.2, -1, 0);
RooRealVar x(“x”, “x”, 70, 110);
RooCBShape signal(“signal”, “signal”, x, m, s, a, n);
RooExponential background(“background”, “background”, x, c1);
RooRealVar sig(“sig”, “sig”, 50000, 0, 1000000);
RooRealVar bgd(“bgd”, “bgd”, 50000, 0, 100000);
RooAddPdf SigPlusBG(“SigPlusBG”, “SigPlusBG”, RooArgList(signal, background), RooArgList(sig, bgd));
RooDataHist data1(“data1”, “data1”, x, hist);
SigPlusBG.fitTo(data1, “qe”);

where hist is my histogram read from the ntuple.
I now want to get the number of events in the signal function. If I do
double N1=sig.getVal();
this gives me the correct answer (about 800) for the fitting range 70-110. But how do I get the number of events in a subrange (say 80-100)? I tried to do the following:

RooRealVar integrationVar(“integrationVar”, “integrationVar”, 50000, 0, 10000000);
integrationVar.setRange(“integralRange”, 80, 100) ;
RooAbsReal* integral = signal.createIntegral(integrationVar, Range(“integralRange”)) ;
double IntegralValue_N1 = integral->getVal();

but this gives me an unfeasibly large answer (500000 or so).
Any ideas? I am a relative newcomer to roofit but I couldn’t find the answer to this on the documentation…
Ellie

I have exactly the same problem. Did you find a solution already?
Thanks,

Catarina

Dear Ellie, catarina,

this is too late? if so, plese ignore this message.

I also had the same problem, and I fixed as followes(with normalization),

x.setRange(“cut”, hogehoge, hogehoge);
RooAbsReal* sig = signal.createIntegral (x, NormSet (x), Range(“cut”));
double IntegralValue = sig->getVal();
cout << IntegralValue << endl;

I refered the following sample.

root.cern.ch/viewvc/trunk/tutori … hrev=24523

Best regards,