Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooEvaluatorWrapper.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*
4 * Project: RooFit
5 * Authors:
6 * Jonas Rembser, CERN 2023
7 *
8 * Copyright (c) 2023, CERN
9 *
10 * Redistribution and use in source and binary forms,
11 * with or without modification, are permitted according to the terms
12 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
13 */
14
15#ifndef RooFit_RooEvaluatorWrapper_h
16#define RooFit_RooEvaluatorWrapper_h
17
18#include <RooAbsData.h>
19#include <RooFit/Evaluator.h>
20#include <RooGlobalFunc.h>
21#include <RooRealProxy.h>
22#include <RooSetProxy.h>
23
24#include <stack>
25
26class RooAbsArg;
27class RooAbsCategory;
28class RooAbsPdf;
29
30namespace RooFit::Experimental {
31
32class RooFuncWrapper;
33
35public:
38
39 RooEvaluatorWrapper(const RooEvaluatorWrapper &other, const char *name = nullptr);
40
42
43 TObject *clone(const char *newname) const override { return new RooEvaluatorWrapper(*this, newname); }
44
45 double defaultErrorLevel() const override { return _topNode->defaultErrorLevel(); }
46
47 bool getParameters(const RooArgSet *observables, RooArgSet &outputSet, bool stripDisconnected = true) const override;
48
49 bool setData(RooAbsData &data, bool cloneData) override;
50
51 double getValV(const RooArgSet *) const override { return evaluate(); }
52
53 void applyWeightSquared(bool flag) override { _topNode->applyWeightSquared(flag); }
54
55 void printMultiline(std::ostream &os, Int_t /*contents*/, bool /*verbose*/ = false,
56 TString /*indent*/ = "") const override
57 {
58 _evaluator->print(os);
59 }
60
61 /// The RooFit::Evaluator is dealing with constant terms itself.
62 void constOptimizeTestStatistic(ConstOpCode /*opcode*/, bool /*doAlsoTrackingOpt*/) override {}
63
64 bool hasGradient() const override;
65
66 void gradient(double *out) const override;
67
68 void generateGradient();
69
71
72 void writeDebugMacro(std::string const &) const;
73
74protected:
75 double evaluate() const override;
76
77private:
78 void createFuncWrapper();
79
80 std::shared_ptr<RooFit::Evaluator> _evaluator;
81 std::shared_ptr<RooFuncWrapper> _funcWrapper;
82 RooRealProxy _topNode;
83 RooAbsData *_data = nullptr;
84 RooSetProxy _paramSet;
85 std::string _rangeName;
86 RooAbsPdf const *_pdf = nullptr;
87 const bool _takeGlobalObservablesFromData;
88 bool _useGeneratedFunctionCode = false;
89 std::stack<std::vector<double>> _vectorBuffers; // used for preserving resources
90 std::map<RooFit::Detail::DataKey, std::span<const double>> _dataSpans;
91};
92
93} // namespace RooFit::Experimental
94
95#endif
96
97/// \endcond
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:76
A space to attach TBranches.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:32
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:138
void evaluate(typename Architecture_t::Tensor_t &A, EActivationFunction f)
Apply the given activation function to each value in the given tensor A.
Definition Functions.h:98