laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DSplineDPPdf.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2004 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
15 #include <iostream>
16 
17 #include "TAxis.h"
18 #include "TH2.h"
19 #include "TRandom.h"
20 #include "TSystem.h"
21 
22 #include "Lau2DSplineDPPdf.hh"
23 #include "Lau2DCubicSpline.hh"
24 #include "LauDaughters.hh"
25 #include "LauKinematics.hh"
26 #include "LauRandom.hh"
27 
29 
30 
31 Lau2DSplineDPPdf::Lau2DSplineDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
32  Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP) :
33  Lau2DAbsHistDPPdf(kinematics,vetoes,useUpperHalfOnly,squareDP),
34  spline_(0)
35 {
36  //We may need to modify the histogram so clone it
37  TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
38 
39  if ( ! tempHist ) {
40  std::cerr << "ERROR in Lau2DSplineDPPdf constructor : the histogram pointer is null." << std::endl;
41  gSystem->Exit(EXIT_FAILURE);
42  }
43 
44  if (fluctuateBins) {
45  this->doBinFluctuation(tempHist);
46  }
47 
48  spline_ = new Lau2DCubicSpline(*tempHist);
49 
50  // Calculate the PDF normalisation.
51  this->calcHistNorm();
52 
53  // Also obtain the maximum height
54  this->calcMaxHeight(tempHist);
55 
56  delete tempHist;
57 }
58 
60 {
61  delete spline_;
62  spline_ = 0;
63 }
64 
65 Double_t Lau2DSplineDPPdf::interpolateXYNorm(Double_t x, Double_t y) const
66 {
67  // Get the normalised interpolated value.
68  Double_t value = this->interpolateXY(x,y);
69  return value/norm_;
70 
71 }
72 
73 Double_t Lau2DSplineDPPdf::interpolateXY(Double_t x, Double_t y) const
74 {
75  // This function returns the interpolated value of the histogram function
76  // for the given values of x and y by finding the adjacent bins and extrapolating
77  // using weights based on the inverse distance of the point from the adajcent
78  // bin centres.
79  // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
80 
81  // If we're only using one half then flip co-ordinates
82  // appropriately for conventional or square DP
83  getUpperHalf(x,y);
84 
85  // First ask whether the point is inside the kinematic region.
86  if (withinDPBoundaries(x,y) == kFALSE) {
87  std::cerr << "WARNING in Lau2DSplineDPPdf::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
88  return 0.0;
89  }
90 
91  return spline_->evaluate(x,y);
92 
93 }
94 
96 {
98 }
Double_t interpolateXYNorm(Double_t x, Double_t y) const
Perform the interpolation and divide by the normalisation.
virtual ~Lau2DSplineDPPdf()
Destructor.
ClassImp(LauAbsCoeffSet)
Lau2DCubicSpline * spline_
A 2D cubic spline generated from the histogram.
Class for defining a 2D cubic spline based on an input histogram.
Abstract base class for defining a variation across a 2D DP based on a histogram. ...
Bool_t withinDPBoundaries(Double_t x, Double_t y) const
Check whether the given co-ordinates are within the kinematic boundary.
File containing declaration of LauDaughters class.
Class for defining a 2D DP spline PDF.
File containing declaration of LauKinematics class.
File containing declaration of Lau2DSplineDPPdf class.
virtual Double_t evaluate(Double_t x, Double_t y) const
Evaluate the function at given point.
void calcHistNorm()
Calculate the PDF normalisation.
void getUpperHalf(Double_t &x, Double_t &y) const
If only using the upper half of the (symmetric) DP then transform into the correct half...
File containing LauRandom namespace.
File containing declaration of Lau2DCubicSpline class.
virtual Double_t analyticalIntegral(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const
Evaluate analytical integral in x, y, or x and y.
Class for calculating 3-body kinematic quantities.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation (unnormalised)
Double_t value() const
The value of the parameter.
Double_t norm_
The histogram normalisation.
Class for defining vetoes within the Dalitz plot.
Definition: LauVetoes.hh:33