laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauFitObject.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2013 - 2017.
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 
16 #include "LauFitObject.hh"
17 
19 
20 LauFitObject::LauFitObject() : TObject(),
21  storeCon_(),
22  twoStageFit_(kFALSE),
23  useAsymmFitErrors_(kFALSE),
24  nParams_(0),
25  nFreeParams_(0),
26  withinAsymErrorCalc_(kFALSE),
27  firstExpt_(0),
28  nExpt_(0),
29  iExpt_(0),
30  evtsPerExpt_(0),
31  fitStatus_({-1,0.0,0.0}),
32  worstLogLike_(std::numeric_limits<Double_t>::max()),
33  covMatrix_(),
34  numberOKFits_(0),
36 {
37 }
38 
40 {
41  numberOKFits_ = 0;
42  numberBadFits_ = 0;
43  fitStatus_ = { -1, 0.0, 0.0 };
44 }
45 
46 void LauFitObject::startNewFit( const UInt_t nPars, const UInt_t nFreePars )
47 {
48  // Reset the worst likelihood found to its catch-all value
49  worstLogLike_ = std::numeric_limits<Double_t>::max();
50 
51  // Store the number of fit parameters (total and floating)
52  nParams_ = nPars;
53  nFreeParams_ = nFreePars;
54 }
55 
56 void LauFitObject::storeFitStatus( const LauAbsFitter::FitStatus& status, const TMatrixD& covMatrix )
57 {
58  fitStatus_ = status;
59 
60  covMatrix_.Clear();
61  covMatrix_.ResizeTo( covMatrix.GetNrows(), covMatrix.GetNcols() );
62  covMatrix_.SetMatrixArray( covMatrix.GetMatrixArray() );
63 
64  // Keep track of how many fits worked or failed
65  // NB values of fitStatus_ indicate the status of the error matrix:
66  // 0= not calculated at all
67  // 1= approximation only, not accurate
68  // 2= full matrix, but forced positive-definite
69  // 3= full accurate covariance matrix
70  if (fitStatus_.status == 3) {
71  ++numberOKFits_;
72  } else {
74  }
75 }
76 
77 void LauFitObject::addConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width)
78 {
79  StoreConstraints newCon;
80  newCon.formula_ = formula;
81  newCon.conPars_ = pars;
82  newCon.mean_ = mean;
83  newCon.width_ = width;
84 
85  storeCon_.push_back(newCon);
86 }
87 
worstLogLike_(std::numeric_limits< Double_t >::max())
Double_t width_
The width of the Gaussian constraint to be applied.
Double_t mean_
The mean value of the Gaussian constraint to be applied.
ClassImp(LauAbsCoeffSet)
std::vector< StoreConstraints > storeCon_
Store the constraints for fit parameters until initialisation is complete.
covMatrix_()
void storeFitStatus(const LauAbsFitter::FitStatus &status, const TMatrixD &covMatrix)
Store fit status information.
Definition: LauFitObject.cc:56
TString formula_
The formula to be used in the LauFormulaPar.
virtual void addConstraint(const TString &formula, const std::vector< TString > &pars, const Double_t mean, const Double_t width)
Store constraint information for fit parameters.
Definition: LauFitObject.cc:77
TMatrixD covMatrix_
The fit covariance matrix.
LauAbsFitter::FitStatus fitStatus_
The status of the current fit.
void resetFitCounters()
Reset the good/bad fit counters.
Definition: LauFitObject.cc:39
numberBadFits_(0)
Definition: LauFitObject.cc:35
UInt_t numberOKFits_
The number of successful fits.
Int_t status
The status code of the fit.
Definition: LauAbsFitter.hh:43
Struct to store fit status information.
Definition: LauAbsFitter.hh:41
UInt_t numberBadFits_
The number of fit failures.
UInt_t nParams_
The number of fit parameters.
File containing declaration of LauFitObject class.
Struct to store constraint information until the fit is run.
void startNewFit(const UInt_t nPars, const UInt_t nFreePars)
Indicate the start of a new fit.
Definition: LauFitObject.cc:46
iExpt_(0)
Definition: LauFitNtuple.cc:42
numberOKFits_(0)
Double_t worstLogLike_
The worst log likelihood value found so far.
std::vector< TString > conPars_
The list of LauParameter names to be used in the LauFormulaPar.
The abstract interface for the objects that control the calculation of the likelihood.
Definition: LauFitObject.hh:30
UInt_t nFreeParams_
The number of free fit parameters.