35 std::string
const &rangeName,
RooAbsPdf const *pdf,
36 bool takeGlobalObservablesFromData)
37 :
RooAbsReal{
"RooEvaluatorWrapper",
"RooEvaluatorWrapper"},
38 _evaluator{std::make_unique<
RooFit::Evaluator>(topNode, useGPU)},
39 _topNode(
"topNode",
"top node", this, topNode, false, false),
41 _paramSet(
"paramSet",
"Set of parameters", this),
50 for (
auto const &item : _dataSpans) {
55RooEvaluatorWrapper::RooEvaluatorWrapper(
const RooEvaluatorWrapper &other,
const char *
name)
57 _evaluator{other._evaluator},
58 _topNode(
"topNode", this, other._topNode),
60 _paramSet(
"paramSet",
"Set of parameters", this),
64 _dataSpans{other._dataSpans}
69double RooEvaluatorWrapper::evaluate()
const
77 return _evaluator->run()[0];
80bool RooEvaluatorWrapper::getParameters(
const RooArgSet *observables,
RooArgSet &outputSet,
83 outputSet.
add(_evaluator->getParameters());
85 outputSet.
remove(*observables,
false,
true);
88 for (
auto const &item : _dataSpans) {
113 constexpr auto errMsg =
"Error in RooAbsReal::setData(): only resetting with same-structured data is supported.";
117 const std::size_t oldSize = _dataSpans.size();
119 std::stack<std::vector<double>>{}.swap(_vectorBuffers);
120 bool skipZeroWeights = !_pdf || !_pdf->getAttribute(
"BinnedLikelihoodActive");
121 _dataSpans = RooFit::Detail::BatchModeDataHelpers::getDataSpans(
124 if (!isInitializing && _dataSpans.size() != oldSize) {
125 coutE(DataHandling) << errMsg << std::endl;
126 throw std::runtime_error(errMsg);
128 for (
auto const &item : _dataSpans) {
129 const char *
name = item.first->GetName();
130 _evaluator->setInput(
name, item.second,
false);
132 coutE(DataHandling) << errMsg << std::endl;
133 throw std::runtime_error(errMsg);
const bool _takeGlobalObservablesFromData
If the global observable values are taken from data.
RooAbsData * _data
Pointer to original input dataset.
RooSetProxy _paramSet
Parameters of the test statistic (=parameters of the input function)
std::string _rangeName
Name of range in which to calculate test statistic.
bool setData(RooAbsData &data, bool cloneData=true) override
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual bool replace(const RooAbsArg &var1, const RooAbsArg &var2)
Replace var1 with var2 and return true for success.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
RooArgSet const * getGlobalObservables() const
Returns snapshot of global observables stored in this data.
Abstract interface for all probability density functions.
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.
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...
bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false) override
Remove object 'var' from set and deregister 'var' as server to owner.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
OffsetMode
For setting the offset mode with the Offset() command argument to RooAbsPdf::fitTo()