Logo ROOT  
Reference Guide
RooAbsPdf.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsPdf.h,v 1.90 2007/07/21 21:32:52 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_PDF
17#define ROO_ABS_PDF
18
19#include "RooAbsReal.h"
20#include "RooObjCacheManager.h"
21#include "RooCmdArg.h"
22#include "RooFit/UniqueId.h"
23
24class RooDataSet;
25class RooDataHist ;
26class RooArgSet ;
27class RooAbsGenContext ;
28class RooFitResult ;
29class RooExtendPdf ;
30class RooCategory ;
31class TPaveText;
32class TH1F;
33class TH2F;
34class TList ;
35class RooLinkedList ;
36class RooMinimizer ;
37class RooNumGenConfig ;
38class RooRealIntegral ;
39
40namespace RooBatchCompute {
41struct RunContext;
42}
43
44class RooAbsPdf : public RooAbsReal {
45public:
46
47 // Constructors, assignment etc
48 RooAbsPdf() ;
49 RooAbsPdf(const char *name, const char *title=nullptr) ;
50 RooAbsPdf(const char *name, const char *title, double minVal, double maxVal) ;
51 // RooAbsPdf(const RooAbsPdf& other, const char* name=nullptr);
52 ~RooAbsPdf() override;
53
54 // Toy MC generation
55
56 ////////////////////////////////////////////////////////////////////////////////
57 /// See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&)
58 /// \param[in] whatVars Set of observables to generate for each event according to this model.
59 /// \param[in] nEvents How many events to generate
60 /// \param arg1,arg2,arg3,arg4,arg5 Optional command arguments.
61 RooDataSet *generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg& arg1,
62 const RooCmdArg& arg2=RooCmdArg::none(), const RooCmdArg& arg3=RooCmdArg::none(),
63 const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none()) {
64 return generate(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5) ;
65 }
66 RooDataSet *generate(const RooArgSet &whatVars,
67 const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
68 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
69 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
70 RooDataSet *generate(const RooArgSet &whatVars, double nEvents = 0, bool verbose=false, bool autoBinned=true,
71 const char* binnedTag="", bool expectedData=false, bool extended = false) const;
72 RooDataSet *generate(const RooArgSet &whatVars, const RooDataSet &prototype, Int_t nEvents= 0,
73 bool verbose=false, bool randProtoOrder=false, bool resampleProto=false) const;
74
75
76 class GenSpec {
77 public:
78 virtual ~GenSpec() ;
79 GenSpec() { _genContext = nullptr ; _protoData = nullptr ; _init = false ; _extended=false, _nGen=0 ; _randProto = false ; _resampleProto=false ; }
80 private:
81 GenSpec(RooAbsGenContext* context, const RooArgSet& whatVars, RooDataSet* protoData, Int_t nGen, bool extended,
82 bool randProto, bool resampleProto, TString dsetName, bool init=false) ;
83 GenSpec(const GenSpec& other) ;
84
85 friend class RooAbsPdf ;
90 bool _extended ;
94 bool _init ;
95
96 ClassDef(GenSpec,0) // Generation specification
97 } ;
98
99 ///Prepare GenSpec configuration object for efficient generation of multiple datasets from identical specification.
100 GenSpec* prepareMultiGen(const RooArgSet &whatVars,
101 const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
102 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
103 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
104 ///Generate according to GenSpec obtained from prepareMultiGen().
105 RooDataSet* generate(GenSpec&) const ;
106
107
108 ////////////////////////////////////////////////////////////////////////////////
109 /// As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&)
110 /// \param[in] whatVars set
111 /// \param[in] nEvents How many events to generate
112 /// \param arg1,arg2,arg3,arg4,arg5 ordered arguments
113 virtual RooDataHist *generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg& arg1,
114 const RooCmdArg& arg2=RooCmdArg::none(), const RooCmdArg& arg3=RooCmdArg::none(),
115 const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none()) const {
116 return generateBinned(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5);
117 }
118 virtual RooDataHist *generateBinned(const RooArgSet &whatVars,
119 const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
120 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
121 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) const;
122 virtual RooDataHist *generateBinned(const RooArgSet &whatVars, double nEvents, bool expectedData=false, bool extended=false) const;
123
124 virtual RooDataSet* generateSimGlobal(const RooArgSet& whatVars, Int_t nEvents) ;
125
126 ///Helper calling plotOn(RooPlot*, RooLinkedList&) const
128 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
129 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
130 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
131 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none(),
132 const RooCmdArg& arg9=RooCmdArg::none(), const RooCmdArg& arg10=RooCmdArg::none()
133 ) const override {
134 return RooAbsReal::plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) ;
135 }
136 RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const override ;
137
138 /// Add a box with parameter values (and errors) to the specified frame
139 virtual RooPlot* paramOn(RooPlot* frame,
140 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
141 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
142 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
143 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
144
145 virtual RooPlot* paramOn(RooPlot* frame, const RooAbsData* data, const char *label= "", Int_t sigDigits = 2,
146 Option_t *options = "NELU", double xmin=0.65,
147 double xmax = 0.9, double ymax = 0.9) ;
148
149 // Built-in generator support
150 virtual Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const;
151 virtual void initGenerator(Int_t code) ;
152 virtual void generateEvent(Int_t code);
153 virtual bool isDirectGenSafe(const RooAbsArg& arg) const ;
154
155 // Configuration of MC generators used for this pdf
156 const RooNumGenConfig* getGeneratorConfig() const ;
159 RooNumGenConfig* specialGeneratorConfig(bool createOnTheFly) ;
160 void setGeneratorConfig() ;
161 void setGeneratorConfig(const RooNumGenConfig& config) ;
162
163 // -log(L) fits to binned and unbinned data
164 virtual RooFitResult* fitTo(RooAbsData& data, const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
165 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
166 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
167 virtual RooFitResult* fitTo(RooAbsData& data, const RooLinkedList& cmdList) ;
168
169 /// Configuration struct for RooAbsPdf::minimizeNLL with all the default
170 //values that also should be taked as the default values for
171 //RooAbsPdf::fitTo.
173 double recoverFromNaN = 10.;
174 int optConst = 2;
175 int verbose = 0;
176 int doSave = 0;
177 int doTimer = 0;
178 int printLevel = 1;
179 int strat = 1;
180 int initHesse = 0;
181 int hesse = 1;
182 int minos = 0;
183 int numee = 10;
184 int doEEWall = 1;
185 int doWarn = 1;
186 int doSumW2 = -1;
187 int doAsymptotic = -1;
188 const RooArgSet* minosSet = nullptr;
189 std::string minType;
190 std::string minAlg = "minuit";
191 };
192 std::unique_ptr<RooFitResult> minimizeNLL(RooAbsReal & nll, RooAbsData const& data, MinimizerConfig const& cfg);
193
194 virtual RooAbsReal* createNLL(RooAbsData& data, const RooLinkedList& cmdList) ;
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
199 // Chi^2 fits to histograms
202 RooFitResult* chi2FitTo(RooDataHist& data, const RooLinkedList& cmdList) override ;
204 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
205 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) override ;
206
207 // Chi^2 fits to X-Y datasets
208 RooAbsReal* createChi2(RooDataSet& data, const RooLinkedList& cmdList) override ;
209
210
211 // Constraint management
212 virtual RooArgSet* getConstraints(const RooArgSet& /*observables*/, RooArgSet& /*constrainedParams*/, bool /*stripDisconnected*/) const {
213 // Interface to retrieve constraint terms on this pdf. Default implementation returns null
214 return nullptr ;
215 }
216 virtual RooArgSet* getAllConstraints(const RooArgSet& observables, RooArgSet& constrainedParams, bool stripDisconnected=true) const ;
217
218 // Project p.d.f into lower dimensional p.d.f
219 virtual RooAbsPdf* createProjection(const RooArgSet& iset) ;
220
221 // Create cumulative density function from p.d.f
222 RooAbsReal* createCdf(const RooArgSet& iset, const RooArgSet& nset=RooArgSet()) ;
223 RooAbsReal* createCdf(const RooArgSet& iset, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg::none(),
224 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
225 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
226 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
227 RooAbsReal* createScanCdf(const RooArgSet& iset, const RooArgSet& nset, Int_t numScanBins, Int_t intOrder) ;
228
229 // Function evaluation support
230 double getValV(const RooArgSet* set=nullptr) const override ;
231 virtual double getLogVal(const RooArgSet* set=nullptr) const ;
232
233 RooSpan<const double> getValues(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet) const override;
235 RooSpan<const double> getLogValBatch(std::size_t begin, std::size_t batchSize,
236 const RooArgSet* normSet = nullptr) const;
237 RooSpan<const double> getLogProbabilities(RooBatchCompute::RunContext& evalData, const RooArgSet* normSet = nullptr) const;
238 void getLogProbabilities(RooSpan<const double> pdfValues, double * output) const;
239
240 /// \copydoc getNorm(const RooArgSet*) const
241 double getNorm(const RooArgSet& nset) const {
242 return getNorm(&nset) ;
243 }
244 virtual double getNorm(const RooArgSet* set=nullptr) const ;
245
246 virtual void resetErrorCounters(Int_t resetValue=10) ;
247 void setTraceCounter(Int_t value, bool allNodes=false) ;
248
249 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
250
251 /// Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
252 /// Always returns false, unless a PDF overrides this function.
253 virtual bool selfNormalized() const {
254 return false ;
255 }
256
257 // Support for extended maximum likelihood, switched off by default
259 /// Returns ability of PDF to provide extended likelihood terms. Possible
260 /// answers are in the enumerator RooAbsPdf::ExtendMode.
261 /// This default implementation always returns CanNotBeExtended.
262 virtual ExtendMode extendMode() const { return CanNotBeExtended; }
263 /// If true, PDF can provide extended likelihood term.
264 inline bool canBeExtended() const {
265 return (extendMode() != CanNotBeExtended) ;
266 }
267 /// If true PDF must provide extended likelihood term.
268 inline bool mustBeExtended() const {
269 return (extendMode() == MustBeExtended) ;
270 }
271 /// Return expected number of events to be used in calculation of extended
272 /// likelihood.
273 virtual double expectedEvents(const RooArgSet* nset) const ;
274 /// Return expected number of events to be used in calculation of extended
275 /// likelihood. This function should not be overridden, as it just redirects
276 /// to the actual virtual function but takes a RooArgSet reference instead of
277 /// pointer (\see expectedEvents(const RooArgSet*) const).
278 double expectedEvents(const RooArgSet& nset) const {
279 return expectedEvents(&nset) ;
280 }
281
282 // Printing interface (human readable)
283 void printValue(std::ostream& os) const override ;
284 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
285
286 static void verboseEval(Int_t stat) ;
287 static int verboseEval() ;
288
289 double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0) const;
290 double extendedTerm(double sumEntries, RooArgSet const* nset, double sumEntriesW2=0.0) const;
291 double extendedTerm(RooAbsData const& data, bool weightSquared) const;
292
293 void setNormRange(const char* rangeName) ;
294 const char* normRange() const {
295 return _normRange.Length()>0 ? _normRange.Data() : nullptr ;
296 }
297 void setNormRangeOverride(const char* rangeName) ;
298
299 const RooAbsReal* getNormIntegral(const RooArgSet& nset) const { return getNormObj(nullptr,&nset,nullptr) ; }
300
301 virtual const RooAbsReal* getNormObj(const RooArgSet* set, const RooArgSet* iset, const TNamed* rangeName=nullptr) const ;
302
303 virtual RooAbsGenContext* binnedGenContext(const RooArgSet &vars, bool verbose= false) const ;
304
305 virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr,
306 const RooArgSet* auxProto=nullptr, bool verbose= false) const ;
307
308 virtual RooAbsGenContext* autoGenContext(const RooArgSet &vars, const RooDataSet* prototype=nullptr, const RooArgSet* auxProto=nullptr,
309 bool verbose=false, bool autoBinned=true, const char* binnedTag="") const ;
310
311private:
312
313 RooDataSet *generate(RooAbsGenContext& context, const RooArgSet& whatVars, const RooDataSet* prototype,
314 double nEvents, bool verbose, bool randProtoOrder, bool resampleProto, bool skipInit=false,
315 bool extended=false) const ;
316
317 // Implementation version
318 virtual RooPlot* paramOn(RooPlot* frame, const RooArgSet& params, bool showConstants=false,
319 const char *label= "", Int_t sigDigits = 2, Option_t *options = "NELU", double xmin=0.65,
320 double xmax= 0.99,double ymax=0.95, const RooCmdArg* formatCmd=nullptr) ;
321
322 void logBatchComputationErrors(RooSpan<const double>& outputs, std::size_t begin) const;
323 bool traceEvalPdf(double value) const;
324
325 /// Setter for the _normSet member, which should never be set directly.
326 inline void setActiveNormSet(RooArgSet const* normSet) const {
327 _normSet = normSet;
328 // Also store the unique ID of the _normSet. This makes it possible to
329 // detect if the pointer was invalidated.
331 }
332
333protected:
334
335 /// Checks if `normSet` is the currently active normalization set of this
336 /// PDF, meaning is exactly the same object as the one the `_normSet` member
337 /// points to (or both are `nullptr`).
338 inline bool isActiveNormSet(RooArgSet const* normSet) const {
339 return RooFit::getUniqueId(normSet).value() == _normSetId;
340 }
341
342 double normalizeWithNaNPacking(double rawVal, double normVal) const;
343
344 RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
345
346 friend class RooMCStudy ;
347
348 Int_t* randomizeProtoOrder(Int_t nProto,Int_t nGen,bool resample=false) const ;
349
350 // This also forces the definition of a copy ctor in derived classes
351 RooAbsPdf(const RooAbsPdf& other, const char* name = nullptr);
352
354
355 virtual bool syncNormalization(const RooArgSet* dset, bool adjustProxies=true) const ;
356
357 mutable double _rawValue ;
358 mutable RooAbsReal* _norm = nullptr; //! Normalization integral (owned by _normMgr)
359 mutable RooArgSet const* _normSet = nullptr; //! Normalization set with for above integral
360
362 public:
363 CacheElem(RooAbsReal& norm) : _norm(&norm) {} ;
364 ~CacheElem() override ;
367 } ;
368 mutable RooObjCacheManager _normMgr ; //! The cache manager
369
370 bool redirectServersHook(const RooAbsCollection & newServerList, bool mustReplaceAll,
371 bool nameChange, bool isRecursiveStep) override;
372
373
374 mutable Int_t _errorCount ; ///< Number of errors remaining to print
375 mutable Int_t _traceCount ; ///< Number of traces remaining to print
376 mutable Int_t _negCount ; ///< Number of negative probablities remaining to print
377
378 bool _selectComp ; ///< Component selection flag for RooAbsPdf::plotCompOn
379
380 std::unique_ptr<RooNumGenConfig> _specGeneratorConfig ; ///<! MC generator configuration specific for this object
381
382 TString _normRange ; ///< Normalization range
384
385private:
386 mutable RooFit::UniqueId<RooArgSet>::Value_t _normSetId = RooFit::UniqueId<RooArgSet>::nullval; ///<! Unique ID of the currently-active normalization set
387
389 int calcSumW2CorrectedCovariance(RooMinimizer& minimizer, RooAbsReal & nll) const;
390
391 ClassDefOverride(RooAbsPdf,5) // Abstract PDF with normalization support
392};
393
394
395
396
397#endif
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:335
#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 value
char name[80]
Definition: TGX11.cxx:110
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
float ymax
Definition: THbookFile.cxx:95
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:71
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:62
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
Normalization set with for above integral.
Definition: RooAbsPdf.h:361
~CacheElem() override
Destructor of normalization cache element.
Definition: RooAbsPdf.cxx:3133
CacheElem(RooAbsReal &norm)
Definition: RooAbsPdf.h:363
RooAbsReal * _norm
Definition: RooAbsPdf.h:366
RooArgList containedArgs(Action) override
Definition: RooAbsPdf.h:365
RooArgSet _whatVars
Definition: RooAbsPdf.h:87
RooAbsGenContext * _genContext
Definition: RooAbsPdf.h:86
GenSpec(const GenSpec &other)
TString _dsetName
Definition: RooAbsPdf.h:93
RooDataSet * _protoData
Definition: RooAbsPdf.h:88
GenSpec * prepareMultiGen(const RooArgSet &whatVars, 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())
Prepare GenSpec configuration object for efficient generation of multiple datasets from identical spe...
Definition: RooAbsPdf.cxx:1957
virtual bool syncNormalization(const RooArgSet *dset, bool adjustProxies=true) const
Verify that the normalization integral cached with this PDF is valid for given set of normalization o...
Definition: RooAbsPdf.cxx:535
int calcSumW2CorrectedCovariance(RooMinimizer &minimizer, RooAbsReal &nll) const
Apply correction to errors and covariance matrix.
Definition: RooAbsPdf.cxx:1202
double getNorm(const RooArgSet &nset) const
Get normalisation term needed to normalise the raw values returned by getVal().
Definition: RooAbsPdf.h:241
RooSpan< const double > getLogValBatch(std::size_t begin, std::size_t batchSize, const RooArgSet *normSet=nullptr) const
RooObjCacheManager _normMgr
Definition: RooAbsPdf.h:368
RooFit::UniqueId< RooArgSet >::Value_t _normSetId
! Unique ID of the currently-active normalization set
Definition: RooAbsPdf.h:386
std::unique_ptr< RooNumGenConfig > _specGeneratorConfig
! MC generator configuration specific for this object
Definition: RooAbsPdf.h:380
double getValV(const RooArgSet *set=nullptr) const override
Return current value, normalized by integrating over the observables in nset.
Definition: RooAbsPdf.cxx:350
RooAbsReal * createChi2(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()) override
Create a from a histogram and this function.
Definition: RooAbsPdf.cxx:1634
bool _selectComp
Component selection flag for RooAbsPdf::plotCompOn.
Definition: RooAbsPdf.h:378
virtual void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
Definition: RooAbsPdf.cxx:2204
double expectedEvents(const RooArgSet &nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition: RooAbsPdf.h:278
void logBatchComputationErrors(RooSpan< const double > &outputs, std::size_t begin) const
Scan through outputs and fix+log all nans and negative values.
Definition: RooAbsPdf.cxx:700
RooSpan< const double > getLogProbabilities(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
Compute the log-likelihoods for all events in the requested batch.
Definition: RooAbsPdf.cxx:723
void setGeneratorConfig()
Remove the specialized numeric MC generator configuration associated with this object.
Definition: RooAbsPdf.cxx:3364
virtual void resetErrorCounters(Int_t resetValue=10)
Reset error counter to given value, limiting the number of future error messages for this pdf to 'res...
Definition: RooAbsPdf.cxx:632
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
Definition: RooAbsPdf.cxx:3121
bool isActiveNormSet(RooArgSet const *normSet) const
Checks if normSet is the currently active normalization set of this PDF, meaning is exactly the same ...
Definition: RooAbsPdf.h:338
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition: RooAbsPdf.cxx:3101
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
Definition: RooAbsPdf.cxx:950
virtual RooAbsGenContext * binnedGenContext(const RooArgSet &vars, bool verbose=false) const
Return a binned generator context.
Definition: RooAbsPdf.cxx:1775
RooAbsReal * createScanCdf(const RooArgSet &iset, const RooArgSet &nset, Int_t numScanBins, Int_t intOrder)
Definition: RooAbsPdf.cxx:3263
TString _normRange
Normalization range.
Definition: RooAbsPdf.h:382
virtual bool isDirectGenSafe(const RooAbsArg &arg) const
Check if given observable can be safely generated using the pdfs internal generator mechanism (if tha...
Definition: RooAbsPdf.cxx:2217
Int_t * randomizeProtoOrder(Int_t nProto, Int_t nGen, bool resample=false) const
Return lookup table with randomized order for nProto prototype events.
Definition: RooAbsPdf.cxx:2145
void setNormRange(const char *rangeName)
Definition: RooAbsPdf.cxx:3392
const RooAbsReal * getNormIntegral(const RooArgSet &nset) const
Definition: RooAbsPdf.h:299
~RooAbsPdf() override
Destructor.
Definition: RooAbsPdf.cxx:308
bool mustBeExtended() const
If true PDF must provide extended likelihood term.
Definition: RooAbsPdf.h:268
virtual RooFitResult * fitTo(RooAbsData &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())
Fit PDF to given dataset.
Definition: RooAbsPdf.cxx:1378
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
Definition: RooAbsPdf.h:359
RooFitResult * chi2FitTo(RooDataHist &data, const RooLinkedList &cmdList) override
Calls RooAbsPdf::createChi2(RooDataSet& data, const RooLinkedList& cmdList) and returns fit result.
Definition: RooAbsPdf.cxx:1610
RooNumGenConfig * specialGeneratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
Definition: RooAbsPdf.cxx:3312
virtual RooPlot * paramOn(RooPlot *frame, 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())
Add a box with parameter values (and errors) to the specified frame.
Definition: RooAbsPdf.cxx:2950
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
Definition: RooAbsPdf.h:61
virtual bool selfNormalized() const
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
Definition: RooAbsPdf.h:253
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print multi line detailed information of this RooAbsPdf.
Definition: RooAbsPdf.cxx:1758
RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const override
Compute batch of values for given input data, and normalise by integrating over the observables in no...
Definition: RooAbsPdf.cxx:402
virtual RooDataHist * generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none()) const
As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,...
Definition: RooAbsPdf.h:113
Int_t _traceCount
Number of traces remaining to print.
Definition: RooAbsPdf.h:375
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
Definition: RooAbsPdf.h:264
RooAbsReal * _norm
Definition: RooAbsPdf.h:358
int calcAsymptoticCorrectedCovariance(RooMinimizer &minimizer, RooAbsData const &data)
Use the asymptotically correct approach to estimate errors in the presence of weights.
Definition: RooAbsPdf.cxx:1122
void setTraceCounter(Int_t value, bool allNodes=false)
Reset trace counter to given value, limiting the number of future trace messages for this pdf to 'val...
Definition: RooAbsPdf.cxx:644
Int_t _errorCount
Number of errors remaining to print.
Definition: RooAbsPdf.h:374
@ CanBeExtended
Definition: RooAbsPdf.h:258
@ MustBeExtended
Definition: RooAbsPdf.h:258
@ CanNotBeExtended
Definition: RooAbsPdf.h:258
double _rawValue
Definition: RooAbsPdf.h:357
const char * normRange() const
Definition: RooAbsPdf.h:294
RooAbsReal * createCdf(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Create a cumulative distribution function of this p.d.f in terms of the observables listed in iset.
Definition: RooAbsPdf.cxx:3186
Int_t _negCount
Number of negative probablities remaining to print.
Definition: RooAbsPdf.h:376
std::unique_ptr< RooFitResult > minimizeNLL(RooAbsReal &nll, RooAbsData const &data, MinimizerConfig const &cfg)
Minimizes a given NLL variable by finding the optimal parameters with the RooMinimzer.
Definition: RooAbsPdf.cxx:1401
virtual const RooAbsReal * getNormObj(const RooArgSet *set, const RooArgSet *iset, const TNamed *rangeName=nullptr) const
Return pointer to RooAbsReal object that implements calculation of integral over observables iset in ...
Definition: RooAbsPdf.cxx:500
void setActiveNormSet(RooArgSet const *normSet) const
Setter for the _normSet member, which should never be set directly.
Definition: RooAbsPdf.h:326
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Analytical integral with normalization (see RooAbsReal::analyticalIntegralWN() for further informatio...
Definition: RooAbsPdf.cxx:421
void setNormRangeOverride(const char *rangeName)
Definition: RooAbsPdf.cxx:3409
virtual RooDataSet * generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents)
Special generator interface for generation of 'global observables' – for RooStats tools.
Definition: RooAbsPdf.cxx:2461
double normalizeWithNaNPacking(double rawVal, double normVal) const
Definition: RooAbsPdf.cxx:313
virtual RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const
Definition: RooAbsPdf.cxx:1794
virtual RooArgSet * getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected=true) const
This helper function finds and collects all constraints terms of all component p.d....
Definition: RooAbsPdf.cxx:3280
const RooNumGenConfig * getGeneratorConfig() const
Return the numeric MC generator configuration used for this object.
Definition: RooAbsPdf.cxx:3340
virtual void initGenerator(Int_t code)
Interface for one-time initialization to setup the generator for the specified code.
Definition: RooAbsPdf.cxx:2192
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Definition: RooAbsPdf.h:262
RooAbsPdf()
Default constructor.
Definition: RooAbsPdf.cxx:252
bool traceEvalPdf(double value) const
Check that passed value is positive and not 'not-a-number'.
Definition: RooAbsPdf.cxx:441
static RooNumGenConfig * defaultGeneratorConfig()
Returns the default numeric MC generator configuration for all RooAbsReals.
Definition: RooAbsPdf.cxx:3302
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
The cache manager.
Definition: RooAbsPdf.cxx:3428
void printValue(std::ostream &os) const override
Print value of p.d.f, also print normalization integral that was last used, if any.
Definition: RooAbsPdf.cxx:1739
virtual RooArgSet * getConstraints(const RooArgSet &, RooArgSet &, bool) const
Definition: RooAbsPdf.h:212
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const
Interface function to create a generator context from a p.d.f.
Definition: RooAbsPdf.cxx:1785
static TString _normRangeOverride
Definition: RooAbsPdf.h:383
static Int_t _verboseEval
Definition: RooAbsPdf.h:353
virtual Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
Definition: RooAbsPdf.cxx:2182
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Return a p.d.f that represent a projection of this p.d.f integrated over given observables.
Definition: RooAbsPdf.cxx:3151
double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0) const
Definition: RooAbsPdf.cxx:785
virtual double getLogVal(const RooArgSet *set=nullptr) const
Return the log of the current value with given normalization An error message is printed if the argum...
Definition: RooAbsPdf.cxx:666
RooPlot * plotOn(RooPlot *frame, 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(), const RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
Definition: RooAbsPdf.h:127
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
virtual RooAbsReal * createChi2(RooDataHist &data, const RooLinkedList &cmdList)
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 RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
Definition: RooAbsReal.cxx:280
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 double maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:28
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
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:45
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
Definition: RooExtendPdf.h:22
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:38
RooMCStudy is a helper class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies,...
Definition: RooMCStudy.h:32
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
Definition: RooMinimizer.h:43
RooNumGenConfig holds the configuration parameters of the various numeric integrators used by RooReal...
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:43
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:574
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:257
A doubly linked list.
Definition: TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
const char * Data() const
Definition: TString.h:369
RooCmdArg NumEvents(Int_t numEvents)
Namespace for dispatching RooFit computations to various backends.
void init()
Inspect hardware capabilities, and load the optimal library for RooFit computations.
UniqueId< Class > const & getUniqueId(Class const *ptr)
A helper function to replace pointer comparisons with UniqueId comparisons.
Definition: UniqueId.h:87
Configuration struct for RooAbsPdf::minimizeNLL with all the default.
Definition: RooAbsPdf.h:172
const RooArgSet * minosSet
Definition: RooAbsPdf.h:188
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
static void output()