Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "RooNameReg.h"
24#include "RooFit/UniqueId.h"
26
27#include <ROOT/RSpan.hxx>
28
29#include <TMatrixDSym.h>
30#include <TNamed.h>
31
32#include <map>
33#include <string>
34
35class RooAbsReal ;
36class RooRealVar;
39class Roo1DTable ;
40class RooPlot;
41class RooArgList;
42class RooSimultaneous;
43class TH1;
44class TH2F;
45class RooAbsBinning ;
46class Roo1DTable ;
47class RooAbsDataStore ;
48class RooFormulaVar;
49namespace RooFit {
50namespace TestStatistics {
51class RooAbsL;
53}
54}
55
56
57class RooAbsData : public TNamed, public RooPrintable {
58public:
59
60 // Constructors, factory methods etc.
61 RooAbsData() ;
63 RooAbsData(const RooAbsData& other, const char* newname = nullptr) ;
64
65 RooAbsData& operator=(const RooAbsData& other);
66 ~RooAbsData() override ;
67 virtual RooFit::OwningPtr<RooAbsData> emptyClone(const char* newName=nullptr, const char* newTitle=nullptr, const RooArgSet* vars=nullptr, const char* wgtVarName=nullptr) const = 0 ;
68
69 // Reduction methods
70 RooFit::OwningPtr<RooAbsData> reduce(const RooCmdArg& arg1,const RooCmdArg& arg2={},const RooCmdArg& arg3={},const RooCmdArg& arg4={},
71 const RooCmdArg& arg5={},const RooCmdArg& arg6={},const RooCmdArg& arg7={},const RooCmdArg& arg8={}) ;
72 RooFit::OwningPtr<RooAbsData> reduce(const char* cut) ;
74 RooFit::OwningPtr<RooAbsData> reduce(const RooArgSet& varSubset, const char* cut=nullptr) ;
75 RooFit::OwningPtr<RooAbsData> reduce(const RooArgSet& varSubset, const RooFormulaVar& cutVar) ;
76
78 const RooAbsDataStore* store() const { return _dstore.get(); }
79 const TTree* tree() const ;
80 TTree *GetClonedTree() const;
81
83 virtual void convertToTreeStore();
84
85 void attachBuffers(const RooArgSet& extObs) ;
86 void resetBuffers() ;
87
88
89 void Draw(Option_t* option = "") override ;
90
91 void checkInit() const ;
92
93 // Change name of observable
94 virtual bool changeObservableName(const char* from, const char* to) ;
95
96 // Add one ore more rows of data
97 virtual void add(const RooArgSet& row, double weight=1) = 0 ; // DERIVED
98 virtual void fill() ;
99
100 // Load a given row of data
101 virtual inline const RooArgSet* get() const {
102 // Return current row of dataset
103 return &_vars ;
104 }
105 virtual double weight() const = 0 ; // DERIVED
106 virtual double weightSquared() const = 0 ; // DERIVED
107
109 /// Return the symmetric error on the current weight.
110 /// See also weightError(double&,double&,ErrorType) const for asymmetric errors.
111 // \param[in] etype Type of error to compute. May throw if not supported.
112 virtual double weightError(ErrorType /*etype*/=Poisson) const {
113 // Dummy implementation returning zero, because not all deriving classes
114 // need to implement a non-zero weight error.
115 return 0.0;
116 }
117 /// Return the asymmetric errors on the current weight.
118 /// See also weightError(ErrorType) const for symmetric error.
119 /// \param[out] lo Low error.
120 /// \param[out] hi High error.
121 // \param[in] etype Type of error to compute. May throw if not supported.
122 virtual void weightError(double& lo, double& hi, ErrorType /*etype*/=Poisson) const {
123 // Dummy implementation returning zero, because not all deriving classes
124 // need to implement a non-zero weight error.
125 lo=0;
126 hi=0;
127 }
128
129 virtual const RooArgSet* get(Int_t index) const ;
130
131 using RealSpans = std::map<RooFit::Detail::DataKey, std::span<const double>>;
132 using CategorySpans = std::map<RooFit::Detail::DataKey, std::span<const RooAbsCategory::value_type>>;
133
134 RealSpans getBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
135 CategorySpans getCategoryBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
136
137 ////////////////////////////////////////////////////////////////////////////////
138 /// Return event weights of all events in range [first, first+len).
139 /// If no contiguous structure of weights is stored, an empty batch can be returned.
140 /// This indicates that the weight is constant. Use weight() to retrieve it.
141 virtual std::span<const double> getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const = 0;
142
143 /// Return number of entries in dataset, i.e., count unweighted entries.
144 virtual Int_t numEntries() const ;
145 /// Return effective number of entries in dataset, i.e., sum all weights.
146 virtual double sumEntries() const = 0 ;
147 /// Return effective number of entries in dataset inside range or after cuts, i.e., sum certain weights.
148 /// \param[in] cutSpec Apply given cut when counting (e.g. `0 < x && x < 5`). Passing `"1"` selects all events.
149 /// \param[in] cutRange If the observables have a range with this name, only count events inside this range.
150 virtual double sumEntries(const char* cutSpec, const char* cutRange=nullptr) const = 0 ; // DERIVED
151 double sumEntriesW2() const;
152 virtual bool isWeighted() const {
153 // Do events in dataset have weights?
154 return false ;
155 }
156 virtual bool isNonPoissonWeighted() const {
157 // Do events in dataset have non-integer weights?
158 return false ;
159 }
160 virtual void reset() ;
161
162
163 bool getRange(const RooAbsRealLValue& var, double& lowest, double& highest, double marginFrac=0.0, bool symMode=false) const ;
164
165 // Plot the distribution of a real valued arg
166 virtual Roo1DTable* table(const RooArgSet& catSet, const char* cuts="", const char* opts="") const ;
167 virtual Roo1DTable* table(const RooAbsCategory& cat, const char* cuts="", const char* opts="") const ;
168 /// \see RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const
169 virtual RooPlot* plotOn(RooPlot* frame,
170 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
171 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
172 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
173 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) const ;
174
175 virtual RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;
176
177 // WVE --- This needs to be public to avoid CINT problems
178 struct PlotOpt {
179 const char* cuts = "";
181 RooAbsBinning* bins = nullptr;
183 const char* cutRange = nullptr;
184 const char* histName = nullptr;
185 bool histInvisible = false;
186 const char* addToHistName = nullptr;
187 double addToWgtSelf = 1.0;
188 double addToWgtOther = 1.0;
189 double xErrorSize = 1.0;
190 bool refreshFrameNorm = false;
192 double scaleFactor = 1.0;
193 } ;
194
195 // Split a dataset by a category
196 virtual RooFit::OwningPtr<TList> split(const RooAbsCategory& splitCat, bool createEmptyDataSets=false) const ;
197
198 // Split a dataset by categories of a RooSimultaneous
199 virtual RooFit::OwningPtr<TList> split(const RooSimultaneous& simpdf, bool createEmptyDataSets=false) const ;
200
201 // Fast splitting for SimMaster setData
202 bool canSplitFast() const ;
203 RooAbsData* getSimData(const char* idxstate) ;
204
205 /// Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const
206 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar,
207 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
208 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
209 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
210 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) const ;
211 TH1 *createHistogram(const char* varNameList,
212 const RooCmdArg& binArgX={}, const RooCmdArg& binArgY={},
213 const RooCmdArg& binArgZ={}) const;
214 /// Create and fill a ROOT histogram TH1,TH2 or TH3 with the values of this dataset.
215 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const ;
216 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, const char* cuts="",
217 const char *name= "hist") const;
218 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, int nx, int ny,
219 const char* cuts="", const char *name="hist") const;
220
221 // Fill an existing histogram
222 virtual TH1 *fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts= "", const char* cutRange=nullptr) const;
223
224 // Printing interface (human readable)
225 inline void Print(Option_t *options= nullptr) const override {
226 // Print contents on stdout
228 }
229
230 void printName(std::ostream& os) const override ;
231 void printTitle(std::ostream& os) const override ;
232 void printClassName(std::ostream& os) const override ;
233 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
234
235 Int_t defaultPrintContents(Option_t* opt) const override ;
236
237 void setDirtyProp(bool flag) ;
238
239 double moment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
240 double moment(const RooRealVar& var, double order, double offset, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
241 double standMoment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
242
243 double mean(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return moment(var,1,0,cutSpec,cutRange) ; }
244 double sigma(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return sqrt(moment(var,2,cutSpec,cutRange)) ; }
245 double skewness(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,3,cutSpec,cutRange) ; }
246 double kurtosis(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,4,cutSpec,cutRange) ; }
247
248 double covariance(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,false) ; }
249 double correlation(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,true) ; }
250
251 RooFit::OwningPtr<TMatrixDSym> covarianceMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return covarianceMatrix(*get(),cutSpec,cutRange) ; }
252 RooFit::OwningPtr<TMatrixDSym> correlationMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return correlationMatrix(*get(),cutSpec,cutRange) ; }
253 RooFit::OwningPtr<TMatrixDSym> covarianceMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,false) ; }
254 RooFit::OwningPtr<TMatrixDSym> correlationMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,true) ; }
255
256 RooRealVar* meanVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
257 RooRealVar* rmsVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
258
259 virtual RooPlot* statOn(RooPlot* frame,
260 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
261 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
262 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
263 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
264
265 virtual RooPlot* statOn(RooPlot* frame, const char *what,
266 const char *label= "", Int_t sigDigits= 2,
267 Option_t *options= "NELU", double xmin=0.15,
268 double xmax= 0.65,double ymax=0.85,
269 const char* cutSpec=nullptr, const char* cutRange=nullptr,
270 const RooCmdArg* formatCmd=nullptr);
271
272 void RecursiveRemove(TObject *obj) override;
273
274 bool hasFilledCache() const ;
275
276 void addOwnedComponent(const char* idxlabel, RooAbsData& data) ;
277
279
280 static void setDefaultStorageType(StorageType s) ;
281
283
284 /// Returns snapshot of global observables stored in this data.
285 /// \return Pointer to a RooArgSet with the snapshot of global observables
286 /// stored in the data. Can be `nullptr` if no global observables are
287 /// stored.
289 void setGlobalObservables(RooArgSet const& globalObservables);
290
291 /// De-duplicated pointer to this object's name.
292 /// This can be used for fast name comparisons.
293 /// like `if (namePtr() == other.namePtr())`.
294 /// \note TNamed::GetName() will return a pointer that's
295 /// different for each object, but namePtr() always points
296 /// to a unique instance.
297 inline const TNamed* namePtr() const {
298 return _namePtr ;
299 }
300
301 void SetName(const char* name) override ;
302 void SetNameTitle(const char *name, const char *title) override ;
303
304 /// Returns a unique ID that is different for every instantiated RooAbsData object.
305 /// This ID can be used whether two RooAbsData are the same object, which is safer
306 /// than memory address comparisons that might result in false positives when
307 /// memory is reused.
309
310protected:
311
313
315
316 void initializeVars(RooArgSet const& vars);
317
318 double corrcov(const RooRealVar& x, const RooRealVar& y, const char* cutSpec, const char* cutRange, bool corr) const ;
319 RooFit::OwningPtr<TMatrixDSym> corrcovMatrix(const RooArgList& vars, const char* cutSpec, const char* cutRange, bool corr) const ;
320
321 virtual void optimizeReadingWithCaching(RooAbsArg& arg, const RooArgSet& cacheList, const RooArgSet& keepObsList) ;
322 bool allClientsCached(RooAbsArg*, const RooArgSet&) ;
323
324
325 // PlotOn implementation
326 virtual RooPlot *plotOn(RooPlot *frame, PlotOpt o) const ;
327 virtual RooPlot *plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const ;
328 virtual RooPlot *plotEffOn(RooPlot* frame, const RooAbsCategoryLValue& effCat, PlotOpt o) const ;
329
330
331 // Constant term optimizer interface
334 // for access into copied dataset:
336
337 virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=nullptr, bool skipZeroWeights=false) ;
338 virtual void resetCache() ;
339 virtual void setArgStatus(const RooArgSet& set, bool active) ;
340 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) ;
341
342 virtual std::unique_ptr<RooAbsData> reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=nullptr,
343 std::size_t nStart = 0, std::size_t = std::numeric_limits<std::size_t>::max()) = 0 ;
344
345 RooRealVar* dataRealVar(const char* methodname, const RooRealVar& extVar) const ;
346
347 // Column structure definition
348 RooArgSet _vars; ///< Dimensions of this data set
349 RooArgSet _cachedVars ; ///<! External variables cached with this data set
350
351 std::unique_ptr<RooAbsDataStore> _dstore; ///< Data storage implementation
352
353 std::map<std::string,RooAbsData*> _ownedComponents ; ///< Owned external components
354
355 std::unique_ptr<RooArgSet> _globalObservables; ///< Snapshot of global observables
356
357 mutable const TNamed * _namePtr = nullptr; ///<! De-duplicated name pointer. This will be equal for all objects with the same name.
358
359private:
360 void copyImpl(const RooAbsData& other, const char* newname);
361
362 void copyGlobalObservables(const RooAbsData& other);
363
365
366 ClassDefOverride(RooAbsData, 7) // Abstract data collection
367};
368
369#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 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 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 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
#define hi
float xmax
float ymax
One-dimensional table.
Definition Roo1DTable.h:23
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract base class for RooRealVar binning definitions.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
Storage_t const & get() const
Const access to the underlying stl container.
Abstract base class for a data collection.
virtual const RooArgSet * get(Int_t index) const =0
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
virtual double weight() const =0
virtual double sumEntries() const =0
Return effective number of entries in dataset, i.e., sum all weights.
RooFit::OwningPtr< TMatrixDSym > correlationMatrix(const RooArgList &vars, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:254
double skewness(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:245
virtual const RooArgSet * get() const
Definition RooAbsData.h:101
const RooAbsDataStore * store() const
Definition RooAbsData.h:78
std::map< RooFit::Detail::DataKey, std::span< const double > > RealSpans
Definition RooAbsData.h:131
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.
const TNamed * _namePtr
! De-duplicated name pointer. This will be equal for all objects with the same name.
Definition RooAbsData.h:357
RooAbsData()
Default constructor.
static void setDefaultStorageType(StorageType s)
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
RooFit::OwningPtr< TMatrixDSym > corrcovMatrix(const RooArgList &vars, const char *cutSpec, const char *cutRange, bool corr) const
Return covariance matrix from data for given list of observables.
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.
void setGlobalObservables(RooArgSet const &globalObservables)
Sets the global observables stored in this data.
RooAbsDataStore * store()
Definition RooAbsData.h:77
void printClassName(std::ostream &os) const override
Print class name of dataset.
virtual void reset()
RooFit::OwningPtr< TMatrixDSym > covarianceMatrix(const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:251
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.
RooFit::UniqueId< RooAbsData > const & uniqueId() const
Returns a unique ID that is different for every instantiated RooAbsData object.
Definition RooAbsData.h:308
virtual bool changeObservableName(const char *from, const char *to)
void printTitle(std::ostream &os) const override
Print title of dataset.
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:112
void setDirtyProp(bool flag)
Control propagation of dirty flags from observables in dataset.
virtual RooFit::OwningPtr< TList > split(const RooAbsCategory &splitCat, bool createEmptyDataSets=false) const
Split the dataset into subsets based on states of a categorical variable in this dataset.
double mean(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:243
double correlation(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:249
RooFit::OwningPtr< TMatrixDSym > correlationMatrix(const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:252
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.
RooFit::OwningPtr< RooAbsData > reduce(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={})
Create a reduced copy of this dataset.
void checkInit() const
virtual void setArgStatus(const RooArgSet &set, bool active)
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=false)
Internal method – Cache given set of functions with data.
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'.
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
static StorageType defaultStorageType
Definition RooAbsData.h:312
std::map< RooFit::Detail::DataKey, std::span< const RooAbsCategory::value_type > > CategorySpans
Definition RooAbsData.h:132
virtual std::span< 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).
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:351
double sigma(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:244
void addOwnedComponent(const char *idxlabel, RooAbsData &data)
RooFit::OwningPtr< TMatrixDSym > covarianceMatrix(const RooArgList &vars, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:253
virtual void fill()
RooArgSet _vars
Dimensions of this data set.
Definition RooAbsData.h:348
bool canSplitFast() const
virtual RooPlot * statOn(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 statistics information to the specified frame.
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
This method must be overridden when a class wants to print itself.
Definition RooAbsData.h:225
RooAbsData * getSimData(const char *idxstate)
void copyGlobalObservables(const RooAbsData &other)
virtual bool isNonPoissonWeighted() const
Definition RooAbsData.h:156
bool hasFilledCache() const
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.
void convertToVectorStore()
Convert tree-based storage to vector-based storage.
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
Definition RooAbsData.h:297
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:349
const RooFit::UniqueId< RooAbsData > _uniqueId
!
Definition RooAbsData.h:364
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
virtual void convertToTreeStore()
Convert vector-based storage to tree-based storage.
double moment(const RooRealVar &var, double order, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Calculate moment of requested order.
StorageType storageType
Definition RooAbsData.h:314
RooArgSet const * getGlobalObservables() const
Returns snapshot of global observables stored in this data.
Definition RooAbsData.h:288
RooAbsData & operator=(const RooAbsData &other)
virtual RooFit::OwningPtr< RooAbsData > emptyClone(const char *newName=nullptr, const char *newTitle=nullptr, const RooArgSet *vars=nullptr, const char *wgtVarName=nullptr) const =0
void SetNameTitle(const char *name, const char *title) override
Set all the TNamed parameters (name and title).
void copyImpl(const RooAbsData &other, const char *newname)
virtual void resetCache()
Internal method – Remove cached function values.
virtual std::unique_ptr< 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
Int_t defaultPrintContents(Option_t *opt) const override
Define default print options, for a given print style.
std::unique_ptr< RooArgSet > _globalObservables
Snapshot of global observables.
Definition RooAbsData.h:355
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.
void attachBuffers(const RooArgSet &extObs)
std::map< std::string, RooAbsData * > _ownedComponents
Owned external components.
Definition RooAbsData.h:353
double covariance(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:248
static StorageType getDefaultStorageType()
virtual bool isWeighted() const
Definition RooAbsData.h:152
virtual void add(const RooArgSet &row, double weight=1)=0
void resetBuffers()
double kurtosis(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:246
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.
TH1 * createHistogram(const char *name, const RooAbsRealLValue &xvar, 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
Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) c...
void printName(std::ostream &os) const override
Print name of dataset.
const TTree * tree() const
Return a pointer to the TTree which stores the data.
void initializeVars(RooArgSet const &vars)
~RooAbsData() override
Destructor.
virtual void weightError(double &lo, double &hi, ErrorType=Poisson) const
Return the asymmetric errors on the current weight.
Definition RooAbsData.h:122
Abstract base class for test statistics objects that evaluate a function or PDF at each point of a gi...
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
A 'mix-in' base class that define the standard RooFit plotting and printing methods.
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,...
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
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:258
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:139
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
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26
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
static const char * what
Definition stlLoader.cc:6
const char * cuts
Definition RooAbsData.h:179
const char * cutRange
Definition RooAbsData.h:183
const char * histName
Definition RooAbsData.h:184
const char * addToHistName
Definition RooAbsData.h:186
RooAbsData::ErrorType etype
Definition RooAbsData.h:182
RooAbsBinning * bins
Definition RooAbsData.h:181
Option_t * drawOptions
Definition RooAbsData.h:180
Analyzes a function given a dataset/observables for constant terms and caches those in the dataset.
A UniqueId can be added as a class member to enhance any class with a unique identifier for each inst...
Definition UniqueId.h:39
th1 Draw()