laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.

Class for defining a 2D histogram PDF. More...

#include <Lau2DHistPdf.hh>

Inheritance diagram for Lau2DHistPdf:
LauAbsPdf

Public Member Functions

 Lau2DHistPdf (const std::vector< TString > &theVarNames, const TH2 *hist, const LauFitData &minVals, const LauFitData &maxVals, Bool_t useInterpolation=kTRUE, Bool_t fluctuateBins=kFALSE)
 Constructor. More...
 
virtual ~Lau2DHistPdf ()
 Destructor.
 
Double_t getMinX () const
 Get the minimum value of x-axis abscissa.
 
Double_t getMaxX () const
 Get the maximum value of x-axis abscissa.
 
Double_t getRangeX () const
 Get the range of x-axis abscissa values.
 
Double_t getMinY () const
 Get the minimum value of y-axis abscissa.
 
Double_t getMaxY () const
 Get the maximum value of y-axis abscissa.
 
Double_t getRangeY () const
 Get the range of y-axis abscissa values.
 
virtual void cacheInfo (const LauFitDataTree &inputData)
 Cache information from data. More...
 
virtual void calcLikelihoodInfo (const LauAbscissas &abscissas)
 Calculate the likelihood (and intermediate info) for a given value of the abscissas. More...
 
virtual void calcLikelihoodInfo (UInt_t iEvt)
 Calculate the likelihood (and intermediate info) for a given event number. More...
 
virtual Double_t getLikelihood (const TString &theVarName) const
 Get likelihood only for the given variable. More...
 
virtual void calcNorm ()
 Calculate the normalisation.
 
virtual void calcPDFHeight (const LauKinematics *kinematics)
 Calculate the PDF height. More...
 
virtual LauFitData generate (const LauKinematics *kinematics)
 Generate an event from the PDF. More...
 
virtual Double_t getLikelihood () const
 Retrieve the normalised likelihood value. More...
 
virtual Double_t getLikelihood (const TString &theVarName) const
 For multidimentional PDFs, retrieve the normalised likelihood value of a named variable. More...
 
- Public Member Functions inherited from LauAbsPdf
 LauAbsPdf (const TString &theVarName, const std::vector< LauAbsRValue * > &params, Double_t minAbscissa, Double_t maxAbscissa)
 Constructor for a 1D PDF. More...
 
 LauAbsPdf (const std::vector< TString > &theVarNames, const std::vector< LauAbsRValue * > &params, const LauFitData &minAbscissas, const LauFitData &maxAbscissas)
 Constructor for a multidimensional PDF. More...
 
virtual ~LauAbsPdf ()
 Destructor.
 
virtual const TString & varName () const
 Retrieve the name of the abscissa. More...
 
virtual std::vector< TString > varNames () const
 Retrieve the names of the abscissas. More...
 
virtual UInt_t nParameters () const
 Retrieve the number of PDF parameters. More...
 
virtual UInt_t nFixedParameters () const
 Retrieve the number of fixed PDF parameters. More...
 
virtual UInt_t nInputVars () const
 Retrieve the number of abscissas. More...
 
virtual Bool_t isDPDependent () const
 Specifies whether or not the PDF is DP dependent. More...
 
virtual Double_t getMinAbscissa () const
 Retrieve the minimum value of the (primary) abscissa. More...
 
virtual Double_t getMaxAbscissa () const
 Retrieve the maximum value of the (primary) abscissa. More...
 
virtual Double_t getRange () const
 Retrieve the range of the (primary) abscissa. More...
 
virtual Double_t getMinAbscissa (const TString &theVarName) const
 Retrieve the minimum value of the specified abscissa. More...
 
virtual Double_t getMaxAbscissa (const TString &theVarName) const
 Retrieve the maximum value of the specified abscissa. More...
 
virtual Double_t getRange (const TString &theVarName) const
 Retrieve the range of the specified abscissa. More...
 
virtual LauFitData getMinAbscissas () const
 Retrieve the minimum values of all the abscissas. More...
 
virtual LauFitData getMaxAbscissas () const
 Retrieve the maximum values of all the abscissas. More...
 
virtual LauFitData getRanges () const
 Retrieve the ranges of all the abscissas. More...
 
virtual void updatePulls ()
 Update the pulls for all parameters.
 
virtual Double_t getUnNormLikelihood () const
 Retrieve the unnormalised likelihood value. More...
 
virtual Double_t getNorm () const
 Retrieve the normalisation factor. More...
 
virtual Double_t getLikelihood () const
 Retrieve the normalised likelihood value. More...
 
virtual Double_t getMaxHeight () const
 Retrieve the maximum height. More...
 
virtual void setRandomFun (TRandom *randomFun)
 Set the random function used for toy MC generation. More...
 
virtual const std::vector< LauAbsRValue * > & getParameters () const
 Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit. More...
 
virtual std::vector< LauAbsRValue * > & getParameters ()
 Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit. More...
 
virtual Bool_t heightUpToDate () const
 Check if the maximum height of the PDF is up to date. More...
 
virtual void heightUpToDate (Bool_t hutd)
 Set whether the height is up to date. More...
 
virtual Bool_t cachePDF () const
 Check if the PDF is to be cached. More...
 
virtual Int_t nNormPoints () const
 Retrieve the number of points to integrate over when normalising. More...
 
virtual void nNormPoints (Int_t nPoints)
 Set the number of points to integrate over when normalising. More...
 
virtual IntMethod integMethod () const
 Retrieve the integration method used to normalise the PDF. More...
 
virtual void integMethod (IntMethod method)
 Set the integration method used to normalise the PDF. More...
 

Protected Member Functions

void doBinFluctuation ()
 Fluctuate the histogram bin contents in accordance with their errors.
 
void checkNormalisation ()
 Check the normalisation calculation.
 
Double_t getBinHistValue (Int_t i, Int_t j) const
 Get the bin content from the histogram. More...
 
Double_t interpolateXY (Double_t x, Double_t y) const
 Perform the interpolation (unnormalised) More...
 
Double_t interpolateXYNorm (Double_t x, Double_t y) const
 Perform the interpolation and divide by the normalisation. More...
 
- Protected Member Functions inherited from LauAbsPdf
virtual void cachePDF (Bool_t doCachePDF)
 Set whether the PDF is to be cached. More...
 
virtual Double_t integrGaussLegendre ()
 Integrate the PDF using the Gauss-Legendre method. More...
 
virtual Double_t integTrapezoid ()
 Integrate the PDF using the simple trapezoid method. More...
 
virtual void setNorm (Double_t norm)
 Set the normalisation factor. More...
 
virtual void setMaxHeight (Double_t maxHeight)
 Set the maximum height. More...
 
virtual void setMinAbscissa (const TString &theVarName, Double_t minAbscissa)
 Set the minimum value of the specified abscissa. More...
 
virtual void setMaxAbscissa (const TString &theVarName, Double_t maxAbscissa)
 Set the maximum value of the specified abscissa. More...
 
virtual void setRange (const TString &theVarName, Double_t minAbscissa, Double_t maxAbscissa)
 Set the range of the specified abscissa. More...
 
virtual Bool_t checkRange (const LauAbscissas &abscissas) const
 Check that all abscissas are within their allowed ranges. More...
 
virtual void setUnNormPDFVal (Double_t unNormPDFVal)
 Set the unnormalised likelihood.
 
virtual LauAbsRValuefindParameter (const TString &parName)
 Retrieve the specified parameter. More...
 
virtual const LauAbsRValuefindParameter (const TString &parName) const
 Retrieve the specified parameter. More...
 
virtual TRandom * getRandomFun () const
 Retrieve the random function used for MC generation. More...
 
virtual std::vector< LauAbscissas > & getAbscissas ()
 Retrieve the abscissa(s) More...
 
virtual const std::vector< LauAbscissas > & getAbscissas () const
 Retrieve the abscissa(s) More...
 
virtual std::vector< Double_t > & getUnNormPDFValues ()
 Retrieve the cached unnormalised likelihood values. More...
 
virtual const std::vector< Double_t > & getUnNormPDFValues () const
 Retrieve the cached unnormalised likelihood values. More...
 
virtual void addParameters (std::vector< LauAbsRValue * > &params)
 Add parameters to the PDF. More...
 
virtual Bool_t withinNormCalc () const
 Check whether the calcNorm method is running. More...
 
virtual void withinNormCalc (Bool_t yorn)
 Set flag to track whether the calcNorm method is running. More...
 
virtual Bool_t withinGeneration () const
 Check whether the generate method is running. More...
 
virtual void withinGeneration (Bool_t yorn)
 Set flag to track whether the generate method is running. More...
 
virtual Bool_t normWeightsDone () const
 Check whether the normalisation weights have been calculated. More...
 
virtual void normWeightsDone (Bool_t yorn)
 Set whether the normalisation weights have been calculated. More...
 
virtual void getNormWeights ()
 Calculate the weights and abscissas used for normalisation.
 
virtual const std::vector< LauAbscissas > & normAbscissas () const
 Retrieve the abscissa points used for normalisation. More...
 
virtual const std::vector< Double_t > & normWeights () const
 Retrieve the weights used for normalisation. More...
 

Private Member Functions

 Lau2DHistPdf (const Lau2DHistPdf &other)
 Copy constructor (not implemented)
 
Lau2DHistPdfoperator= (const Lau2DHistPdf &other)
 Copy assignment operator (not implemented)
 

Private Attributes

TH2 * hist_
 The underlying histogram.
 
TH1 * xProj_
 Projection of histogram x-axis.
 
TH1 * yProj_
 Projection of histogram y-axis.
 
Lau1DHistPdfxVarPdf_
 1D PDF for x variable
 
Lau1DHistPdfyVarPdf_
 1D PDF for y variable
 
TString xName_
 x variable name
 
TString yName_
 y variable name
 
Int_t nBinsX_
 The number of bins on the x-axis of the histogram.
 
Int_t nBinsY_
 The number of bins on the y-axis of the histogram.
 
Double_t minX_
 The histogram x-axis minimum.
 
Double_t maxX_
 The histogram x-axis maximum.
 
Double_t minY_
 The histogram y-axis minimum.
 
Double_t maxY_
 The histogram y-axis maximum.
 
Double_t rangeX_
 The histogram x-axis range.
 
Double_t rangeY_
 The histogram y-axis range.
 
Double_t binXWidth_
 The histogram x-axis bin width.
 
Double_t binYWidth_
 The histogram y-axis bin width.
 
Double_t invBinXWidth_
 The histogram x-axis inverse bin width.
 
Double_t invBinYWidth_
 The histogram y-axis inverse bin width.
 
Bool_t useInterpolation_
 Control boolean for using the linear interpolation.
 
Bool_t fluctuateBins_
 Control boolean for performing the fluctuation of the histogram bin contents.
 

Additional Inherited Members

- Public Types inherited from LauAbsPdf
enum  IntMethod { GaussLegendre, Trapezoid }
 The possible numerical intergration methods. More...
 
typedef std::vector< Double_t > LauAbscissas
 The type used for containing multiple abscissa values.
 

Detailed Description

Class for defining a 2D histogram PDF.

Class for defining a 2D histogram PDF. Employs linear interpolation to get the histogram value based on how far away a point is to nearby bin centres. The returned values are normalised to the total area.

Definition at line 47 of file Lau2DHistPdf.hh.

Constructor & Destructor Documentation

◆ Lau2DHistPdf()

Lau2DHistPdf::Lau2DHistPdf ( const std::vector< TString > &  theVarNames,
const TH2 *  hist,
const LauFitData minVals,
const LauFitData maxVals,
Bool_t  useInterpolation = kTRUE,
Bool_t  fluctuateBins = kFALSE 
)

Constructor.

Parameters
[in]theVarNamesthe names of the abscissa variables
[in]histthe 2D histogram from which the PDF should be constructed
[in]minValsthe minimum values of the abscissas
[in]maxValsthe maximum values of the abscissas
[in]useInterpolationboolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
[in]fluctuateBinsboolean flag to determine whether the bin contents should be fluctuated in accordance with their errors. The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.

Definition at line 45 of file Lau2DHistPdf.cc.

Member Function Documentation

◆ cacheInfo()

void Lau2DHistPdf::cacheInfo ( const LauFitDataTree inputData)
virtual

Cache information from data.

Parameters
[in]inputDatathe input data

Reimplemented from LauAbsPdf.

Definition at line 445 of file Lau2DHistPdf.cc.

◆ calcLikelihoodInfo() [1/2]

void Lau2DHistPdf::calcLikelihoodInfo ( const LauAbscissas abscissas)
virtual

Calculate the likelihood (and intermediate info) for a given value of the abscissas.

Parameters
[in]abscissasthe abscissa values

Implements LauAbsPdf.

Definition at line 403 of file Lau2DHistPdf.cc.

◆ calcLikelihoodInfo() [2/2]

void Lau2DHistPdf::calcLikelihoodInfo ( UInt_t  iEvt)
virtual

Calculate the likelihood (and intermediate info) for a given event number.

Parameters
[in]iEvtevent number

Reimplemented from LauAbsPdf.

Definition at line 422 of file Lau2DHistPdf.cc.

◆ calcPDFHeight()

void Lau2DHistPdf::calcPDFHeight ( const LauKinematics kinematics)
virtual

Calculate the PDF height.

Parameters
[in]kinematicsthe current DP kinematics (not strictly required in this case since PDF has no DP dependence)

Implements LauAbsPdf.

Definition at line 191 of file Lau2DHistPdf.cc.

◆ generate()

LauFitData Lau2DHistPdf::generate ( const LauKinematics kinematics)
virtual

Generate an event from the PDF.

Parameters
[in]kinematicsthe current DP kinematics (used to determine the DP position by some PDFs that have dependence on it)
Returns
generated data

Reimplemented from LauAbsPdf.

Definition at line 472 of file Lau2DHistPdf.cc.

◆ getBinHistValue()

Double_t Lau2DHistPdf::getBinHistValue ( Int_t  i,
Int_t  j 
) const
protected

Get the bin content from the histogram.

Parameters
[in]ithe x-axis bin number
[in]jthe y-axis bin number
Returns
the bin conent

Definition at line 261 of file Lau2DHistPdf.cc.

◆ getLikelihood() [1/3]

Double_t LauAbsPdf::getLikelihood

Retrieve the normalised likelihood value.

Returns
the normalised likelihood value

Definition at line 230 of file LauAbsPdf.cc.

◆ getLikelihood() [2/3]

Double_t Lau2DHistPdf::getLikelihood ( const TString &  theVarName) const
virtual

Get likelihood only for the given variable.

Parameters
[in]theVarNamethe variable name (must be one of the two dimensions of this histogram!)
Returns
likelihood value

Reimplemented from LauAbsPdf.

Definition at line 432 of file Lau2DHistPdf.cc.

◆ getLikelihood() [3/3]

Double_t LauAbsPdf::getLikelihood

For multidimentional PDFs, retrieve the normalised likelihood value of a named variable.

Defaults to simply returning the complete likelihood. Should be overridden by multidimensional PDFs.

Returns
the normalised likelihood value of the named variable

Definition at line 238 of file LauAbsPdf.cc.

◆ interpolateXY()

Double_t Lau2DHistPdf::interpolateXY ( Double_t  x,
Double_t  y 
) const
protected

Perform the interpolation (unnormalised)

Parameters
[in]xthe x-axis abscissa value
[in]ythe y-aixs abscissa value
Returns
the unnormalised PDF value

Definition at line 289 of file Lau2DHistPdf.cc.

◆ interpolateXYNorm()

Double_t Lau2DHistPdf::interpolateXYNorm ( Double_t  x,
Double_t  y 
) const
protected

Perform the interpolation and divide by the normalisation.

Parameters
[in]xthe x-axis abscissa value
[in]ythe y-axis abscissa value
Returns
the normalised PDF value

Definition at line 281 of file Lau2DHistPdf.cc.


The documentation for this class was generated from the following files: