laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 #include "Rtypes.h"
60 
61 #include <vector>
62 
63 class TH2;
64 
66  private:
68  enum {
69  NCoeff = 16,
70  CoeffRecLen = 17
71  };
72 
73  public:
75 
78  Lau2DCubicSpline( const TH2& h );
79 
81  virtual ~Lau2DCubicSpline();
82 
84 
88  virtual Double_t evaluate( Double_t x, Double_t y ) const;
89 
91 
97  virtual Double_t analyticalIntegral( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const;
98 
100  virtual Double_t analyticalIntegral() const;
101 
102  private:
105 
108 
110  Int_t nBinsX;
111 
113  Int_t nBinsY;
114 
116  Double_t binSizeX;
117 
119  Double_t binSizeY;
120 
122  Double_t xmin;
123 
125  Double_t xmax;
126 
128  Double_t ymin;
129 
131  Double_t ymax;
132 
134  std::vector<Double_t> coeffs;
135 
137 
143  Double_t histcont( const TH2& h, Int_t xbin, Int_t ybin ) const;
144 
146 
152  Double_t dhistdx( const TH2& h, Int_t xbin, Int_t ybin ) const;
153 
155 
161  Double_t dhistdy( const TH2& h, Int_t xbin, Int_t ybin ) const;
162 
164 
170  Double_t d2histdxdy( const TH2& h, Int_t xbin, Int_t ybin ) const;
171 
173 
179  inline const Double_t& coeff( Int_t binx, Int_t biny, Int_t theCoeff ) const
180  {
181  return coeffs[theCoeff + CoeffRecLen * ( binx + nBinsX * biny )];
182  }
183 
185 
191  inline Double_t& coeff( Int_t binx, Int_t biny, Int_t theCoeff )
192  {
193  return coeffs[theCoeff + CoeffRecLen * ( binx + nBinsX * biny )];
194  }
195 
197 
203  Double_t evalX( Double_t x1, Double_t x2, Double_t y ) const;
204 
206 
212  Double_t evalY( Double_t x, Double_t y1, Double_t y2 ) const;
213 
215 
222  Double_t evalXY( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const;
223 
224  ClassDef( Lau2DCubicSpline,
225  0 ); // Class for defining a 2D cubic spline based on an input histogram
226 };
227 
228 #endif
Double_t binSizeY
Bin size in y.
Class for defining a 2D cubic spline based on an input histogram.
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.
Int_t nBinsX
Number of bins in x axis.
virtual Double_t evaluate(Double_t x, Double_t y) const
Evaluate the function at given point.
Double_t xmax
Maximum x value.
Int_t nBinsY
Number of bins in y axis.
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)
Double_t & coeff(Int_t binx, Int_t biny, Int_t theCoeff)
Access to coefficients.
virtual ~Lau2DCubicSpline()
Destructor.
virtual Double_t analyticalIntegral() const
Evaluate analytical integral across the whole function.
Lau2DCubicSpline(const TH2 &h)
Constructor from histogram.
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)
Double_t binSizeX
Bin size in x.
const Double_t & coeff(Int_t binx, Int_t biny, Int_t theCoeff) const
Const access to coefficients.
Double_t ymax
Maximum y value.
Double_t histcont(const TH2 &h, Int_t xbin, Int_t ybin) const
Get contents of a given bin from a histogram.
std::vector< Double_t > coeffs
Coefficients of interpolation polynomials.
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.
Lau2DCubicSpline(const Lau2DCubicSpline &rhs)
Copy constructor - not implemented.
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.
Lau2DCubicSpline & operator=(const Lau2DCubicSpline &rhs)
Copy assignment operator - not implemented.
Double_t xmin
Minimum x value.
Double_t ymin
Minimum y value.
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)