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