RooCurve.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooCurve.h,v 1.24 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_CURVE
00017 #define ROO_CURVE
00018 
00019 #include "TGraph.h"
00020 #include "RooPlotable.h"
00021 #include <list>
00022 #include <vector>
00023 #include "TMatrixDfwd.h"
00024 
00025 class RooAbsReal;
00026 class RooRealVar;
00027 class RooAbsFunc;
00028 class RooArgSet;
00029 class RooAbsRealLValue ;
00030 class RooHist ;
00031 
00032 class RooCurve : public TGraph, public RooPlotable {
00033 public:
00034   RooCurve();
00035   enum WingMode { NoWings=0 ,Straight=1, Extended=2 } ;
00036   RooCurve(const RooAbsReal &func, RooAbsRealLValue &x, Double_t xlo, Double_t xhi, Int_t xbins,
00037            Double_t scaleFactor= 1, const RooArgSet *normVars= 0, Double_t prec= 1e-3, Double_t resolution= 1e-3,
00038            Bool_t shiftToZero=kFALSE, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=kFALSE, Double_t eeVal=0,
00039            Bool_t showProgress=kFALSE);
00040   RooCurve(const char *name, const char *title, const RooAbsFunc &func, Double_t xlo,
00041            Double_t xhi, UInt_t minPoints, Double_t prec= 1e-3, Double_t resolution= 1e-3,
00042            Bool_t shiftToZero=kFALSE, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=kFALSE, Double_t eeVal=0);
00043   virtual ~RooCurve();
00044 
00045   RooCurve(const char* name, const char* title, const RooCurve& c1, const RooCurve& c2, Double_t scale1=1., Double_t scale2=1.) ;
00046 
00047   void addPoint(Double_t x, Double_t y);
00048 
00049   Double_t getFitRangeBinW() const;
00050   Double_t getFitRangeNEvt(Double_t xlo, Double_t xhi) const ;
00051   Double_t getFitRangeNEvt() const;
00052 
00053 
00054   virtual void printName(ostream& os) const ;
00055   virtual void printTitle(ostream& os) const ;
00056   virtual void printClassName(ostream& os) const ;
00057   virtual void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
00058 
00059   inline virtual void Print(Option_t *options= 0) const {
00060     // Printing interface
00061     printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00062   }
00063 
00064   Double_t chiSquare(const RooHist& hist, int nFitParam) const ;
00065   Int_t findPoint(Double_t value, Double_t tolerance=1e-10) const ;
00066   Double_t average(Double_t lo, Double_t hi) const ;
00067   Double_t interpolate(Double_t x, Double_t tolerance=1e-10) const ;
00068 
00069   Bool_t isIdentical(const RooCurve& other, Double_t tol=1e-6) const ;
00070 
00071   RooCurve* makeErrorBand(const std::vector<RooCurve*>& variations, Double_t Z=1) const ;
00072   RooCurve* makeErrorBand(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, const TMatrixD& V, Double_t Z=1) const ;
00073 
00074 protected:
00075 
00076   void calcBandInterval(const std::vector<RooCurve*>& variations,Int_t i,Double_t Z,Double_t& lo, Double_t& hi, Bool_t approxGauss) const ;
00077   void calcBandInterval(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, Int_t i, const TMatrixD& V,
00078                         Double_t Z,Double_t& lo, Double_t& hi) const ;
00079 
00080   void initialize();
00081   void addPoints(const RooAbsFunc &func, Double_t xlo, Double_t xhi,
00082                  Int_t minPoints, Double_t prec, Double_t resolution, WingMode wmode,
00083                  Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.,std::list<Double_t>* samplingHint=0) ;
00084   void addRange(const RooAbsFunc& func, Double_t x1, Double_t x2, Double_t y1,
00085                 Double_t y2, Double_t minDy, Double_t minDx,
00086                 Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.)  ;
00087 
00088 
00089   void shiftCurveToZero(Double_t prevYMax) ;
00090 
00091   Bool_t _showProgress ; //! Show progress indication when adding points
00092 
00093   ClassDef(RooCurve,1) // 1-dimensional smooth curve for use in RooPlots
00094 };
00095 
00096 #endif

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