73 _depList(
"depList",
"List of dependents",this),
88 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
89 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
92 for (
const auto arg : vars) {
93 if (!dvars->
find(arg->GetName())) {
95 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
96 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
115 _depList(
"depList",
"List of dependents",this),
130 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
131 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
134 for (
const auto arg : histObs) {
135 if (!dvars->
find(arg->GetName())) {
137 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
138 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
152 _depList(
"depList",this,other._depList),
153 _dataHist(other._dataHist),
154 _codeReg(other._codeReg),
155 _intOrder(other._intOrder),
156 _cdfBoundaries(other._cdfBoundaries),
157 _totVolume(other._totVolume),
158 _unitNorm(other._unitNorm)
192 harg->copyCache(parg,
kTRUE) ;
193 if (!harg->inRange(0)) {
206 std::vector<RooSpan<const double>> inputValues;
208 auto realObs =
dynamic_cast<const RooAbsReal*
>(obs);
210 auto inputs = dataMap[realObs];
211 inputValues.push_back(std::move(inputs));
213 inputValues.emplace_back();
217 for (std::size_t i = 0; i <
size; ++i) {
223 if (i < inputValues[j].
size()) {
224 histObs->setCachedValue(inputValues[j][i],
false);
225 if (!histObs->inRange(
nullptr)) {
261 if (wgt>max) max=wgt ;
335 if (
string(parg->GetName())==obs.
GetName()) {
353 list<Double_t>* hint =
new list<Double_t> ;
356 xlo = xlo - 0.01*(xhi-xlo) ;
357 xhi = xhi + 0.01*(xhi-xlo) ;
364 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
365 hint->push_back(boundaries[i]-delta) ;
366 hint->push_back(boundaries[i]+delta) ;
391 if (
string(parg->GetName())==obs.
GetName()) {
407 if (
string(harg->GetName())==obs.
GetName()) {
415 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") obs = " << obs.
GetName() <<
" hobs is not found, returning null" << endl ;
431 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" is not found in dataset?" << endl ;
437 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" but is not an LV, returning null" << endl ;
445 list<Double_t>* hint =
new list<Double_t> ;
452 if (boundaries[i]>xlo-delta && boundaries[i]<xhi+delta) {
456 transform->
setVal(boundary) ;
458 hint->push_back(obs.
getVal()) ;
460 hint->push_back(boundary) ;
497 coutE(
ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
509 coutE(
ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
585 harg->copyCache(parg,
kTRUE) ;
586 if (!harg->inRange(
nullptr)) {
601 std::vector<RooSpan<const double>> depData;
603 auto real =
dynamic_cast<const RooAbsReal*
>(dep);
605 depData.push_back(dataMap[real]);
607 depData.emplace_back(
nullptr, 0);
611 const auto batchSize = std::max_element(depData.begin(), depData.end(),
613 std::vector<Int_t> results;
615 for (std::size_t evt = 0; evt < batchSize; ++evt) {
620 if (evt < depData[i].
size())
621 harg->setCachedValue(depData[i][evt],
false);
623 if (!harg->inRange(
nullptr)) {
624 results.push_back(-1);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
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.
void registerProxy(RooArgProxy &proxy)
Register an RooArgProxy in the proxy list.
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
virtual Int_t numBoundaries() const =0
Int_t numTypes(const char *=0) const
Return number of types defined (in range named rangeName if rangeName!=0)
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
void Print(Option_t *options=0) const override
This method must be overridden when a class wants to print itself.
Int_t getSize() const
Return the number of elements in the collection.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
Storage_t::size_type size() const
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Abstract base class for objects that are lvalues, i.e.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual Double_t getMin(const char *name=0) const
Get minimum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory is an object to represent discrete states.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
The RooDataHist is a container class to hold N-dimensional binned data.
Int_t getIndex(const RooAbsCollection &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
double weight(std::size_t i) const
Return weight of i-th bin.
Double_t sumEntries() const override
Sum the weights of all bins.
double weightFast(const RooArgSet &bin, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A faster version of RooDataHist::weight that assumes the passed arguments are aligned with the histog...
Int_t numEntries() const override
Return the number of bins.
const RooArgSet * get() const override
Get bin centre of current bin.
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
Double_t maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
Bool_t _cdfBoundaries
Use boundary conditions for CDFs.
RooDataHist * _dataHist
Unowned pointer to underlying histogram.
std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Double_t evaluate() const override
Return the current value: The value of the bin enclosing the current coordinates of the dependents,...
RooHistFunc()
Default constructor.
Double_t totVolume() const
Get total bin volume spanned by this hist function.
void ioStreamerPass2() override
Schema evolution: if histObsList wasn't filled from persistence (v1) then fill it here.
std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const override
Return sampling hint for making curves of (projections) of this function as the recursive division st...
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const override
Return integral identified by 'code'.
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
void Streamer(TBuffer &) override
Stream an object of class RooHistFunc.
Int_t getMaxVal(const RooArgSet &vars) const override
Only handle case of maximum in all variables.
Int_t getBin() const
Compute bin number corresponding to current coordinates.
std::vector< Int_t > getBins(RooBatchCompute::DataMap &dataMap) const
Compute bin numbers corresponding to all coordinates in evalData.
void computeBatch(cudaStream_t *, double *output, size_t size, RooBatchCompute::DataMap &) const override
Base function for computing multiple values of a RooAbsReal.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const override
Determine integration scenario.
Int_t _intOrder
Interpolation order.
Double_t _totVolume
! Total volume of space (product of ranges of observables)
RooSetProxy _depList
List of observables mapped onto histogram observables.
Bool_t importWorkspaceHook(RooWorkspace &ws) override
Check if our datahist is already in the workspace.
RooArgSet _histObsList
List of observables defining dimensions of histogram.
static Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, Int_t intOrder)
static Double_t analyticalIntegral(Int_t code, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, RooDataHist &dataHist, bool histFuncMode)
RooRealVar represents a variable that can be changed from the outside.
A simple container to hold a batch of data values.
The RooWorkspace is a persistable container for RooFit projects.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetName() const override
Returns name of object.
void Clear(Option_t *option="") override
Remove all objects from the array.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
const char * Data() const
RooCmdArg Embedded(Bool_t flag=kTRUE)
RooCmdArg Rename(const char *suffix)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
std::map< DataKey, RooSpan< const double > > DataMap
std::string getColonSeparatedNameString(RooArgSet const &argSet)
Create a string with all sorted names of RooArgSet elements separated by colons.