laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauFitter.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2005 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 
29 #include "LauFitter.hh"
30 
31 #include "LauMinuit.hh"
32 
33 #include <array>
34 #include <iostream>
35 #include <memory>
36 
37 std::unique_ptr<LauAbsFitter> LauFitter::theInstance_ = nullptr;
40 UInt_t LauFitter::fitterMaxPars_ = 100;
41 
42 void LauFitter::setFitterType( const Type type )
43 {
44  if ( theInstance_ != nullptr ) {
45  std::cerr << "ERROR in LauFitter::setFitterType : The fitter has already been created, cannot change the type now."
46  << std::endl;
47  return;
48  }
49 
50  fitterType_ = type;
51 }
52 
54 {
55  if ( theInstance_ != nullptr ) {
56  std::cerr << "ERROR in LauFitter::setFitterVerbosity : The fitter has already been created, cannot change the verbosity now."
57  << std::endl;
58  return;
59  }
60 
61  fitterVerbosity_ = level;
62 }
63 
64 void LauFitter::setFitterMaxPars( const UInt_t maxPars )
65 {
66  if ( theInstance_ != nullptr ) {
67  std::cerr << "ERROR in LauFitter::setFitterMaxPars : The fitter has already been created, cannot change the maximum number of parameters now."
68  << std::endl;
69  return;
70  }
71 
72  fitterMaxPars_ = maxPars;
73 }
74 
76 {
77  // Returns a reference to a singleton LauAbsFitter object.
78  // Creates the object the first time it is called.
79 
80  if ( theInstance_ == nullptr ) {
81  if ( fitterType_ == Type::Minuit ) {
82  // NB cannot use std::make_unique here since the LauMinuit constructor is private
84  }
85  }
86 
87  return *theInstance_;
88 }
89 
91 {
92  // destroy the current fitter
93  theInstance_.reset();
94 
95  // restore the default settings
98  fitterMaxPars_ = 100;
99 }
static LauOutputLevel fitterVerbosity_
The fitter verbosity.
Definition: LauFitter.hh:111
static Type fitterType_
The fitter type.
Definition: LauFitter.hh:108
File containing declaration of LauFitter class.
static std::unique_ptr< LauAbsFitter > theInstance_
Pointer to the singleton fitter instance.
Definition: LauFitter.hh:105
static void setFitterMaxPars(const UInt_t maxPars)
Set the maximum number of parameters for the fitter.
Definition: LauFitter.cc:64
@ Standard
Normal level of printout.
static LauAbsFitter & fitter()
Method that provides access to the singleton fitter.
Definition: LauFitter.cc:75
static UInt_t fitterMaxPars_
The maximum number of parameters for the fitter.
Definition: LauFitter.hh:114
File containing declaration of LauMinuit class.
The abstract interface to the fitter.
Definition: LauAbsFitter.hh:47
Type
The types of fitter available.
Definition: LauFitter.hh:51
The interface to the Minuit fitter.
Definition: LauMinuit.hh:50
static void setFitterType(const Type type)
Set the type of the fitter.
Definition: LauFitter.cc:42
static void destroyFitter()
Destroy the current fitter.
Definition: LauFitter.cc:90
static void setFitterVerbosity(const LauOutputLevel level)
Set the verbosity level of the fitter.
Definition: LauFitter.cc:53
LauOutputLevel
Enumeration to define verbosity level for various printouts.
Definition: LauPrint.hh:40