Logo ROOT  
Reference Guide
RooAbsData.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsData.h,v 1.33 2007/07/16 21:04:28 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_DATA
17#define ROO_ABS_DATA
18
19#include "RooPrintable.h"
20#include "RooAbsCategory.h"
21#include "RooArgSet.h"
22#include "RooArgList.h"
23#include "RooSpan.h"
24#include "RooNameReg.h"
25
26#include "ROOT/RStringView.hxx"
27#include "TNamed.h"
28
29#include <map>
30#include <string>
31
32class RooAbsArg;
33class RooAbsReal ;
34class RooRealVar;
37class Roo1DTable ;
38class RooPlot;
39class RooArgList;
40class RooSimultaneous;
41class TH1;
42class TH2F;
43class RooAbsBinning ;
44class Roo1DTable ;
45class RooAbsDataStore ;
46template<typename T> class TMatrixTSym;
48class RooFormulaVar;
49namespace RooBatchCompute{
50struct RunContext;
51}
52namespace RooFit {
53namespace TestStatistics {
54class RooAbsL;
56}
57}
58
59
60// Writes a templated constructor for compatibility with ROOT builds using the
61// C++14 standard or earlier, taking `ROOT::Internal::TStringView` instead of
62// `std::string_view`. This means one can still use a `TString` for the name or
63// title parameter. The condition in the following `#if` should be kept in
64// sync with the one in TString.h.
65#if (__cplusplus >= 201700L) && !defined(_MSC_VER) && (!defined(__clang_major__) || __clang_major__ > 5)
66#define WRITE_TSTRING_COMPATIBLE_CONSTRUCTOR(Class_t) // does nothing
67#else
68#define WRITE_TSTRING_COMPATIBLE_CONSTRUCTOR(Class_t) \
69 template<typename ...Args_t> \
70 Class_t(ROOT::Internal::TStringView name, ROOT::Internal::TStringView title, Args_t &&... args) \
71 : Class_t(std::string_view(name), std::string_view(title), std::forward<Args_t>(args)...) {} \
72 template<typename ...Args_t> \
73 Class_t(ROOT::Internal::TStringView name, std::string_view title, Args_t &&... args) \
74 : Class_t(std::string_view(name), title, std::forward<Args_t>(args)...) {} \
75 template<typename ...Args_t> \
76 Class_t(std::string_view name, ROOT::Internal::TStringView title, Args_t &&... args) \
77 : Class_t(name, std::string_view(title), std::forward<Args_t>(args)...) {}
78#endif
79
80
81class RooAbsData : public TNamed, public RooPrintable {
82public:
83
84 // Constructors, factory methods etc.
85 RooAbsData() ;
87 RooAbsData(const RooAbsData& other, const char* newname = 0) ;
88
90
91 RooAbsData& operator=(const RooAbsData& other);
92 virtual ~RooAbsData() ;
93 virtual RooAbsData* emptyClone(const char* newName=0, const char* newTitle=0, const RooArgSet* vars=0, const char* wgtVarName=0) const = 0 ;
94
95 // Reduction methods
96 RooAbsData* reduce(const RooCmdArg& arg1,const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg(),const RooCmdArg& arg4=RooCmdArg(),
97 const RooCmdArg& arg5=RooCmdArg(),const RooCmdArg& arg6=RooCmdArg(),const RooCmdArg& arg7=RooCmdArg(),const RooCmdArg& arg8=RooCmdArg()) ;
98 RooAbsData* reduce(const char* cut) ;
99 RooAbsData* reduce(const RooFormulaVar& cutVar) ;
100 RooAbsData* reduce(const RooArgSet& varSubset, const char* cut=0) ;
101 RooAbsData* reduce(const RooArgSet& varSubset, const RooFormulaVar& cutVar) ;
102
104 const RooAbsDataStore* store() const { return _dstore ; }
105 const TTree* tree() const ;
106 TTree *GetClonedTree() const;
107
108 void convertToVectorStore() ;
109 virtual void convertToTreeStore();
110
111 void attachBuffers(const RooArgSet& extObs) ;
112 void resetBuffers() ;
113
114
115 virtual void Draw(Option_t* option = "") ;
116
117 void checkInit() const ;
118
119 // Change name of observable
120 virtual Bool_t changeObservableName(const char* from, const char* to) ;
121
122 // Add one ore more rows of data
123 virtual void add(const RooArgSet& row, Double_t weight=1, Double_t weightError=0) = 0 ; // DERIVED
124 virtual void fill() ;
125
126 // Load a given row of data
127 virtual inline const RooArgSet* get() const {
128 // Return current row of dataset
129 return &_vars ;
130 }
131 virtual Double_t weight() const = 0 ; // DERIVED
132 virtual Double_t weightSquared() const = 0 ; // DERIVED
133 virtual Bool_t valid() const { return kTRUE ; }
134
136 /// Return the symmetric error on the current weight.
137 /// See also weightError(double&,double&,ErrorType) const for asymmetric errors.
138 /// \param[in] etype Type of error to compute. May throw if not supported.
139 virtual double weightError(ErrorType /*etype*/=Poisson) const {
140 // Dummy implementation returning zero, because not all deriving classes
141 // need to implement a non-zero weight error.
142 return 0.0;
143 }
144 /// Return the asymmetric errors on the current weight.
145 /// See also weightError(ErrorType) const for symmetric error.
146 /// \param[out] lo Low error.
147 /// \param[out] hi High error.
148 /// \param[in] etype Type of error to compute. May throw if not supported.
149 virtual void weightError(double& lo, double& hi, ErrorType /*etype*/=Poisson) const {
150 // Dummy implementation returning zero, because not all deriving classes
151 // need to implement a non-zero weight error.
152 lo=0;
153 hi=0;
154 }
155
156 virtual const RooArgSet* get(Int_t index) const ;
157
158 virtual void getBatches(RooBatchCompute::RunContext& evalData,
159 std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
160 virtual std::map<const std::string, RooSpan<const RooAbsCategory::value_type>> getCategoryBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
161
162 ////////////////////////////////////////////////////////////////////////////////
163 /// Return event weights of all events in range [first, first+len).
164 /// If no contiguous structure of weights is stored, an empty batch can be returned.
165 /// This indicates that the weight is constant. Use weight() to retrieve it.
166 virtual RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const = 0;
167
168 /// Return number of entries in dataset, *i.e.*, count unweighted entries.
169 virtual Int_t numEntries() const ;
170 /// Return effective number of entries in dataset, *i.e.*, sum all weights.
171 virtual Double_t sumEntries() const = 0 ;
172 /// Return effective number of entries in dataset inside range or after cuts, *i.e.*, sum certain weights.
173 /// \param[in] cutSpec Apply given cut when counting (*e.g.* `0 < x && x < 5`). Passing `"1"` selects all events.
174 /// \param[in] cutRange If the observables have a range with this name, only count events inside this range.
175 virtual Double_t sumEntries(const char* cutSpec, const char* cutRange=0) const = 0 ; // DERIVED
176 double sumEntriesW2() const;
177 virtual Bool_t isWeighted() const {
178 // Do events in dataset have weights?
179 return kFALSE ;
180 }
181 virtual Bool_t isNonPoissonWeighted() const {
182 // Do events in dataset have non-integer weights?
183 return kFALSE ;
184 }
185 virtual void reset() ;
186
187
188 Bool_t getRange(const RooAbsRealLValue& var, Double_t& lowest, Double_t& highest, Double_t marginFrac=0, Bool_t symMode=kFALSE) const ;
189
190 // Plot the distribution of a real valued arg
191 virtual Roo1DTable* table(const RooArgSet& catSet, const char* cuts="", const char* opts="") const ;
192 virtual Roo1DTable* table(const RooAbsCategory& cat, const char* cuts="", const char* opts="") const ;
193 /// \see RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const
194 virtual RooPlot* plotOn(RooPlot* frame,
195 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
196 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
197 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
198 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
199
200 virtual RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;
201
202 // WVE --- This needs to be public to avoid CINT problems
203 struct PlotOpt {
206 scaleFactor(1.) {} ;
207 const char* cuts ;
211 const char* cutRange ;
212 const char* histName ;
214 const char* addToHistName ;
221 } ;
222
223 // Split a dataset by a category
224 virtual TList* split(const RooAbsCategory& splitCat, Bool_t createEmptyDataSets=kFALSE) const ;
225
226 // Split a dataset by categories of a RooSimultaneous
227 virtual TList* split(const RooSimultaneous& simpdf, Bool_t createEmptyDataSets=kFALSE) const ;
228
229 // Fast splitting for SimMaster setData
230 Bool_t canSplitFast() const ;
231 RooAbsData* getSimData(const char* idxstate) ;
232
233 /// Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const
234 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar,
235 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
236 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
237 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
238 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
239 /// Create and fill a ROOT histogram TH1,TH2 or TH3 with the values of this dataset.
240 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const ;
241 TH1 *createHistogram(const char* varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const ;
242
243 // Fill an existing histogram
244 virtual TH1 *fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts= "", const char* cutRange=0) const;
245
246 // Printing interface (human readable)
247 inline virtual void Print(Option_t *options= 0) const {
248 // Print contents on stdout
250 }
251
252 virtual void printName(std::ostream& os) const ;
253 virtual void printTitle(std::ostream& os) const ;
254 virtual void printClassName(std::ostream& os) const ;
255 void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
256
257 virtual Int_t defaultPrintContents(Option_t* opt) const ;
258
259 void setDirtyProp(Bool_t flag) ;
260
261 Double_t moment(const RooRealVar& var, Double_t order, const char* cutSpec=0, const char* cutRange=0) const ;
262 Double_t moment(const RooRealVar& var, Double_t order, Double_t offset, const char* cutSpec=0, const char* cutRange=0) const ;
263 Double_t standMoment(const RooRealVar& var, Double_t order, const char* cutSpec=0, const char* cutRange=0) const ;
264
265 Double_t mean(const RooRealVar& var, const char* cutSpec=0, const char* cutRange=0) const { return moment(var,1,0,cutSpec,cutRange) ; }
266 Double_t sigma(const RooRealVar& var, const char* cutSpec=0, const char* cutRange=0) const { return sqrt(moment(var,2,cutSpec,cutRange)) ; }
267 Double_t skewness(const RooRealVar& var, const char* cutSpec=0, const char* cutRange=0) const { return standMoment(var,3,cutSpec,cutRange) ; }
268 Double_t kurtosis(const RooRealVar& var, const char* cutSpec=0, const char* cutRange=0) const { return standMoment(var,4,cutSpec,cutRange) ; }
269
270 Double_t covariance(RooRealVar &x,RooRealVar &y, const char* cutSpec=0, const char* cutRange=0) const { return corrcov(x,y,cutSpec,cutRange,kFALSE) ; }
271 Double_t correlation(RooRealVar &x,RooRealVar &y, const char* cutSpec=0, const char* cutRange=0) const { return corrcov(x,y,cutSpec,cutRange,kTRUE) ; }
272
273 TMatrixDSym* covarianceMatrix(const char* cutSpec=0, const char* cutRange=0) const { return covarianceMatrix(*get(),cutSpec,cutRange) ; }
274 TMatrixDSym* correlationMatrix(const char* cutSpec=0, const char* cutRange=0) const { return correlationMatrix(*get(),cutSpec,cutRange) ; }
275 TMatrixDSym* covarianceMatrix(const RooArgList& vars, const char* cutSpec=0, const char* cutRange=0) const { return corrcovMatrix(vars,cutSpec,cutRange,kFALSE) ; }
276 TMatrixDSym* correlationMatrix(const RooArgList& vars, const char* cutSpec=0, const char* cutRange=0) const { return corrcovMatrix(vars,cutSpec,cutRange,kTRUE) ; }
277
278 RooRealVar* meanVar(const RooRealVar &var, const char* cutSpec=0, const char* cutRange=0) const ;
279 RooRealVar* rmsVar(const RooRealVar &var, const char* cutSpec=0, const char* cutRange=0) const ;
280
281 virtual RooPlot* statOn(RooPlot* frame,
282 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
283 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
284 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
285 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
286
287 virtual RooPlot* statOn(RooPlot* frame, const char *what,
288 const char *label= "", Int_t sigDigits= 2,
289 Option_t *options= "NELU", Double_t xmin=0.15,
290 Double_t xmax= 0.65,Double_t ymax=0.85,
291 const char* cutSpec=0, const char* cutRange=0,
292 const RooCmdArg* formatCmd=0);
293
294 virtual void RecursiveRemove(TObject *obj);
295
296 Bool_t hasFilledCache() const ;
297
298 void addOwnedComponent(const char* idxlabel, RooAbsData& data) ;
299 static void claimVars(RooAbsData*) ;
300 static Bool_t releaseVars(RooAbsData*) ;
301
303
304 static void setDefaultStorageType(StorageType s) ;
305
307
308 /// Returns snapshot of global observables stored in this data.
309 /// \return Pointer to a RooArgSet with the snapshot of global observables
310 /// stored in the data. Can be `nullptr` if no global observales are
311 /// stored.
312 RooArgSet const* getGlobalObservables() const { return _globalObservables.get(); }
313 void setGlobalObservables(RooArgSet const& globalObservables);
314
315 /// De-duplicated pointer to this object's name.
316 /// This can be used for fast name comparisons.
317 /// like `if (namePtr() == other.namePtr())`.
318 /// \note TNamed::GetName() will return a pointer that's
319 /// different for each object, but namePtr() always points
320 /// to a unique instance.
321 inline const TNamed* namePtr() const {
322 return _namePtr ;
323 }
324
325 void SetName(const char* name) ;
326 void SetNameTitle(const char *name, const char *title) ;
327
328
329protected:
330
332
334
335 Double_t corrcov(const RooRealVar& x, const RooRealVar& y, const char* cutSpec, const char* cutRange, Bool_t corr) const ;
336 TMatrixDSym* corrcovMatrix(const RooArgList& vars, const char* cutSpec, const char* cutRange, Bool_t corr) const ;
337
338 virtual void optimizeReadingWithCaching(RooAbsArg& arg, const RooArgSet& cacheList, const RooArgSet& keepObsList) ;
340
341
342 // PlotOn implementation
343 virtual RooPlot *plotOn(RooPlot *frame, PlotOpt o) const ;
344 virtual RooPlot *plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const ;
345 virtual RooPlot *plotEffOn(RooPlot* frame, const RooAbsCategoryLValue& effCat, PlotOpt o) const ;
346
347
348 // Constant term optimizer interface
349 friend class RooAbsArg ;
350 friend class RooAbsReal ;
352 friend class RooAbsCachedPdf ;
354 // for access into copied dataset:
356
357 virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=0, Bool_t skipZeroWeights=kFALSE) ;
358 virtual void resetCache() ;
359 virtual void setArgStatus(const RooArgSet& set, Bool_t active) ;
360 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) ;
361
362 virtual RooAbsData* cacheClone(const RooAbsArg* newCacheOwner, const RooArgSet* newCacheVars, const char* newName=0) = 0 ; // DERIVED
363 virtual RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=0,
364 std::size_t nStart = 0, std::size_t = std::numeric_limits<std::size_t>::max(), Bool_t copyCache=kTRUE) = 0 ; // DERIVED
365
366 RooRealVar* dataRealVar(const char* methodname, const RooRealVar& extVar) const ;
367
368 // Column structure definition
369 RooArgSet _vars; // Dimensions of this data set
370 RooArgSet _cachedVars ; //! External variables cached with this data set
371
372 RooAbsDataStore* _dstore ; // Data storage implementation
373
374 std::map<std::string,RooAbsData*> _ownedComponents ; // Owned external components
375
376 std::unique_ptr<RooArgSet> _globalObservables; // Snapshot of global observables
377
378 mutable const TNamed * _namePtr ; //! De-duplicated name pointer. This will be equal for all objects with the same name.
379
380private:
381 void copyGlobalObservables(const RooAbsData& other);
382
383 ClassDef(RooAbsData, 6) // Abstract data collection
384};
385
386#endif
#define WRITE_TSTRING_COMPATIBLE_CONSTRUCTOR(Class_t)
Definition: RooAbsData.h:68
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition: TGX11.cxx:110
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
float type_of_call hi(const int &, const int &)
float ymax
Definition: THbookFile.cxx:95
Roo1DTable implements a one-dimensional table.
Definition: Roo1DTable.h:23
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:75
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:26
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:81
RooRealVar * meanVar(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Create a RooRealVar containing the mean of observable 'var' in this dataset.
virtual const RooArgSet * get() const
Definition: RooAbsData.h:127
const RooAbsDataStore * store() const
Definition: RooAbsData.h:104
void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
const TNamed * _namePtr
Definition: RooAbsData.h:378
void SetName(const char *name)
Set the name of the TNamed.
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
RooAbsData()
Default constructor.
Definition: RooAbsData.cxx:173
static void setDefaultStorageType(StorageType s)
Definition: RooAbsData.cxx:133
virtual Bool_t changeObservableName(const char *from, const char *to)
Definition: RooAbsData.cxx:361
Double_t skewness(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:267
RooRealVar * dataRealVar(const char *methodname, const RooRealVar &extVar) const
Internal method to check if given RooRealVar maps to a RooRealVar in this dataset.
Definition: RooAbsData.cxx:962
virtual Roo1DTable * table(const RooArgSet &catSet, const char *cuts="", const char *opts="") const
Construct table for product of categories in catSet.
Definition: RooAbsData.cxx:810
void setGlobalObservables(RooArgSet const &globalObservables)
Sets the global observables stored in this data.
RooAbsDataStore * store()
Definition: RooAbsData.h:103
virtual void reset()
Definition: RooAbsData.cxx:388
Double_t sigma(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:266
virtual RooAbsData * cacheClone(const RooAbsArg *newCacheOwner, const RooArgSet *newCacheVars, const char *newName=0)=0
TMatrixDSym * covarianceMatrix(const RooArgList &vars, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:275
static Bool_t releaseVars(RooAbsData *)
If return value is true variables can be deleted.
Definition: RooAbsData.cxx:160
TMatrixDSym * correlationMatrix(const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:274
TMatrixDSym * corrcovMatrix(const RooArgList &vars, const char *cutSpec, const char *cutRange, Bool_t corr) const
Return covariance matrix from data for given list of observables.
virtual Bool_t isNonPoissonWeighted() const
Definition: RooAbsData.h:181
TMatrixDSym * correlationMatrix(const RooArgList &vars, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:276
Double_t kurtosis(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:268
virtual Double_t sumEntries(const char *cutSpec, const char *cutRange=0) const =0
Return effective number of entries in dataset inside range or after cuts, i.e.
virtual TList * split(const RooAbsCategory &splitCat, Bool_t createEmptyDataSets=kFALSE) const
Split dataset into subsets based on states of given splitCat in this dataset.
virtual Double_t sumEntries() const =0
Return effective number of entries in dataset, i.e., sum all weights.
virtual std::map< const std::string, RooSpan< const RooAbsCategory::value_type > > getCategoryBatches(std::size_t first=0, std::size_t len=std::numeric_limits< std::size_t >::max()) const
virtual double weightError(ErrorType=Poisson) const
Return the symmetric error on the current weight.
Definition: RooAbsData.h:139
void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for detailed printing of object.
Definition: RooAbsData.cxx:863
virtual TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts="", const char *cutRange=0) const
Loop over columns of our tree data and fill the input histogram.
virtual RooPlot * statOn(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 statistics information to the specified frame.
void checkInit() const
virtual Bool_t valid() const
Definition: RooAbsData.h:133
virtual RooPlot * plotEffOn(RooPlot *frame, const RooAbsCategoryLValue &effCat, PlotOpt o) const
Create and fill a histogram with the efficiency N[1] / ( N[1] + N[0] ), where N(1/0) is the number of...
virtual void optimizeReadingWithCaching(RooAbsArg &arg, const RooArgSet &cacheList, const RooArgSet &keepObsList)
Prepare dataset for use with cached constant terms listed in 'cacheList' of expression 'arg'.
static void claimVars(RooAbsData *)
Definition: RooAbsData.cxx:151
virtual Double_t weight() const =0
static StorageType defaultStorageType
Definition: RooAbsData.h:331
virtual Double_t weightSquared() const =0
Double_t standMoment(const RooRealVar &var, Double_t order, const char *cutSpec=0, const char *cutRange=0) const
Calculate standardized moment.
Definition: RooAbsData.cxx:885
TMatrixDSym * covarianceMatrix(const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:273
virtual Bool_t isWeighted() const
Definition: RooAbsData.h:177
void addOwnedComponent(const char *idxlabel, RooAbsData &data)
virtual void fill()
Definition: RooAbsData.cxx:374
RooArgSet _vars
Definition: RooAbsData.h:369
virtual void printName(std::ostream &os) const
Print name of dataset.
Definition: RooAbsData.cxx:840
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsData.h:247
virtual RooPlot * plotAsymOn(RooPlot *frame, const RooAbsCategoryLValue &asymCat, PlotOpt o) const
Create and fill a histogram with the asymmetry N[+] - N[-] / ( N[+] + N[-] ), where N(+/-) is the num...
RooAbsData * getSimData(const char *idxstate)
virtual void Draw(Option_t *option="")
Forward draw command to data store.
virtual RooAbsData * reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=0, std::size_t nStart=0, std::size_t=std::numeric_limits< std::size_t >::max(), Bool_t copyCache=kTRUE)=0
void copyGlobalObservables(const RooAbsData &other)
De-duplicated name pointer. This will be equal for all objects with the same name.
Definition: RooAbsData.cxx:314
RooRealVar * rmsVar(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Create a RooRealVar containing the RMS of observable 'var' in this dataset.
Double_t correlation(RooRealVar &x, RooRealVar &y, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:271
double sumEntriesW2() const
Return sum of squared weights of this data.
virtual void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars)
Internal method – Attach dataset copied with cache contents to copied instances of functions.
Definition: RooAbsData.cxx:421
Double_t corrcov(const RooRealVar &x, const RooRealVar &y, const char *cutSpec, const char *cutRange, Bool_t corr) const
Internal method to calculate single correlation and covariance elements.
Definition: RooAbsData.cxx:981
void convertToVectorStore()
Convert tree-based storage to vector-based storage.
Definition: RooAbsData.cxx:350
virtual RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const =0
Return event weights of all events in range [first, first+len).
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
Definition: RooAbsData.h:321
RooArgSet _cachedVars
Definition: RooAbsData.h:370
virtual void add(const RooArgSet &row, Double_t weight=1, Double_t weightError=0)=0
Bool_t getRange(const RooAbsRealLValue &var, Double_t &lowest, Double_t &highest, Double_t marginFrac=0, Bool_t symMode=kFALSE) const
Fill Doubles 'lowest' and 'highest' with the lowest and highest value of observable 'var' in this dat...
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Definition: RooAbsData.cxx:381
virtual void getBatches(RooBatchCompute::RunContext &evalData, std::size_t first=0, std::size_t len=std::numeric_limits< std::size_t >::max()) const
Write information to retrieve data columns into evalData.spans.
virtual void convertToTreeStore()
Convert vector-based storage to tree-based storage.
virtual 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
Definition: RooAbsData.cxx:609
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
Definition: RooAbsData.cxx:871
StorageType storageType
Definition: RooAbsData.h:333
RooArgSet const * getGlobalObservables() const
Returns snapshot of global observables stored in this data.
Definition: RooAbsData.h:312
RooAbsData & operator=(const RooAbsData &other)
Definition: RooAbsData.cxx:271
Double_t moment(const RooRealVar &var, Double_t order, const char *cutSpec=0, const char *cutRange=0) const
Calculate moment of requested order.
Definition: RooAbsData.cxx:904
Double_t covariance(RooRealVar &x, RooRealVar &y, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:270
virtual void resetCache()
Internal method – Remove cached function values.
Definition: RooAbsData.cxx:412
std::unique_ptr< RooArgSet > _globalObservables
Definition: RooAbsData.h:376
Bool_t hasFilledCache() const
TTree * GetClonedTree() const
Return a clone of the TTree which stores the data or create such a tree if vector storage is used.
RooAbsData * reduce(const RooCmdArg &arg1, 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())
Create a reduced copy of this dataset.
Definition: RooAbsData.cxx:456
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kFALSE)
Internal method – Cache given set of functions with data.
Definition: RooAbsData.cxx:404
void attachBuffers(const RooArgSet &extObs)
Double_t mean(const RooRealVar &var, const char *cutSpec=0, const char *cutRange=0) const
Definition: RooAbsData.h:265
virtual RooAbsData * emptyClone(const char *newName=0, const char *newTitle=0, const RooArgSet *vars=0, const char *wgtVarName=0) const =0
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
Definition: RooAbsData.cxx:428
virtual void printClassName(std::ostream &os) const
Print class name of dataset.
Definition: RooAbsData.cxx:856
std::map< std::string, RooAbsData * > _ownedComponents
Definition: RooAbsData.h:374
TH1 * createHistogram(const char *name, const RooAbsRealLValue &xvar, 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
Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) c...
Definition: RooAbsData.cxx:687
static StorageType getDefaultStorageType()
Definition: RooAbsData.cxx:144
void resetBuffers()
Bool_t canSplitFast() const
virtual void printTitle(std::ostream &os) const
Print title of dataset.
Definition: RooAbsData.cxx:848
RooAbsDataStore * _dstore
External variables cached with this data set.
Definition: RooAbsData.h:372
const TTree * tree() const
Return a pointer to the TTree which stores the data.
Bool_t allClientsCached(RooAbsArg *, const RooArgSet &)
Utility function that determines if all clients of object 'var' appear in given list of cached nodes.
void setDirtyProp(Bool_t flag)
Control propagation of dirty flags from observables in dataset.
Definition: RooAbsData.cxx:436
virtual ~RooAbsData()
Destructor.
Definition: RooAbsData.cxx:328
virtual void weightError(double &lo, double &hi, ErrorType=Poisson) const
Return the asymmetric errors on the current weight.
Definition: RooAbsData.h:149
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:63
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:35
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:52
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:38
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
virtual StyleOption defaultPrintStyle(Option_t *opt) const
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
A doubly linked list.
Definition: TList.h:44
TMatrixTSym.
Definition: TMatrixTSym.h:34
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:136
A TTree represents a columnar dataset.
Definition: TTree.h:79
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
basic_string_view< char > string_view
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
Namespace for dispatching RooFit computations to various backends.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18
static constexpr double s
Definition: first.py:1
const double xbins[xbins_n]
static const char * what
Definition: stlLoader.cc:6
Double_t scaleFactor
Definition: RooAbsData.h:220
const char * cuts
Definition: RooAbsData.h:206
const char * cutRange
Definition: RooAbsData.h:211
Double_t addToWgtOther
Definition: RooAbsData.h:216
const char * histName
Definition: RooAbsData.h:212
const char * addToHistName
Definition: RooAbsData.h:214
Double_t addToWgtSelf
Definition: RooAbsData.h:215
RooAbsData::ErrorType etype
Definition: RooAbsData.h:210
RooAbsBinning * bins
Definition: RooAbsData.h:209
Bool_t correctForBinWidth
Definition: RooAbsData.h:219
Option_t * drawOptions
Definition: RooAbsData.h:208
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31
Analyzes a function given a dataset/observables for constant terms and caches those in the dataset.