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#include "RooFit/UniqueId.h"
27
28#include <ROOT/RConfig.hxx> // R__DEPRECATED
29#include "TNamed.h"
30
31#include <map>
32#include <string>
33
34class RooAbsArg;
35class RooAbsReal ;
36class RooRealVar;
39class Roo1DTable ;
40class RooPlot;
41class RooArgList;
42class RooSimultaneous;
43class TH1;
44class TH2F;
45class RooAbsBinning ;
46class Roo1DTable ;
47class RooAbsDataStore ;
48template<typename T> class TMatrixTSym;
50class RooFormulaVar;
51namespace RooBatchCompute{
52struct RunContext;
53}
54namespace RooFit {
55namespace TestStatistics {
56class RooAbsL;
58}
59}
60
61
62class RooAbsData : public TNamed, public RooPrintable {
63public:
64
65 // Constructors, factory methods etc.
66 RooAbsData() ;
68 RooAbsData(const RooAbsData& other, const char* newname = nullptr) ;
69
70 RooAbsData& operator=(const RooAbsData& other);
71 ~RooAbsData() override ;
72 virtual RooAbsData* emptyClone(const char* newName=nullptr, const char* newTitle=nullptr, const RooArgSet* vars=nullptr, const char* wgtVarName=nullptr) const = 0 ;
73
74 // Reduction methods
75 RooAbsData* reduce(const RooCmdArg& arg1,const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg(),const RooCmdArg& arg4=RooCmdArg(),
76 const RooCmdArg& arg5=RooCmdArg(),const RooCmdArg& arg6=RooCmdArg(),const RooCmdArg& arg7=RooCmdArg(),const RooCmdArg& arg8=RooCmdArg()) ;
77 RooAbsData* reduce(const char* cut) ;
78 RooAbsData* reduce(const RooFormulaVar& cutVar) ;
79 RooAbsData* reduce(const RooArgSet& varSubset, const char* cut=nullptr) ;
80 RooAbsData* reduce(const RooArgSet& varSubset, const RooFormulaVar& cutVar) ;
81
82 RooAbsDataStore* store() { return _dstore.get(); }
83 const RooAbsDataStore* store() const { return _dstore.get(); }
84 const TTree* tree() const ;
85 TTree *GetClonedTree() const;
86
88 virtual void convertToTreeStore();
89
90 void attachBuffers(const RooArgSet& extObs) ;
91 void resetBuffers() ;
92
93
94 void Draw(Option_t* option = "") override ;
95
96 void checkInit() const ;
97
98 // Change name of observable
99 virtual bool changeObservableName(const char* from, const char* to) ;
100
101 // Add one ore more rows of data
102 virtual void add(const RooArgSet& row, double weight=1, double weightError=0.0) = 0 ; // DERIVED
103 virtual void fill() ;
104
105 // Load a given row of data
106 virtual inline const RooArgSet* get() const {
107 // Return current row of dataset
108 return &_vars ;
109 }
110 virtual double weight() const = 0 ; // DERIVED
111 virtual double weightSquared() const = 0 ; // DERIVED
112
114 /// Return the symmetric error on the current weight.
115 /// See also weightError(double&,double&,ErrorType) const for asymmetric errors.
116 // \param[in] etype Type of error to compute. May throw if not supported.
117 virtual double weightError(ErrorType /*etype*/=Poisson) const {
118 // Dummy implementation returning zero, because not all deriving classes
119 // need to implement a non-zero weight error.
120 return 0.0;
121 }
122 /// Return the asymmetric errors on the current weight.
123 /// See also weightError(ErrorType) const for symmetric error.
124 /// \param[out] lo Low error.
125 /// \param[out] hi High error.
126 // \param[in] etype Type of error to compute. May throw if not supported.
127 virtual void weightError(double& lo, double& hi, ErrorType /*etype*/=Poisson) const {
128 // Dummy implementation returning zero, because not all deriving classes
129 // need to implement a non-zero weight error.
130 lo=0;
131 hi=0;
132 }
133
134 virtual const RooArgSet* get(Int_t index) const ;
135
136 using RealSpans = std::map<RooFit::Detail::DataKey, RooSpan<const double>>;
137 using CategorySpans = std::map<RooFit::Detail::DataKey, RooSpan<const RooAbsCategory::value_type>>;
138
139 RealSpans getBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
140 CategorySpans getCategoryBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
141
142 ////////////////////////////////////////////////////////////////////////////////
143 /// Return event weights of all events in range [first, first+len).
144 /// If no contiguous structure of weights is stored, an empty batch can be returned.
145 /// This indicates that the weight is constant. Use weight() to retrieve it.
146 virtual RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const = 0;
147
148 /// Return number of entries in dataset, i.e., count unweighted entries.
149 virtual Int_t numEntries() const ;
150 /// Return effective number of entries in dataset, i.e., sum all weights.
151 virtual double sumEntries() const = 0 ;
152 /// Return effective number of entries in dataset inside range or after cuts, i.e., sum certain weights.
153 /// \param[in] cutSpec Apply given cut when counting (e.g. `0 < x && x < 5`). Passing `"1"` selects all events.
154 /// \param[in] cutRange If the observables have a range with this name, only count events inside this range.
155 virtual double sumEntries(const char* cutSpec, const char* cutRange=nullptr) const = 0 ; // DERIVED
156 double sumEntriesW2() const;
157 virtual bool isWeighted() const {
158 // Do events in dataset have weights?
159 return false ;
160 }
161 virtual bool isNonPoissonWeighted() const {
162 // Do events in dataset have non-integer weights?
163 return false ;
164 }
165 virtual void reset() ;
166
167
168 bool getRange(const RooAbsRealLValue& var, double& lowest, double& highest, double marginFrac=0.0, bool symMode=false) const ;
169
170 // Plot the distribution of a real valued arg
171 virtual Roo1DTable* table(const RooArgSet& catSet, const char* cuts="", const char* opts="") const ;
172 virtual Roo1DTable* table(const RooAbsCategory& cat, const char* cuts="", const char* opts="") const ;
173 /// \see RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const
174 virtual RooPlot* plotOn(RooPlot* frame,
175 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
176 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
177 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
178 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
179
180 virtual RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;
181
182 // WVE --- This needs to be public to avoid CINT problems
183 struct PlotOpt {
184 PlotOpt() : cuts(""), drawOptions("P"), bins(nullptr), etype(RooAbsData::Poisson), cutRange(nullptr), histName(nullptr), histInvisible(false),
186 scaleFactor(1.) {} ;
187 const char* cuts ;
191 const char* cutRange ;
192 const char* histName ;
194 const char* addToHistName ;
197 double xErrorSize ;
200 double scaleFactor ;
201 } ;
202
203 // Split a dataset by a category
204 virtual TList* split(const RooAbsCategory& splitCat, bool createEmptyDataSets=false) const ;
205
206 // Split a dataset by categories of a RooSimultaneous
207 virtual TList* split(const RooSimultaneous& simpdf, bool createEmptyDataSets=false) const ;
208
209 // Fast splitting for SimMaster setData
210 bool canSplitFast() const ;
211 RooAbsData* getSimData(const char* idxstate) ;
212
213 /// Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const
214 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar,
215 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
216 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
217 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
218 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
219 // Developer note: the `binArgX` parameter has no default `none` value,
220 // because then the signature would be ambiguous with the deprecated bin
221 // integer overload below. When the deprecated overload is removed, a default
222 // value must be set (tutorial failures will remind us to do that).
223 TH1 *createHistogram(const char* varNameList,
224 const RooCmdArg& binArgX, const RooCmdArg& binArgY=RooCmdArg::none(),
225 const RooCmdArg& binArgZ=RooCmdArg::none()) const;
226 /// Create and fill a ROOT histogram TH1,TH2 or TH3 with the values of this dataset.
227 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const ;
228 TH1 *createHistogram(const char* varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const
229 R__DEPRECATED(6, 30, "Use the overload of RooAbsData::createHistogram that takes RooFit command arguments.");
230 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, const char* cuts="",
231 const char *name= "hist") const;
232 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, int nx, int ny,
233 const char* cuts="", const char *name="hist") const;
234
235 // Fill an existing histogram
236 virtual TH1 *fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts= "", const char* cutRange=nullptr) const;
237
238 // Printing interface (human readable)
239 inline void Print(Option_t *options= nullptr) const override {
240 // Print contents on stdout
242 }
243
244 void printName(std::ostream& os) const override ;
245 void printTitle(std::ostream& os) const override ;
246 void printClassName(std::ostream& os) const override ;
247 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
248
249 Int_t defaultPrintContents(Option_t* opt) const override ;
250
251 void setDirtyProp(bool flag) ;
252
253 double moment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
254 double moment(const RooRealVar& var, double order, double offset, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
255 double standMoment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
256
257 double mean(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return moment(var,1,0,cutSpec,cutRange) ; }
258 double sigma(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return sqrt(moment(var,2,cutSpec,cutRange)) ; }
259 double skewness(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,3,cutSpec,cutRange) ; }
260 double kurtosis(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,4,cutSpec,cutRange) ; }
261
262 double covariance(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,false) ; }
263 double correlation(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,true) ; }
264
265 TMatrixDSym* covarianceMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return covarianceMatrix(*get(),cutSpec,cutRange) ; }
266 TMatrixDSym* correlationMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return correlationMatrix(*get(),cutSpec,cutRange) ; }
267 TMatrixDSym* covarianceMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,false) ; }
268 TMatrixDSym* correlationMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,true) ; }
269
270 RooRealVar* meanVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
271 RooRealVar* rmsVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
272
273 virtual RooPlot* statOn(RooPlot* frame,
274 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
275 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
276 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
277 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) ;
278
279 virtual RooPlot* statOn(RooPlot* frame, const char *what,
280 const char *label= "", Int_t sigDigits= 2,
281 Option_t *options= "NELU", double xmin=0.15,
282 double xmax= 0.65,double ymax=0.85,
283 const char* cutSpec=nullptr, const char* cutRange=nullptr,
284 const RooCmdArg* formatCmd=nullptr);
285
286 void RecursiveRemove(TObject *obj) override;
287
288 bool hasFilledCache() const ;
289
290 void addOwnedComponent(const char* idxlabel, RooAbsData& data) ;
291 static void claimVars(RooAbsData*) ;
292 static bool releaseVars(RooAbsData*) ;
293
295
296 static void setDefaultStorageType(StorageType s) ;
297
299
300 /// Returns snapshot of global observables stored in this data.
301 /// \return Pointer to a RooArgSet with the snapshot of global observables
302 /// stored in the data. Can be `nullptr` if no global observables are
303 /// stored.
304 RooArgSet const* getGlobalObservables() const { return _globalObservables.get(); }
305 void setGlobalObservables(RooArgSet const& globalObservables);
306
307 /// De-duplicated pointer to this object's name.
308 /// This can be used for fast name comparisons.
309 /// like `if (namePtr() == other.namePtr())`.
310 /// \note TNamed::GetName() will return a pointer that's
311 /// different for each object, but namePtr() always points
312 /// to a unique instance.
313 inline const TNamed* namePtr() const {
314 return _namePtr ;
315 }
316
317 void SetName(const char* name) override ;
318 void SetNameTitle(const char *name, const char *title) override ;
319
320 /// Returns a unique ID that is different for every instantiated RooAbsData object.
321 /// This ID can be used whether two RooAbsData are the same object, which is safer
322 /// than memory address comparisons that might result in false positives when
323 /// memory is reused.
325
326protected:
327
329
331
332 double corrcov(const RooRealVar& x, const RooRealVar& y, const char* cutSpec, const char* cutRange, bool corr) const ;
333 TMatrixDSym* corrcovMatrix(const RooArgList& vars, const char* cutSpec, const char* cutRange, bool corr) const ;
334
335 virtual void optimizeReadingWithCaching(RooAbsArg& arg, const RooArgSet& cacheList, const RooArgSet& keepObsList) ;
336 bool allClientsCached(RooAbsArg*, const RooArgSet&) ;
337
338
339 // PlotOn implementation
340 virtual RooPlot *plotOn(RooPlot *frame, PlotOpt o) const ;
341 virtual RooPlot *plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const ;
342 virtual RooPlot *plotEffOn(RooPlot* frame, const RooAbsCategoryLValue& effCat, PlotOpt o) const ;
343
344
345 // Constant term optimizer interface
348 // for access into copied dataset:
350
351 virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=nullptr, bool skipZeroWeights=false) ;
352 virtual void resetCache() ;
353 virtual void setArgStatus(const RooArgSet& set, bool active) ;
354 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) ;
355
356 virtual RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=nullptr,
357 std::size_t nStart = 0, std::size_t = std::numeric_limits<std::size_t>::max()) = 0 ;
358
359 RooRealVar* dataRealVar(const char* methodname, const RooRealVar& extVar) const ;
360
361 // Column structure definition
362 RooArgSet _vars; ///< Dimensions of this data set
363 RooArgSet _cachedVars ; ///<! External variables cached with this data set
364
365 std::unique_ptr<RooAbsDataStore> _dstore; ///< Data storage implementation
366
367 std::map<std::string,RooAbsData*> _ownedComponents ; ///< Owned external components
368
369 std::unique_ptr<RooArgSet> _globalObservables; ///< Snapshot of global observables
370
371 mutable const TNamed * _namePtr = nullptr; ///<! De-duplicated name pointer. This will be equal for all objects with the same name.
372
373private:
374 void copyGlobalObservables(const RooAbsData& other);
375
377
378 ClassDefOverride(RooAbsData, 7) // Abstract data collection
379};
380
381#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition: RConfig.hxx:513
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char name[80]
Definition: TGX11.cxx:110
float xmin
Definition: THbookFile.cxx:95
#define hi
Definition: THbookFile.cxx:128
float xmax
Definition: THbookFile.cxx:95
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:71
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:25
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
A space to attach TBranches.
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:62
virtual double weight() const =0
virtual double sumEntries() const =0
Return effective number of entries in dataset, i.e., sum all weights.
double skewness(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:259
virtual const RooArgSet * get() const
Definition: RooAbsData.h:106
const RooAbsDataStore * store() const
Definition: RooAbsData.h:83
RooRealVar * meanVar(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Create a RooRealVar containing the mean of observable 'var' in this dataset.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Interface for detailed printing of object.
Definition: RooAbsData.cxx:930
const TNamed * _namePtr
! De-duplicated name pointer. This will be equal for all objects with the same name.
Definition: RooAbsData.h:371
RooAbsData()
Default constructor.
Definition: RooAbsData.cxx:172
static void setDefaultStorageType(StorageType s)
Definition: RooAbsData.cxx:132
void SetName(const char *name) override
Set the name of the TNamed.
CategorySpans getCategoryBatches(std::size_t first=0, std::size_t len=std::numeric_limits< std::size_t >::max()) const
RooRealVar * dataRealVar(const char *methodname, const RooRealVar &extVar) const
Internal method to check if given RooRealVar maps to a RooRealVar in this dataset.
virtual Roo1DTable * table(const RooArgSet &catSet, const char *cuts="", const char *opts="") const
Construct table for product of categories in catSet.
Definition: RooAbsData.cxx:880
void setGlobalObservables(RooArgSet const &globalObservables)
Sets the global observables stored in this data.
RooAbsDataStore * store()
Definition: RooAbsData.h:82
virtual RooAbsData * emptyClone(const char *newName=nullptr, const char *newTitle=nullptr, const RooArgSet *vars=nullptr, const char *wgtVarName=nullptr) const =0
std::map< RooFit::Detail::DataKey, RooSpan< const double > > RealSpans
Definition: RooAbsData.h:136
void printClassName(std::ostream &os) const override
Print class name of dataset.
Definition: RooAbsData.cxx:923
virtual void reset()
Definition: RooAbsData.cxx:381
RooRealVar * rmsVar(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Create a RooRealVar containing the RMS of observable 'var' in this dataset.
double standMoment(const RooRealVar &var, double order, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Calculate standardized moment.
Definition: RooAbsData.cxx:952
RooFit::UniqueId< RooAbsData > const & uniqueId() const
Returns a unique ID that is different for every instantiated RooAbsData object.
Definition: RooAbsData.h:324
void Draw(Option_t *option="") override
Forward draw command to data store.
virtual bool changeObservableName(const char *from, const char *to)
Definition: RooAbsData.cxx:354
void printTitle(std::ostream &os) const override
Print title of dataset.
Definition: RooAbsData.cxx:915
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
virtual double weightError(ErrorType=Poisson) const
Return the symmetric error on the current weight.
Definition: RooAbsData.h:117
void setDirtyProp(bool flag)
Control propagation of dirty flags from observables in dataset.
Definition: RooAbsData.cxx:429
virtual void add(const RooArgSet &row, double weight=1, double weightError=0.0)=0
double mean(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:257
double correlation(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:263
virtual TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts="", const char *cutRange=nullptr) 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 void setArgStatus(const RooArgSet &set, bool active)
Definition: RooAbsData.cxx:421
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=false)
Internal method – Cache given set of functions with data.
Definition: RooAbsData.cxx:397
TMatrixDSym * correlationMatrix(const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:266
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...
RealSpans getBatches(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 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:150
static StorageType defaultStorageType
Definition: RooAbsData.h:328
double corrcov(const RooRealVar &x, const RooRealVar &y, const char *cutSpec, const char *cutRange, bool corr) const
Internal method to calculate single correlation and covariance elements.
bool allClientsCached(RooAbsArg *, const RooArgSet &)
Utility function that determines if all clients of object 'var' appear in given list of cached nodes.
std::unique_ptr< RooAbsDataStore > _dstore
Data storage implementation.
Definition: RooAbsData.h:365
double sigma(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:258
void addOwnedComponent(const char *idxlabel, RooAbsData &data)
virtual void fill()
Definition: RooAbsData.cxx:367
RooArgSet _vars
Dimensions of this data set.
Definition: RooAbsData.h:362
bool canSplitFast() const
static bool releaseVars(RooAbsData *)
If return value is true variables can be deleted.
Definition: RooAbsData.cxx:159
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...
void Print(Option_t *options=nullptr) const override
Print TNamed name and title.
Definition: RooAbsData.h:239
TMatrixDSym * covarianceMatrix(const RooArgList &vars, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:267
TH1 Use the overload of RooAbsData::createHistogram that takes RooFit command arguments
Definition: RooAbsData.h:229
RooAbsData * getSimData(const char *idxstate)
void copyGlobalObservables(const RooAbsData &other)
Definition: RooAbsData.cxx:311
virtual bool isNonPoissonWeighted() const
Definition: RooAbsData.h:161
bool hasFilledCache() const
TMatrixDSym * correlationMatrix(const RooArgList &vars, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:268
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:414
std::map< RooFit::Detail::DataKey, RooSpan< const RooAbsCategory::value_type > > CategorySpans
Definition: RooAbsData.h:137
void convertToVectorStore()
Convert tree-based storage to vector-based storage.
Definition: RooAbsData.cxx:344
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:313
bool getRange(const RooAbsRealLValue &var, double &lowest, double &highest, double marginFrac=0.0, bool symMode=false) const
Fill Doubles 'lowest' and 'highest' with the lowest and highest value of observable 'var' in this dat...
RooArgSet _cachedVars
! External variables cached with this data set
Definition: RooAbsData.h:363
const RooFit::UniqueId< RooAbsData > _uniqueId
!
Definition: RooAbsData.h:376
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Definition: RooAbsData.cxx:374
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:598
double moment(const RooRealVar &var, double order, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Calculate moment of requested order.
Definition: RooAbsData.cxx:971
StorageType storageType
Definition: RooAbsData.h:330
RooArgSet const * getGlobalObservables() const
Returns snapshot of global observables stored in this data.
Definition: RooAbsData.h:304
RooAbsData & operator=(const RooAbsData &other)
Definition: RooAbsData.cxx:268
void SetNameTitle(const char *name, const char *title) override
Set all the TNamed parameters (name and title).
virtual void resetCache()
Internal method – Remove cached function values.
Definition: RooAbsData.cxx:405
virtual TList * split(const RooAbsCategory &splitCat, bool createEmptyDataSets=false) const
Split dataset into subsets based on states of given splitCat in this dataset.
Int_t defaultPrintContents(Option_t *opt) const override
Define default print options, for a given print style.
Definition: RooAbsData.cxx:938
std::unique_ptr< RooArgSet > _globalObservables
Snapshot of global observables.
Definition: RooAbsData.h:369
virtual double weightSquared() const =0
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:449
void attachBuffers(const RooArgSet &extObs)
virtual RooAbsData * reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=nullptr, std::size_t nStart=0, std::size_t=std::numeric_limits< std::size_t >::max())=0
std::map< std::string, RooAbsData * > _ownedComponents
Owned external components.
Definition: RooAbsData.h:367
double covariance(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:262
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:685
static StorageType getDefaultStorageType()
Definition: RooAbsData.cxx:143
virtual bool isWeighted() const
Definition: RooAbsData.h:157
void resetBuffers()
double kurtosis(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:260
TMatrixDSym * corrcovMatrix(const RooArgList &vars, const char *cutSpec, const char *cutRange, bool corr) const
Return covariance matrix from data for given list of observables.
virtual double sumEntries(const char *cutSpec, const char *cutRange=nullptr) const =0
Return effective number of entries in dataset inside range or after cuts, i.e., sum certain weights.
void printName(std::ostream &os) const override
Print name of dataset.
Definition: RooAbsData.cxx:907
const TTree * tree() const
Return a pointer to the TTree which stores the data.
TMatrixDSym * covarianceMatrix(const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition: RooAbsData.h:265
~RooAbsData() override
Destructor.
Definition: RooAbsData.cxx:325
virtual void weightError(double &lo, double &hi, ErrorType=Poisson) const
Return the asymmetric errors on the current weight.
Definition: RooAbsData.h:127
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:62
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:26
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:51
A 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:43
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=nullptr)
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:40
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
The RooStringView is a wrapper around a C-syle string that can also be constructed from a std::string...
Definition: RooStringView.h:27
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:257
A doubly linked list.
Definition: TList.h:38
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:41
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
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
const char * cuts
Definition: RooAbsData.h:187
const char * cutRange
Definition: RooAbsData.h:191
const char * histName
Definition: RooAbsData.h:192
const char * addToHistName
Definition: RooAbsData.h:194
RooAbsData::ErrorType etype
Definition: RooAbsData.h:190
RooAbsBinning * bins
Definition: RooAbsData.h:189
Option_t * drawOptions
Definition: RooAbsData.h:188
Analyzes a function given a dataset/observables for constant terms and caches those in the dataset.