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"
25#include "RooFit/EvalContext.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={}) const;
72 RooFit::OwningPtr<RooAbsData> reduce(const char* cut) const;
74 RooFit::OwningPtr<RooAbsData> reduce(const RooArgSet& varSubset, const char* cut=nullptr) const;
75 RooFit::OwningPtr<RooAbsData> reduce(const RooArgSet& varSubset, const RooFormulaVar& cutVar) const;
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 static ErrorType errorTypeFromString(std::string const &name);
110
111 /// Return the symmetric error on the current weight.
112 /// See also weightError(double&,double&,ErrorType) const for asymmetric errors.
113 // \param[in] etype Type of error to compute. May throw if not supported.
114 virtual double weightError(ErrorType /*etype*/=Poisson) const {
115 // Dummy implementation returning zero, because not all deriving classes
116 // need to implement a non-zero weight error.
117 return 0.0;
118 }
119 /// Return the asymmetric errors on the current weight.
120 /// See also weightError(ErrorType) const for symmetric error.
121 /// \param[out] lo Low error.
122 /// \param[out] hi High error.
123 // \param[in] etype Type of error to compute. May throw if not supported.
124 virtual void weightError(double& lo, double& hi, ErrorType /*etype*/=Poisson) const {
125 // Dummy implementation returning zero, because not all deriving classes
126 // need to implement a non-zero weight error.
127 lo=0;
128 hi=0;
129 }
130
131 virtual const RooArgSet* get(Int_t index) const ;
132
133 using RealSpans = std::map<RooFit::Detail::DataKey, std::span<const double>>;
134 using CategorySpans = std::map<RooFit::Detail::DataKey, std::span<const RooAbsCategory::value_type>>;
135
136 RealSpans getBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
137 CategorySpans getCategoryBatches(std::size_t first = 0, std::size_t len = std::numeric_limits<std::size_t>::max()) const;
138
139 ////////////////////////////////////////////////////////////////////////////////
140 /// Return event weights of all events in range [first, first+len).
141 /// If no contiguous structure of weights is stored, an empty batch can be returned.
142 /// This indicates that the weight is constant. Use weight() to retrieve it.
143 virtual std::span<const double> getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const = 0;
144
145 /// Return number of entries in dataset, i.e., count unweighted entries.
146 virtual Int_t numEntries() const ;
147 /// Return effective number of entries in dataset, i.e., sum all weights.
148 virtual double sumEntries() const = 0 ;
149 /// Return effective number of entries in dataset inside range or after cuts, i.e., sum certain weights.
150 /// \param[in] cutSpec Apply given cut when counting (e.g. `0 < x && x < 5`). Passing `"1"` selects all events.
151 /// \param[in] cutRange If the observables have a range with this name, only count events inside this range.
152 virtual double sumEntries(const char* cutSpec, const char* cutRange=nullptr) const = 0 ; // DERIVED
153 double sumEntriesW2() const;
154 virtual bool isWeighted() const {
155 // Do events in dataset have weights?
156 return false ;
157 }
158 virtual bool isNonPoissonWeighted() const {
159 // Do events in dataset have non-integer weights?
160 return false ;
161 }
162 virtual void reset() ;
163
164
165 bool getRange(const RooAbsRealLValue& var, double& lowest, double& highest, double marginFrac=0.0, bool symMode=false) const ;
166
167 // Plot the distribution of a real valued arg
168 virtual Roo1DTable* table(const RooArgSet& catSet, const char* cuts="", const char* opts="") const ;
169 virtual Roo1DTable* table(const RooAbsCategory& cat, const char* cuts="", const char* opts="") const ;
170 /// \see RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const
171 virtual RooPlot* plotOn(RooPlot* frame,
172 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
173 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
174 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
175 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) const ;
176
177 virtual RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;
178
179 // WVE --- This needs to be public to avoid CINT problems
180 struct PlotOpt {
181 const char* cuts = "";
183 RooAbsBinning* bins = nullptr;
185 const char* cutRange = nullptr;
186 const char* histName = nullptr;
187 bool histInvisible = false;
188 const char* addToHistName = nullptr;
189 double addToWgtSelf = 1.0;
190 double addToWgtOther = 1.0;
191 double xErrorSize = 1.0;
192 bool refreshFrameNorm = false;
194 double scaleFactor = 1.0;
195 } ;
196
197 // Split a dataset by a category
198 virtual RooFit::OwningPtr<TList> split(const RooAbsCategory& splitCat, bool createEmptyDataSets=false) const ;
199
200 // Split a dataset by categories of a RooSimultaneous
201 virtual RooFit::OwningPtr<TList> split(const RooSimultaneous& simpdf, bool createEmptyDataSets=false) const ;
202
203 // Fast splitting for SimMaster setData
204 bool canSplitFast() const ;
205 RooAbsData* getSimData(const char* idxstate) ;
206
207 /// Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const
208 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar,
209 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
210 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
211 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
212 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) const ;
213 TH1 *createHistogram(const char* varNameList,
214 const RooCmdArg& binArgX={}, const RooCmdArg& binArgY={},
215 const RooCmdArg& binArgZ={}) const;
216 /// Create and fill a ROOT histogram TH1,TH2 or TH3 with the values of this dataset.
217 TH1 *createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) const ;
218 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, const char* cuts="",
219 const char *name= "hist") const;
220 TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, int nx, int ny,
221 const char* cuts="", const char *name="hist") const;
222
223 // Fill an existing histogram
224 virtual TH1 *fillHistogram(TH1 *hist, const RooArgList &plotVars, const char *cuts= "", const char* cutRange=nullptr) const;
225
226 // Printing interface (human readable)
227 inline void Print(Option_t *options= nullptr) const override {
228 // Print contents on stdout
230 }
231
232 void printName(std::ostream& os) const override ;
233 void printTitle(std::ostream& os) const override ;
234 void printClassName(std::ostream& os) const override ;
235 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
236
237 Int_t defaultPrintContents(Option_t* opt) const override ;
238
239 void setDirtyProp(bool flag) ;
240
241 double moment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
242 double moment(const RooRealVar& var, double order, double offset, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
243 double standMoment(const RooRealVar& var, double order, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
244
245 double mean(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return moment(var,1,0,cutSpec,cutRange) ; }
246 double sigma(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return sqrt(moment(var,2,cutSpec,cutRange)) ; }
247 double skewness(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,3,cutSpec,cutRange) ; }
248 double kurtosis(const RooRealVar& var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return standMoment(var,4,cutSpec,cutRange) ; }
249
250 double covariance(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,false) ; }
251 double correlation(RooRealVar &x,RooRealVar &y, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcov(x,y,cutSpec,cutRange,true) ; }
252
253 RooFit::OwningPtr<TMatrixDSym> covarianceMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return covarianceMatrix(*get(),cutSpec,cutRange) ; }
254 RooFit::OwningPtr<TMatrixDSym> correlationMatrix(const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return correlationMatrix(*get(),cutSpec,cutRange) ; }
255 RooFit::OwningPtr<TMatrixDSym> covarianceMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,false) ; }
256 RooFit::OwningPtr<TMatrixDSym> correlationMatrix(const RooArgList& vars, const char* cutSpec=nullptr, const char* cutRange=nullptr) const { return corrcovMatrix(vars,cutSpec,cutRange,true) ; }
257
258 RooRealVar* meanVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
259 RooRealVar* rmsVar(const RooRealVar &var, const char* cutSpec=nullptr, const char* cutRange=nullptr) const ;
260
261 virtual RooPlot* statOn(RooPlot* frame,
262 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
263 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
264 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
265 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
266
267 virtual RooPlot* statOn(RooPlot* frame, const char *what,
268 const char *label= "", Int_t sigDigits= 2,
269 Option_t *options= "NELU", double xmin=0.15,
270 double xmax= 0.65,double ymax=0.85,
271 const char* cutSpec=nullptr, const char* cutRange=nullptr,
272 const RooCmdArg* formatCmd=nullptr);
273
274 void RecursiveRemove(TObject *obj) override;
275
276 bool hasFilledCache() const ;
277
278 void addOwnedComponent(const char* idxlabel, RooAbsData& data) ;
279
281
282 static void setDefaultStorageType(StorageType s) ;
283
285
286 /// Returns snapshot of global observables stored in this data.
287 /// \return Pointer to a RooArgSet with the snapshot of global observables
288 /// stored in the data. Can be `nullptr` if no global observables are
289 /// stored.
291 void setGlobalObservables(RooArgSet const& globalObservables);
292
293 /// De-duplicated pointer to this object's name.
294 /// This can be used for fast name comparisons.
295 /// like `if (namePtr() == other.namePtr())`.
296 /// \note TNamed::GetName() will return a pointer that's
297 /// different for each object, but namePtr() always points
298 /// to a unique instance.
299 inline const TNamed* namePtr() const {
300 return _namePtr ;
301 }
302
303 void SetName(const char* name) override ;
304 void SetNameTitle(const char *name, const char *title) override ;
305
306 /// Returns a unique ID that is different for every instantiated RooAbsData object.
307 /// This ID can be used whether two RooAbsData are the same object, which is safer
308 /// than memory address comparisons that might result in false positives when
309 /// memory is reused.
311
312protected:
313
315
317
318 void initializeVars(RooArgSet const& vars);
319
320 double corrcov(const RooRealVar& x, const RooRealVar& y, const char* cutSpec, const char* cutRange, bool corr) const ;
321 RooFit::OwningPtr<TMatrixDSym> corrcovMatrix(const RooArgList& vars, const char* cutSpec, const char* cutRange, bool corr) const ;
322
323 virtual void optimizeReadingWithCaching(RooAbsArg& arg, const RooArgSet& cacheList, const RooArgSet& keepObsList) ;
324 bool allClientsCached(RooAbsArg*, const RooArgSet&) ;
325
326
327 // PlotOn implementation
328 virtual RooPlot *plotOn(RooPlot *frame, PlotOpt o) const ;
329 virtual RooPlot *plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, PlotOpt o) const ;
330 virtual RooPlot *plotEffOn(RooPlot* frame, const RooAbsCategoryLValue& effCat, PlotOpt o) const ;
331
332
333 // Constant term optimizer interface
336 // for access into copied dataset:
338
339 virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=nullptr, bool skipZeroWeights=false) ;
340 virtual void resetCache() ;
341 virtual void setArgStatus(const RooArgSet& set, bool active) ;
342 virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) ;
343
344 virtual std::unique_ptr<RooAbsData> reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=nullptr,
345 std::size_t nStart = 0, std::size_t = std::numeric_limits<std::size_t>::max()) const = 0 ;
346
347 RooRealVar* dataRealVar(const char* methodname, const RooRealVar& extVar) const ;
348
349 // Column structure definition
350 RooArgSet _vars; ///< Dimensions of this data set
351 RooArgSet _cachedVars ; ///<! External variables cached with this data set
352
353 std::unique_ptr<RooAbsDataStore> _dstore; ///< Data storage implementation
354
355 std::map<std::string,RooAbsData*> _ownedComponents ; ///< Owned external components
356
357 std::unique_ptr<RooArgSet> _globalObservables; ///< Snapshot of global observables
358
359 mutable const TNamed * _namePtr = nullptr; ///<! De-duplicated name pointer. This will be equal for all objects with the same name.
360
361private:
362 void copyImpl(const RooAbsData& other, const char* newname);
363
364 void copyGlobalObservables(const RooAbsData& other);
365
367
368 ClassDefOverride(RooAbsData, 7) // Abstract data collection
369};
370
371#endif
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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
#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:256
double skewness(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:247
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:133
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:359
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:253
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:310
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 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:114
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:245
double correlation(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:251
RooFit::OwningPtr< TMatrixDSym > correlationMatrix(const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:254
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.
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'.
static StorageType defaultStorageType
Definition RooAbsData.h:314
std::map< RooFit::Detail::DataKey, std::span< const RooAbsCategory::value_type > > CategorySpans
Definition RooAbsData.h:134
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).
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()) const =0
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={}) const
Create a reduced copy of this dataset.
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:353
double sigma(const RooRealVar &var, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:246
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:255
virtual void fill()
RooArgSet _vars
Dimensions of this data set.
Definition RooAbsData.h:350
bool canSplitFast() const
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:227
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
RooAbsData * getSimData(const char *idxstate)
void copyGlobalObservables(const RooAbsData &other)
virtual bool isNonPoissonWeighted() const
Definition RooAbsData.h:158
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:299
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:351
const RooFit::UniqueId< RooAbsData > _uniqueId
!
Definition RooAbsData.h:366
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:316
RooArgSet const * getGlobalObservables() const
Returns snapshot of global observables stored in this data.
Definition RooAbsData.h:290
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.
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:357
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:355
double covariance(RooRealVar &x, RooRealVar &y, const char *cutSpec=nullptr, const char *cutRange=nullptr) const
Definition RooAbsData.h:250
static StorageType getDefaultStorageType()
virtual bool isWeighted() const
Definition RooAbsData.h:154
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:248
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.
static ErrorType errorTypeFromString(std::string const &name)
Convert a string to the value of the RooAbsData::ErrorType enum with the same name.
const TTree * tree() const
Return a pointer to the TTree which stores the data.
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 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:124
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:24
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:59
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:308
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 CodegenImpl.h:64
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:5
const char * cuts
Definition RooAbsData.h:181
const char * cutRange
Definition RooAbsData.h:185
const char * histName
Definition RooAbsData.h:186
const char * addToHistName
Definition RooAbsData.h:188
RooAbsData::ErrorType etype
Definition RooAbsData.h:184
RooAbsBinning * bins
Definition RooAbsData.h:183
Option_t * drawOptions
Definition RooAbsData.h:182
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()