RooDataSet.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooDataSet.h,v 1.59 2007/05/11 09:11:30 verkerke Exp $
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_DATA_SET
00017 #define ROO_DATA_SET
00018 
00019 class TDirectory ;
00020 class RooAbsRealLValue ;
00021 class RooRealVar ;
00022 class RooDataHist ;
00023 #include "RooAbsData.h"
00024 #include "RooDirItem.h"
00025 
00026 
00027 class RooDataSet : public RooAbsData, public RooDirItem {
00028 public:
00029 
00030   // Constructors, factory methods etc.
00031   RooDataSet() ; 
00032 
00033   // Empty constructor 
00034   RooDataSet(const char *name, const char *title, const RooArgSet& vars, const char* wgtVarName=0) ;
00035 
00036   // Universal constructor
00037   RooDataSet(const char* name, const char* title, const RooArgSet& vars, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg(), 
00038              const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),const RooCmdArg& arg5=RooCmdArg(),
00039              const RooCmdArg& arg6=RooCmdArg(),const RooCmdArg& arg7=RooCmdArg(),const RooCmdArg& arg8=RooCmdArg()) ; 
00040 
00041     // Constructor for subset of existing dataset
00042   RooDataSet(const char *name, const char *title, RooDataSet *data, const RooArgSet& vars, 
00043              const char *cuts=0, const char* wgtVarName=0);
00044   RooDataSet(const char *name, const char *title, RooDataSet *data, const RooArgSet& vars,  
00045              const RooFormulaVar& cutVar, const char* wgtVarName=0) ;  
00046 
00047 
00048   // Constructor importing data from external ROOT Tree
00049   RooDataSet(const char *name, const char *title, TTree *ntuple, const RooArgSet& vars, 
00050              const char *cuts=0, const char* wgtVarName=0); 
00051   RooDataSet(const char *name, const char *title, TTree *t, const RooArgSet& vars, 
00052              const RooFormulaVar& cutVar, const char* wgtVarName=0) ;  
00053   
00054 
00055   RooDataSet(RooDataSet const & other, const char* newname=0) ;
00056   virtual TObject* Clone(const char* newname=0) const { return new RooDataSet(*this,newname?newname:GetName()) ; }
00057   virtual ~RooDataSet() ;
00058 
00059   virtual RooAbsData* emptyClone(const char* newName=0, const char* newTitle=0, const RooArgSet* vars=0) const ;
00060 
00061   RooDataHist* binnedClone(const char* newName=0, const char* newTitle=0) const ;
00062 
00063   virtual Double_t sumEntries(const char* cutSpec=0, const char* cutRange=0) const ;
00064 
00065   virtual RooPlot* plotOnXY(RooPlot* frame, 
00066                             const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
00067                             const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
00068                             const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
00069                             const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
00070 
00071 
00072   // Read data from a text file and create a dataset from it.
00073   // The possible options are: (D)ebug, (Q)uiet.
00074   static RooDataSet *read(const char *filename, const RooArgList &variables,
00075                           const char *opts= "", const char* commonPath="",
00076                           const char *indexCatName=0) ;
00077   Bool_t write(const char* filename) ;
00078 
00079 /*   void setWeightVar(const char* name=0) ; */
00080 /*   void setWeightVar(const RooAbsArg& arg) {  */
00081 /*     // Interpret given argument as event weight */
00082 /*     setWeightVar(arg.GetName()) ;  */
00083 /*   } */
00084   virtual Bool_t isWeighted() const ;
00085   virtual Bool_t isNonPoissonWeighted() const ;
00086 
00087   virtual Double_t weight() const ; 
00088   virtual void weightError(Double_t& lo, Double_t& hi,ErrorType etype=SumW2) const ;
00089   Double_t weightError(ErrorType etype=SumW2) const ;
00090 
00091   virtual const RooArgSet* get(Int_t index) const;
00092   virtual const RooArgSet* get() const ; 
00093 
00094   // Add one ore more rows of data
00095   virtual void add(const RooArgSet& row, Double_t weight=1.0, Double_t weightError=0);
00096   virtual void add(const RooArgSet& row, Double_t weight, Double_t weightErrorLo, Double_t weightErrorHi);
00097 
00098   virtual void addFast(const RooArgSet& row, Double_t weight=1.0, Double_t weightError=0);
00099 
00100   void append(RooDataSet& data) ;
00101   Bool_t merge(RooDataSet* data1, RooDataSet* data2=0, RooDataSet* data3=0,  
00102                RooDataSet* data4=0, RooDataSet* data5=0, RooDataSet* data6=0) ; 
00103   Bool_t merge(std::list<RooDataSet*> dsetList) ;
00104 
00105   virtual RooAbsArg* addColumn(RooAbsArg& var, Bool_t adjustRange=kTRUE) ;
00106   virtual RooArgSet* addColumns(const RooArgList& varList) ;
00107 
00108   // Plot the distribution of a real valued arg
00109   using RooAbsData::createHistogram ;
00110   TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, const char* cuts="", 
00111                         const char *name= "hist") const;         
00112   TH2F* createHistogram(const RooAbsRealLValue& var1, const RooAbsRealLValue& var2, Int_t nx, Int_t ny,
00113                         const char* cuts="", const char *name="hist") const;
00114 
00115   void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
00116   virtual void printArgs(ostream& os) const ;
00117   virtual void printValue(ostream& os) const ;
00118 
00119   void SetName(const char *name) ;
00120   void SetNameTitle(const char *name, const char* title) ;
00121 
00122 protected:
00123 
00124   virtual RooAbsData* cacheClone(const RooAbsArg* newCacheOwner, const RooArgSet* newCacheVars, const char* newName=0) ;
00125 
00126   friend class RooProdGenContext ;
00127 
00128   void initialize(const char* wgtVarName) ;
00129   
00130   // Cache copy feature is not publicly accessible
00131   RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=0, 
00132                         Int_t nStart=0, Int_t nStop=2000000000, Bool_t copyCache=kTRUE) ;
00133   RooDataSet(const char *name, const char *title, RooDataSet *ntuple, 
00134              const RooArgSet& vars, const RooFormulaVar* cutVar, const char* cutRange, int nStart, int nStop, Bool_t copyCache, const char* wgtVarName=0);
00135   
00136   RooArgSet addWgtVar(const RooArgSet& origVars, const RooAbsArg* wgtVar) ; 
00137   
00138   RooArgSet _varsNoWgt ;   // Vars without weight variable 
00139   RooRealVar* _wgtVar ;    // Pointer to weight variable (if set) 
00140 
00141   ClassDef(RooDataSet,2) // Unbinned data set
00142 };
00143 
00144 #endif

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