MINT2
RooCubicSplineFun.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * File: $Id$
5  * Authors: *
6  * Gerhard Raven
7  * *
8  * *
9  * Redistribution and use in source and binary forms, *
10  * with or without modification, are permitted according to the terms *
11  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
12  *****************************************************************************/
13 #ifndef ROO_CUBICSPLINEFUN
14 #define ROO_CUBICSPLINEFUN
15 
16 #include "RooRealProxy.h"
17 #include "RooListProxy.h"
18 #include "RooCubicSplineKnot.h"
20 
21 class RooRealVar;
22 class RooArgList ;
23 class TH1;
24 class TGraph;
25 class TGraphErrors;
26 
28  friend class RooSplineProduct;
29 public:
31  RooCubicSplineFun(const char* name, const char* title, RooRealVar& x,
32  const std::vector<double>& knots,
33  const std::vector<double>& values,
34  const std::vector<double>& errors = std::vector<double>(),
35  double smooth = 0, bool constCoeffs = true);
36  RooCubicSplineFun(const char* name, const char* title, RooRealVar& x, const TGraph* graph,
37  bool constCoeffs = true);
38  // smooth = 0: no smoothing, interpolating spline
39  // smooth = Infty: extreme smoothing, resulting in a straight line (as the 2nd derivative is forced to zero)
40  // TODO: map [0,Infty] -> [0,1]
41  RooCubicSplineFun(const char* name, const char* title, RooRealVar& x, const TH1* hist,
42  double smooth = 0, bool constCoeffs = true);
43  RooCubicSplineFun(const char* name, const char* title, RooRealVar& x, const TGraphErrors* graph,
44  double smooth = 0, bool constCoeffs = true);
45  RooCubicSplineFun(const char *name, const char *title, RooRealVar& x,
46  const char *knotBinningName, const RooArgList& coefList) ;
47  RooCubicSplineFun(const char* name, const char* title, RooRealVar& x,
48  const std::vector<double>& knots, const RooArgList& coefList);
49 
51 
52  RooCubicSplineFun(const RooCubicSplineFun& other, const char* name = 0);
53  TObject* clone(const char* newname) const { return new RooCubicSplineFun(*this, newname); }
54 
55  Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const;
56  Double_t analyticalIntegral(Int_t code, const char* rangeName) const;
57 
58  Int_t getMaxVal(const RooArgSet& vars) const;
59  Double_t maxVal(Int_t code) const;
60 
61  // for use as RooAbsGaussModelEfficiency...
62  std::complex<double> productAnalyticalIntegral(Double_t umin, Double_t umax
63  ,Double_t scale, Double_t offset
64  ,const std::complex<double>& z) const;
65 
66  unsigned knotSize() const { return _aux.size(); }
67  double u(int i) const { return _aux.u(i); }
68  const std::vector<double>& knots() const { return _aux.knots(); }
69  const RooArgList& coefficients() const { return _coefList; }
70 
71 private:
72 
73  RooRealProxy _x;
74  RooListProxy _coefList ;
76 
77  void init(const char* name, const std::vector<double>& heights,
78  const std::vector<double>& errors, double smooth, bool constCoeffs);
79 
80  Double_t evaluate() const;
81  //
82  // for use in RooGaussEfficiencyModel...
83  std::complex<double> gaussIntegralE(bool left, const RooGaussModelAcceptance::M_n<4U>& dM,
85  double offset, double* sc) const ;
86 
87  //ClassDef(RooCubicSplineFun,1) // CubicSpline polynomial PDF
88 };
89 
90 #endif
double u(int i) const
TObject * clone(const char *newname) const
const RooArgList & coefficients() const
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName) const
Double_t evaluate() const
void init(const char *name, const std::vector< double > &heights, const std::vector< double > &errors, double smooth, bool constCoeffs)
double u(int i) const
const std::vector< double > & knots() const
unsigned knotSize() const
Double_t analyticalIntegral(Int_t code, const char *rangeName) const
const std::vector< double > & knots() const
Int_t getMaxVal(const RooArgSet &vars) const
std::complex< double > gaussIntegralE(bool left, const RooGaussModelAcceptance::M_n< 4U > &dM, const RooGaussModelAcceptance::K_n &K, double offset, double *sc) const
RooCubicSplineKnot _aux
RooListProxy _coefList
std::complex< double > productAnalyticalIntegral(Double_t umin, Double_t umax, Double_t scale, Double_t offset, const std::complex< double > &z) const
Double_t maxVal(Int_t code) const