30std::unique_ptr<RooDataHist> generateBinnedAsimov(
RooAbsPdf const &pdf,
RooRealVar &
x,
int nEvents)
32 auto dataH = std::make_unique<RooDataHist>(
"dataH",
"dataH",
RooArgSet{
x});
34 for (
int iBin = 0; iBin <
x.numBins(); ++iBin) {
35 x.
setRange(
"bin", xBinning.binLow(iBin), xBinning.binHigh(iBin));
38 dataH->set(iBin, nEvents * integ->getVal(), -1);
45void enableBinIntegrator(
RooAbsReal &func,
int numBins)
48 customConfig.method1D().setLabel(
"RooBinIntegrator");
49 customConfig.getConfigSection(
"RooBinIntegrator").setRealValue(
"numBins", numBins);
83 std::unique_ptr<RooAbsData> expoData{generateBinnedAsimov(expo,
x, 10000)};
98 enableBinIntegrator(expo,
x.numBins());
101 disableBinIntegrator(expo);
109 std::unique_ptr<RooAbsData> powerlawData{generateBinnedAsimov(powerlaw,
x, 10000)};
122 enableBinIntegrator(powerlaw,
x.numBins());
125 disableBinIntegrator(powerlaw);
133 std::unique_ptr<RooFitResult> fit5{
162 RooRealVar nsig{
"nsig",
"nsig", 10000, 0, 1e9};
163 RooRealVar nbkg{
"nbkg",
"nbkg", 10000000, 0, 1e9};
164 RooRealVar frac{
"frac",
"frac", nsig.
getVal() / (nsig.getVal() + nbkg.getVal()), 0.0, 1.0};
166 RooAddPdf model{
"model",
"model", {gauss, expo}, {nsig, nbkg}};
190 std::unique_ptr<RooFitResult> fit7{
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
Abstract base class for RooRealVar binning definitions.
virtual void setRange(double xlo, double xhi)=0
Abstract interface for all probability density functions.
virtual RooFit::OwningPtr< RooDataHist > generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}) const
As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,...
Abstract base class for objects that represent a real value and implements functionality common to al...
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
void setIntegratorConfig()
Remove the specialized numeric integration configuration associated with this object.
virtual void forceNumInt(bool flag=true)
const RooNumIntConfig * getIntegratorConfig() const
Return the numeric integration configuration used for this object.
Efficient implementation of a sum of PDFs of the form.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
static RooMsgService & instance()
Return reference to singleton instance.
StreamConfig & getStream(Int_t id)
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
RooPowerSum implements a power law PDF of the form.
Variable that can be changed from the outside.
void setBins(Int_t nBins, const char *name=nullptr)
Create a uniform binning under name 'name' for this variable.
RooConstVar & RooConst(double val)
RooCmdArg NormSet(Args_t &&... argsOrArgSet)
RooCmdArg IntegrateBins(double precision)
Integrate the PDF over bins.
RooCmdArg Offset(std::string const &mode)
RooCmdArg Save(bool flag=true)
RooCmdArg SumW2Error(bool flag)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
void removeTopic(RooFit::MsgTopic oldTopic)