laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DCubicSpline.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2013 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
56 #ifndef LAU_2DCUBICSPLINE
57 #define LAU_2DCUBICSPLINE
58 
59 class TH2;
60 
62 {
63  private:
65  enum { NCoeff = 16, CoeffRecLen = 17 };
66 
67  public:
69 
72  Lau2DCubicSpline(const TH2& h);
73 
75  virtual ~Lau2DCubicSpline();
76 
78 
82  virtual Double_t evaluate(Double_t x, Double_t y) const;
83 
85 
91  virtual Double_t analyticalIntegral(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const;
92 
94  virtual Double_t analyticalIntegral() const;
95 
96 
97  private:
99  Lau2DCubicSpline( const Lau2DCubicSpline& rhs );
100 
103 
105  Int_t nBinsX;
106 
108  Int_t nBinsY;
109 
111  Double_t binSizeX;
112 
114  Double_t binSizeY;
115 
117  Double_t xmin;
118 
120  Double_t xmax;
121 
123  Double_t ymin;
124 
126  Double_t ymax;
127 
129  std::vector<Double_t> coeffs;
130 
132 
138  Double_t histcont(const TH2& h, Int_t xbin, Int_t ybin) const;
139 
141 
147  Double_t dhistdx(const TH2& h, Int_t xbin, Int_t ybin) const;
148 
150 
156  Double_t dhistdy(const TH2& h, Int_t xbin, Int_t ybin) const;
157 
159 
165  Double_t d2histdxdy(const TH2& h, Int_t xbin, Int_t ybin) const;
166 
168 
174  inline const Double_t& coeff(Int_t binx, Int_t biny, Int_t theCoeff) const
175  { return coeffs[theCoeff + CoeffRecLen * (binx + nBinsX * biny)]; }
176 
178 
184  inline Double_t& coeff(Int_t binx, Int_t biny, Int_t theCoeff)
185  { return coeffs[theCoeff + CoeffRecLen * (binx + nBinsX * biny)]; }
186 
188 
194  Double_t evalX(Double_t x1, Double_t x2, Double_t y) const;
195 
197 
203  Double_t evalY(Double_t x, Double_t y1, Double_t y2) const;
204 
206 
213  Double_t evalXY(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const;
214 
215  ClassDef(Lau2DCubicSpline, 0); // Class for defining a 2D cubic spline based on an input histogram
216 };
217 
218 #endif
Double_t dhistdx(const TH2 &h, Int_t xbin, Int_t ybin) const
Get d/dx finite difference in a given bin from a histogram.
Double_t histcont(const TH2 &h, Int_t xbin, Int_t ybin) const
Get contents of a given bin from a histogram.
Double_t xmax
Maximum x value.
virtual Double_t analyticalIntegral() const
Evaluate analytical integral across the whole function.
Double_t & coeff(Int_t binx, Int_t biny, Int_t theCoeff)
Access to coefficients.
Double_t d2histdxdy(const TH2 &h, Int_t xbin, Int_t ybin) const
Get d^2/dydx finite difference in a given bin from a histogram.
Class for defining a 2D cubic spline based on an input histogram.
Lau2DCubicSpline & operator=(const Lau2DCubicSpline &rhs)
Copy assignment operator - not implemented.
ClassDef(Lau2DCubicSpline, 0)
Int_t nBinsX
Number of bins in x axis.
Double_t evalX(Double_t x1, Double_t x2, Double_t y) const
Evaluate integral over x at a given y from (x1, y) to (x2, y)
Int_t nBinsY
Number of bins in y axis.
virtual Double_t evaluate(Double_t x, Double_t y) const
Evaluate the function at given point.
Double_t xmin
Minimum x value.
Lau2DCubicSpline(const TH2 &h)
Constructor from histogram.
Double_t binSizeX
Bin size in x.
virtual ~Lau2DCubicSpline()
Destructor.
Double_t evalXY(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const
Evaluate integral over x and y from (x1, y1) to (x2, y2)
Double_t ymax
Maximum y value.
Double_t dhistdy(const TH2 &h, Int_t xbin, Int_t ybin) const
Get d/dy finite difference in a given bin from a histogram.
Double_t ymin
Minimum y value.
Double_t binSizeY
Bin size in y.
std::vector< Double_t > coeffs
Coefficients of interpolation polynomials.
Double_t evalY(Double_t x, Double_t y1, Double_t y2) const
Evaluate integral over y at a given x from (x, y1) to (x, y2)
const Double_t & coeff(Int_t binx, Int_t biny, Int_t theCoeff) const
Const access to coefficients.