laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauMinuit.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2013 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 
35 #ifndef LAU_MINUIT
36 #define LAU_MINUIT
37 
38 #include "LauAbsFitter.hh"
39 #include "LauPrint.hh"
40 
41 #include "Rtypes.h"
42 #include "TMatrixD.h"
43 
44 #include <utility>
45 #include <vector>
46 
47 class LauParameter;
48 class TVirtualFitter;
49 
50 class LauMinuit : public LauAbsFitter {
51 
52  public:
54  virtual ~LauMinuit() = default;
55 
57 
61  virtual void initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters );
62 
64  virtual LauFitObject* getFitObject();
65 
67  virtual UInt_t nParameters() const { return nParams_; }
68 
70  virtual UInt_t nFreeParameters() const { return nFreeParams_; }
71 
73  virtual Bool_t twoStageFit() const { return twoStageFit_; }
74 
76 
86  virtual void twoStageFit( Bool_t doTwoStageFit ) { twoStageFit_ = doTwoStageFit; }
87 
89  virtual Bool_t useAsymmFitErrors() const { return useAsymmFitErrors_; }
90 
92 
95  virtual void useAsymmFitErrors( Bool_t useAsymmErrors ) { useAsymmFitErrors_ = useAsymmErrors; }
96 
98 
101  virtual const FitStatus& minimise();
102 
104  virtual void fixSecondStageParameters();
105 
107  virtual void releaseSecondStageParameters();
108 
110  virtual void updateParameters();
111 
113  virtual const TMatrixD& covarianceMatrix() const { return covMatrix_; }
114 
115  private:
117  friend class LauFitter;
118 
120  LauMinuit( const UInt_t maxPar = 100, const LauOutputLevel verbosity = LauOutputLevel::Standard );
121 
123  LauMinuit( const LauMinuit& ) = delete;
124 
126  LauMinuit( LauMinuit&& ) = delete;
127 
129  LauMinuit& operator=( const LauMinuit& ) = delete;
130 
132  LauMinuit& operator=( LauMinuit&& ) = delete;
133 
135  TVirtualFitter* minuit_ { nullptr };
136 
138  const UInt_t maxPar_ { 100 };
139 
142 
144  std::vector<LauParameter*> params_;
145 
147  UInt_t nParams_ { 0 };
148 
150  UInt_t nFreeParams_ { 0 };
151 
153  Bool_t twoStageFit_ { kFALSE };
154 
156  Bool_t useAsymmFitErrors_ { kFALSE };
157 
159  FitStatus fitStatus_ { -1, 0.0, 0.0 };
160 
162  TMatrixD covMatrix_;
163 
164  ClassDef( LauMinuit, 0 );
165 };
166 
167 #endif
virtual const TMatrixD & covarianceMatrix() const
Retrieve the fit covariance matrix.
Definition: LauMinuit.hh:113
Factory class for creating and providing access to the fitter.
Definition: LauFitter.hh:47
Class for defining the fit parameter objects.
Definition: LauParameter.hh:49
virtual void releaseSecondStageParameters()
Release parameters marked as "second stage".
Definition: LauMinuit.cc:269
Struct to store fit status information.
Definition: LauAbsFitter.hh:54
File containing declaration of LauAbsFitter class.
FitStatus fitStatus_
The status of the fit.
Definition: LauMinuit.hh:159
virtual void initialise(LauFitObject *fitObj, const std::vector< LauParameter * > &parameters)
Initialise the fitter, setting the information on the parameters.
Definition: LauMinuit.cc:67
UInt_t nFreeParams_
The number of free parameters.
Definition: LauMinuit.hh:150
virtual LauFitObject * getFitObject()
Get the object that controls the calculation of the likelihood.
Definition: LauMinuit.cc:154
@ Standard
Normal level of printout.
LauMinuit(LauMinuit &&)=delete
Move constructor - private and not implemented.
TMatrixD covMatrix_
The covariance matrix.
Definition: LauMinuit.hh:162
LauMinuit & operator=(const LauMinuit &)=delete
Copy assignment operator - private and not implemented.
The abstract interface to the fitter.
Definition: LauAbsFitter.hh:47
Bool_t useAsymmFitErrors_
Option to use asymmetric errors.
Definition: LauMinuit.hh:156
Bool_t twoStageFit_
Option to perform a two stage fit.
Definition: LauMinuit.hh:153
virtual Bool_t twoStageFit() const
Determine whether the two-stage fit is enabled.
Definition: LauMinuit.hh:73
virtual Bool_t useAsymmFitErrors() const
Determine whether calculation of asymmetric errors is enabled.
Definition: LauMinuit.hh:89
LauMinuit & operator=(LauMinuit &&)=delete
Move assignment operator - private and not implemented.
LauMinuit(const LauMinuit &)=delete
Copy constructor - private and not implemented.
The interface to the Minuit fitter.
Definition: LauMinuit.hh:50
virtual void twoStageFit(Bool_t doTwoStageFit)
Turn on or off the two stage fit.
Definition: LauMinuit.hh:86
virtual ~LauMinuit()=default
Destructor.
virtual UInt_t nFreeParameters() const
Get the number of floating fit parameters.
Definition: LauMinuit.hh:70
TVirtualFitter * minuit_
The interface to Minuit.
Definition: LauMinuit.hh:135
virtual const FitStatus & minimise()
Perform the minimisation of the fit function.
Definition: LauMinuit.cc:159
std::vector< LauParameter * > params_
The fit parameters.
Definition: LauMinuit.hh:144
LauOutputLevel
Enumeration to define verbosity level for various printouts.
Definition: LauPrint.hh:40
LauMinuit(const UInt_t maxPar=100, const LauOutputLevel verbosity=LauOutputLevel::Standard)
Constructor.
Definition: LauMinuit.cc:51
virtual UInt_t nParameters() const
Get the total number of fit parameters.
Definition: LauMinuit.hh:67
UInt_t nParams_
The total number of parameters.
Definition: LauMinuit.hh:147
const LauOutputLevel outputLevel_
The verbosity level of the fitter.
Definition: LauMinuit.hh:141
File containing declaration of LauPrint class and LauOutputLevel enum.
The abstract interface for the objects that control the calculation of the likelihood.
Definition: LauFitObject.hh:47
virtual void useAsymmFitErrors(Bool_t useAsymmErrors)
Turn on or off the computation of asymmetric errors (i.e. the MINOS routine)
Definition: LauMinuit.hh:95
virtual void fixSecondStageParameters()
Fix parameters marked as "second stage".
Definition: LauMinuit.cc:257
virtual void updateParameters()
Update the values and errors of the parameters based on the fit minimum.
Definition: LauMinuit.cc:281
const UInt_t maxPar_
The maximum number of parameters.
Definition: LauMinuit.hh:138