laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauNovosibirskPdf.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2008 - 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 using std::cout;
18 using std::cerr;
19 using std::endl;
20 
21 #include "TMath.h"
22 #include "TSystem.h"
23 
24 #include "LauNovosibirskPdf.hh"
25 #include "LauConstants.hh"
26 
28 
29 LauNovosibirskPdf::LauNovosibirskPdf(const TString& theVarName, const vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
30  LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
31  mean_(0),
32  sigma_(0),
33  tail_(0)
34 {
35  // Constructor for the Novosibirsk PDF.
36  //
37  // The parameters in params are the mean, sigma and tail.
38  // The last two arguments specify the range in which the PDF is defined, and the PDF
39  // will be normalised w.r.t. these limits.
40 
41  mean_ = this->findParameter("mean");
42  sigma_ = this->findParameter("sigma");
43  tail_ = this->findParameter("tail");
44 
45  if ((this->nParameters() != 3) || (mean_ == 0) || (sigma_ == 0) || (tail_ == 0)) {
46  cerr<<"ERROR in LauNovosibirskPdf constructor: LauNovosibirskPdf requires 3 parameters: \"mean\", \"sigma\"and \"tail\" "<<endl;
47  gSystem->Exit(EXIT_FAILURE);
48  }
49 
50  // Cache the normalisation factor
51  this->calcNorm();
52 }
53 
55 {
56  // Destructor
57 }
58 
60 {
61  // Check that the given abscissa is within the allowed range
62  if (!this->checkRange(abscissas)) {
63  gSystem->Exit(EXIT_FAILURE);
64  }
65 
66  // Get our abscissa
67  Double_t abscissa = abscissas[0];
68 
69  // Get the up to date parameter values
70  Double_t mean = mean_->value();
71  Double_t sigma = sigma_->value();
72  Double_t tail = tail_->value();
73 
74  // Evaluate the Novosibirsk PDF value
75 
76 
77  Double_t qa(0.0), qb(0.0), qx(0.0), qy(0.0);
78  Double_t arg(0.0);
79  Double_t value(0.0);
80 
81 
82  if(TMath::Abs(tail) < 1.e-7)
83  arg = 0.5*((abscissa - mean)/sigma)*((abscissa - mean)/sigma);
84  else {
85  qa = tail*TMath::Sqrt(LauConstants::log4);
86  qb = TMath::SinH(qa)/qa;
87  qx = (abscissa - mean)/sigma*qb;
88  qy = 1.0+ tail*qx;
89 
90  //---- Cutting curve from right side
91 
92  if( qy > 1.E-7) {
93  arg = 0.5*( (log(qy)/tail)*(log(qy)/tail) + tail*tail);
94  }else{
95  arg = 15.0;
96  }
97  }
98 
99  value = TMath::Exp(-arg);
100 
101  // if the parameters are floating then we
102  // need to recalculate the normalisation
103  if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
104  this->calcNorm();
105  }
106  this->setUnNormPDFVal(value);
107 }
108 
109 void LauNovosibirskPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
110 {
111  if (this->heightUpToDate()) {
112  return;
113  }
114 
115  // Get the up to date parameter values
116  Double_t mean = mean_->value();
117 
118  LauAbscissas maxPoint(1);
119  maxPoint[0] = mean;
120 
121 
122  // Calculate the PDF height for the Bifurcated Gaussian function.
123 
124  if (mean < this->getMinAbscissa()) {
125  maxPoint[0] = this->getMinAbscissa();
126  } else if (mean > this->getMaxAbscissa()) {
127  maxPoint[0] = this->getMaxAbscissa();
128  }
129 
130  this->calcLikelihoodInfo(maxPoint);
131  Double_t height = this->getUnNormLikelihood();
132 
133  // Multiply by a small factor to avoid problems from rounding errors
134  height *= (1.0 + 1e-1);
135 
136  this->setMaxHeight(height);
137 }
138 
virtual void setUnNormPDFVal(Double_t unNormPDFVal)
Set the unnormalised likelihood.
Definition: LauAbsPdf.hh:369
virtual Double_t getMinAbscissa() const
Retrieve the minimum value of the (primary) abscissa.
Definition: LauAbsPdf.hh:117
Class for defining a Novosibirsk function PDF.
virtual Bool_t heightUpToDate() const
Check if the maximum height of the PDF is up to date.
Definition: LauAbsPdf.hh:264
ClassImp(LauAbsCoeffSet)
virtual void calcPDFHeight(const LauKinematics *kinematics)
Calculate the PDF height.
virtual Double_t getUnNormLikelihood() const
Retrieve the unnormalised likelihood value.
Definition: LauAbsPdf.hh:196
File containing declaration of LauNovosibirskPdf class.
virtual Bool_t checkRange(const LauAbscissas &abscissas) const
Check that all abscissas are within their allowed ranges.
Definition: LauAbsPdf.cc:213
virtual ~LauNovosibirskPdf()
Destructor.
virtual Bool_t withinNormCalc() const
Check whether the calcNorm method is running.
Definition: LauAbsPdf.hh:423
LauAbsRValue * sigma_
Gaussian sigma.
virtual Double_t getMaxAbscissa() const
Retrieve the maximum value of the (primary) abscissa.
Definition: LauAbsPdf.hh:123
virtual void setMaxHeight(Double_t maxHeight)
Set the maximum height.
Definition: LauAbsPdf.hh:331
LauAbsRValue * tail_
Gaussian tail.
const Double_t log4
Logarithm of four.
virtual Bool_t withinGeneration() const
Check whether the generate method is running.
Definition: LauAbsPdf.hh:435
virtual Bool_t cachePDF() const
Check if the PDF is to be cached.
Definition: LauAbsPdf.hh:276
virtual void calcLikelihoodInfo(const LauAbscissas &abscissas)
Calculate the likelihood (and intermediate info) for a given abscissa.
File containing LauConstants namespace.
virtual Double_t value() const =0
Return the value of the parameter.
virtual void calcNorm()
Calculate the normalisation factor of the PDF.
Definition: LauAbsPdf.cc:430
Class for defining the abstract interface for PDF classes.
Definition: LauAbsPdf.hh:41
LauAbsRValue * mean_
Gaussian mean.
Class for calculating 3-body kinematic quantities.
Double_t value() const
The value of the parameter.
Pure abstract base class for defining a parameter containing an R value.
Definition: LauAbsRValue.hh:29
std::vector< Double_t > LauAbscissas
The type used for containing multiple abscissa values.
Definition: LauAbsPdf.hh:45