Logo ROOT   6.10/09
Reference Guide
RooCompositeDataStore.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_COMPOSITE_DATA_STORE
17 #define ROO_COMPOSITE_DATA_STORE
18 
19 #include "RooAbsDataStore.h"
20 #include "TString.h"
21 #include <map>
22 #include <string>
23 
24 class RooAbsArg ;
25 class RooArgList ;
26 class RooFormulaVar ;
27 class RooArgSet ;
28 class RooCategory ;
29 
30 
32 public:
33 
35 
36  // Ctors from DataStore
37  RooCompositeDataStore(const char* name, const char* title, const RooArgSet& vars, RooCategory& indexCat, std::map<std::string,RooAbsDataStore*> inputData) ;
38 
39  // Empty ctor
40  virtual RooAbsDataStore* clone(const char* newname=0) const { return new RooCompositeDataStore(*this,newname) ; }
41  virtual RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=0) const { return new RooCompositeDataStore(*this,vars,newname) ; }
42 
43  RooCompositeDataStore(const RooCompositeDataStore& other, const char* newname=0) ;
44  RooCompositeDataStore(const RooCompositeDataStore& other, const RooArgSet& vars, const char* newname=0) ;
45  virtual ~RooCompositeDataStore() ;
46 
47  virtual void dump() ;
48 
49  // Write current row
50  virtual Int_t fill() ;
51 
52  virtual Double_t sumEntries() const ;
53 
54  // Retrieve a row
55  using RooAbsDataStore::get ;
56  virtual const RooArgSet* get(Int_t index) const ;
57  virtual Double_t weight() const ;
58  virtual Double_t weight(Int_t index) const ;
60  virtual void weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const ;
61  virtual Bool_t isWeighted() const ;
62 
63  // Change observable name
64  virtual Bool_t changeObservableName(const char* from, const char* to) ;
65 
66  // Add one or more columns
67  virtual RooAbsArg* addColumn(RooAbsArg& var, Bool_t adjustRange=kTRUE) ;
68  virtual RooArgSet* addColumns(const RooArgList& varList) ;
69 
70  // Merge column-wise
71  RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) ;
72 
73  RooCategory* index() { return _indexCat ; }
74 
75  // Add rows
76  virtual void append(RooAbsDataStore& other) ;
77 
78  // General & bookkeeping methods
79  virtual Bool_t valid() const ;
80  virtual Int_t numEntries() const ;
81  virtual void reset() ;
82 
83  // Buffer redirection routines used in inside RooAbsOptTestStatistics
84  virtual void attachBuffers(const RooArgSet& extObs) ;
85  virtual void resetBuffers() ;
86 
87  // Constant term optimizer interface
88  virtual void cacheArgs(const RooAbsArg* owner, RooArgSet& varSet, const RooArgSet* nset=0, Bool_t skipZeroWeights=kFALSE) ;
89  virtual const RooAbsArg* cacheOwner() { return 0 ; }
90  virtual void setArgStatus(const RooArgSet& set, Bool_t active) ;
91  virtual void resetCache() ;
92 
93  virtual void recalculateCache(const RooArgSet* /*proj*/, Int_t /*firstEvent*/, Int_t /*lastEvent*/, Int_t /*stepSize*/, Bool_t /*skipZeroWeights*/) ;
94  virtual Bool_t hasFilledCache() const ;
95 
96  void loadValues(const RooAbsDataStore *tds, const RooFormulaVar* select=0, const char* rangeName=0, Int_t nStart=0, Int_t nStop=2000000000) ;
97 
98  virtual void forceCacheUpdate() ;
99 
100  protected:
101 
102  void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) ;
103 
104  std::map<Int_t,RooAbsDataStore*> _dataMap ;
106  mutable RooAbsDataStore* _curStore ; //! Datastore associated with current event
107  mutable Int_t _curIndex ; //! Index associated with current event
109 
110  ClassDef(RooCompositeDataStore,1) // Composite Data Storage class
111 };
112 
113 
114 #endif
virtual const RooArgSet * get() const
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
virtual Int_t numEntries() const
virtual ~RooCompositeDataStore()
Destructor.
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t hasFilledCache() const
const RooArgSet & cachedVars() const
RooAbsDataStore * merge(const RooArgSet &allvars, std::list< RooAbsDataStore *> dstoreList)
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual void attachBuffers(const RooArgSet &extObs)
virtual RooAbsDataStore * clone(const RooArgSet &vars, const char *newname=0) const
std::map< Int_t, RooAbsDataStore * > _dataMap
virtual Int_t fill()
Forward fill request to appropriate subset.
Bool_t _ownComps
Index associated with current event.
RooCompositeDataStore is the abstract base class for data collection that use a TTree as internal sto...
virtual Bool_t changeObservableName(const char *from, const char *to)
Change name of internal observable named &#39;from&#39; into &#39;to&#39;.
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar *select=0, const char *rangeName=0, Int_t nStart=0, Int_t nStop=2000000000)
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
WVE ownership issue here!! Caller (a RooAbsData) should take ownership of all arguments, but only does for the first one here...
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kFALSE)
RooCategory represents a fundamental (non-derived) discrete value object.
Definition: RooCategory.h:24
void attachCache(const RooAbsArg *newOwner, const RooArgSet &cachedVars)
Initialize cache of dataset: attach variables of cache ArgSet to the corresponding TTree branches...
const Bool_t kFALSE
Definition: RtypesCore.h:92
virtual RooArgSet * addColumns(const RooArgList &varList)
WVE ownership issue here!! Caller (a RooAbsData) should take ownership of all arguments, but only does for the first one here...
double Double_t
Definition: RtypesCore.h:55
virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const
virtual Double_t sumEntries() const
Forward fill request to appropriate subset.
Int_t _curIndex
Datastore associated with current event.
virtual Bool_t isWeighted() const
virtual Bool_t valid() const
Return true if currently loaded coordinate is considered valid within the current range definitions o...
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:66
virtual RooAbsDataStore * clone(const char *newname=0) const
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual const RooAbsArg * cacheOwner()
virtual void append(RooAbsDataStore &other)
virtual void recalculateCache(const RooArgSet *, Int_t, Int_t, Int_t, Bool_t)
Forward recalculate request to all subsets.
virtual Double_t weight() const