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 RooNumGenConfig ;
30
31
32class RooAbsPdf : public RooAbsReal {
33public:
34
35 // Constructors, assignment etc
36 RooAbsPdf() ;
37 RooAbsPdf(const char *name, const char *title=nullptr) ;
38 RooAbsPdf(const char *name, const char *title, double minVal, double maxVal) ;
39 // RooAbsPdf(const RooAbsPdf& other, const char* name=nullptr);
40 ~RooAbsPdf() override;
41
42 // Toy MC generation
43
44 ////////////////////////////////////////////////////////////////////////////////
45 /// See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&)
46 /// \param[in] whatVars Set of observables to generate for each event according to this model.
47 /// \param[in] nEvents How many events to generate
48 /// \param arg1,arg2,arg3,arg4,arg5 Optional command arguments.
49 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg& arg1,
50 const RooCmdArg& arg2={}, const RooCmdArg& arg3={},
51 const RooCmdArg& arg4={}, const RooCmdArg& arg5={}) {
52 return generate(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5) ;
53 }
54 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars,
55 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
56 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
57 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
58 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, double nEvents = 0, bool verbose=false, bool autoBinned=true,
59 const char* binnedTag="", bool expectedData=false, bool extended = false) const;
60 RooFit::OwningPtr<RooDataSet> generate(const RooArgSet &whatVars, const RooDataSet &prototype, Int_t nEvents= 0,
61 bool verbose=false, bool randProtoOrder=false, bool resampleProto=false) const;
62
63
64 class GenSpec {
65 public:
66 virtual ~GenSpec() ;
67 GenSpec() = default;
68
69 private:
70 GenSpec(RooAbsGenContext* context, const RooArgSet& whatVars, RooDataSet* protoData, Int_t nGen, bool extended,
71 bool randProto, bool resampleProto, TString dsetName, bool init=false) ;
72 GenSpec(const GenSpec& other) ;
73
74 friend class RooAbsPdf ;
75 std::unique_ptr<RooAbsGenContext> _genContext;
79 bool _extended = false;
80 bool _randProto = false;
81 bool _resampleProto = false;
83 bool _init = false;
84
85 ClassDef(GenSpec,0) // Generation specification
86 } ;
87
88 ///Prepare GenSpec configuration object for efficient generation of multiple datasets from identical specification.
89 GenSpec* prepareMultiGen(const RooArgSet &whatVars,
90 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
91 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
92 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
93 ///Generate according to GenSpec obtained from prepareMultiGen().
95
96
97 ////////////////////////////////////////////////////////////////////////////////
98 /// As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,const RooCmdArg&) const.
99 /// \param[in] whatVars set
100 /// \param[in] nEvents How many events to generate
101 /// \param arg1,arg2,arg3,arg4,arg5 ordered arguments
102 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg& arg1,
103 const RooCmdArg& arg2={}, const RooCmdArg& arg3={},
104 const RooCmdArg& arg4={}, const RooCmdArg& arg5={}) const {
105 return generateBinned(whatVars,RooFit::NumEvents(nEvents),arg1,arg2,arg3,arg4,arg5);
106 }
107 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars,
108 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
109 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
110 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) const;
111 virtual RooFit::OwningPtr<RooDataHist> generateBinned(const RooArgSet &whatVars, double nEvents, bool expectedData=false, bool extended=false) const;
112
113 virtual RooFit::OwningPtr<RooDataSet> generateSimGlobal(const RooArgSet& whatVars, Int_t nEvents) ;
114
115 ///Helper calling plotOn(RooPlot*, RooLinkedList&) const
117 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
118 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
119 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
120 const RooCmdArg& arg7={}, const RooCmdArg& arg8={},
121 const RooCmdArg& arg9={}, const RooCmdArg& arg10={}
122 ) const override {
123 return RooAbsReal::plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) ;
124 }
125 RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const override ;
126
127 /// Add a box with parameter values (and errors) to the specified frame
128 virtual RooPlot* paramOn(RooPlot* frame,
129 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
130 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
131 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
132 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
133
134 // Built-in generator support
135 virtual Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const;
136 virtual void initGenerator(Int_t code) ;
137 virtual void generateEvent(Int_t code);
138 virtual bool isDirectGenSafe(const RooAbsArg& arg) const ;
139
140 // Configuration of MC generators used for this pdf
141 const RooNumGenConfig* getGeneratorConfig() const ;
142 static RooNumGenConfig* defaultGeneratorConfig() ;
143 RooNumGenConfig* specialGeneratorConfig() const ;
144 RooNumGenConfig* specialGeneratorConfig(bool createOnTheFly) ;
145 void setGeneratorConfig() ;
146 void setGeneratorConfig(const RooNumGenConfig& config) ;
147
148 template <typename... CmdArgs_t>
149 RooFit::OwningPtr<RooFitResult> fitTo(RooAbsData& data, CmdArgs_t const&... cmdArgs)
150 {
152 }
153
154 template <typename... CmdArgs_t>
155 RooFit::OwningPtr<RooAbsReal> createNLL(RooAbsData& data, CmdArgs_t const&... cmdArgs)
156 {
158 }
159
160 // Constraint management. Interface to retrieve constraint terms on this pdf. Default implementation returns null.
161 virtual std::unique_ptr<RooArgSet> getConstraints(const RooArgSet & /*observables*/,
162 RooArgSet const & /*constrainedParams*/,
163 RooArgSet & /*pdfParams*/) const
164 {
165 return nullptr;
166 }
167
168 std::unique_ptr<RooArgSet>
169 getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected = true) const;
170
171 // Project p.d.f into lower dimensional p.d.f
172 virtual RooAbsPdf* createProjection(const RooArgSet& iset) ;
173
174 virtual double getCorrection() const;
175
176 // Create cumulative density function from p.d.f
178 RooFit::OwningPtr<RooAbsReal> createCdf(const RooArgSet& iset, const RooCmdArg& arg1, const RooCmdArg& arg2={},
179 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
180 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
181 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
182 RooFit::OwningPtr<RooAbsReal> createScanCdf(const RooArgSet& iset, const RooArgSet& nset, Int_t numScanBins, Int_t intOrder) ;
183
184 // Function evaluation support
185 double getValV(const RooArgSet* set=nullptr) const override ;
186 virtual double getLogVal(const RooArgSet* set=nullptr) const ;
187
188 void getLogProbabilities(std::span<const double> pdfValues, double * output) const;
189
190 /// \copydoc getNorm(const RooArgSet*) const
191 double getNorm(const RooArgSet& nset) const {
192 return getNorm(&nset) ;
193 }
194 virtual double getNorm(const RooArgSet* set=nullptr) const ;
195
196 virtual void resetErrorCounters(Int_t resetValue=10) ;
197 void setTraceCounter(Int_t value, bool allNodes=false) ;
198
199 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=nullptr) const override ;
200
201 /// Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
202 /// Always returns false, unless a PDF overrides this function.
203 virtual bool selfNormalized() const {
204 return false ;
205 }
206
207 // Support for extended maximum likelihood, switched off by default
209 /// Returns ability of PDF to provide extended likelihood terms. Possible
210 /// answers are in the enumerator RooAbsPdf::ExtendMode.
211 /// This default implementation always returns CanNotBeExtended.
212 virtual ExtendMode extendMode() const { return CanNotBeExtended; }
213 /// If true, PDF can provide extended likelihood term.
214 inline bool canBeExtended() const {
215 return (extendMode() != CanNotBeExtended) ;
216 }
217 /// If true PDF must provide extended likelihood term.
218 inline bool mustBeExtended() const {
219 return (extendMode() == MustBeExtended) ;
220 }
221 /// Return expected number of events to be used in calculation of extended
222 /// likelihood.
223 virtual double expectedEvents(const RooArgSet* nset) const ;
224 /// Return expected number of events to be used in calculation of extended
225 /// likelihood. This function should not be overridden, as it just redirects
226 /// to the actual virtual function but takes a RooArgSet reference instead of
227 /// pointer. \see expectedEvents(const RooArgSet*) const
228 double expectedEvents(const RooArgSet& nset) const {
229 return expectedEvents(&nset) ;
230 }
231
232 virtual std::unique_ptr<RooAbsReal> createExpectedEventsFunc(const RooArgSet* nset) const;
233
234 // Printing interface (human readable)
235 void printValue(std::ostream& os) const override ;
236 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
237
238 static void verboseEval(Int_t stat) ;
239 static int verboseEval() ;
240
241 double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0, bool doOffset=false) const;
242 double extendedTerm(double sumEntries, RooArgSet const* nset, double sumEntriesW2=0.0, bool doOffset=false) const;
243 double extendedTerm(RooAbsData const& data, bool weightSquared, bool doOffset=false) const;
244
245 void setNormRange(const char* rangeName) ;
246 const char* normRange() const {
247 return _normRange.Length()>0 ? _normRange.Data() : nullptr ;
248 }
249 void setNormRangeOverride(const char* rangeName) ;
250
251 const RooAbsReal* getNormIntegral(const RooArgSet& nset) const { return getNormObj(nullptr,&nset,nullptr) ; }
252
253 virtual const RooAbsReal* getNormObj(const RooArgSet* set, const RooArgSet* iset, const TNamed* rangeName=nullptr) const ;
254
255 virtual RooAbsGenContext* binnedGenContext(const RooArgSet &vars, bool verbose= false) const ;
256
257 virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr,
258 const RooArgSet* auxProto=nullptr, bool verbose= false) const ;
259
260 virtual RooAbsGenContext* autoGenContext(const RooArgSet &vars, const RooDataSet* prototype=nullptr, const RooArgSet* auxProto=nullptr,
261 bool verbose=false, bool autoBinned=true, const char* binnedTag="") const ;
262
263 std::unique_ptr<RooAbsArg> compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override;
264
265private:
266
267 std::unique_ptr<RooDataSet> generate(RooAbsGenContext& context, const RooArgSet& whatVars, const RooDataSet* prototype,
268 double nEvents, bool verbose, bool randProtoOrder, bool resampleProto, bool skipInit=false,
269 bool extended=false) const ;
270
271 // Implementation version
272 virtual RooPlot* paramOn(RooPlot* frame, const RooArgSet& params, bool showConstants=false,
273 const char *label= "", double xmin=0.65,
274 double xmax= 0.99,double ymax=0.95, const RooCmdArg* formatCmd=nullptr) ;
275
276 void logBatchComputationErrors(std::span<const double>& outputs, std::size_t begin) const;
277 bool traceEvalPdf(double value) const;
278
279 /// Setter for the _normSet member, which should never be set directly.
280 inline void setActiveNormSet(RooArgSet const* normSet) const {
281 _normSet = normSet;
282 // Also store the unique ID of the _normSet. This makes it possible to
283 // detect if the pointer was invalidated.
285 }
286
287protected:
288
289 virtual std::unique_ptr<RooAbsReal> createNLLImpl(RooAbsData& data, const RooLinkedList& cmdList);
290 virtual std::unique_ptr<RooFitResult> fitToImpl(RooAbsData& data, const RooLinkedList& cmdList);
291
292 /// Checks if `normSet` is the currently active normalization set of this
293 /// PDF, meaning is exactly the same object as the one the `_normSet` member
294 /// points to (or both are `nullptr`).
295 inline bool isActiveNormSet(RooArgSet const* normSet) const {
296 return RooFit::getUniqueId(normSet).value() == _normSetId;
297 }
298
299 RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
300
301 friend class RooMCStudy ;
302
303 Int_t* randomizeProtoOrder(Int_t nProto,Int_t nGen,bool resample=false) const ;
304
305 // This also forces the definition of a copy ctor in derived classes
306 RooAbsPdf(const RooAbsPdf& other, const char* name = nullptr);
307
309
310 virtual bool syncNormalization(const RooArgSet* dset, bool adjustProxies=true) const ;
311
312 mutable double _rawValue = 0;
313 mutable RooAbsReal* _norm = nullptr; ///<! Normalization integral (owned by _normMgr)
314 mutable RooArgSet const* _normSet = nullptr; ///<! Normalization set with for above integral
315
317 public:
318 CacheElem(RooAbsReal& norm) : _norm(&norm) {} ;
319 ~CacheElem() override ;
321 std::unique_ptr<RooAbsReal> _norm;
322 } ;
323 mutable RooObjCacheManager _normMgr ; ///<! The cache manager
324
325 bool redirectServersHook(const RooAbsCollection & newServerList, bool mustReplaceAll,
326 bool nameChange, bool isRecursiveStep) override;
327
328 mutable Int_t _errorCount = 0; ///< Number of errors remaining to print
329 mutable Int_t _traceCount = 0; ///< Number of traces remaining to print
330 mutable Int_t _negCount = 0; ///< Number of negative probabilities remaining to print
331
332 bool _selectComp = false; ///< Component selection flag for RooAbsPdf::plotCompOn
333
334 std::unique_ptr<RooNumGenConfig> _specGeneratorConfig ; ///<! MC generator configuration specific for this object
335
336 TString _normRange ; ///< Normalization range
338
339private:
340 mutable RooFit::UniqueId<RooArgSet>::Value_t _normSetId = RooFit::UniqueId<RooArgSet>::nullval; ///<! Unique ID of the currently-active normalization set
341
342 friend class RooAbsReal;
343 friend class RooChi2Var;
344
345 ClassDefOverride(RooAbsPdf,5) // Abstract PDF with normalization support
346};
347
348
349
350
351#endif
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:344
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition TGX11.cxx:148
float xmin
float xmax
float ymax
friend class RooDataSet
Definition RooAbsArg.h:598
RooAbsArg()
Default constructor.
friend class RooAbsCollection
Definition RooAbsArg.h:561
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:56
Abstract base class for generator contexts of RooAbsPdf objects.
std::unique_ptr< RooAbsReal > _norm
Definition RooAbsPdf.h:321
~CacheElem() override
Destructor of normalization cache element.
CacheElem(RooAbsReal &norm)
Definition RooAbsPdf.h:318
RooArgList containedArgs(Action) override
Definition RooAbsPdf.h:320
std::unique_ptr< RooAbsGenContext > _genContext
Definition RooAbsPdf.h:75
RooArgSet _whatVars
Definition RooAbsPdf.h:76
GenSpec(const GenSpec &other)
friend class RooAbsPdf
Definition RooAbsPdf.h:74
RooDataSet * _protoData
Definition RooAbsPdf.h:77
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:32
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:191
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooObjCacheManager _normMgr
! The cache manager
Definition RooAbsPdf.h:323
RooFit::UniqueId< RooArgSet >::Value_t _normSetId
! Unique ID of the currently-active normalization set
Definition RooAbsPdf.h:340
std::unique_ptr< RooNumGenConfig > _specGeneratorConfig
! MC generator configuration specific for this object
Definition RooAbsPdf.h:334
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:116
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:332
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:343
double expectedEvents(const RooArgSet &nset) const
Return expected number of events to be used in calculation of extended likelihood.
Definition RooAbsPdf.h:228
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...
std::unique_ptr< 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....
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:295
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:336
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:251
~RooAbsPdf() override
Destructor.
bool mustBeExtended() const
If true PDF must provide extended likelihood term.
Definition RooAbsPdf.h:218
RooArgSet const * _normSet
! Normalization set with for above integral
Definition RooAbsPdf.h:314
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:203
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print multi line detailed information of this RooAbsPdf.
virtual double getCorrection() const
This function returns the penalty term.
friend class RooMCStudy
Definition RooAbsPdf.h:301
Int_t _traceCount
Number of traces remaining to print.
Definition RooAbsPdf.h:329
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
Definition RooAbsPdf.h:214
RooAbsReal * _norm
! Normalization integral (owned by _normMgr)
Definition RooAbsPdf.h:313
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:328
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
Definition RooAbsPdf.h:155
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
Definition RooAbsPdf.h:149
@ CanBeExtended
Definition RooAbsPdf.h:208
@ MustBeExtended
Definition RooAbsPdf.h:208
@ CanNotBeExtended
Definition RooAbsPdf.h:208
double _rawValue
Definition RooAbsPdf.h:312
const char * normRange() const
Definition RooAbsPdf.h:246
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:330
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:49
virtual std::unique_ptr< RooArgSet > getConstraints(const RooArgSet &, RooArgSet const &, RooArgSet &) const
Definition RooAbsPdf.h:161
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:280
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.
virtual RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const
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:212
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:102
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
Hook function intercepting redirectServer calls.
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:342
void getLogProbabilities(std::span< const double > pdfValues, double *output) const
static TString _normRangeOverride
Definition RooAbsPdf.h:337
static Int_t _verboseEval
Definition RooAbsPdf.h:308
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:63
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:24
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:32
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...
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:43
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Basic string class.
Definition TString.h:138
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