ROOT  6.06/09
Reference Guide
BasicMinimumState.h
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef ROOT_Minuit2_BasicMinimumState
11 #define ROOT_Minuit2_BasicMinimumState
12 
14 #include "Minuit2/MinimumError.h"
16 
17 #include "Minuit2/StackAllocator.h"
18 
19 namespace ROOT {
20 
21  namespace Minuit2 {
22 
23 
24 //extern StackAllocator gStackAllocator;
25 
27 
28 public:
29 
30  // constructor without parameter values but with function value, edm and nfcn
31  BasicMinimumState(unsigned int n, double fval, double edm, int nfcn) :
33  fGradient(FunctionGradient(n)), fEDM(edm), fNFcn(nfcn) {}
34 
36  const FunctionGradient& grad, double edm, int nfcn) :
37  fParameters(states), fError(err), fGradient(grad), fEDM(edm), fNFcn(nfcn) {}
38 
39  BasicMinimumState(const MinimumParameters& states, double edm, int nfcn) : fParameters(states), fError(MinimumError(states.Vec().size())),
40  fGradient(FunctionGradient(states.Vec().size())), fEDM(edm), fNFcn(nfcn)
41  {}
42 
44 
46  fParameters(state.fParameters), fError(state.fError), fGradient(state.fGradient), fEDM(state.fEDM), fNFcn(state.fNFcn) {}
47 
49  fParameters = state.fParameters;
50  fError = state.fError;
51  fGradient = state.fGradient;
52  fEDM = state.fEDM;
53  fNFcn = state.fNFcn;
54  return *this;
55  }
56 
57  void* operator new(size_t nbytes) {
58  return StackAllocatorHolder::Get().Allocate(nbytes);
59  }
60 
61  void operator delete(void* p, size_t /*nbytes */) {
63  }
64 
65  const MinimumParameters& Parameters() const {return fParameters;}
66  const MnAlgebraicVector& Vec() const {return fParameters.Vec();}
67  int size() const {return fParameters.Vec().size();}
68 
69  const MinimumError& Error() const {return fError;}
70  const FunctionGradient& Gradient() const {return fGradient;}
71  double Fval() const {return fParameters.Fval();}
72  double Edm() const {return fEDM;}
73  int NFcn() const {return fNFcn;}
74 
75 
76  bool IsValid() const {
77  if(HasParameters() && HasCovariance())
78  return Parameters().IsValid() && Error().IsValid();
79  else if(HasParameters()) return Parameters().IsValid();
80  else return false;
81  }
82  bool HasParameters() const {return fParameters.IsValid();}
83  bool HasCovariance() const {return fError.IsAvailable();}
84 
85 private:
86 
90  double fEDM;
91  int fNFcn;
92 };
93 
94  } // namespace Minuit2
95 
96 } // namespace ROOT
97 
98 #endif // ROOT_Minuit2_BasicMinimumState
const MinimumParameters & Parameters() const
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
BasicMinimumState(const BasicMinimumState &state)
unsigned int size() const
Definition: LAVector.h:198
const FunctionGradient & Gradient() const
const MnAlgebraicVector & Vec() const
BasicMinimumState & operator=(const BasicMinimumState &state)
const MnAlgebraicVector & Vec() const
BasicMinimumState(unsigned int n, double fval, double edm, int nfcn)
void * Allocate(size_t nBytes)
BasicMinimumState(const MinimumParameters &states, double edm, int nfcn)
BasicMinimumState(const MinimumParameters &states, const MinimumError &err, const FunctionGradient &grad, double edm, int nfcn)
MinimumError keeps the inv.
Definition: MinimumError.h:26
static StackAllocator & Get()
const Int_t n
Definition: legend1.C:16
const MinimumError & Error() const