laura is hosted by Hepforge, IPPP Durham
Laura++  v1r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DSplineDP.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 "Lau2DSplineDP.hh"
23 #include "Lau2DCubicSpline.hh"
24 #include "LauDaughters.hh"
25 #include "LauKinematics.hh"
26 #include "LauRandom.hh"
27 
28 ClassImp(Lau2DSplineDP)
29 
30 
31 Lau2DSplineDP::Lau2DSplineDP(const TH2* hist, const LauDaughters* daughters,
32  Bool_t fluctuateBins, Double_t avEff, Double_t avEffError,
33  Bool_t useUpperHalfOnly, Bool_t squareDP) :
34  Lau2DAbsHistDP(daughters,useUpperHalfOnly,squareDP),
35  spline_(0)
36 {
37  //We may need to modify the histogram so clone it
38  TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
39 
40  if ( ! tempHist ) {
41  std::cerr << "ERROR in Lau2DSplineDP constructor : the histogram pointer is null." << std::endl;
42  gSystem->Exit(EXIT_FAILURE);
43  }
44 
45  if (fluctuateBins) {
46  this->doBinFluctuation(tempHist);
47  }
48  if (avEff > 0.0 && avEffError > 0.0) {
49  this->raiseOrLowerBins(tempHist,avEff,avEffError);
50  }
51 
52  spline_ = new Lau2DCubicSpline(*tempHist);
53 
54  delete tempHist;
55 }
56 
58 {
59  delete spline_;
60  spline_ = 0;
61 }
62 
63 Double_t Lau2DSplineDP::interpolateXY(Double_t x, Double_t y) const
64 {
65  // This function returns the interpolated value of the histogram function
66  // for the given values of x and y by finding the adjacent bins and extrapolating
67  // using weights based on the inverse distance of the point from the adajcent
68  // bin centres.
69  // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
70 
71  // If we're only using one half then flip co-ordinates
72  // appropriately for conventional or square DP
73  getUpperHalf(x,y);
74 
75  // First ask whether the point is inside the kinematic region.
76  if (withinDPBoundaries(x,y) == kFALSE) {
77  std::cerr << "WARNING in Lau2DSplineDP::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
78  return 0.0;
79  }
80 
81  return spline_->evaluate(x,y);
82 
83 }
File containing declaration of Lau2DSplineDP class.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation.
virtual ~Lau2DSplineDP()
Destructor.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
Class for defining a 2D cubic spline based on an input histogram.
File containing declaration of LauDaughters class.
File containing declaration of LauKinematics class.
virtual Double_t evaluate(Double_t x, Double_t y) const
Evaluate the function at given point.
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 LauRandom namespace.
File containing declaration of Lau2DCubicSpline class.
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...
Lau2DCubicSpline * spline_
A 2D cubic spline generated from the histogram.
Class for defining variations across a 2D DP using a spline.