Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <RooDataHist.h>
21#include <RooDataSet.h>
22#include <RooFit/UniqueId.h>
23#include <RooGlobalFunc.h>
24#include <RooObjCacheManager.h>
25
26class RooArgSet ;
27class RooAbsGenContext ;
28class RooFitResult ;
29class RooExtendPdf ;
30class RooCategory ;
31class TPaveText;
32class TH1F;
33class TH2F;
34class TList ;
35class RooMinimizer ;
36class RooNumGenConfig ;
37class RooRealIntegral ;
38
39
40class RooAbsPdf : public RooAbsReal {
41public:
42
43 // Constructors, assignment etc
44 RooAbsPdf() ;
45 RooAbsPdf(const char *name, const char *title=nullptr) ;
46 RooAbsPdf(const char *name, const char *title, double minVal, double maxVal) ;
47 // RooAbsPdf(const RooAbsPdf& other, const char* name=nullptr);
48 ~RooAbsPdf() override;
49
50 // Toy MC generation
51
52 ////////////////////////////////////////////////////////////////////////////////
53 /// See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&)
54 /// \param[in] whatVars Set of observables to generate for each event according to this model.
55 /// \param[in] nEvents How many events to generate
56 /// \param arg1,arg2,arg3,arg4,arg5 Optional command arguments.
57 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg& arg1,
58 const RooCmdArg& arg2={}, const RooCmdArg& arg3={},
59 const RooCmdArg& arg4={}, const RooCmdArg& arg5={}) {
60 return generate(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5) ;
61 }
62 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars,
63 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
64 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
65 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
66 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, double nEvents = 0, bool verbose=false, bool autoBinned=true,
67 const char* binnedTag="", bool expectedData=false, bool extended = false) const;
68 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, const RooDataSet &prototype, Int_t nEvents= 0,
69 bool verbose=false, bool randProtoOrder=false, bool resampleProto=false) const;
70
71
72 class GenSpec {
73 public:
74 virtual ~GenSpec() ;
75 GenSpec() = default;
76
77 private:
78 GenSpec(RooAbsGenContext* context, const RooArgSet& whatVars, RooDataSet* protoData, Int_t nGen, bool extended,
79 bool randProto, bool resampleProto, TString dsetName, bool init=false) ;
80 GenSpec(const GenSpec& other) ;
81
82 friend class RooAbsPdf ;
87 bool _extended = false;
88 bool _randProto = false;
89 bool _resampleProto = false;
91 bool _init = false;
92
93 ClassDef(GenSpec,0) // Generation specification
94 } ;
95
96 ///Prepare GenSpec configuration object for efficient generation of multiple datasets from identical specification.
97 GenSpec* prepareMultiGen(const RooArgSet &whatVars,
98 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
99 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
100 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
101 ///Generate according to GenSpec obtained from prepareMultiGen().
103
104
105 ////////////////////////////////////////////////////////////////////////////////
106 /// As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&) const.
107 /// \param[in] whatVars set
108 /// \param[in] nEvents How many events to generate
109 /// \param arg1,arg2,arg3,arg4,arg5 ordered arguments
110 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg& arg1,
111 const RooCmdArg& arg2={}, const RooCmdArg& arg3={},
112 const RooCmdArg& arg4={}, const RooCmdArg& arg5={}) const {
113 return generateBinned(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5);
114 }
115 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars,
116 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
117 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
118 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) const;
119 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars, double nEvents, bool expectedData=false, bool extended=false) const;
120
121 virtual RooFit::OwningPtr<RooDataSet> generateSimGlobal(const RooArgSet& whatVars, Int_t nEvents) ;
122
123 ///Helper calling plotOn(RooPlot*, RooLinkedList&) const
125 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
126 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
127 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
128 const RooCmdArg& arg7={}, const RooCmdArg& arg8={},
129 const RooCmdArg& arg9={}, const RooCmdArg& arg10={}
130 ) const override {
131 return RooAbsReal::plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) ;
132 }
133 RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const override ;
134
135 /// Add a box with parameter values (and errors) to the specified frame
136 virtual RooPlot* paramOn(RooPlot* frame,
137 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
138 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
139 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
140 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
141
142 // Built-in generator support
143 virtual Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const;
144 virtual void initGenerator(Int_t code) ;
145 virtual void generateEvent(Int_t code);
146 virtual bool isDirectGenSafe(const RooAbsArg& arg) const ;
147
148 // Configuration of MC generators used for this pdf
149 const RooNumGenConfig* getGeneratorConfig() const ;
150 static RooNumGenConfig* defaultGeneratorConfig() ;
151 RooNumGenConfig* specialGeneratorConfig() const ;
152 RooNumGenConfig* specialGeneratorConfig(bool createOnTheFly) ;
153 void setGeneratorConfig() ;
154 void setGeneratorConfig(const RooNumGenConfig& config) ;
155
156 template <typename... CmdArgs_t>
158 {
160 }
161
162 template <typename... CmdArgs_t>
167
168 // Constraint management
169 virtual RooArgSet* getConstraints(const RooArgSet& /*observables*/, RooArgSet& /*constrainedParams*/,
170 bool /*stripDisconnected*/, bool /*removeConstraintsFromPdf*/=false) const
171 {
172 // Interface to retrieve constraint terms on this pdf. Default implementation returns null
173 return nullptr ;
174 }
175 RooArgSet* getAllConstraints(const RooArgSet& observables, RooArgSet& constrainedParams,
176 bool stripDisconnected=true, bool removeConstraintsFromPdf=false) const ;
177
178 // Project p.d.f into lower dimensional p.d.f
179 virtual RooAbsPdf* createProjection(const RooArgSet& iset) ;
180
181 // Create cumulative density function from p.d.f
183 RooFit::OwningPtr<RooAbsReal> createCdf(const RooArgSet& iset, const RooCmdArg& arg1, const RooCmdArg& arg2={},
184 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
185 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
186 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
187 RooFit::OwningPtr<RooAbsReal> createScanCdf(const RooArgSet& iset, const RooArgSet& nset, Int_t numScanBins, Int_t intOrder) ;
188
189 // Function evaluation support
190 double getValV(const RooArgSet* set=nullptr) const override ;
191 virtual double getLogVal(const RooArgSet* set=nullptr) const ;
192
193 void getLogProbabilities(std::span<const double> pdfValues, double * output) const;
194
195 /// \copydoc getNorm(const RooArgSet*) const
196 double getNorm(const RooArgSet& nset) const {
197 return getNorm(&nset) ;
198 }
199 virtual double getNorm(const RooArgSet* set=nullptr) const ;
200
201 virtual void resetErrorCounters(Int_t resetValue=10) ;
202 void setTraceCounter(Int_t value, bool allNodes=false) ;
203
204 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
205
206 /// Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
207 /// Always returns false, unless a PDF overrides this function.
208 virtual bool selfNormalized() const {
209 return false ;
210 }
211
212 // Support for extended maximum likelihood, switched off by default
214 /// Returns ability of PDF to provide extended likelihood terms. Possible
215 /// answers are in the enumerator RooAbsPdf::ExtendMode.
216 /// This default implementation always returns CanNotBeExtended.
217 virtual ExtendMode extendMode() const { return CanNotBeExtended; }
218 /// If true, PDF can provide extended likelihood term.
219 inline bool canBeExtended() const {
220 return (extendMode() != CanNotBeExtended) ;
221 }
222 /// If true PDF must provide extended likelihood term.
223 inline bool mustBeExtended() const {
224 return (extendMode() == MustBeExtended) ;
225 }
226 /// Return expected number of events to be used in calculation of extended
227 /// likelihood.
228 virtual double expectedEvents(const RooArgSet* nset) const ;
229 /// Return expected number of events to be used in calculation of extended
230 /// likelihood. This function should not be overridden, as it just redirects
231 /// to the actual virtual function but takes a RooArgSet reference instead of
232 /// pointer. \see expectedEvents(const RooArgSet*) const
233 double expectedEvents(const RooArgSet& nset) const {
234 return expectedEvents(&nset) ;
235 }
236
237 virtual std::unique_ptr<RooAbsReal> createExpectedEventsFunc(const RooArgSet* nset) const;
238
239 // Printing interface (human readable)
240 void printValue(std::ostream& os) const override ;
241 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
242
243 static void verboseEval(Int_t stat) ;
244 static int verboseEval() ;
245
246 double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0, bool doOffset=false) const;
247 double extendedTerm(double sumEntries, RooArgSet const* nset, double sumEntriesW2=0.0, bool doOffset=false) const;
248 double extendedTerm(RooAbsData const& data, bool weightSquared, bool doOffset=false) const;
249
250 void setNormRange(const char* rangeName) ;
251 const char* normRange() const {
252 return _normRange.Length()>0 ? _normRange.Data() : nullptr ;
253 }
254 void setNormRangeOverride(const char* rangeName) ;
255
256 const RooAbsReal* getNormIntegral(const RooArgSet& nset) const { return getNormObj(nullptr,&nset,nullptr) ; }
257
258 virtual const RooAbsReal* getNormObj(const RooArgSet* set, const RooArgSet* iset, const TNamed* rangeName=nullptr) const ;
259
260 virtual RooAbsGenContext* binnedGenContext(const RooArgSet &vars, bool verbose= false) const ;
261
262 virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr,
263 const RooArgSet* auxProto=nullptr, bool verbose= false) const ;
264
265 virtual RooAbsGenContext* autoGenContext(const RooArgSet &vars, const RooDataSet* prototype=nullptr, const RooArgSet* auxProto=nullptr,
266 bool verbose=false, bool autoBinned=true, const char* binnedTag="") const ;
267
268 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
269
270private:
271
272 std::unique_ptr<RooDataSet> generate(RooAbsGenContext& context, const RooArgSet& whatVars, const RooDataSet* prototype,
273 double nEvents, bool verbose, bool randProtoOrder, bool resampleProto, bool skipInit=false,
274 bool extended=false) const ;
275
276 // Implementation version
277 virtual RooPlot* paramOn(RooPlot* frame, const RooArgSet& params, bool showConstants=false,
278 const char *label= "", double xmin=0.65,
279 double xmax= 0.99,double ymax=0.95, const RooCmdArg* formatCmd=nullptr) ;
280
281 void logBatchComputationErrors(std::span<const double>& outputs, std::size_t begin) const;
282 bool traceEvalPdf(double value) const;
283
284 /// Setter for the _normSet member, which should never be set directly.
285 inline void setActiveNormSet(RooArgSet const* normSet) const {
286 _normSet = normSet;
287 // Also store the unique ID of the _normSet. This makes it possible to
288 // detect if the pointer was invalidated.
290 }
291
292protected:
293
294 virtual std::unique_ptr<RooAbsReal> createNLLImpl(RooAbsData& data, const RooLinkedList& cmdList);
295 virtual std::unique_ptr<RooFitResult> fitToImpl(RooAbsData& data, const RooLinkedList& cmdList);
296
297 /// Checks if `normSet` is the currently active normalization set of this
298 /// PDF, meaning is exactly the same object as the one the `_normSet` member
299 /// points to (or both are `nullptr`).
300 inline bool isActiveNormSet(RooArgSet const* normSet) const {
301 return RooFit::getUniqueId(normSet).value() == _normSetId;
302 }
303
304 double normalizeWithNaNPacking(double rawVal, double normVal) const;
305
306 RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
307
308 friend class RooMCStudy ;
309
310 Int_t* randomizeProtoOrder(Int_t nProto,Int_t nGen,bool resample=false) const ;
311
312 // This also forces the definition of a copy ctor in derived classes
313 RooAbsPdf(const RooAbsPdf& other, const char* name = nullptr);
314
316
317 virtual bool syncNormalization(const RooArgSet* dset, bool adjustProxies=true) const ;
318
319 mutable double _rawValue = 0;
320 mutable RooAbsReal* _norm = nullptr; //! Normalization integral (owned by _normMgr)
321 mutable RooArgSet const* _normSet = nullptr; //! Normalization set with for above integral
322
324 public:
325 CacheElem(RooAbsReal& norm) : _norm(&norm) {} ;
326 ~CacheElem() override ;
329 } ;
330 mutable RooObjCacheManager _normMgr ; //! The cache manager
331
332 bool redirectServersHook(const RooAbsCollection & newServerList, bool mustReplaceAll,
333 bool nameChange, bool isRecursiveStep) override;
334
335 mutable Int_t _errorCount = 0; ///< Number of errors remaining to print
336 mutable Int_t _traceCount = 0; ///< Number of traces remaining to print
337 mutable Int_t _negCount = 0; ///< Number of negative probabilities remaining to print
338
339 bool _selectComp = false; ///< Component selection flag for RooAbsPdf::plotCompOn
340
341 std::unique_ptr<RooNumGenConfig> _specGeneratorConfig ; ///<! MC generator configuration specific for this object
342
343 TString _normRange ; ///< Normalization range
345
346private:
347 mutable RooFit::UniqueId<RooArgSet>::Value_t _normSetId = RooFit::UniqueId<RooArgSet>::nullval; ///<! Unique ID of the currently-active normalization set
348
349 friend class RooAbsReal;
350 friend class RooChi2Var;
351
352 ClassDefOverride(RooAbsPdf,5) // Abstract PDF with normalization support
353};
354
355
356
357
358#endif
int Int_t
Definition RtypesCore.h:45
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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
float xmax
float ymax
friend class RooDataSet
Definition RooAbsArg.h:667
RooAbsArg()
Default constructor.
friend class RooAbsCollection
Definition RooAbsArg.h:629
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract base class for generator contexts of RooAbsPdf objects.
~CacheElem() override
Destructor of normalization cache element.
CacheElem(RooAbsReal &norm)
Definition RooAbsPdf.h:325
RooAbsReal * _norm
Definition RooAbsPdf.h:328
RooArgList containedArgs(Action) override
Definition RooAbsPdf.h:327
RooArgSet _whatVars
Definition RooAbsPdf.h:84
RooAbsGenContext * _genContext
Definition RooAbsPdf.h:83
GenSpec(const GenSpec &other)
friend class RooAbsPdf
Definition RooAbsPdf.h:82
RooDataSet * _protoData
Definition RooAbsPdf.h:85
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
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...
double getNorm(const RooArgSet &nset) const
Get normalisation term needed to normalise the raw values returned by getVal().
Definition RooAbsPdf.h:196
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooObjCacheManager _normMgr
Definition RooAbsPdf.h:330
RooFit::UniqueId< RooArgSet >::Value_t _normSetId
! Unique ID of the currently-active normalization set
Definition RooAbsPdf.h:347
std::unique_ptr< RooNumGenConfig > _specGeneratorConfig
! MC generator configuration specific for this object
Definition RooAbsPdf.h:341
double getValV(const RooArgSet *set=nullptr) const override
Return current value, normalized by integrating over the observables in nset.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
Definition RooAbsPdf.h:124
virtual std::unique_ptr< RooFitResult > fitToImpl(RooAbsData &data, const RooLinkedList &cmdList)
Protected implementation of the likelihood fitting routine.
bool _selectComp
Component selection flag for RooAbsPdf::plotCompOn.
Definition RooAbsPdf.h:339
virtual void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
RooFit::OwningPtr< RooAbsReal > createScanCdf(const RooArgSet &iset, const RooArgSet &nset, Int_t numScanBins, Int_t intOrder)
friend class RooChi2Var
Definition RooAbsPdf.h:350
double expectedEvents(const RooArgSet &nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition RooAbsPdf.h:233
void setGeneratorConfig()
Remove the specialized numeric MC generator configuration associated with this object.
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...
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
RooFit::OwningPtr< 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.
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:300
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
virtual RooAbsGenContext * binnedGenContext(const RooArgSet &vars, bool verbose=false) const
Return a binned generator context.
TString _normRange
Normalization range.
Definition RooAbsPdf.h:343
virtual bool isDirectGenSafe(const RooAbsArg &arg) const
Check if given observable can be safely generated using the pdfs internal generator mechanism (if tha...
Int_t * randomizeProtoOrder(Int_t nProto, Int_t nGen, bool resample=false) const
Return lookup table with randomized order for nProto prototype events.
void setNormRange(const char *rangeName)
const RooAbsReal * getNormIntegral(const RooArgSet &nset) const
Definition RooAbsPdf.h:256
~RooAbsPdf() override
Destructor.
bool mustBeExtended() const
If true PDF must provide extended likelihood term.
Definition RooAbsPdf.h:223
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
Definition RooAbsPdf.h:321
RooNumGenConfig * specialGeneratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
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:208
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print multi line detailed information of this RooAbsPdf.
friend class RooMCStudy
Definition RooAbsPdf.h:308
Int_t _traceCount
Number of traces remaining to print.
Definition RooAbsPdf.h:336
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
Definition RooAbsPdf.h:219
RooAbsReal * _norm
Definition RooAbsPdf.h:320
GenSpec * prepareMultiGen(const RooArgSet &whatVars, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={})
Prepare GenSpec configuration object for efficient generation of multiple datasets from identical spe...
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...
Int_t _errorCount
Number of errors remaining to print.
Definition RooAbsPdf.h:335
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
Definition RooAbsPdf.h:163
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
Definition RooAbsPdf.h:157
@ CanBeExtended
Definition RooAbsPdf.h:213
@ MustBeExtended
Definition RooAbsPdf.h:213
@ CanNotBeExtended
Definition RooAbsPdf.h:213
double _rawValue
Definition RooAbsPdf.h:319
const char * normRange() const
Definition RooAbsPdf.h:251
virtual std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const
Returns an object that represents the expected number of events for a given normalization set,...
Int_t _negCount
Number of negative probabilities remaining to print.
Definition RooAbsPdf.h:337
virtual RooPlot * paramOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={})
Add a box with parameter values (and errors) to the specified frame.
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
Definition RooAbsPdf.h:57
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 ...
void setActiveNormSet(RooArgSet const *normSet) const
Setter for the _normSet member, which should never be set directly.
Definition RooAbsPdf.h:285
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Analytical integral with normalization (see RooAbsReal::analyticalIntegralWN() for further informatio...
void setNormRangeOverride(const char *rangeName)
virtual RooFit::OwningPtr< RooDataSet > generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents)
Special generator interface for generation of 'global observables' – for RooStats tools.
double normalizeWithNaNPacking(double rawVal, double normVal) const
virtual RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const
RooArgSet * getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected=true, bool removeConstraintsFromPdf=false) const
This helper function finds and collects all constraints terms of all component p.d....
const RooNumGenConfig * getGeneratorConfig() const
Return the numeric MC generator configuration used for this object.
virtual void initGenerator(Int_t code)
Interface for one-time initialization to setup the generator for the specified code.
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Definition RooAbsPdf.h:217
RooAbsPdf()
Default constructor.
virtual RooFit::OwningPtr< RooDataHist > generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}) const
As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,...
Definition RooAbsPdf.h:110
virtual RooArgSet * getConstraints(const RooArgSet &, RooArgSet &, bool, bool=false) const
Definition RooAbsPdf.h:169
bool traceEvalPdf(double value) const
Check that passed value is positive and not 'not-a-number'.
static RooNumGenConfig * defaultGeneratorConfig()
Returns the default numeric MC generator configuration for all RooAbsReals.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
The cache manager.
void printValue(std::ostream &os) const override
Print value of p.d.f, also print normalization integral that was last used, if any.
virtual std::unique_ptr< RooAbsReal > createNLLImpl(RooAbsData &data, const RooLinkedList &cmdList)
Protected implementation of the NLL creation routine.
void logBatchComputationErrors(std::span< const double > &outputs, std::size_t begin) const
Scan through outputs and fix+log all nans and negative values.
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.
friend class RooAbsReal
Definition RooAbsPdf.h:349
void getLogProbabilities(std::span< const double > pdfValues, double *output) const
static TString _normRangeOverride
Definition RooAbsPdf.h:344
static Int_t _verboseEval
Definition RooAbsPdf.h:315
double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0, bool doOffset=false) const
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...
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Return a p.d.f that represent a projection of this p.d.f integrated over given observables.
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...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
virtual double maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
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:55
Object to represent discrete states.
Definition RooCategory.h:28
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Container class to hold unbinned data.
Definition RooDataSet.h:57
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Wrapper class around ROOT::Fit:Fitter that provides a seamless interface between the minimizer functi...
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
Implementation of a RooCacheManager<RooAbsCacheElement> that specializes in the storage of cache elem...
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:45
Performs hybrid numerical/analytical integrals of RooAbsReal objects.
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
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:139
STL class.
RooCmdArg NumEvents(Int_t numEvents)
std::unique_ptr< RooLinkedList > createCmdList(RooCmdArg const *arg1, Args &&...args)
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
UniqueId_t const & getUniqueId(Class const *ptr)
A helper function to replace pointer comparisons with UniqueId comparisons.
Definition UniqueId.h:89
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
Definition Config.h:40
unsigned long Value_t
Definition UniqueId.h:41
static constexpr Value_t nullval
The value of the nullid.
Definition UniqueId.h:71
static void output()