laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DHistPdf.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2008 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 "Lau2DHistPdf.hh"
30 
31 #include "Lau1DHistPdf.hh"
32 #include "LauRandom.hh"
33 
34 #include "TAxis.h"
35 #include "TH2.h"
36 #include "TRandom.h"
37 #include "TSystem.h"
38 
39 #include <cstdlib>
40 #include <iostream>
41 #include <vector>
42 
43 class LauParameter;
44 
45 Lau2DHistPdf::Lau2DHistPdf( const std::vector<TString>& theVarNames,
46  const TH2* hist,
47  const LauFitData& minVals,
48  const LauFitData& maxVals,
49  Bool_t useInterpolation,
50  Bool_t fluctuateBins ) :
51  LauAbsPdf( theVarNames, std::vector<LauAbsRValue*>(), minVals, maxVals ),
52  hist_( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 ),
53  xProj_( 0 ),
54  yProj_( 0 ),
55  xVarPdf_( 0 ),
56  yVarPdf_( 0 ),
57  xName_( "" ),
58  yName_( "" ),
59  nBinsX_( 0 ),
60  nBinsY_( 0 ),
61  minX_( 0.0 ),
62  maxX_( 0.0 ),
63  minY_( 0.0 ),
64  maxY_( 0.0 ),
65  rangeX_( 0.0 ),
66  rangeY_( 0.0 ),
67  binXWidth_( 0.0 ),
68  binYWidth_( 0.0 ),
69  invBinXWidth_( 0.0 ),
70  invBinYWidth_( 0.0 ),
71  useInterpolation_( useInterpolation ),
72  fluctuateBins_( fluctuateBins )
73 {
74  // Constructor
75 
76  // Check that we have two variables
77  if ( this->nInputVars() != 2 ) {
78  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Have not been provided with exactly two variables."
79  << std::endl;
80  gSystem->Exit( EXIT_FAILURE );
81  }
82 
83  // Set the variable names from the abstract class
84  xName_ = this->varNames()[0];
85  yName_ = this->varNames()[1];
86 
87  // Set the variable limits from the abstract class
88  minX_ = this->getMinAbscissa( xName_ );
89  maxX_ = this->getMaxAbscissa( xName_ );
90  minY_ = this->getMinAbscissa( yName_ );
91  maxY_ = this->getMaxAbscissa( yName_ );
92  rangeX_ = maxX_ - minX_;
93  rangeY_ = maxY_ - minY_;
94 
95  // Have we got a valid histogram
96  if ( hist_ == 0 ) {
97  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram pointer is null." << std::endl;
98  gSystem->Exit( EXIT_FAILURE );
99  }
100 
101  // Set the directory for the histogram
102  hist_->SetDirectory( 0 );
103 
104  // Save various attributes of the histogram
105  nBinsX_ = hist_->GetNbinsX();
106  nBinsY_ = hist_->GetNbinsY();
107 
108  TAxis* xAxis = hist_->GetXaxis();
109  Double_t xAxisMin = xAxis->GetXmin();
110  Double_t xAxisMax = xAxis->GetXmax();
111 
112  TAxis* yAxis = hist_->GetYaxis();
113  Double_t yAxisMin = yAxis->GetXmin();
114  Double_t yAxisMax = yAxis->GetXmax();
115 
116  // Check that axis ranges corresponds to ranges of abscissas
117  if ( TMath::Abs( minX_ - xAxisMin ) > 1e-6 ) {
118  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis minimum: " << xAxisMin
119  << " does not correspond to " << xName_ << " minimum: " << minX_ << "."
120  << std::endl;
121  gSystem->Exit( EXIT_FAILURE );
122  }
123  if ( TMath::Abs( maxX_ - xAxisMax ) > 1e-6 ) {
124  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis maximum: " << xAxisMax
125  << " does not correspond to " << xName_ << " maximum: " << maxX_ << "."
126  << std::endl;
127  gSystem->Exit( EXIT_FAILURE );
128  }
129  if ( TMath::Abs( minY_ - yAxisMin ) > 1e-6 ) {
130  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis minimum: " << yAxisMin
131  << " does not correspond to " << yName_ << " minimum: " << minY_ << "."
132  << std::endl;
133  gSystem->Exit( EXIT_FAILURE );
134  }
135  if ( TMath::Abs( maxY_ - yAxisMax ) > 1e-6 ) {
136  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis maximum: " << yAxisMax
137  << " does not correspond to " << yName_ << " maximum: " << maxY_ << "."
138  << std::endl;
139  gSystem->Exit( EXIT_FAILURE );
140  }
141 
142  // Calculate the bin widths and inverse bin widths
143  binXWidth_ = static_cast<Double_t>( TMath::Abs( rangeX_ ) / ( nBinsX_ * 1.0 ) );
144  binYWidth_ = static_cast<Double_t>( TMath::Abs( rangeY_ ) / ( nBinsY_ * 1.0 ) );
145  if ( binXWidth_ > 1e-10 ) {
146  invBinXWidth_ = 1.0 / binXWidth_;
147  }
148  if ( binYWidth_ > 1e-10 ) {
149  invBinYWidth_ = 1.0 / binYWidth_;
150  }
151 
152  // If the bins are to be fluctuated then do so now before
153  // calculating anything that depends on the bin content.
154  if ( fluctuateBins ) {
155  this->doBinFluctuation();
156  }
157 
158  // Create the projections and 1D PDFs from those
159  xProj_ = hist_->ProjectionX();
160  yProj_ = hist_->ProjectionY();
161  if ( ! xProj_ || ! yProj_ ) {
162  std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Can't get X or Y projection from 2D histogram."
163  << std::endl;
164  gSystem->Exit( EXIT_FAILURE );
165  }
168 
169  // Calculate the PDF normalisation.
170  this->calcNorm();
171 
172  // And check it is OK.
173  this->checkNormalisation();
174 }
175 
177 {
178  // Destructor
179  delete hist_;
180  hist_ = 0;
181  delete xProj_;
182  xProj_ = 0;
183  delete yProj_;
184  yProj_ = 0;
185  delete xVarPdf_;
186  xVarPdf_ = 0;
187  delete yVarPdf_;
188  yVarPdf_ = 0;
189 }
190 
191 void Lau2DHistPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
192 {
193  if ( this->heightUpToDate() ) {
194  return;
195  }
196 
197  // Get the maximum height of the histogram
198  Int_t maxBin = hist_->GetMaximumBin();
199  Double_t height = hist_->GetBinContent( maxBin );
200  this->setMaxHeight( height );
201 }
202 
204 {
205  // Calculate the histogram normalisation.
206 
207  // Loop over the total x and y range to get the total area under x
208  // and y. Just sum the contributions up using 1e-3 increments of
209  // the range in x and y. Multiply the end result by dx and dy.
210 
211  Double_t dx( 1e-3 * rangeX_ ), dy( 1e-3 * rangeY_ );
212  Double_t area( 0.0 );
213 
214  Double_t x( minX_ + dx / 2.0 );
215  while ( x > minX_ && x < maxX_ ) {
216  Double_t y( minY_ + dy / 2.0 );
217  while ( y > minY_ && y < maxY_ ) {
218  area += this->interpolateXY( x, y );
219  y += dy;
220  } // y while loop
221  x += dx;
222  } // x while loop
223 
224  Double_t norm = area * dx * dy;
225  this->setNorm( norm );
226 }
227 
229 {
230  Double_t dx( 1e-3 * rangeX_ ), dy( 1e-3 * rangeY_ );
231  Double_t area( 0.0 );
232  Double_t areaNoNorm( 0.0 );
233 
234  // Preserve the value of a variable we change temporarily
235  Bool_t interpolate = useInterpolation_;
236 
237  Double_t x( minX_ + dx / 2.0 );
238  while ( x > minX_ && x < maxX_ ) {
239  Double_t y( minY_ + dy / 2.0 );
240  while ( y > minY_ && y < maxY_ ) {
241  area += this->interpolateXYNorm( x, y );
242  useInterpolation_ = kFALSE;
243  areaNoNorm += this->interpolateXY( x, y );
244  useInterpolation_ = kTRUE;
245  y += dy;
246  } // y while loop
247  x += dx;
248  } // x while loop
249  Double_t norm = area * dx * dy;
250 
251  useInterpolation_ = interpolate; //Restore old value
252 
253  std::cout << "INFO in Lau2DHistPdf::checkNormalisation : Area = " << area << ", dx = " << dx
254  << ", dy = " << dy << ", dx*dy = " << dx * dy << std::endl;
255  std::cout << " : Area with no norm = " << areaNoNorm
256  << "*dx*dy = " << areaNoNorm * dx * dy << std::endl;
257  std::cout << " : The total area of the normalised histogram PDF is "
258  << norm << std::endl;
259 }
260 
261 Double_t Lau2DHistPdf::getBinHistValue( Int_t i, Int_t j ) const
262 {
263  // Check that x co-ord is in range [1 , nBinsX_]
264  if ( ( i < 1 ) || ( i > nBinsX_ ) ) {
265  return 0.0;
266  }
267  // Check that y co-ord is in range [1 , nBinsY_]
268  if ( ( j < 1 ) || ( j > nBinsY_ ) ) {
269  return 0.0;
270  }
271  Double_t value = hist_->GetBinContent( i, j );
272  // protect against negative values
273  if ( value < 0.0 ) {
274  std::cerr << "WARNING in Lau2DHistPdf::getBinHistValue : Negative bin content set to zero!"
275  << std::endl;
276  value = 0.0;
277  }
278  return value;
279 }
280 
281 Double_t Lau2DHistPdf::interpolateXYNorm( Double_t x, Double_t y ) const
282 {
283  // Get the normalised interpolated value.
284  Double_t value = this->interpolateXY( x, y );
285  Double_t norm = this->getNorm();
286  return value / norm;
287 }
288 
289 Double_t Lau2DHistPdf::interpolateXY( Double_t x, Double_t y ) const
290 {
291  // This function returns the interpolated value of the histogram
292  // function for the given values of x and y by finding the adjacent
293  // bins and extrapolating using weights based on the inverse
294  // distance of the point from the adajcent bin centres.
295 
296  // Find the 2D histogram bin for x and y
297  Int_t i = static_cast<Int_t>( ( x - minX_ ) * invBinXWidth_ ) + 1;
298  Int_t j = static_cast<Int_t>( ( y - minY_ ) * invBinYWidth_ ) + 1;
299 
300  if ( i > nBinsX_ ) {
301  i = nBinsX_;
302  }
303  if ( j > nBinsY_ ) {
304  j = nBinsY_;
305  }
306 
307  // Ask whether we want to do the interpolation, since this method is
308  // not reliable for low statistics histograms.
309  if ( useInterpolation_ == kFALSE ) {
310  return this->getBinHistValue( i, j );
311  }
312 
313  // Find the bin centres (actual co-ordinate positions, not histogram indices)
314  Double_t cbinx = static_cast<Double_t>( i - 0.5 ) * binXWidth_ + minX_;
315  Double_t cbiny = static_cast<Double_t>( j - 0.5 ) * binYWidth_ + minY_;
316 
317  // Find the adjacent bins
318  Double_t deltax = x - cbinx;
319  Double_t deltay = y - cbiny;
320 
321  Int_t i_adj( 0 ), j_adj( 0 );
322  if ( deltax > 0.0 ) {
323  i_adj = i + 1;
324  } else {
325  i_adj = i - 1;
326  }
327  if ( deltay > 0.0 ) {
328  j_adj = j + 1;
329  } else {
330  j_adj = j - 1;
331  }
332 
333  Bool_t isXBoundary( kFALSE ), isYBoundary( kFALSE );
334 
335  Double_t value( 0.0 );
336 
337  if ( i_adj > nBinsX_ || i_adj < 1 ) {
338  isYBoundary = kTRUE;
339  }
340  if ( j_adj > nBinsY_ || j_adj < 1 ) {
341  isXBoundary = kTRUE;
342  }
343 
344  // In the corners, do no interpolation. Use entry in bin (i,j)
345  if ( isXBoundary == kTRUE && isYBoundary == kTRUE ) {
346 
347  value = this->getBinHistValue( i, j );
348 
349  } else if ( isXBoundary == kTRUE && isYBoundary == kFALSE ) {
350 
351  // Find the adjacent x bin centre
352  Double_t cbinx_adj = static_cast<Double_t>( i_adj - 0.5 ) * binXWidth_ + minX_;
353 
354  Double_t dx0 = TMath::Abs( x - cbinx );
355  Double_t dx1 = TMath::Abs( cbinx_adj - x );
356  Double_t inter_denom = dx0 + dx1;
357 
358  Double_t value1 = this->getBinHistValue( i, j );
359  Double_t value2 = this->getBinHistValue( i_adj, j );
360 
361  value = ( value1 * dx1 + value2 * dx0 ) / inter_denom;
362 
363  } else if ( isYBoundary == kTRUE && isXBoundary == kFALSE ) {
364 
365  // Find the adjacent y bin centre
366  Double_t cbiny_adj = static_cast<Double_t>( j_adj - 0.5 ) * binYWidth_ + minY_;
367 
368  Double_t dy0 = TMath::Abs( y - cbiny );
369  Double_t dy1 = TMath::Abs( cbiny_adj - y );
370  Double_t inter_denom = dy0 + dy1;
371 
372  Double_t value1 = this->getBinHistValue( i, j );
373  Double_t value2 = this->getBinHistValue( i, j_adj );
374 
375  value = ( value1 * dy1 + value2 * dy0 ) / inter_denom;
376 
377  } else {
378 
379  // 2D linear interpolation using inverse distance as weights.
380  // Find the adjacent x and y bin centres
381  Double_t cbinx_adj = static_cast<Double_t>( i_adj - 0.5 ) * binXWidth_ + minX_;
382  Double_t cbiny_adj = static_cast<Double_t>( j_adj - 0.5 ) * binYWidth_ + minY_;
383 
384  Double_t dx0 = TMath::Abs( x - cbinx );
385  Double_t dx1 = TMath::Abs( cbinx_adj - x );
386  Double_t dy0 = TMath::Abs( y - cbiny );
387  Double_t dy1 = TMath::Abs( cbiny_adj - y );
388 
389  Double_t inter_denom = ( dx0 + dx1 ) * ( dy0 + dy1 );
390 
391  Double_t value1 = this->getBinHistValue( i, j );
392  Double_t value2 = this->getBinHistValue( i_adj, j );
393  Double_t value3 = this->getBinHistValue( i, j_adj );
394  Double_t value4 = this->getBinHistValue( i_adj, j_adj );
395 
396  value = value1 * dx1 * dy1 + value2 * dx0 * dy1 + value3 * dx1 * dy0 + value4 * dx0 * dy0;
397  value /= inter_denom;
398  }
399 
400  return value;
401 }
402 
404 {
405  // Check that the given abscissa is within the allowed range
406  if ( ! this->checkRange( abscissas ) ) {
407  gSystem->Exit( EXIT_FAILURE );
408  }
409 
410  // Calculate the interpolated value
411  Double_t x = abscissas[0];
412  Double_t y = abscissas[1];
413  Double_t value = this->interpolateXY( x, y );
414  this->setUnNormPDFVal( value );
415 
416  // TODO - do we need this? I think probably not.
417  // Have the 1D PDFs calculate their likelihoods as well
418  //xVarPdf_->calcLikelihoodInfo(x);
419  //yVarPdf_->calcLikelihoodInfo(y);
420 }
421 
423 {
424  // Call the base class method
425  this->LauAbsPdf::calcLikelihoodInfo( iEvt );
426 
427  // Have the 1D PDFs retrieve their values as well
428  xVarPdf_->calcLikelihoodInfo( iEvt );
429  yVarPdf_->calcLikelihoodInfo( iEvt );
430 }
431 
432 Double_t Lau2DHistPdf::getLikelihood( const TString& theVarName ) const
433 {
434  if ( theVarName == xName_ ) {
435  return xVarPdf_->getLikelihood();
436  } else if ( theVarName == yName_ ) {
437  return yVarPdf_->getLikelihood();
438  } else {
439  std::cerr << "ERROR in Lau2DHistPdf::getLikelihood : Unrecognised variable name \""
440  << theVarName << "\", cannot determine likelihood." << std::endl;
441  return 0.0;
442  }
443 }
444 
445 void Lau2DHistPdf::cacheInfo( const LauFitDataTree& inputData )
446 {
447  // Call the base class method
448  this->LauAbsPdf::cacheInfo( inputData );
449 
450  // Have the 1D PDFs cache their info as well
451  xVarPdf_->cacheInfo( inputData );
452  yVarPdf_->cacheInfo( inputData );
453 }
454 
456 {
457  TRandom* random( LauRandom::randomFun() );
458  for ( Int_t i( 0 ); i < nBinsX_; i++ ) {
459  for ( Int_t j( 0 ); j < nBinsY_; j++ ) {
460  Double_t currentContent = hist_->GetBinContent( i + 1, j + 1 );
461  Double_t currentError = hist_->GetBinError( i + 1, j + 1 );
462  Double_t newContent = random->Gaus( currentContent, currentError );
463  if ( newContent < 0.0 ) {
464  hist_->SetBinContent( i + 1, j + 1, 0.0 );
465  } else {
466  hist_->SetBinContent( i + 1, j + 1, newContent );
467  }
468  }
469  }
470 }
471 
473 {
474  this->withinGeneration( kTRUE );
475 
476  // Check that the PDF height is up to date
477  this->calcPDFHeight( kinematics );
478 
479  // Generate the value of the abscissa.
480  Bool_t gotAbscissa( kFALSE );
481  if ( this->getRandomFun() == 0 ) {
482  std::cerr << "ERROR in Lau2DHistPdf::generate : Please set the random number generator for this PDF by using the setRandomFun(TRandom*) function."
483  << std::endl;
484  this->withinGeneration( kFALSE );
485  gSystem->Exit( EXIT_FAILURE );
486  }
487 
488  Double_t genPDFVal( 0.0 );
489  LauAbscissas genAbscissas( 2 );
490 
491  Double_t PDFheight = this->getMaxHeight() * ( 1.0 + 1e-11 );
492  while ( ! gotAbscissa ) {
493 
494  genAbscissas[0] = this->getRandomFun()->Rndm() * this->getRange( xName_ ) +
495  this->getMinAbscissa( xName_ );
496  genAbscissas[1] = this->getRandomFun()->Rndm() * this->getRange( yName_ ) +
497  this->getMinAbscissa( yName_ );
498 
499  this->calcLikelihoodInfo( genAbscissas );
500  genPDFVal = this->getUnNormLikelihood();
501 
502  if ( this->getRandomFun()->Rndm() <= genPDFVal / PDFheight ) {
503  gotAbscissa = kTRUE;
504  }
505 
506  if ( genPDFVal > PDFheight ) {
507  std::cerr << "WARNING in LauAbsPdf::generate : genPDFVal = " << genPDFVal
508  << " is larger than the specified PDF height " << this->getMaxHeight()
509  << " for (x,y) = (" << genAbscissas[0] << "," << genAbscissas[1] << ")."
510  << std::endl;
511  std::cerr << " : Need to reset height to be larger than "
512  << genPDFVal
513  << " by using the setMaxHeight(Double_t) function and re-run the Monte Carlo generation!"
514  << std::endl;
515  }
516  }
517 
518  LauFitData genData;
519  genData[xName_] = genAbscissas[0];
520  genData[yName_] = genAbscissas[1];
521 
522  this->withinGeneration( kFALSE );
523 
524  return genData;
525 }
Class for defining a 1D histogram PDF.
Definition: Lau1DHistPdf.hh:45
void checkNormalisation()
Check the normalisation calculation.
Int_t nBinsX_
The number of bins on the x-axis of the histogram.
File containing LauRandom namespace.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:49
virtual Double_t getMaxAbscissa() const
Retrieve the maximum value of the (primary) abscissa.
Definition: LauAbsPdf.hh:141
virtual Double_t getMaxHeight() const
Retrieve the maximum height.
Definition: LauAbsPdf.hh:244
Double_t value() const
The value of the parameter.
Double_t binYWidth_
The histogram y-axis bin width.
virtual Double_t getMinAbscissa() const
Retrieve the minimum value of the (primary) abscissa.
Definition: LauAbsPdf.hh:135
virtual void calcPDFHeight(const LauKinematics *kinematics)
Calculate the PDF height.
virtual void calcNorm()
Calculate the normalisation.
Double_t minY_
The histogram y-axis minimum.
Lau1DHistPdf * xVarPdf_
1D PDF for x variable
std::vector< Double_t > LauAbscissas
The type used for containing multiple abscissa values.
Definition: LauAbsPdf.hh:58
virtual LauFitData generate(const LauKinematics *kinematics)
Generate an event from the PDF.
virtual Double_t getRange() const
Retrieve the range of the (primary) abscissa.
Definition: LauAbsPdf.hh:147
Double_t minX_
The histogram x-axis minimum.
Double_t interpolateXYNorm(Double_t x, Double_t y) const
Perform the interpolation and divide by the normalisation.
Double_t invBinXWidth_
The histogram x-axis inverse bin width.
virtual void cacheInfo(const LauFitDataTree &inputData)
Cache information from data.
Definition: LauAbsPdf.cc:275
Double_t rangeX_
The histogram x-axis range.
Double_t maxY_
The histogram y-axis maximum.
Class to store the input fit variables.
virtual void calcLikelihoodInfo(const LauAbscissas &abscissas)
Calculate the likelihood (and intermediate info) for a given value of the abscissas.
virtual void setNorm(Double_t norm)
Set the normalisation factor.
Definition: LauAbsPdf.hh:348
TString yName_
y variable name
virtual void calcLikelihoodInfo(const LauAbscissas &abscissas)
Calculate the likelihood (and intermediate info) for a given abscissa.
Int_t nBinsY_
The number of bins on the y-axis of the histogram.
TH1 * xProj_
Projection of histogram x-axis.
virtual std::vector< TString > varNames() const
Retrieve the names of the abscissas.
Definition: LauAbsPdf.cc:122
virtual ~Lau2DHistPdf()
Destructor.
virtual TRandom * getRandomFun() const
Retrieve the random function used for MC generation.
Definition: LauAbsPdf.hh:412
virtual UInt_t nInputVars() const
Retrieve the number of abscissas.
Definition: LauAbsPdf.hh:121
virtual void setUnNormPDFVal(Double_t unNormPDFVal)
Set the unnormalised likelihood.
Definition: LauAbsPdf.hh:394
Double_t rangeY_
The histogram y-axis range.
TRandom * randomFun()
Access the singleton random number generator with a particular seed.
Definition: LauRandom.cc:33
Double_t binXWidth_
The histogram x-axis bin width.
virtual void calcLikelihoodInfo(const LauAbscissas &abscissas)=0
Calculate the likelihood (and all associated information) given value(s) of the abscissa(s)
Class for defining the abstract interface for PDF classes.
Definition: LauAbsPdf.hh:54
virtual void cacheInfo(const LauFitDataTree &inputData)
Cache information from data.
virtual Double_t getLikelihood() const
Retrieve the normalised likelihood value.
Definition: LauAbsPdf.cc:403
virtual Bool_t withinGeneration() const
Check whether the generate method is running.
Definition: LauAbsPdf.hh:460
Pure abstract base class for defining a parameter containing an R value.
Definition: LauAbsRValue.hh:45
Bool_t useInterpolation_
Control boolean for using the linear interpolation.
Bool_t fluctuateBins_
Control boolean for performing the fluctuation of the histogram bin contents.
Lau1DHistPdf * yVarPdf_
1D PDF for y variable
File containing declaration of Lau1DHistPdf class.
std::map< TString, Double_t > LauFitData
Type for holding event data.
Double_t maxX_
The histogram x-axis maximum.
virtual void setMaxHeight(Double_t maxHeight)
Set the maximum height.
Definition: LauAbsPdf.hh:354
virtual Double_t getNorm() const
Retrieve the normalisation factor.
Definition: LauAbsPdf.hh:224
TH2 * hist_
The underlying histogram.
Lau2DHistPdf(const std::vector< TString > &theVarNames, const TH2 *hist, const LauFitData &minVals, const LauFitData &maxVals, Bool_t useInterpolation=kTRUE, Bool_t fluctuateBins=kFALSE)
Constructor.
Definition: Lau2DHistPdf.cc:45
Class for calculating 3-body kinematic quantities.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation (unnormalised)
Double_t getBinHistValue(Int_t i, Int_t j) const
Get the bin content from the histogram.
Double_t invBinYWidth_
The histogram y-axis inverse bin width.
void doBinFluctuation()
Fluctuate the histogram bin contents in accordance with their errors.
virtual Double_t getUnNormLikelihood() const
Retrieve the unnormalised likelihood value.
Definition: LauAbsPdf.hh:218
TString xName_
x variable name
virtual Bool_t heightUpToDate() const
Check if the maximum height of the PDF is up to date.
Definition: LauAbsPdf.hh:287
File containing declaration of Lau2DHistPdf class.
TH1 * yProj_
Projection of histogram y-axis.
virtual Bool_t checkRange(const LauAbscissas &abscissas) const
Check that all abscissas are within their allowed ranges.
Definition: LauAbsPdf.cc:243