laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauFitObject.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2017 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 
30 #include "LauFitObject.hh"
31 
33 
34 LauFitObject::LauFitObject() : TObject(),
35  storeCon_(),
36  twoStageFit_(kFALSE),
37  useAsymmFitErrors_(kFALSE),
38  nParams_(0),
39  nFreeParams_(0),
40  withinAsymErrorCalc_(kFALSE),
41  firstExpt_(0),
42  nExpt_(0),
43  iExpt_(0),
44  evtsPerExpt_(0),
45  fitStatus_({-1,0.0,0.0}),
46  worstLogLike_(std::numeric_limits<Double_t>::max()),
47  covMatrix_(),
48  numberOKFits_(0),
50 {
51 }
52 
54 {
55  numberOKFits_ = 0;
56  numberBadFits_ = 0;
57  fitStatus_ = { -1, 0.0, 0.0 };
58 }
59 
60 void LauFitObject::startNewFit( const UInt_t nPars, const UInt_t nFreePars )
61 {
62  // Reset the worst likelihood found to its catch-all value
63  worstLogLike_ = std::numeric_limits<Double_t>::max();
64 
65  // Store the number of fit parameters (total and floating)
66  nParams_ = nPars;
67  nFreeParams_ = nFreePars;
68 }
69 
70 void LauFitObject::storeFitStatus( const LauAbsFitter::FitStatus& status, const TMatrixD& covMatrix )
71 {
72  fitStatus_ = status;
73 
74  covMatrix_.Clear();
75  covMatrix_.ResizeTo( covMatrix.GetNrows(), covMatrix.GetNcols() );
76  covMatrix_.SetMatrixArray( covMatrix.GetMatrixArray() );
77 
78  // Keep track of how many fits worked or failed
79  // NB values of fitStatus_ indicate the status of the error matrix:
80  // 0= not calculated at all
81  // 1= approximation only, not accurate
82  // 2= full matrix, but forced positive-definite
83  // 3= full accurate covariance matrix
84  if (fitStatus_.status == 3) {
85  ++numberOKFits_;
86  } else {
88  }
89 }
90 
91 void LauFitObject::addConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width)
92 {
93  StoreConstraints newCon;
94  newCon.formula_ = formula;
95  newCon.conPars_ = pars;
96  newCon.mean_ = mean;
97  newCon.width_ = width;
98 
99  storeCon_.push_back(newCon);
100 }
101 
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:70
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:91
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:53
numberBadFits_(0)
Definition: LauFitObject.cc:49
UInt_t numberOKFits_
The number of successful fits.
Int_t status
The status code of the fit.
Definition: LauAbsFitter.hh:57
Struct to store fit status information.
Definition: LauAbsFitter.hh:55
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:60
iExpt_(0)
Definition: LauFitNtuple.cc:56
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:44
UInt_t nFreeParams_
The number of free fit parameters.