111 _pdf(
"inputPdf",
"Function to be converted into a PDF", this, inputPdf),
112 _observable(
"observable",
"Observable to integrate over", this, observable, true, true),
115 throw std::invalid_argument(std::string(
"RooBinSamplingPDF(") +
GetName()
116 +
"): The PDF " +
_pdf->
GetName() +
" needs to depend on the observable "
128 _pdf(
"inputPdf", this, other._pdf),
129 _observable(
"observable", this, other._observable),
130 _relEpsilon(other._relEpsilon) { }
162 auto results = evalData.
makeBatch(
this, xValues.size());
168 for (
unsigned int i=0; i < xValues.size(); ++i) {
169 const double x = xValues[i];
170 const auto upperIt = std::upper_bound(boundaries.begin(), boundaries.end(),
x);
171 const unsigned int bin = std::distance(boundaries.begin(), upperIt) - 1;
172 assert(bin < boundaries.size());
174 results[i] =
integrate(normSet, boundaries[bin], boundaries[bin+1]) / (boundaries[bin+1]-boundaries[bin]);
188 const double* boundaries = binning.
array();
211 coutE(Plotting) <<
"RooBinSamplingPdf::binBoundaries(" <<
GetName() <<
"): observable '" << obs.
GetName()
212 <<
"' is not the observable of this PDF ('" <<
_observable->
GetName() <<
"')." << std::endl;
216 auto list =
new std::list<double>;
218 if (xlo <= val && val < xhi)
219 list->push_back(val);
234 coutE(Plotting) <<
"RooBinSamplingPdf::plotSamplingHint(" <<
GetName() <<
"): observable '" << obs.
GetName()
235 <<
"' is not the observable of this PDF ('" <<
_observable->
GetName() <<
"')." << std::endl;
239 auto binEdges =
new std::list<double>;
242 for (
unsigned int bin=0, numBins =
static_cast<unsigned int>(binning.numBins()); bin < numBins; ++bin) {
243 const double low = std::max(binning.binLow(bin), xlo);
244 const double high = std::min(binning.binHigh(bin), xhi);
245 const double width = high - low;
252 binEdges->push_back(low + 0.001 *
width);
253 binEdges->push_back(high - 0.001 *
width);
include TDocParser_001 C image html pict1_TDocParser_001 png width
User Class for performing numerical integration of a function in one dimension.
const TNamed * namePtr() const
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
Bool_t isShapeDirty() const
Bool_t inhibitDirty() const
Delete watch flag.
void clearShapeDirty() const
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t binLow(Int_t bin) const =0
virtual Double_t * array() const =0
virtual Double_t binHigh(Int_t bin) const =0
virtual Int_t numBoundaries() const =0
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const =0
Retrive binning configuration with given name or default binning.
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual Int_t getBin(const char *rangeName=0) const
virtual RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this trans...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
The RooBinSamplingPdf is supposed to be used as an adapter between a continuous PDF and a binned dist...
double integrate(const RooArgSet *normSet, double low, double high) const
Integrate the wrapped PDF using our current integrator, with given norm set and limits.
RooTemplateProxy< RooAbsPdf > _pdf
std::vector< double > _binBoundaries
Integrator used to sample bins.
const RooArgSet * _normSetForIntegrator
Workspace to store data for bin sampling.
std::unique_ptr< ROOT::Math::IntegratorOneDim > & integrator() const
Direct access to the unique_ptr holding the integrator that's used to sample the bins.
RooTemplateProxy< RooAbsRealLValue > _observable
RooSpan< const double > binBoundaries() const
Get the bin boundaries for the observable.
std::unique_ptr< ROOT::Math::IntegratorOneDim > _integrator
Default integrator precision.
double operator()(double x) const
Binding used by the integrator to evaluate the PDF.
double evaluate() const override
Integrate the PDF over the current bin of the observable.
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return a list of all bin edges, so the PDF is plotted as a step function.
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const override
Integrate the PDF over all its bins, and return a batch with those values.
A simple container to hold a batch of data values.
virtual const char * GetName() const
Returns name of object.
This struct enables passing computation data around between elements of a computation graph.
RooSpan< double > makeBatch(const RooAbsReal *owner, std::size_t size)
Create a writable batch.
Disable all caches for sub-branches in an expression tree.