Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooCurve.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooCurve.h,v 1.24 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_CURVE
0017 #define ROO_CURVE
0018 
0019 #include <RooPlotable.h>
0020 
0021 #include <ROOT/RSpan.hxx>
0022 
0023 #include <TGraph.h>
0024 #include <TMatrixDfwd.h>
0025 
0026 #include <list>
0027 #include <vector>
0028 
0029 class RooAbsReal;
0030 class RooRealVar;
0031 class RooAbsFunc;
0032 class RooArgSet;
0033 class RooAbsRealLValue ;
0034 class RooHist ;
0035 
0036 class RooCurve : public TGraph, public RooPlotable {
0037 public:
0038   RooCurve();
0039   enum WingMode { NoWings=0 ,Straight=1, Extended=2 } ;
0040   RooCurve(const RooAbsReal &func, RooAbsRealLValue &x, double xlo, double xhi, Int_t xbins,
0041       double scaleFactor= 1, const RooArgSet *normVars= nullptr, double prec= 1e-3, double resolution= 1e-3,
0042       bool shiftToZero=false, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=false, double eeVal=0.0,
0043       bool showProgress=false);
0044   RooCurve(const char *name, const char *title, const RooAbsFunc &func, double xlo,
0045       double xhi, UInt_t minPoints, double prec= 1e-3, double resolution= 1e-3,
0046       bool shiftToZero=false, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=false, double eeVal=0.0);
0047   ~RooCurve() override;
0048 
0049   RooCurve(const char* name, const char* title, const RooCurve& c1, const RooCurve& c2, double scale1=1., double scale2=1.) ;
0050 
0051   void addPoint(double x, double y);
0052 
0053   double getFitRangeBinW() const override;
0054   double getFitRangeNEvt(double xlo, double xhi) const override ;
0055   double getFitRangeNEvt() const override;
0056 
0057 
0058   void printName(std::ostream& os) const override ;
0059   void printTitle(std::ostream& os) const override ;
0060   void printClassName(std::ostream& os) const override ;
0061   void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override;
0062 
0063   inline void Print(Option_t *options= nullptr) const override {
0064     // Printing interface
0065     printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
0066   }
0067 
0068   double chiSquare(const RooHist& hist, int nFitParam) const ;
0069   Int_t findPoint(double value, double tolerance=1e-10) const ;
0070   double average(double lo, double hi) const ;
0071   double interpolate(double x, double tolerance=1e-10) const ;
0072 
0073   bool isIdentical(const RooCurve& other, double tol=1e-6, bool verbose=true) const ;
0074 
0075   RooCurve* makeErrorBand(const std::vector<RooCurve*>& variations, double Z=1) const ;
0076   RooCurve* makeErrorBand(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, const TMatrixD& V, double Z=1) const ;
0077 
0078   static std::list<double>* plotSamplingHintForBinBoundaries(std::span<const double> boundaries, double xlo, double xhi);
0079 
0080 protected:
0081 
0082   void calcBandInterval(const std::vector<RooCurve*>& variations,Int_t i,double Z,double& lo, double& hi, bool approxGauss) const ;
0083   void calcBandInterval(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, Int_t i, const TMatrixD& V,
0084          double Z,double& lo, double& hi) const ;
0085 
0086   void initialize();
0087   void addPoints(const RooAbsFunc &func, double xlo, double xhi,
0088        Int_t minPoints, double prec, double resolution, WingMode wmode,
0089        Int_t numee=0, bool doEEVal=false, double eeVal=0.0,std::list<double>* samplingHint=nullptr) ;
0090   void addRange(const RooAbsFunc& func, double x1, double x2, double y1,
0091       double y2, double minDy, double minDx,
0092       int numee, bool doEEVal, double eeVal, double epsilon);
0093 
0094 
0095   void shiftCurveToZero();
0096 
0097   bool _showProgress = false; ///<! Show progress indication when adding points
0098 
0099 private:
0100   /// The distance between two points x1 and x2 relative to the full plot range
0101   /// below which two points are considered identical. No further sampling
0102   /// points will be added to the curve when the distance between two sampling
0103   /// points falls below this threshold.
0104   static constexpr double relativeXEpsilon() { return 1e-9; }
0105 
0106   ClassDefOverride(RooCurve,1) // 1-dimensional smooth curve for use in RooPlots
0107 };
0108 
0109 #endif