58 _histFunc(
"HistFuncForBinWidth",
"Handle to a RooHistFunc, whose bin volumes should be returned.", this, histFunc,
60 _divideByBinWidth(divideByBinWidth)
91 const double volume = idx >= 0 ? volumes[idx] : 1.;
104 std::vector<Int_t> bins =
_histFunc->getBins(ctx);
108 for (std::size_t i = 0; i < bins.size(); ++i) {
113 for (std::size_t i = 0; i < bins.size(); ++i) {
114 output[i] = bins[i] >= 0 ? 1. / volumes[bins[i]] : 1.;
117 for (std::size_t i = 0; i < bins.size(); ++i) {
118 output[i] = bins[i] >= 0 ? volumes[bins[i]] : 1.;
125std::unique_ptr<RooAbsArg>
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const
const RefCountList_t & servers() const
List of all servers of this object.
void addServer(RooAbsArg &server, bool valueProp=true, bool shapeProp=false, std::size_t refCount=1)
Register another RooAbsArg as a server to us, ie, declare that we depend on it.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
void doEval(RooFit::EvalContext &) const override
Compute bin index for all values of the observable(s) in evalData, and return their volumes or invers...
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
const RooHistFunc & histFunc() const
RooBinWidthFunction()
Create an empty instance.
static void disableClass()
Globally disable bin-width corrections by this class.
double evaluate() const override
Compute current bin of observable, and return its volume or inverse volume, depending on configuratio...
RooTemplateProxy< const RooHistFunc > _histFunc
static bool isClassEnabled()
Returns true if bin-width corrections by this class are globally enabled, false otherwise.
static void enableClass()
Globally enable bin-width corrections by this class.
Container class to hold N-dimensional binned data.
std::span< const double > binVolumes(std::size_t first, std::size_t len) const
Retrieve all bin volumes. Bins are indexed according to getIndex().
void markAsCompiled(RooAbsArg &arg) const
bool binnedLikelihoodMode() const
void setBinWidthFuncFlag(bool flag)
std::span< double > output()
A real-valued function sampled from a multidimensional histogram.
RooConstVar & RooConst(double val)