RooErrorVar.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooErrorVar.h,v 1.16 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_ERROR_VAR
00017 #define ROO_ERROR_VAR
00018 
00019 #include "Riosfwd.h"
00020 #include <math.h>
00021 #include <float.h>
00022 
00023 #include "RooNumber.h"
00024 #include "RooAbsReal.h"
00025 #include "RooRealVar.h"
00026 #include "RooRealProxy.h"
00027 
00028 class RooErrorVar : public RooAbsRealLValue {
00029 public:
00030   // Constructors, assignment etc.
00031   inline RooErrorVar() { 
00032     // Default constructor
00033   }
00034   RooErrorVar(const char *name, const char *title, const RooRealVar& input) ;
00035   RooErrorVar(const RooErrorVar& other, const char* name=0);
00036   virtual TObject* clone(const char* newname) const { return new RooErrorVar(*this,newname); }
00037   virtual ~RooErrorVar() ;
00038 
00039   virtual Double_t getVal(const RooArgSet* set=0) const ; 
00040 
00041   virtual Double_t evaluate() const { 
00042     // return error of input RooRealVar
00043     return ((RooRealVar&)_realVar.arg()).getError() ; 
00044   } 
00045 
00046   virtual void setVal(Double_t value) {
00047     // Set error of input RooRealVar to value
00048     ((RooRealVar&)_realVar.arg()).setVal(value) ; 
00049   }
00050 
00051   inline virtual Bool_t isFundamental() const { 
00052     // Return kTRUE as we implement a fundamental type of AbsArg that can be stored in a dataset    
00053     return kTRUE ; 
00054   }
00055 
00056   // I/O streaming interface (machine readable)
00057   virtual Bool_t readFromStream(istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
00058   virtual void writeToStream(ostream& os, Bool_t compact) const ;
00059 
00060   // Set/get finite fit range limits
00061   inline void setMin(Double_t value) { 
00062     // Set lower bound of default range to value
00063     setMin(0,value) ; 
00064   }
00065   inline void setMax(Double_t value) { 
00066     // Set upper bound of default range to value
00067     setMax(0,value) ; 
00068   }
00069   inline void setRange(Double_t min, Double_t max) { 
00070     // Set default ranges to [min,max]
00071     setRange(0,min,max) ; 
00072   }
00073   void setMin(const char* name, Double_t value) ;
00074   void setMax(const char* name, Double_t value) ;
00075   void setRange(const char* name, Double_t min, Double_t max) ;
00076 
00077   void setBins(Int_t nBins) { 
00078     // Set default binning to nBins uniform bins
00079     setBinning(RooUniformBinning(getMin(),getMax(),nBins)) ; 
00080   }
00081   void setBinning(const RooAbsBinning& binning, const char* name=0) ;
00082   const RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const ;
00083   RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) ;
00084   Bool_t hasBinning(const char* name) const ;
00085 
00086   // Set infinite fit range limits
00087   inline void removeMin(const char* name=0) { 
00088     // Remove lower bound from named binning, or default binning if name is null
00089     getBinning(name).setMin(-RooNumber::infinity()) ; 
00090   }
00091   inline void removeMax(const char* name=0) { 
00092     // Remove upper bound from named binning, or default binning if name is null
00093     getBinning(name).setMax(RooNumber::infinity()) ; 
00094   }
00095   inline void removeRange(const char* name=0) { 
00096     // Remove both upper and lower bounds from named binning, or
00097     // default binning if name is null
00098     getBinning(name).setRange(-RooNumber::infinity(),RooNumber::infinity()) ; 
00099   }
00100 
00101   using RooAbsRealLValue::operator= ;
00102   using RooAbsRealLValue::setVal ;
00103 
00104 protected:
00105 
00106   RooLinkedList _altBinning ;  //! Optional alternative ranges and binnings
00107 
00108   void syncCache(const RooArgSet* set=0) ;
00109 
00110   RooRealProxy _realVar ; // RealVar with the original error
00111   RooAbsBinning* _binning ; //! Pointer to default binning definition
00112 
00113   ClassDef(RooErrorVar,1) // RooAbsRealLValue representation of an error of a RooRealVar
00114 };
00115 
00116 #endif

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