RooAbsDataStore.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooAbsDataStore.h 31258 2009-11-17 22:41:06Z wouter $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 #ifndef ROO_ABS_DATA_STORE
00017 #define ROO_ABS_DATA_STORE
00018 
00019 #include "Rtypes.h"
00020 #include "RooArgSet.h" 
00021 #include "RooAbsData.h"
00022 #include "TNamed.h"
00023 #include <list>
00024 
00025 
00026 class RooAbsArg ;
00027 class RooArgList ;
00028 class TIterator ;
00029 class TTree ;
00030 
00031 class RooAbsDataStore : public TNamed, public RooPrintable {
00032 public:
00033 
00034   RooAbsDataStore() ; 
00035   RooAbsDataStore(const char* name, const char* title, const RooArgSet& vars) ; 
00036   RooAbsDataStore(const RooAbsDataStore& other, const char* newname=0) ; 
00037   RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname=0) ; 
00038   virtual RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=0) const = 0 ;
00039   virtual ~RooAbsDataStore() ;
00040 
00041   // Write current row
00042   virtual Int_t fill() = 0 ;
00043   
00044   // Retrieve a row
00045   virtual const RooArgSet* get(Int_t index) const = 0 ;
00046   virtual const RooArgSet* get() const { return &_vars ; } 
00047   virtual Double_t weight() const = 0 ;
00048 
00049   virtual Double_t weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const = 0 ;
00050   virtual void weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const = 0 ; 
00051 
00052   virtual Double_t weight(Int_t index) const = 0 ;
00053 
00054   virtual Bool_t isWeighted() const = 0 ;
00055 
00056   // Change observable name
00057   virtual Bool_t changeObservableName(const char* from, const char* to) =0 ;
00058   
00059   // Add one or more columns
00060   virtual RooAbsArg* addColumn(RooAbsArg& var, Bool_t adjustRange=kTRUE) = 0 ;
00061   virtual RooArgSet* addColumns(const RooArgList& varList) = 0 ;
00062 
00063   // Merge column-wise
00064   virtual RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) = 0 ;
00065 
00066   // Add rows 
00067   virtual void append(RooAbsDataStore& other)= 0 ;
00068 
00069   // General & bookkeeping methods
00070   virtual Bool_t valid() const = 0 ;
00071   virtual Int_t numEntries() const = 0 ;
00072   virtual void reset() = 0 ;
00073 
00074 
00075   // Printing interface (human readable)
00076   inline virtual void Print(Option_t *options= 0) const {
00077     // Print contents on stdout
00078     printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00079   }
00080 
00081   virtual void printName(ostream& os) const ;
00082   virtual void printTitle(ostream& os) const ;
00083   virtual void printClassName(ostream& os) const ;
00084   virtual void printArgs(ostream& os) const ;
00085   virtual void printValue(ostream& os) const ;
00086   void printMultiline(ostream& os, Int_t content, Bool_t verbose, TString indent) const ;
00087 
00088   virtual Int_t defaultPrintContents(Option_t* opt) const ;
00089    
00090 
00091   // Constant term  optimizer interface
00092   virtual void cacheArgs(const RooAbsArg* cacheOwner, RooArgSet& varSet, const RooArgSet* nset=0) = 0 ;
00093   virtual const RooAbsArg* cacheOwner() = 0 ;
00094   virtual void attachCache(const RooAbsArg* newOwner, const RooArgSet& cachedVars) = 0 ;
00095   virtual void setArgStatus(const RooArgSet& set, Bool_t active) = 0 ;
00096   const RooArgSet& cachedVars() const { return _cachedVars ; }
00097   virtual void resetCache() = 0 ;
00098 
00099   virtual void setDirtyProp(Bool_t flag) { _doDirtyProp = flag ; }
00100 
00101   virtual void checkInit() const {} ;
00102   
00103   Bool_t hasFilledCache() const { return _cachedVars.getSize()>0 ; }
00104 
00105   virtual const TTree* tree() const { return 0 ; }
00106 
00107  protected:
00108 
00109   RooArgSet _vars ;
00110   RooArgSet _cachedVars ;
00111   TIterator *_iterator;    //! Iterator over dimension variables
00112   TIterator *_cacheIter ;  //! Iterator over cached variables
00113 
00114   Bool_t _doDirtyProp ;    // Switch do (de)activate dirty state propagation when loading a data point
00115 
00116   ClassDef(RooAbsDataStore,1) // Abstract Data Storage class
00117 };
00118 
00119 
00120 #endif

Generated on Tue Jul 5 14:25:59 2011 for ROOT_528-00b_version by  doxygen 1.5.1