Logo ROOT  
Reference Guide
RooAbsDataStore.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id$
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_STORE
17 #define ROO_ABS_DATA_STORE
18 
19 #include "Rtypes.h"
20 #include "RooArgSet.h"
21 #include "RooAbsData.h"
22 #include "TNamed.h"
23 #include <list>
24 #include <vector>
25 
26 class RooAbsArg ;
27 class RooArgList ;
28 class TIterator ;
29 class TTree ;
30 namespace BatchHelpers {
31 struct RunContext;
32 }
33 
34 class RooAbsDataStore : public TNamed, public RooPrintable {
35 public:
36 
37  RooAbsDataStore() ;
38  RooAbsDataStore(const char* name, const char* title, const RooArgSet& vars) ;
39  RooAbsDataStore(const RooAbsDataStore& other, const char* newname=0) ;
40  RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname=0) ;
41  virtual RooAbsDataStore* clone(const char* newname=0) const = 0 ;
42  virtual RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=0) const = 0 ;
43  virtual ~RooAbsDataStore() ;
44 
45  // Write current row
46  virtual Int_t fill() = 0 ;
47 
48  // Retrieve a row
49  virtual const RooArgSet* get(Int_t index) const = 0 ;
50  virtual const RooArgSet* get() const { return &_vars ; }
51  virtual Double_t weight() const = 0 ;
52 
54  virtual void weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const = 0 ;
55 
56  virtual Double_t weight(Int_t index) const = 0 ;
57  virtual Bool_t isWeighted() const = 0 ;
58 
59  /// Retrieve batches for all observables in this data store.
60  virtual BatchHelpers::RunContext getBatches(std::size_t first, std::size_t len) const = 0;
61  virtual RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len) const = 0;
62 
63  // Change observable name
64  virtual Bool_t changeObservableName(const char* from, const char* to) =0 ;
65 
66  // Add one or more columns
67  virtual RooAbsArg* addColumn(RooAbsArg& var, Bool_t adjustRange=kTRUE) = 0 ;
68  virtual RooArgSet* addColumns(const RooArgList& varList) = 0 ;
69 
70  // Merge column-wise
71  virtual RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) = 0 ;
72 
73  // Add rows
74  virtual void append(RooAbsDataStore& other)= 0 ;
75 
76  // General & bookkeeping methods
77  virtual Bool_t valid() const = 0 ;
78  virtual Int_t numEntries() const = 0 ;
79  virtual Double_t sumEntries() const { return 0 ; } ;
80  virtual void reset() = 0 ;
81 
82  // Buffer redirection routines used in inside RooAbsOptTestStatistics
83  virtual void attachBuffers(const RooArgSet& extObs) = 0 ;
84  virtual void resetBuffers() = 0 ;
85 
86  virtual void setExternalWeightArray(const Double_t* /*arrayWgt*/, const Double_t* /*arrayWgtErrLo*/, const Double_t* /*arrayWgtErrHi*/, const Double_t* /*arraySumW2*/) {} ;
87 
88  // Printing interface (human readable)
89  inline virtual void Print(Option_t *options= 0) const {
90  // Print contents on stdout
92  }
93 
94  virtual void printName(std::ostream& os) const ;
95  virtual void printTitle(std::ostream& os) const ;
96  virtual void printClassName(std::ostream& os) const ;
97  virtual void printArgs(std::ostream& os) const ;
98  virtual void printValue(std::ostream& os) const ;
99  void printMultiline(std::ostream& os, Int_t content, Bool_t verbose, TString indent) const ;
100 
101  virtual Int_t defaultPrintContents(Option_t* opt) const ;
102 
103 
104  // Constant term optimizer interface
105  virtual void cacheArgs(const RooAbsArg* cacheOwner, RooArgSet& varSet, const RooArgSet* nset=0, Bool_t skipZeroWeights=kFALSE) = 0 ;
106  virtual const RooAbsArg* cacheOwner() = 0 ;
107  virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) = 0 ;
108  virtual void setArgStatus(const RooArgSet& set, Bool_t active) = 0 ;
109  const RooArgSet& cachedVars() const { return _cachedVars ; }
110  virtual void resetCache() = 0 ;
111  virtual void recalculateCache(const RooArgSet* /*proj*/, Int_t /*firstEvent*/, Int_t /*lastEvent*/, Int_t /*stepSize*/, Bool_t /* skipZeroWeights*/) {} ;
112 
113  virtual void setDirtyProp(Bool_t flag) { _doDirtyProp = flag ; }
114  Bool_t dirtyProp() const { return _doDirtyProp ; }
115 
116  virtual void checkInit() const {} ;
117 
118  virtual Bool_t hasFilledCache() const { return kFALSE ; }
119 
120  virtual const TTree* tree() const { return 0 ; }
121  virtual void dump() {}
122 
123  virtual void loadValues(const RooAbsDataStore *tds, const RooFormulaVar* select=0, const char* rangeName=0,
124  std::size_t nStart=0, std::size_t nStop = std::numeric_limits<std::size_t>::max()) = 0 ;
125 
126  virtual void forceCacheUpdate() {} ;
127 
128  protected:
129 
132 
133  Bool_t _doDirtyProp ; // Switch do (de)activate dirty state propagation when loading a data point
134 
135  ClassDef(RooAbsDataStore,1) // Abstract Data Storage class
136 };
137 
138 
139 #endif
RooAbsDataStore::weightError
virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const =0
first
Definition: first.py:1
RooAbsDataStore::cachedVars
const RooArgSet & cachedVars() const
Definition: RooAbsDataStore.h:109
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsDataStore::isWeighted
virtual Bool_t isWeighted() const =0
RooAbsDataStore::get
virtual const RooArgSet * get() const
Definition: RooAbsDataStore.h:50
RooAbsDataStore::printClassName
virtual void printClassName(std::ostream &os) const
Print class name of dataset.
Definition: RooAbsDataStore.cxx:135
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooArgSet.h
RooAbsDataStore::getBatches
virtual BatchHelpers::RunContext getBatches(std::size_t first, std::size_t len) const =0
Retrieve batches for all observables in this data store.
TNamed.h
RooAbsDataStore::attachCache
virtual void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars)=0
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
RooAbsDataStore::resetCache
virtual void resetCache()=0
RooAbsDataStore::clone
virtual RooAbsDataStore * clone(const char *newname=0) const =0
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsDataStore::RooAbsDataStore
RooAbsDataStore()
Default constructor.
Definition: RooAbsDataStore.cxx:43
TString
Basic string class.
Definition: TString.h:136
RooAbsDataStore::_cachedVars
RooArgSet _cachedVars
Definition: RooAbsDataStore.h:131
RooPrintable
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
RooAbsDataStore::tree
virtual const TTree * tree() const
Definition: RooAbsDataStore.h:120
RooAbsData::ErrorType
ErrorType
Definition: RooAbsData.h:97
RooAbsDataStore::printTitle
virtual void printTitle(std::ostream &os) const
Print title of dataset.
Definition: RooAbsDataStore.cxx:125
bool
TIterator
Iterator abstract base class.
Definition: TIterator.h:30
BatchHelpers::RunContext
Data that has to be passed around when evaluating functions / PDFs.
Definition: RunContext.h:32
RooAbsDataStore::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
Definition: RooAbsDataStore.cxx:178
RooAbsDataStore::resetBuffers
virtual void resetBuffers()=0
hi
float type_of_call hi(const int &, const int &)
RooAbsDataStore::printValue
virtual void printValue(std::ostream &os) const
Print value of the dataset, i.e. the sum of weights contained in the dataset.
Definition: RooAbsDataStore.cxx:145
BatchHelpers
Definition: RooFitComputeInterface.h:9
RooFormulaVar
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
RooAbsDataStore::dirtyProp
Bool_t dirtyProp() const
Definition: RooAbsDataStore.h:114
RooAbsDataStore::sumEntries
virtual Double_t sumEntries() const
Definition: RooAbsDataStore.h:79
RooAbsDataStore::clone
virtual RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=0) const =0
RooPrintable::defaultPrintStream
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
Definition: RooPrintable.cxx:272
RooAbsDataStore::recalculateCache
virtual void recalculateCache(const RooArgSet *, Int_t, Int_t, Int_t, Bool_t)
Definition: RooAbsDataStore.h:111
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooAbsDataStore::_vars
RooArgSet _vars
Definition: RooAbsDataStore.h:126
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooAbsDataStore::Print
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsDataStore.h:89
RooAbsDataStore::changeObservableName
virtual Bool_t changeObservableName(const char *from, const char *to)=0
RooAbsDataStore::setExternalWeightArray
virtual void setExternalWeightArray(const Double_t *, const Double_t *, const Double_t *, const Double_t *)
Definition: RooAbsDataStore.h:86
RooAbsDataStore::addColumns
virtual RooArgSet * addColumns(const RooArgList &varList)=0
RooAbsDataStore::~RooAbsDataStore
virtual ~RooAbsDataStore()
Destructor.
Definition: RooAbsDataStore.cxx:95
RooAbsDataStore::loadValues
virtual void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=0, const char *rangeName=0, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max())=0
RooAbsDataStore::forceCacheUpdate
virtual void forceCacheUpdate()
Definition: RooAbsDataStore.h:126
RooAbsDataStore::addColumn
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)=0
RooAbsDataStore::merge
virtual RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore * > dstoreList)=0
RooAbsDataStore::printName
virtual void printName(std::ostream &os) const
Print name of dataset.
Definition: RooAbsDataStore.cxx:115
RooAbsData::Poisson
@ Poisson
Definition: RooAbsData.h:97
RooAbsDataStore::weight
virtual Double_t weight() const =0
RooAbsDataStore::printArgs
virtual void printArgs(std::ostream &os) const
Print argument of dataset, i.e. the observable names.
Definition: RooAbsDataStore.cxx:155
RooAbsDataStore::weightError
virtual void weightError(Double_t &lo, Double_t &hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const =0
RooAbsDataStore::numEntries
virtual Int_t numEntries() const =0
RooAbsDataStore::_doDirtyProp
Bool_t _doDirtyProp
Definition: RooAbsDataStore.h:133
RooAbsDataStore::checkInit
virtual void checkInit() const
Definition: RooAbsDataStore.h:116
RooAbsDataStore::valid
virtual Bool_t valid() const =0
Return true if currently loaded coordinate is considered valid within the current range definitions o...
Definition: RooAbsDataStore.cxx:106
RooAbsData.h
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsDataStore::hasFilledCache
virtual Bool_t hasFilledCache() const
Definition: RooAbsDataStore.h:118
RooAbsDataStore::append
virtual void append(RooAbsDataStore &other)=0
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooAbsDataStore::printMultiline
void printMultiline(std::ostream &os, Int_t content, Bool_t verbose, TString indent) const
Detailed printing interface.
Definition: RooAbsDataStore.cxx:190
RooAbsDataStore::setDirtyProp
virtual void setDirtyProp(Bool_t flag)
Definition: RooAbsDataStore.h:113
RooAbsDataStore::reset
virtual void reset()=0
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsDataStore::cacheArgs
virtual void cacheArgs(const RooAbsArg *cacheOwner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kFALSE)=0
RooAbsDataStore
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
Definition: RooAbsDataStore.h:34
RooAbsDataStore::fill
virtual Int_t fill()=0
RooPrintable::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Definition: RooPrintable.cxx:241
RooAbsDataStore::dump
virtual void dump()
Definition: RooAbsDataStore.h:121
RooAbsDataStore::setArgStatus
virtual void setArgStatus(const RooArgSet &set, Bool_t active)=0
RooAbsDataStore::weight
virtual Double_t weight(Int_t index) const =0
Rtypes.h
RooAbsDataStore::cacheOwner
virtual const RooAbsArg * cacheOwner()=0
RooSpan
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int
RooAbsDataStore::attachBuffers
virtual void attachBuffers(const RooArgSet &extObs)=0
RooAbsDataStore::getWeightBatch
virtual RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len) const =0