Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooBinWidthFunction.h
Go to the documentation of this file.
1// Author Stephan Hageboeck, CERN, 6/2020
2/*****************************************************************************
3 * Project: RooFit *
4 * Package: RooFitCore *
5 * File: $Id$
6 * Authors: *
7 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
8 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
9 * *
10 * Copyright (c) 2000-2020, Regents of the University of California *
11 * and Stanford University. All rights reserved. *
12 * *
13 * Redistribution and use in source and binary forms, *
14 * with or without modification, are permitted according to the terms *
15 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
16 *****************************************************************************/
17
18#ifndef ROOFIT_ROOFITCORE_INC_BINWIDTHFUNCTION_H_
19#define ROOFIT_ROOFITCORE_INC_BINWIDTHFUNCTION_H_
20
21#include "RooAbsReal.h"
22#include "RooTemplateProxy.h"
23#include "RooHistFunc.h"
24
26 static bool _enabled;
27
28public:
29 static void enableClass();
30 static void disableClass();
31 static bool isClassEnabled();
32
33 /// Create an empty instance.
35 _histFunc("HistFuncForBinWidth", "Handle to a RooHistFunc, whose bin volumes should be returned.", this,
36 /*valueServer=*/true, /*shapeServer=*/true) { }
37
38 RooBinWidthFunction(const char* name, const char* title, const RooHistFunc& histFunc, bool divideByBinWidth);
39
40 /// Copy an existing object.
41 RooBinWidthFunction(const RooBinWidthFunction& other, const char* newname = nullptr) :
42 RooAbsReal(other, newname),
43 _histFunc("HistFuncForBinWidth", this, other._histFunc),
45
46 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
47
48 /// Copy the object and return as TObject*.
49 TObject* clone(const char* newname = nullptr) const override {
50 return new RooBinWidthFunction(*this, newname);
51 }
52
53 // Plotting and binning hints
54 /// Test if internal RooHistFunc is binned.
55 bool isBinnedDistribution(const RooArgSet& obs) const override {
57 }
58 /// Return bin boundaries of internal RooHistFunc.
59 std::list<double>* binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const override {
60 return _histFunc->binBoundaries(obs, xlo, xhi);
61 }
62 /// Return plotSamplingHint of internal RooHistFunc.
63 std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override {
64 return _histFunc->plotSamplingHint(obs, xlo, xhi);
65 }
66
67 bool divideByBinWidth() const { return _divideByBinWidth; }
68 const RooHistFunc& histFunc() const { return (*_histFunc); }
69 double evaluate() const override;
70 void doEval(RooFit::EvalContext &) const override;
71
72private:
74 bool _divideByBinWidth{false};
75
77};
78
79#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Returns the bin width (or volume) given a RooHistFunc.
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
TObject * clone(const char *newname=nullptr) const override
Copy the object and return as TObject*.
std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return bin boundaries of internal RooHistFunc.
const RooHistFunc & histFunc() const
RooBinWidthFunction(const RooBinWidthFunction &other, const char *newname=nullptr)
Copy an existing object.
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return plotSamplingHint of internal RooHistFunc.
RooBinWidthFunction()
Create an empty instance.
bool isBinnedDistribution(const RooArgSet &obs) const override
Test if internal RooHistFunc is binned.
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.
A real-valued function sampled from a multidimensional histogram.
Definition RooHistFunc.h:31
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
bool isBinnedDistribution(const RooArgSet &) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition RooHistFunc.h:95
Mother of all ROOT objects.
Definition TObject.h:41