I have fitted the Bs mass(it’s PDG mass 5.367 GeV) with gaussian(for signal) and exponential function(for combinatorial background). The fitted plot isattached with this post. I want to get the no.of background events in the signal region. Could you please tell me how to do this?
Try to calculate the integral of your background function using, for example, something similar to (instead of “gaus” use the name of your “red dots” background function):
I tried "std::cout << Bmass->GetFunction("bkgExpo")->Integral(5.287, 5.447) /Bmass->GetBinWidth(1) << std::endl;". It is showing error as below.
Error: Can't call RooRealVar::GetFunction("bkgExpo") in current scope bstophimumu_data.cc:70:
Possible candidates are...
(in RooRealVar)
(in RooAbsRealLValue)
(in RooAbsReal)
(in RooAbsArg)
(in RooPrintable)
(in RooAbsLValue)
Error: non class,struct,union object GetFunction("bkgExpo") used with . or -> bstophimumu_data.cc:70:
Error: operator '/' divided by zero bstophimumu_data.cc:70:
*** Interpreter error recovered ***