MINT2
RooCubicSplinePdf.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_CUBICSPLINEPDF
14 #define ROO_CUBICSPLINEPDF
15 
16 #include "RooRealProxy.h"
17 #include "RooListProxy.h"
18 #include "RooCubicSplineKnot.h"
20 #include "RooAbsPdf.h"
21 
22 class RooRealVar;
23 class RooArgList ;
24 class TH1;
25 class TGraph;
26 class TGraphErrors;
27 
28 class RooCubicSplinePdf : public RooAbsPdf {
29 public:
31  RooCubicSplinePdf(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  RooCubicSplinePdf(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  RooCubicSplinePdf(const char* name, const char* title, RooRealVar& x, const TH1* hist,
42  double smooth = 0, bool constCoeffs = true);
43  RooCubicSplinePdf(const char* name, const char* title, RooRealVar& x, const TGraphErrors* graph,
44  double smooth = 0, bool constCoeffs = true);
45  RooCubicSplinePdf(const char *name, const char *title, RooRealVar& x,
46  const char *knotBinningName, const RooArgList& coefList) ;
47  RooCubicSplinePdf(const char* name, const char* title, RooRealVar& x,
48  const std::vector<double>& knots, const RooArgList& coefList);
49 
51 
52  RooCubicSplinePdf(const RooCubicSplinePdf& other, const char* name = 0);
53  TObject* clone(const char* newname) const { return new RooCubicSplinePdf(*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(RooCubicSplinePdf,1) // CubicSpline polynomial PDF
88 };
89 
90 #endif
91 
const std::vector< double > & knots() const
unsigned knotSize() const
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName) const
void init(const char *name, const std::vector< double > &heights, const std::vector< double > &errors, double smooth, bool constCoeffs)
Int_t getMaxVal(const RooArgSet &vars) const
const RooArgList & coefficients() const
std::complex< double > gaussIntegralE(bool left, const RooGaussModelAcceptance::M_n< 4U > &dM, const RooGaussModelAcceptance::K_n &K, double offset, double *sc) const
std::complex< double > productAnalyticalIntegral(Double_t umin, Double_t umax, Double_t scale, Double_t offset, const std::complex< double > &z) const
RooCubicSplineKnot _aux
TObject * clone(const char *newname) const
double u(int i) const
double u(int i) const
const std::vector< double > & knots() const
Double_t maxVal(Int_t code) const
Double_t analyticalIntegral(Int_t code, const char *rangeName) const
RooListProxy _coefList
Double_t evaluate() const