54 _depList(
"depList",
"List of dependents",this),
65 coutE(InputArguments) <<
"RooHistFunc::ctor(" << GetName()
66 <<
") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
67 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
70 for (
const auto arg : vars) {
71 if (!dvars->
find(arg->GetName())) {
72 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
73 <<
") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
74 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
93 _depList(
"depList",
"List of dependents",this),
103 if (histObs.
size()!=dvars->
size()) {
104 coutE(InputArguments) <<
"RooHistFunc::ctor(" << GetName()
105 <<
") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
106 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
109 for (
const auto arg : histObs) {
110 if (!dvars->
find(arg->GetName())) {
111 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
112 <<
") ERROR variable list and RooDataHist must contain the same variables." << std::endl ;
113 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
128 std::unique_ptr<RooDataHist> dhist,
int intOrder)
180 harg->copyCache(parg,
true) ;
181 if (!harg->inRange(
nullptr)) {
194 std::span<double> output = ctx.
output();
195 std::size_t nEvents = output.size();
203 std::vector<std::span<const double>> inputValues;
205 auto realObs =
dynamic_cast<const RooAbsReal*
>(obs);
207 inputValues.push_back(ctx.
at(realObs));
209 inputValues.emplace_back();
213 for (std::size_t i = 0; i < nEvents; ++i) {
219 if (i < inputValues[j].
size()) {
220 histObs->setCachedValue(inputValues[j][i],
false);
221 if (!histObs->inRange(
nullptr)) {
238 std::unique_ptr<RooAbsCollection> common{
_depList.selectCommon(vars)};
239 return common->size() ==
_depList.size() ? 1 : 0;
251 if (wgt>max) max=wgt ;
346 if (std::string(parg->GetName())==obs.
GetName()) {
362 if (std::string(harg->GetName())==obs.
GetName()) {
370 std::cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") obs = " << obs.
GetName() <<
" hobs is not found, returning null" << std::endl ;
386 std::cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" is not found in dataset?" << std::endl ;
392 std::cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" but is not an LV, returning null" << std::endl ;
398 double* boundaries = binning->
array() ;
400 auto hint =
new std::list<double> ;
402 double delta = (xhi-xlo)*1
e-8 ;
407 if (boundaries[i]>xlo-delta && boundaries[i]<xhi+delta) {
409 double boundary = boundaries[i] ;
411 transform->setVal(boundary) ;
413 hint->push_back(obs.
getVal()) ;
415 hint->push_back(boundary) ;
452 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << std::endl ;
464 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << std::endl ;
489 if (std::abs(dh1.
weight(i)-dh2.
weight(i))>1
e-8)
return false ;
540 harg->copyCache(parg,
true) ;
541 if (!harg->inRange(
nullptr)) {
556 std::vector<std::span<const double>> depData;
558 auto real =
dynamic_cast<const RooAbsReal*
>(dep);
560 depData.push_back(ctx.
at(real));
562 depData.emplace_back();
566 const auto batchSize = std::max_element(depData.begin(), depData.end(),
567 [](
const std::span<const double>&
a,
const std::span<const double>&
b){ return a.size() < b.size(); })->size();
568 std::vector<Int_t> results;
570 for (std::size_t evt = 0; evt < batchSize; ++evt) {
575 if (evt < depData[i].
size())
576 harg->setCachedValue(depData[i][evt],
false);
578 if (!harg->inRange(
nullptr)) {
579 results.push_back(-1);
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) 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.
virtual void ioStreamerPass2()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
friend class RooWorkspace
RooAbsArg()
Default constructor.
Abstract base class for RooRealVar binning definitions.
virtual Int_t numBoundaries() const =0
virtual double * array() const =0
Int_t numTypes(const char *=nullptr) const
Return number of types defined (in range named rangeName if rangeName!=nullptr).
Storage_t::size_type size() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract base class for objects that are lvalues, i.e.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Container class to hold N-dimensional binned data.
double weight(std::size_t i) const
Return weight of i-th bin.
const RooArgSet * get() const override
Get bin centre of current bin.
double sumEntries() const override
Sum the weights of all bins.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
bool _cdfBoundaries
Use boundary conditions for CDFs.
RooDataHist * _dataHist
Unowned pointer to underlying histogram.
double _totVolume
! Total volume of space (product of ranges of observables)
void doEval(RooFit::EvalContext &) const override
Base function for computing multiple values of a RooAbsReal.
bool forceAnalyticalInt(const RooAbsArg &dep) const override
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Return integral identified by 'code'.
RooAICRegistry _codeReg
! Auxiliary class keeping tracking of analytical integration code
bool _unitNorm
! Assume contents is unit normalized (for use as pdf cache)
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::unique_ptr< RooDataHist > _ownedDataHist
! Owned pointer to underlying histogram
void ioStreamerPass2() override
Schema evolution: if histObsList wasn't filled from persistence (v1) then fill it here.
void initializeOwnedDataHist(std::unique_ptr< RooDataHist > &&dataHist)
double evaluate() const override
Return the current value: The value of the bin enclosing the current coordinates of the dependents,...
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...
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.
double totVolume() const
Get total bin volume spanned by this hist function.
Int_t getBin() const
Compute bin number corresponding to current coordinates.
bool areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
double maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
std::vector< Int_t > getBins(RooFit::EvalContext &ctx) const
Compute bin numbers corresponding to all coordinates in evalData.
bool importWorkspaceHook(RooWorkspace &ws) override
Check if our datahist is already in the workspace.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Determine integration scenario.
RooDataHist * cloneAndOwnDataHist(const char *newname="")
Replaces underlying RooDataHist with a clone, which is now owned, and returns the clone.
Int_t _intOrder
Interpolation order.
RooSetProxy _depList
List of observables mapped onto histogram observables.
RooArgSet _histObsList
List of observables defining dimensions of histogram.
bool forceAnalyticalInt(const RooAbsArg &dep) const override
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Return integral identified by 'code'.
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...
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Determine integration scenario.
Variable that can be changed from the outside.
RooAbsData * embeddedData(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, 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 RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetName() const override
Returns name of object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
RooCmdArg Rename(const char *suffix)
RooCmdArg Embedded(bool flag=true)
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')