Logo ROOT  
Reference Guide
RooAbsReal.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsReal.h,v 1.75 2007/07/13 21:50:24 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_ABS_REAL
17#define ROO_ABS_REAL
18
19#include "RooAbsArg.h"
20#include "RooCmdArg.h"
21#include "RooCurve.h"
22#include "RooArgSet.h"
23#include "RooArgList.h"
24#include "RooGlobalFunc.h"
25#include "RooSpan.h"
29
30class RooDataSet ;
31class RooPlot;
32class RooRealVar;
33class RooAbsFunc;
35class RooLinkedList ;
36class RooNumIntConfig ;
37class RooDataHist ;
38class RooFunctor ;
39class RooFitResult ;
40class RooAbsMoment ;
41class RooDerivative ;
43struct TreeReadBuffer; /// A space to attach TBranches
44namespace ROOT {
45namespace Experimental {
46class RooFitDriver ;
47}
48}
49
50class TH1;
51class TH1F;
52class TH2F;
53class TH3F;
54
55#include <iostream>
56#include <list>
57#include <map>
58#include <string>
59#include <sstream>
60
61class RooAbsReal : public RooAbsArg {
62public:
64
65 /// A RooAbsReal::Ref can be constructed from a `RooAbsReal&` or a `double`
66 /// that will be implicitly converted to a RooConstVar&. The RooAbsReal::Ref
67 /// can be used as a replacement for `RooAbsReal&`. With this type
68 /// definition, you can write RooFit interfaces that accept both RooAbsReal,
69 /// or simply a number that will be implicitly converted to a RooConstVar&.
70 class Ref {
71 public:
72 inline Ref(RooAbsReal &ref) : _ref{ref} {}
73 Ref(double val);
74 inline operator RooAbsReal &() const { return _ref; }
75
76 private:
78 };
79
80 // Constructors, assignment etc
81 RooAbsReal() ;
82 RooAbsReal(const char *name, const char *title, const char *unit= "") ;
83 RooAbsReal(const char *name, const char *title, double minVal, double maxVal,
84 const char *unit= "") ;
85 RooAbsReal(const RooAbsReal& other, const char* name=nullptr);
86 ~RooAbsReal() override;
87
88
89
90
91 //////////////////////////////////////////////////////////////////////////////////
92 /// Evaluate object. Returns either cached value or triggers a recalculation.
93 /// The recalculation happens by calling getValV(), which in the end calls the
94 /// virtual evaluate() functions of the respective PDFs.
95 /// \param[in] normalisationSet getValV() reacts differently depending on the value of the normalisation set.
96 /// If the set is `nullptr`, an unnormalised value is returned.
97 /// \note The normalisation is arbitrary, because it is up to the implementation
98 /// of the PDF to e.g. leave out normalisation constants for speed reasons. The range
99 /// of the variables is also ignored.
100 ///
101 /// To normalise the result properly, a RooArgSet has to be passed, which contains
102 /// the variables to normalise over.
103 /// These are integrated over their current ranges to compute the normalisation constant,
104 /// and the unnormalised result is divided by this value.
105 inline double getVal(const RooArgSet* normalisationSet = nullptr) const {
106 // Sometimes, the calling code uses an empty RooArgSet to request evaluation
107 // without normalization set instead of following the `nullptr` convention.
108 // To remove this ambiguity which might not always be correctly handled in
109 // downstream code, we set `normalisationSet` to nullptr if it is pointing
110 // to an empty set.
111 if(normalisationSet && normalisationSet->empty()) {
112 normalisationSet = nullptr;
113 }
114#ifdef ROOFIT_CHECK_CACHED_VALUES
115 return _DEBUG_getVal(normalisationSet);
116#else
117
118#ifndef _WIN32
119 return (_fast && !_inhibitDirty) ? _value : getValV(normalisationSet) ;
120#else
121 return (_fast && !inhibitDirty()) ? _value : getValV(normalisationSet) ;
122#endif
123
124#endif
125 }
126
127 /// Like getVal(const RooArgSet*), but always requires an argument for normalisation.
128 inline double getVal(const RooArgSet& normalisationSet) const {
129 // Sometimes, the calling code uses an empty RooArgSet to request evaluation
130 // without normalization set instead of following the `nullptr` convention.
131 // To remove this ambiguity which might not always be correctly handled in
132 // downstream code, we set `normalisationSet` to nullptr if it is an empty set.
133 return _fast ? _value : getValV(normalisationSet.empty() ? nullptr : &normalisationSet) ;
134 }
135
136 virtual double getValV(const RooArgSet* normalisationSet = nullptr) const ;
137
138 /// \deprecated getValBatch() has been removed in favour of the faster getValues(). If your code is affected
139 /// by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this transition.
140 /// https://root.cern/doc/v624/release-notes.html
141#ifndef R__MACOSX
142 virtual RooSpan<const double> getValBatch(std::size_t /*begin*/, std::size_t /*maxSize*/, const RooArgSet* /*normSet*/ = nullptr) = delete;
143#else
144 //AppleClang in MacOS10.14 has a linker bug and fails to link programs that create objects of classes containing virtual deleted methods.
145 //This can be safely deleted when MacOS10.14 is no longer supported by ROOT. See https://reviews.llvm.org/D37830
146 virtual RooSpan<const double> getValBatch(std::size_t /*begin*/, std::size_t /*maxSize*/, const RooArgSet* /*normSet*/ = nullptr) final {
147 throw std::logic_error("Deprecated getValBatch() has been removed in favour of the faster getValues(). If your code is affected by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this transition. https://root.cern/doc/v624/release-notes.html");
148 }
149#endif
150 /// \copydoc getValBatch(std::size_t, std::size_t, const RooArgSet*)
151 virtual RooSpan<const double> getValues(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet = nullptr) const;
152 std::vector<double> getValues(RooAbsData const& data, RooFit::BatchModeOption batchMode=RooFit::BatchModeOption::Cpu) const;
153
154 double getPropagatedError(const RooFitResult &fr, const RooArgSet &nset = RooArgSet()) const;
155
156 bool operator==(double value) const ;
157 bool operator==(const RooAbsArg& other) const override;
158 bool isIdentical(const RooAbsArg& other, bool assumeSameType=false) const override;
159
160
161 inline const Text_t *getUnit() const {
162 // Return string with unit description
163 return _unit.Data();
164 }
165 inline void setUnit(const char *unit) {
166 // Set unit description to given string
167 _unit= unit;
168 }
169 TString getTitle(bool appendUnit= false) const;
170
171 // Lightweight interface adaptors (caller takes ownership)
172 RooAbsFunc *bindVars(const RooArgSet &vars, const RooArgSet* nset=nullptr, bool clipInvalid=false) const;
173
174 // Create a fundamental-type object that can hold our value.
175 RooAbsArg *createFundamental(const char* newname=nullptr) const override;
176
177 // Analytical integration support
178 virtual Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=nullptr) const ;
179 virtual double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const ;
180 virtual Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=nullptr) const ;
181 virtual double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const ;
182 virtual bool forceAnalyticalInt(const RooAbsArg& /*dep*/) const {
183 // Interface to force RooRealIntegral to offer given observable for internal integration
184 // even if this is deemed unsafe. This default implementation returns always false
185 return false ;
186 }
187 virtual void forceNumInt(bool flag=true) {
188 // If flag is true, all advertised analytical integrals will be ignored
189 // and all integrals are calculated numerically
190 _forceNumInt = flag ;
191 }
192 bool getForceNumInt() const { return _forceNumInt ; }
193
194 // Chi^2 fits to histograms
196 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
197 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
198 virtual RooFitResult* chi2FitTo(RooDataHist& data, const RooLinkedList& cmdList) ;
199
200 virtual RooAbsReal* createChi2(RooDataHist& data, const RooLinkedList& cmdList) ;
202 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
203 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
204
205 // Chi^2 fits to X-Y datasets
206 virtual RooFitResult* chi2FitTo(RooDataSet& xydata, const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
207 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
208 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
209 virtual RooFitResult* chi2FitTo(RooDataSet& xydata, const RooLinkedList& cmdList) ;
210
211 virtual RooAbsReal* createChi2(RooDataSet& data, const RooLinkedList& cmdList) ;
213 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
214 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
215
216
217 virtual RooAbsReal* createProfile(const RooArgSet& paramsOfInterest) ;
218
219
220 RooAbsReal* createIntegral(const RooArgSet& iset, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg::none(),
221 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
222 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
223 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
224
225 /// Create integral over observables in iset in range named rangeName.
226 RooAbsReal* createIntegral(const RooArgSet& iset, const char* rangeName) const {
227 return createIntegral(iset,nullptr,nullptr,rangeName) ;
228 }
229 /// Create integral over observables in iset in range named rangeName with integrand normalized over observables in nset
230 RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet& nset, const char* rangeName=nullptr) const {
231 return createIntegral(iset,&nset,nullptr,rangeName) ;
232 }
233 /// Create integral over observables in iset in range named rangeName with integrand normalized over observables in nset while
234 /// using specified configuration for any numeric integration.
235 RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet& nset, const RooNumIntConfig& cfg, const char* rangeName=nullptr) const {
236 return createIntegral(iset,&nset,&cfg,rangeName) ;
237 }
238 /// Create integral over observables in iset in range named rangeName using specified configuration for any numeric integration.
239 RooAbsReal* createIntegral(const RooArgSet& iset, const RooNumIntConfig& cfg, const char* rangeName=nullptr) const {
240 return createIntegral(iset,nullptr,&cfg,rangeName) ;
241 }
242 virtual RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet* nset=nullptr, const RooNumIntConfig* cfg=nullptr, const char* rangeName=nullptr) const ;
243
244
245 void setParameterizeIntegral(const RooArgSet& paramVars) ;
246
247 // Create running integrals
248 RooAbsReal* createRunningIntegral(const RooArgSet& iset, const RooArgSet& nset=RooArgSet()) ;
249 RooAbsReal* createRunningIntegral(const RooArgSet& iset, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg::none(),
250 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
251 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
252 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
253 RooAbsReal* createIntRI(const RooArgSet& iset, const RooArgSet& nset=RooArgSet()) ;
254 RooAbsReal* createScanRI(const RooArgSet& iset, const RooArgSet& nset, Int_t numScanBins, Int_t intOrder) ;
255
256
257 // Optimized accept/reject generator support
258 virtual Int_t getMaxVal(const RooArgSet& vars) const ;
259 virtual double maxVal(Int_t code) const ;
260 virtual Int_t minTrialSamples(const RooArgSet& /*arGenObs*/) const { return 0 ; }
261
262
263 // Plotting options
264 void setPlotLabel(const char *label);
265 const char *getPlotLabel() const;
266
267 virtual double defaultErrorLevel() const {
268 // Return default level for MINUIT error analysis
269 return 1.0 ;
270 }
271
272 const RooNumIntConfig* getIntegratorConfig() const ;
276 RooNumIntConfig* specialIntegratorConfig(bool createOnTheFly) ;
277 void setIntegratorConfig() ;
278 void setIntegratorConfig(const RooNumIntConfig& config) ;
279
280 virtual void fixAddCoefNormalization(const RooArgSet& addNormSet=RooArgSet(),bool force=true) ;
281 virtual void fixAddCoefRange(const char* rangeName=nullptr,bool force=true) ;
282
283 virtual void preferredObservableScanOrder(const RooArgSet& obs, RooArgSet& orderedObs) const ;
284
285 // User entry point for plotting
286 virtual RooPlot* plotOn(RooPlot* frame,
287 const RooCmdArg& arg1=RooCmdArg(), const RooCmdArg& arg2=RooCmdArg(),
288 const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
289 const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(),
290 const RooCmdArg& arg7=RooCmdArg(), const RooCmdArg& arg8=RooCmdArg(),
291 const RooCmdArg& arg9=RooCmdArg(), const RooCmdArg& arg10=RooCmdArg()
292 ) const ;
293
294
296
297 // Forwarder function for backward compatibility
298 virtual RooPlot *plotSliceOn(RooPlot *frame, const RooArgSet& sliceSet, Option_t* drawOptions="L",
299 double scaleFactor=1.0, ScaleType stype=Relative, const RooAbsData* projData=nullptr) const;
300
301 // Fill an existing histogram
302 TH1 *fillHistogram(TH1 *hist, const RooArgList &plotVars,
303 double scaleFactor= 1, const RooArgSet *projectedVars= nullptr, bool scaling=true,
304 const RooArgSet* condObs=nullptr, bool setError=true) const;
305
306 // Create 1,2, and 3D histograms from and fill it
307 TH1 *createHistogram(RooStringView varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const ;
308 TH1* createHistogram(const char *name, const RooAbsRealLValue& xvar, RooLinkedList& argList) const ;
309 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar,
310 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
311 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
312 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
313 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
314
315 // Fill a RooDataHist
316 RooDataHist* fillDataHist(RooDataHist *hist, const RooArgSet* nset, double scaleFactor,
317 bool correctForBinVolume=false, bool showProgress=false) const ;
318
319 // I/O streaming interface (machine readable)
320 bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
321 void writeToStream(std::ostream& os, bool compact) const override ;
322
323 // Printing interface (human readable)
324 void printValue(std::ostream& os) const override ;
325 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
326
327 inline void setCachedValue(double value, bool notifyClients = true) final;
328
329 // Evaluation error logging
330 class EvalError {
331 public:
333 EvalError(const EvalError& other) : _msg(other._msg), _srvval(other._srvval) { }
334 void setMessage(const char* tmp) { std::string s(tmp); s.swap(_msg); }
335 void setServerValues(const char* tmp) { std::string s(tmp); s.swap(_srvval); }
336 std::string _msg;
337 std::string _srvval;
338 } ;
339
341
342 /// Context to temporarily change the error logging mode as long as the context is alive.
344 public:
346
351
353 private:
355 };
356
359 void logEvalError(const char* message, const char* serverValueString=nullptr) const ;
360 static void logEvalError(const RooAbsReal* originator, const char* origName, const char* message, const char* serverValueString=nullptr) ;
361 static void printEvalErrors(std::ostream&os=std::cout, Int_t maxPerNode=10000000) ;
362 static Int_t numEvalErrors() ;
363 static Int_t numEvalErrorItems() ;
364
365
366 typedef std::map<const RooAbsArg*,std::pair<std::string,std::list<EvalError> > >::const_iterator EvalErrorIter ;
368
369 static void clearEvalErrorLog() ;
370
371 /// Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
372 virtual bool isBinnedDistribution(const RooArgSet& /*obs*/) const { return false ; }
373 virtual std::list<double>* binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const;
374 virtual std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const;
375
376 RooFunctor* functor(const RooArgList& obs, const RooArgList& pars=RooArgList(), const RooArgSet& nset=RooArgSet()) const ;
377 TF1* asTF(const RooArgList& obs, const RooArgList& pars=RooArgList(), const RooArgSet& nset=RooArgSet()) const ;
378
379 RooDerivative* derivative(RooRealVar& obs, Int_t order=1, double eps=0.001) ;
380 RooDerivative* derivative(RooRealVar& obs, const RooArgSet& normSet, Int_t order, double eps=0.001) ;
381
382 RooAbsMoment* moment(RooRealVar& obs, Int_t order, bool central, bool takeRoot) ;
383 RooAbsMoment* moment(RooRealVar& obs, const RooArgSet& normObs, Int_t order, bool central, bool takeRoot, bool intNormObs) ;
384
385 RooAbsMoment* mean(RooRealVar& obs) { return moment(obs,1,false,false) ; }
386 RooAbsMoment* mean(RooRealVar& obs, const RooArgSet& nset) { return moment(obs,nset,1,false,false,true) ; }
387 RooAbsMoment* sigma(RooRealVar& obs) { return moment(obs,2,true,true) ; }
388 RooAbsMoment* sigma(RooRealVar& obs, const RooArgSet& nset) { return moment(obs,nset,2,true,true,true) ; }
389
390 double findRoot(RooRealVar& x, double xmin, double xmax, double yval) ;
391
392
393 virtual bool setData(RooAbsData& /*data*/, bool /*cloneData*/=true) { return true ; }
394
395 virtual void enableOffsetting(bool);
396 virtual bool isOffsetting() const { return false ; }
397 virtual double offset() const { return 0 ; }
398
399 static void setHideOffset(bool flag);
400 static bool hideOffset() ;
401
402protected:
403 // Hook for objects with normalization-dependent parameters interpretation
404 virtual void selectNormalization(const RooArgSet* depSet=nullptr, bool force=false) ;
405 virtual void selectNormalizationRange(const char* rangeName=nullptr, bool force=false) ;
406
407 // Helper functions for plotting
408 bool plotSanityChecks(RooPlot* frame) const ;
409 void makeProjectionSet(const RooAbsArg* plotVar, const RooArgSet* allVars,
410 RooArgSet& projectedVars, bool silent) const ;
411
412 TString integralNameSuffix(const RooArgSet& iset, const RooArgSet* nset=nullptr, const char* rangeName=nullptr, bool omitEmpty=false) const ;
413
414
415
416
417
418 public:
419 bool isSelectedComp() const ;
420 void selectComp(bool flag) {
421 // If flag is true, only selected component will be included in evaluates of RooAddPdf components
422 _selectComp = flag ;
423 }
424
425 const RooAbsReal* createPlotProjection(const RooArgSet& depVars, const RooArgSet& projVars, RooArgSet*& cloneSet) const ;
426 const RooAbsReal *createPlotProjection(const RooArgSet &dependentVars, const RooArgSet *projectedVars,
427 RooArgSet *&cloneSet, const char* rangeName=nullptr, const RooArgSet* condObs=nullptr) const;
428 virtual void computeBatch(cudaStream_t*, double* output, size_t size, RooFit::Detail::DataMap const&) const;
429
430 virtual void translate(RooFit::Detail::CodeSquashContext &ctx) const;
431 virtual std::string
432 buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const;
433
434 protected:
435
437
438 void plotOnCompSelect(RooArgSet* selNodes) const ;
439 RooPlot* plotOnWithErrorBand(RooPlot* frame,const RooFitResult& fr, double Z, const RooArgSet* params, const RooLinkedList& argList, bool method1) const ;
440
441 // Support interface for subclasses to advertise their analytic integration
442 // and generator capabilities in their analyticalIntegral() and generateEvent()
443 // implementations.
444 bool matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps,
445 const RooArgProxy& a) const ;
446 bool matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps,
447 const RooArgProxy& a, const RooArgProxy& b) const ;
448 bool matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps,
449 const RooArgProxy& a, const RooArgProxy& b, const RooArgProxy& c) const ;
450 bool matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps,
451 const RooArgProxy& a, const RooArgProxy& b,
452 const RooArgProxy& c, const RooArgProxy& d) const ;
453
454 bool matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps,
455 const RooArgSet& set) const ;
456
457
458 RooAbsReal* createIntObj(const RooArgSet& iset, const RooArgSet* nset, const RooNumIntConfig* cfg, const char* rangeName) const ;
459 void findInnerMostIntegration(const RooArgSet& allObs, RooArgSet& innerObs, const char* rangeName) const ;
460
461
462 // Internal consistency checking (needed by RooDataSet)
463 /// Check if current value is valid.
464 bool isValid() const override { return isValidReal(_value); }
465 /// Interface function to check if given value is a valid value for this object. Returns true unless overridden.
466 virtual bool isValidReal(double /*value*/, bool printError = false) const { (void)printError; return true; }
467
468
469 // Function evaluation and error tracing
470 double traceEval(const RooArgSet* set) const ;
471
472 /// Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
473 virtual double evaluate() const = 0;
474
475 /// \deprecated evaluateBatch() has been removed in favour of the faster evaluateSpan(). If your code is affected
476 /// by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this transition.
477 /// https://root.cern/doc/v624/release-notes.html
478#ifndef R__MACOSX
479 virtual RooSpan<double> evaluateBatch(std::size_t /*begin*/, std::size_t /*maxSize*/) = delete;
480#else
481 //AppleClang in MacOS10.14 has a linker bug and fails to link programs that create objects of classes containing virtual deleted methods.
482 //This can be safely deleted when MacOS10.14 is no longer supported by ROOT. See https://reviews.llvm.org/D37830
483 virtual RooSpan<double> evaluateBatch(std::size_t /*begin*/, std::size_t /*maxSize*/) final {
484 throw std::logic_error("Deprecated evaluatedBatch() has been removed in favour of the faster evaluateSpan(). If your code is affected by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this transition. https://root.cern/doc/v624/release-notes.html");
485 }
486#endif
487
488 virtual RooSpan<double> evaluateSpan(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet) const;
489
490
491 //---------- Interface to access batch data ---------------------------
492 //
494
495 private:
496 void checkBatchComputation(const RooBatchCompute::RunContext& evalData, std::size_t evtNo, const RooArgSet* normSet = nullptr, double relAccuracy = 1.E-13) const;
497
498 /// Debug version of getVal(), which is slow and does error checking.
499 double _DEBUG_getVal(const RooArgSet* normalisationSet) const;
500
501 //--------------------------------------------------------------------
502
503 protected:
504 // Hooks for RooDataSet interface
505 friend class RooVectorDataStore ;
506 void syncCache(const RooArgSet* set=nullptr) override { getVal(set) ; }
507 void copyCache(const RooAbsArg* source, bool valueOnly=false, bool setValDirty=true) override ;
508 void attachToTree(TTree& t, Int_t bufSize=32000) override ;
509 void attachToVStore(RooVectorDataStore& vstore) override ;
510 void setTreeBranchStatus(TTree& t, bool active) override ;
511 void fillTreeBranch(TTree& t) override ;
512
513 friend class RooRealBinding ;
514 double _plotMin = 0.0; ///< Minimum of plot range
515 double _plotMax = 0.0; ///< Maximum of plot range
516 Int_t _plotBins = 100; ///< Number of plot bins
517 mutable double _value = 0.0; ///< Cache for current value of object
518 TString _unit ; ///< Unit for objects value
519 TString _label ; ///< Plot label for objects value
520 bool _forceNumInt = false; ///< Force numerical integration if flag set
521
522 std::unique_ptr<RooNumIntConfig> _specIntegratorConfig; // Numeric integrator configuration specific for this object
523
524 struct PlotOpt {
525 PlotOpt() : drawOptions("L"), scaleFactor(1.0), stype(Relative), projData(nullptr), binProjData(false), projSet(nullptr), precision(1e-3),
527 projectionRangeName(nullptr),curveInvisible(false), curveName(nullptr),addToCurveName(nullptr),addToWgtSelf(1.),addToWgtOther(1.),
528 numCPU(1),interleave(RooFit::Interleave),curveNameSuffix(""), numee(10), eeval(0), doeeval(false), progress(false), errorFR(nullptr) {}
530 double scaleFactor ;
535 double precision ;
538 const char* normRangeName ;
539 double rangeLo ;
540 double rangeHi ;
545 const char* curveName ;
546 const char* addToCurveName ;
551 const char* curveNameSuffix ;
553 double eeval ;
554 bool doeeval ;
555 bool progress ;
557 } ;
558
559 // Plot implementation functions
560 virtual RooPlot *plotOn(RooPlot* frame, PlotOpt o) const;
561
562public:
563 // PlotOn with command list
564 virtual RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const ;
565
566 protected:
567 virtual RooPlot *plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const;
568
569
570private:
571
573 static std::map<const RooAbsArg*,std::pair<std::string,std::list<EvalError> > > _evalErrorList ;
575
576 bool matchArgsByName(const RooArgSet &allArgs, RooArgSet &matchedArgs, const TList &nameList) const;
577
578 std::unique_ptr<TreeReadBuffer> _treeReadBuffer; //! A buffer for reading values from trees
579
580protected:
581
582 bool redirectServersHook(const RooAbsCollection & newServerList, bool mustReplaceAll,
583 bool nameChange, bool isRecursiveStep) override;
584
585 friend class RooRealSumPdf ;
586 friend class RooRealSumFunc;
587 friend class RooAddHelpers ;
588 friend class RooAddPdf ;
589 friend class RooAddModel ;
590
591 static void globalSelectComp(bool flag) ;
592 bool _selectComp = true; //! Component selection flag for RooAbsPdf::plotCompOn
593 static bool _globalSelectComp ; // Global activation switch for component selection
594 // This struct can be used to flip the global switch to select components.
595 // Doing this with RAII prevents forgetting to reset the state.
601 }
602
606 }
607
609 };
610
611
613 static bool _hideOffset ; ///< Offset hiding flag
614
615 ClassDefOverride(RooAbsReal,3) // Abstract real-valued variable
616};
617
618
619/// Helper class to access a batch-related part of RooAbsReal's interface, which should not leak to the outside world.
621 public:
622 static void checkBatchComputation(const RooAbsReal& theReal, const RooBatchCompute::RunContext& evalData, std::size_t evtNo,
623 const RooArgSet* normSet = nullptr, double relAccuracy = 1.E-13) {
624 theReal.checkBatchComputation(evalData, evtNo, normSet, relAccuracy);
625 }
626};
627
628
629////////////////////////////////////////////////////////////////////////////////
630/// Overwrite the value stored in this object's cache.
631/// This can be used to fake a computation that resulted in `value`.
632/// \param[in] value Value to write.
633/// \param[in] notifyClients If true, notify users of this object that its value changed.
634/// This is the default.
635void RooAbsReal::setCachedValue(double value, bool notifyClients) {
636 _value = value;
637
638 if (notifyClients) {
640 _valueDirty = false;
641 }
642}
643
644
645#endif
#define d(i)
Definition: RSha256.hxx:102
#define c(i)
Definition: RSha256.hxx:101
#define e(i)
Definition: RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
char Text_t
Definition: RtypesCore.h:62
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition: TGX11.cxx:110
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
Helper class to access a batch-related part of RooAbsReal's interface, which should not leak to the o...
Definition: RooAbsReal.h:620
static void checkBatchComputation(const RooAbsReal &theReal, const RooBatchCompute::RunContext &evalData, std::size_t evtNo, const RooArgSet *normSet=nullptr, double relAccuracy=1.E-13)
Definition: RooAbsReal.h:622
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
bool _fast
Definition: RooAbsArg.h:718
bool _valueDirty
Definition: RooAbsArg.h:714
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
Definition: RooAbsArg.h:493
bool inhibitDirty() const
Delete watch flag.
Definition: RooAbsArg.cxx:109
static bool _inhibitDirty
Definition: RooAbsArg.h:697
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
bool empty() const
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:61
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooAbsMoment represents the first, second, or third order derivative of any RooAbsReal as calculated ...
Definition: RooAbsMoment.h:27
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Context to temporarily change the error logging mode as long as the context is alive.
Definition: RooAbsReal.h:343
EvalErrorContext(ErrorLoggingMode m)
Definition: RooAbsReal.h:345
EvalErrorContext & operator=(EvalErrorContext const &)=delete
EvalErrorContext & operator=(EvalErrorContext &&)=delete
EvalErrorContext(EvalErrorContext const &)=delete
EvalErrorContext(EvalErrorContext &&)=delete
void setServerValues(const char *tmp)
Definition: RooAbsReal.h:335
std::string _srvval
Definition: RooAbsReal.h:337
void setMessage(const char *tmp)
Definition: RooAbsReal.h:334
EvalError(const EvalError &other)
Definition: RooAbsReal.h:333
A RooAbsReal::Ref can be constructed from a RooAbsReal& or a double that will be implicitly converted...
Definition: RooAbsReal.h:70
Ref(RooAbsReal &ref)
Definition: RooAbsReal.h:72
RooAbsReal & _ref
Definition: RooAbsReal.h:77
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
virtual RooSpan< const double > getValBatch(std::size_t, std::size_t, const RooArgSet *=nullptr)=delete
RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, double scaleFactor, bool correctForBinVolume=false, bool showProgress=false) const
Fill a RooDataHist with values sampled from this function at the bin centers.
virtual void selectNormalizationRange(const char *rangeName=nullptr, bool force=false)
Interface function to force use of a given normalization range to interpret function value.
void plotOnCompSelect(RooArgSet *selNodes) const
Helper function for plotting of composite p.d.fs.
bool isSelectedComp() const
If true, the current pdf is a selected component (for use in plotting)
std::unique_ptr< TreeReadBuffer > _treeReadBuffer
Definition: RooAbsReal.h:578
virtual std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
void selectComp(bool flag)
Definition: RooAbsReal.h:420
TString _label
Plot label for objects value.
Definition: RooAbsReal.h:519
@ RelativeExpected
Definition: RooAbsReal.h:295
bool _selectComp
Definition: RooAbsReal.h:592
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:105
double findRoot(RooRealVar &x, double xmin, double xmax, double yval)
Return value of x (in range xmin,xmax) at which function equals yval.
RooAbsMoment * mean(RooRealVar &obs)
Definition: RooAbsReal.h:385
virtual bool isOffsetting() const
Definition: RooAbsReal.h:396
virtual double getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
Definition: RooAbsReal.cxx:228
virtual RooPlot * plotSliceOn(RooPlot *frame, const RooArgSet &sliceSet, Option_t *drawOptions="L", double scaleFactor=1.0, ScaleType stype=Relative, const RooAbsData *projData=nullptr) const
static Int_t numEvalErrorItems()
Definition: RooAbsReal.cxx:292
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
Definition: RooAbsReal.cxx:127
virtual void fixAddCoefNormalization(const RooArgSet &addNormSet=RooArgSet(), bool force=true)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
virtual RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const
Evaluate this object for a batch/span of data points.
RooAbsReal * createScanRI(const RooArgSet &iset, const RooArgSet &nset, Int_t numScanBins, Int_t intOrder)
Utility function for createRunningIntegral that construct an object implementing the numeric scanning...
static std::map< const RooAbsArg *, std::pair< std::string, std::list< EvalError > > > _evalErrorList
Definition: RooAbsReal.h:573
virtual Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
Definition: RooAbsReal.cxx:341
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables std::liste...
Definition: RooAbsReal.cxx:503
virtual RooAbsReal * createChi2(RooDataHist &data, const RooLinkedList &cmdList)
RooAbsArg * createFundamental(const char *newname=nullptr) const override
Create a RooRealVar fundamental object with our properties.
bool isValid() const override
Check if current value is valid.
Definition: RooAbsReal.h:464
bool _forceNumInt
Force numerical integration if flag set.
Definition: RooAbsReal.h:520
~RooAbsReal() override
Destructor.
Definition: RooAbsReal.cxx:169
void setParameterizeIntegral(const RooArgSet &paramVars)
bool matchArgsByName(const RooArgSet &allArgs, RooArgSet &matchedArgs, const TList &nameList) const
Check if allArgs contains matching elements for each name in nameList.
static bool hideOffset()
Definition: RooAbsReal.cxx:116
virtual RooAbsReal * createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
Definition: RooAbsReal.cxx:461
void setTreeBranchStatus(TTree &t, bool active) override
(De)Activate associated tree branch
TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, double scaleFactor=1, const RooArgSet *projectedVars=nullptr, bool scaling=true, const RooArgSet *condObs=nullptr, bool setError=true) const
Fill the ROOT histogram 'hist' with values sampled from this function at the bin centers.
Definition: RooAbsReal.cxx:969
virtual double defaultErrorLevel() const
Definition: RooAbsReal.h:267
double _DEBUG_getVal(const RooArgSet *normalisationSet) const
Debug version of getVal(), which is slow and does error checking.
RooAbsReal * createIntegral(const RooArgSet &iset, const RooArgSet &nset, const char *rangeName=nullptr) const
Create integral over observables in iset in range named rangeName with integrand normalized over obse...
Definition: RooAbsReal.h:230
bool plotSanityChecks(RooPlot *frame) const
Utility function for plotOn(), perform general sanity check on frame to ensure safe plotting operatio...
double getPropagatedError(const RooFitResult &fr, const RooArgSet &nset=RooArgSet()) const
Calculate error on self by linearly propagating errors on parameters using the covariance matrix from...
virtual void selectNormalization(const RooArgSet *depSet=nullptr, bool force=false)
Interface function to force use of a given set of observables to interpret function value.
RooDerivative * derivative(RooRealVar &obs, Int_t order=1, double eps=0.001)
Return function representing first, second or third order derivative of this function.
static EvalErrorIter evalErrorIter()
Definition: RooAbsReal.cxx:300
RooAbsReal * createIntRI(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Utility function for createRunningIntegral.
TF1 * asTF(const RooArgList &obs, const RooArgList &pars=RooArgList(), const RooArgSet &nset=RooArgSet()) const
Return a ROOT TF1,2,3 object bound to this RooAbsReal with given definition of observables and parame...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
virtual bool setData(RooAbsData &, bool=true)
Definition: RooAbsReal.h:393
TString _unit
Unit for objects value.
Definition: RooAbsReal.h:518
static RooNumIntConfig * defaultIntegratorConfig()
Returns the default numeric integration configuration for all RooAbsReals.
RooFitResult * chi2FitDriver(RooAbsReal &fcn, RooLinkedList &cmdList)
Internal driver function for chi2 fits.
virtual RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
Definition: RooAbsReal.cxx:261
double getVal(const RooArgSet &normalisationSet) const
Like getVal(const RooArgSet*), but always requires an argument for normalisation.
Definition: RooAbsReal.h:128
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from stream (dummy for now)
Definition: RooAbsReal.cxx:416
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
void fillTreeBranch(TTree &t) override
Fill the tree branch that associated with this object with its current value.
RooAbsFunc * bindVars(const RooArgSet &vars, const RooArgSet *nset=nullptr, bool clipInvalid=false) const
Create an interface adaptor f(vars) that binds us to the specified variables (in arbitrary order).
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
Definition: RooAbsReal.cxx:445
virtual RooPlot * plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue &asymCat, PlotOpt o) const
virtual RooSpan< double > evaluateBatch(std::size_t, std::size_t)=delete
bool operator==(double value) const
Equality operator comparing to a double.
Definition: RooAbsReal.cxx:175
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
A buffer for reading values from trees.
virtual Int_t minTrialSamples(const RooArgSet &) const
Definition: RooAbsReal.h:260
virtual bool isValidReal(double, bool printError=false) const
Interface function to check if given value is a valid value for this object. Returns true unless over...
Definition: RooAbsReal.h:466
void setIntegratorConfig()
Remove the specialized numeric integration configuration associated with this object.
void syncCache(const RooArgSet *set=nullptr) override
Definition: RooAbsReal.h:506
void printValue(std::ostream &os) const override
Print object value.
Definition: RooAbsReal.cxx:435
virtual bool forceAnalyticalInt(const RooAbsArg &) const
Definition: RooAbsReal.h:182
bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const override
Definition: RooAbsReal.cxx:195
void setUnit(const char *unit)
Definition: RooAbsReal.h:165
bool getForceNumInt() const
Definition: RooAbsReal.h:192
static bool _hideOffset
Offset hiding flag.
Definition: RooAbsReal.h:613
static ErrorLoggingMode _evalErrorMode
Definition: RooAbsReal.h:572
void attachToVStore(RooVectorDataStore &vstore) override
static Int_t _evalErrorCount
Definition: RooAbsReal.h:574
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true) override
Copy the cached value of another RooAbsArg to our cache.
TH1 * createHistogram(RooStringView varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const
Create and fill a ROOT histogram TH1, TH2 or TH3 with the values of this function for the variables w...
virtual void fixAddCoefRange(const char *rangeName=nullptr, bool force=true)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
double _value
Cache for current value of object.
Definition: RooAbsReal.h:517
virtual double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Definition: RooAbsReal.cxx:384
void attachToTree(TTree &t, Int_t bufSize=32000) override
Attach object to a branch of given TTree.
std::map< constRooAbsArg *, std::pair< std::string, std::list< EvalError > > >::const_iterator EvalErrorIter
Definition: RooAbsReal.h:366
virtual void translate(RooFit::Detail::CodeSquashContext &ctx) const
This function defines a translation for each RooAbsReal based object that can be used to express the ...
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
RooAbsReal * createIntObj(const RooArgSet &iset, const RooArgSet *nset, const RooNumIntConfig *cfg, const char *rangeName) const
Internal utility function for createIntegral() that creates the actual integral object.
Definition: RooAbsReal.cxx:581
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to stream (dummy for now)
Definition: RooAbsReal.cxx:426
double traceEval(const RooArgSet *set) const
Calculate current value of object, with error tracing wrapper.
Definition: RooAbsReal.cxx:309
RooAbsReal * createIntegral(const RooArgSet &iset, const RooArgSet &nset, const RooNumIntConfig &cfg, const char *rangeName=nullptr) const
Create integral over observables in iset in range named rangeName with integrand normalized over obse...
Definition: RooAbsReal.h:235
static void setHideOffset(bool flag)
Definition: RooAbsReal.cxx:115
void checkBatchComputation(const RooBatchCompute::RunContext &evalData, std::size_t evtNo, const RooArgSet *normSet=nullptr, double relAccuracy=1.E-13) const
Walk through expression tree headed by the this object, and check a batch computation.
static void globalSelectComp(bool flag)
Global switch controlling the activation of the selectComp() functionality.
RooAbsMoment * moment(RooRealVar &obs, Int_t order, bool central, bool takeRoot)
Return function representing moment of function of given order.
virtual std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const
This function defines the analytical integral translation for the class.
RooPlot * plotOnWithErrorBand(RooPlot *frame, const RooFitResult &fr, double Z, const RooArgSet *params, const RooLinkedList &argList, bool method1) const
Plot function or PDF on frame with support for visualization of the uncertainty encoded in the given ...
RooFit::UniqueId< RooArgSet >::Value_t _lastNormSetId
!
Definition: RooAbsReal.h:612
const char * getPlotLabel() const
Get the label associated with the variable.
Definition: RooAbsReal.cxx:396
virtual RooFitResult * chi2FitTo(RooDataHist &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Perform a fit to given histogram.
virtual void forceNumInt(bool flag=true)
Definition: RooAbsReal.h:187
std::unique_ptr< RooNumIntConfig > _specIntegratorConfig
Definition: RooAbsReal.h:522
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Definition: RooAbsReal.cxx:358
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
double _plotMax
Maximum of plot range.
Definition: RooAbsReal.h:515
virtual void preferredObservableScanOrder(const RooArgSet &obs, RooArgSet &orderedObs) const
Interface method for function objects to indicate their preferred order of observables for scanning t...
virtual double maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
void findInnerMostIntegration(const RooArgSet &allObs, RooArgSet &innerObs, const char *rangeName) const
Utility function for createIntObj() that aids in the construct of recursive integrals over functions ...
Definition: RooAbsReal.cxx:691
TString integralNameSuffix(const RooArgSet &iset, const RooArgSet *nset=nullptr, const char *rangeName=nullptr, bool omitEmpty=false) const
Construct std::string with unique suffix name to give to integral object that encodes integrated obse...
Definition: RooAbsReal.cxx:745
RooAbsReal * createIntegral(const RooArgSet &iset, const RooNumIntConfig &cfg, const char *rangeName=nullptr) const
Create integral over observables in iset in range named rangeName using specified configuration for a...
Definition: RooAbsReal.h:239
virtual double evaluate() const =0
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const
Base function for computing multiple values of a RooAbsReal.
TString getTitle(bool appendUnit=false) const
Return this variable's title std::string.
Definition: RooAbsReal.cxx:210
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
virtual double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Definition: RooAbsReal.cxx:370
RooAbsReal * createIntegral(const RooArgSet &iset, const char *rangeName) const
Create integral over observables in iset in range named rangeName.
Definition: RooAbsReal.h:226
const Text_t * getUnit() const
Definition: RooAbsReal.h:161
const RooNumIntConfig * getIntegratorConfig() const
Return the numeric integration configuration used for this object.
virtual bool isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooAbsReal.h:372
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
virtual void enableOffsetting(bool)
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooAbsMoment * sigma(RooRealVar &obs, const RooArgSet &nset)
Definition: RooAbsReal.h:388
RooFunctor * functor(const RooArgList &obs, const RooArgList &pars=RooArgList(), const RooArgSet &nset=RooArgSet()) const
Return a RooFunctor object bound to this RooAbsReal with given definition of observables and paramete...
void setCachedValue(double value, bool notifyClients=true) final
Overwrite the value stored in this object's cache.
Definition: RooAbsReal.h:635
Int_t _plotBins
Number of plot bins.
Definition: RooAbsReal.h:516
const RooAbsReal * createPlotProjection(const RooArgSet &depVars, const RooArgSet &projVars, RooArgSet *&cloneSet) const
Utility function for plotOn() that creates a projection of a function or p.d.f to be plotted on a Roo...
Definition: RooAbsReal.cxx:805
virtual std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
void setPlotLabel(const char *label)
Set the label associated with this variable.
Definition: RooAbsReal.cxx:406
void makeProjectionSet(const RooAbsArg *plotVar, const RooArgSet *allVars, RooArgSet &projectedVars, bool silent) const
Utility function for plotOn() that constructs the set of observables to project when plotting ourselv...
virtual Int_t getMaxVal(const RooArgSet &vars) const
Advertise capability to determine maximum value of function for given set of observables.
double _plotMin
Minimum of plot range.
Definition: RooAbsReal.h:514
RooAbsMoment * mean(RooRealVar &obs, const RooArgSet &nset)
Definition: RooAbsReal.h:386
virtual double offset() const
Definition: RooAbsReal.h:397
RooAbsMoment * sigma(RooRealVar &obs)
Definition: RooAbsReal.h:387
RooAbsReal * createRunningIntegral(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Calls createRunningIntegral(const RooArgSet&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&,...
static bool _globalSelectComp
Component selection flag for RooAbsPdf::plotCompOn.
Definition: RooAbsReal.h:593
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddModel.h:28
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:34
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgProxy is the abstract interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:26
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:51
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:39
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:57
RooDerivative represents the first, second, or third order derivative of any RooAbsReal as calculated...
Definition: RooDerivative.h:30
This class can evaluate a RooAbsReal object in other ways than recursive graph traversal.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
A class to maintain the context for squashing of RooFit models into code.
Lightweight interface adaptor that exports a RooAbsPdf as a functor.
Definition: RooFunctor.h:25
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:38
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:43
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
Definition: RooRealSumPdf.h:24
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
The RooStringView is a wrapper around a C-syle string that can also be constructed from a std::string...
Definition: RooStringView.h:27
RooVectorDataStore uses std::vectors to store data columns.
1-Dim function class
Definition: TF1.h:213
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:577
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:257
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:268
A doubly linked list.
Definition: TList.h:38
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
A TTree represents a columnar dataset.
Definition: TTree.h:79
RooCmdArg Extended(bool flag=true)
Double_t x[n]
Definition: legend1.C:17
void(off) SmallVectorTemplateBase< T
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18
@ Interleave
Definition: RooGlobalFunc.h:65
BatchModeOption
For setting the batch mode flag with the BatchMode() command argument to RooAbsPdf::fitTo()
Definition: RooGlobalFunc.h:69
static constexpr double s
const double xbins[xbins_n]
RooCurve::WingMode wmode
Definition: RooAbsReal.h:542
const char * normRangeName
Definition: RooAbsReal.h:538
RooFit::MPSplit interleave
Definition: RooAbsReal.h:550
const char * projectionRangeName
Definition: RooAbsReal.h:543
const RooArgSet * projDataSet
Definition: RooAbsReal.h:537
const char * curveNameSuffix
Definition: RooAbsReal.h:551
const char * addToCurveName
Definition: RooAbsReal.h:546
const RooFitResult * errorFR
Definition: RooAbsReal.h:556
const RooArgSet * projSet
Definition: RooAbsReal.h:534
const char * curveName
Definition: RooAbsReal.h:545
const RooAbsData * projData
Definition: RooAbsReal.h:532
Option_t * drawOptions
Definition: RooAbsReal.h:529
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:32
A UniqueId can be added as a class member to enhance any class with a unique identifier for each inst...
Definition: UniqueId.h:39
unsigned long Value_t
Definition: UniqueId.h:41
TMarker m
Definition: textangle.C:8
TArc a
Definition: textangle.C:12
static void output()