laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DSplineDPPdf.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2014 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 
29 #include <iostream>
30 
31 #include "TAxis.h"
32 #include "TH2.h"
33 #include "TRandom.h"
34 #include "TSystem.h"
35 
36 #include "Lau2DSplineDPPdf.hh"
37 #include "Lau2DCubicSpline.hh"
38 #include "LauDaughters.hh"
39 #include "LauKinematics.hh"
40 #include "LauRandom.hh"
41 
43 
44 
45 Lau2DSplineDPPdf::Lau2DSplineDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
46  Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP) :
47  Lau2DAbsHistDPPdf(kinematics,vetoes,useUpperHalfOnly,squareDP),
48  spline_(0)
49 {
50  //We may need to modify the histogram so clone it
51  TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
52 
53  if ( ! tempHist ) {
54  std::cerr << "ERROR in Lau2DSplineDPPdf constructor : the histogram pointer is null." << std::endl;
55  gSystem->Exit(EXIT_FAILURE);
56  }
57 
58  if (fluctuateBins) {
59  this->doBinFluctuation(tempHist);
60  }
61 
62  spline_ = new Lau2DCubicSpline(*tempHist);
63 
64  // Calculate the PDF normalisation.
65  this->calcHistNorm();
66 
67  // Also obtain the maximum height
68  this->calcMaxHeight(tempHist);
69 
70  delete tempHist;
71 }
72 
74 {
75  delete spline_;
76  spline_ = 0;
77 }
78 
79 Double_t Lau2DSplineDPPdf::interpolateXYNorm(Double_t x, Double_t y) const
80 {
81  // Get the normalised interpolated value.
82  Double_t value = this->interpolateXY(x,y);
83  return value/norm_;
84 
85 }
86 
87 Double_t Lau2DSplineDPPdf::interpolateXY(Double_t x, Double_t y) const
88 {
89  // This function returns the interpolated value of the histogram function
90  // for the given values of x and y by finding the adjacent bins and extrapolating
91  // using weights based on the inverse distance of the point from the adajcent
92  // bin centres.
93  // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
94 
95  // If we're only using one half then flip co-ordinates
96  // appropriately for conventional or square DP
97  getUpperHalf(x,y);
98 
99  // First ask whether the point is inside the kinematic region.
100  if (withinDPBoundaries(x,y) == kFALSE) {
101  std::cerr << "WARNING in Lau2DSplineDPPdf::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
102  return 0.0;
103  }
104 
105  return spline_->evaluate(x,y);
106 
107 }
108 
110 {
112 }
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:50