laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0
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. More...
 
Double_t getMinX () const
 Get the minimum value of x-axis abscissa. More...
 
Double_t getMaxX () const
 Get the maximum value of x-axis abscissa. More...
 
Double_t getRangeX () const
 Get the range of x-axis abscissa values. More...
 
Double_t getMinY () const
 Get the minimum value of y-axis abscissa. More...
 
Double_t getMaxY () const
 Get the maximum value of y-axis abscissa. More...
 
Double_t getRangeY () const
 Get the range of y-axis abscissa values. More...
 
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. More...
 
virtual void calcPDFHeight (const LauKinematics *kinematics)
 Calculate the PDF height. More...
 
virtual LauFitData generate (const LauKinematics *kinematics)
 Generate an event from the PDF. 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. More...
 
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. More...
 
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. More...
 
void checkNormalisation ()
 Check the normalisation calculation. More...
 
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. More...
 
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. More...
 
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) More...
 
Lau2DHistPdfoperator= (const Lau2DHistPdf &other)
 Copy assignment operator (not implemented) More...
 

Private Attributes

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

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. More...
 

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 33 of file Lau2DHistPdf.hh.

Constructor & Destructor Documentation

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 33 of file Lau2DHistPdf.cc.

Lau2DHistPdf::~Lau2DHistPdf ( )
virtual

Destructor.

Definition at line 151 of file Lau2DHistPdf.cc.

Lau2DHistPdf::Lau2DHistPdf ( const Lau2DHistPdf other)
private

Copy constructor (not implemented)

Member Function Documentation

void Lau2DHistPdf::cacheInfo ( const LauFitDataTree inputData)
virtual

Cache information from data.

Parameters
[in]inputDatathe input data

Reimplemented from LauAbsPdf.

Definition at line 402 of file Lau2DHistPdf.cc.

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 361 of file Lau2DHistPdf.cc.

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 380 of file Lau2DHistPdf.cc.

void Lau2DHistPdf::calcNorm ( )
virtual

Calculate the normalisation.

Reimplemented from LauAbsPdf.

Definition at line 173 of file Lau2DHistPdf.cc.

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 161 of file Lau2DHistPdf.cc.

void Lau2DHistPdf::checkNormalisation ( )
protected

Check the normalisation calculation.

Definition at line 198 of file Lau2DHistPdf.cc.

void Lau2DHistPdf::doBinFluctuation ( )
protected

Fluctuate the histogram bin contents in accordance with their errors.

Definition at line 412 of file Lau2DHistPdf.cc.

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 429 of file Lau2DHistPdf.cc.

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 228 of file Lau2DHistPdf.cc.

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 390 of file Lau2DHistPdf.cc.

Double_t Lau2DHistPdf::getMaxX ( ) const
inline

Get the maximum value of x-axis abscissa.

Definition at line 57 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::getMaxY ( ) const
inline

Get the maximum value of y-axis abscissa.

Definition at line 66 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::getMinX ( ) const
inline

Get the minimum value of x-axis abscissa.

Definition at line 54 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::getMinY ( ) const
inline

Get the minimum value of y-axis abscissa.

Definition at line 63 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::getRangeX ( ) const
inline

Get the range of x-axis abscissa values.

Definition at line 60 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::getRangeY ( ) const
inline

Get the range of y-axis abscissa values.

Definition at line 69 of file Lau2DHistPdf.hh.

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 255 of file Lau2DHistPdf.cc.

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 247 of file Lau2DHistPdf.cc.

Lau2DHistPdf& Lau2DHistPdf::operator= ( const Lau2DHistPdf other)
private

Copy assignment operator (not implemented)

Member Data Documentation

Double_t Lau2DHistPdf::binXWidth_
private

The histogram x-axis bin width.

Definition at line 187 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::binYWidth_
private

The histogram y-axis bin width.

Definition at line 189 of file Lau2DHistPdf.hh.

Bool_t Lau2DHistPdf::fluctuateBins_
private

Control boolean for performing the fluctuation of the histogram bin contents.

Definition at line 199 of file Lau2DHistPdf.hh.

TH2* Lau2DHistPdf::hist_
private

The underlying histogram.

Definition at line 153 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::invBinXWidth_
private

The histogram x-axis inverse bin width.

Definition at line 192 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::invBinYWidth_
private

The histogram y-axis inverse bin width.

Definition at line 194 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::maxX_
private

The histogram x-axis maximum.

Definition at line 176 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::maxY_
private

The histogram y-axis maximum.

Definition at line 180 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::minX_
private

The histogram x-axis minimum.

Definition at line 174 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::minY_
private

The histogram y-axis minimum.

Definition at line 178 of file Lau2DHistPdf.hh.

Int_t Lau2DHistPdf::nBinsX_
private

The number of bins on the x-axis of the histogram.

Definition at line 170 of file Lau2DHistPdf.hh.

Int_t Lau2DHistPdf::nBinsY_
private

The number of bins on the y-axis of the histogram.

Definition at line 172 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::rangeX_
private

The histogram x-axis range.

Definition at line 182 of file Lau2DHistPdf.hh.

Double_t Lau2DHistPdf::rangeY_
private

The histogram y-axis range.

Definition at line 184 of file Lau2DHistPdf.hh.

Bool_t Lau2DHistPdf::useInterpolation_
private

Control boolean for using the linear interpolation.

Definition at line 197 of file Lau2DHistPdf.hh.

TString Lau2DHistPdf::xName_
private

x variable name

Definition at line 165 of file Lau2DHistPdf.hh.

TH1* Lau2DHistPdf::xProj_
private

Projection of histogram x-axis.

Definition at line 155 of file Lau2DHistPdf.hh.

Lau1DHistPdf* Lau2DHistPdf::xVarPdf_
private

1D PDF for x variable

Definition at line 160 of file Lau2DHistPdf.hh.

TString Lau2DHistPdf::yName_
private

y variable name

Definition at line 167 of file Lau2DHistPdf.hh.

TH1* Lau2DHistPdf::yProj_
private

Projection of histogram y-axis.

Definition at line 157 of file Lau2DHistPdf.hh.

Lau1DHistPdf* Lau2DHistPdf::yVarPdf_
private

1D PDF for y variable

Definition at line 162 of file Lau2DHistPdf.hh.


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