Logo ROOT  
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 // extern StackAllocator gStackAllocator;
24 
26 
27 public:
28  /// Constructor without parameter values, but with function value, edm and nfcn.
29  /// This constructor will result in a state that is flagged as not valid
30  BasicMinimumState(unsigned int n, double fval, double edm, int nfcn)
32  fNFcn(nfcn)
33  {
34  }
35 
36  /// Constructor with parameters values, errors and gradient
37  BasicMinimumState(const MinimumParameters &states, const MinimumError &err, const FunctionGradient &grad, double edm,
38  int nfcn)
39  : fParameters(states), fError(err), fGradient(grad), fEDM(edm), fNFcn(nfcn)
40  {
41  }
42 
43  /// Constuctor with only parameter values, edm and nfcn, but without errors (covariance).
44  /// The resulting state it will be considered valid, since it contains the parameter values,
45  /// although it will has not the error matrix (MinimumError) with
46  /// HasCovariance() returning false.
47  BasicMinimumState(const MinimumParameters &states, double edm, int nfcn)
48  : fParameters(states), fError(MinimumError(states.Vec().size())),
49  fGradient(FunctionGradient(states.Vec().size())), fEDM(edm), fNFcn(nfcn)
50  {
51  }
52 
53  void *operator new(size_t nbytes) { return StackAllocatorHolder::Get().Allocate(nbytes); }
54 
55  void operator delete(void *p, size_t /*nbytes */) { StackAllocatorHolder::Get().Deallocate(p); }
56 
57  const MinimumParameters &Parameters() const { return fParameters; }
58  const MnAlgebraicVector &Vec() const { return fParameters.Vec(); }
59  int size() const { return fParameters.Vec().size(); }
60 
61  const MinimumError &Error() const { return fError; }
62  const FunctionGradient &Gradient() const { return fGradient; }
63  double Fval() const { return fParameters.Fval(); }
64  double Edm() const { return fEDM; }
65  int NFcn() const { return fNFcn; }
66 
67  bool IsValid() const
68  {
69  if (HasParameters() && HasCovariance())
70  return Parameters().IsValid() && Error().IsValid();
71  else if (HasParameters())
72  return Parameters().IsValid();
73  else
74  return false;
75  }
76  bool HasParameters() const { return fParameters.IsValid(); }
77  bool HasCovariance() const { return fError.IsAvailable(); }
78 
79 private:
83  double fEDM;
84  int fNFcn;
85 };
86 
87 } // namespace Minuit2
88 
89 } // namespace ROOT
90 
91 #endif // ROOT_Minuit2_BasicMinimumState
n
const Int_t n
Definition: legend1.C:16
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
ROOT::Minuit2::BasicMinimumState::BasicMinimumState
BasicMinimumState(const MinimumParameters &states, double edm, int nfcn)
Constuctor with only parameter values, edm and nfcn, but without errors (covariance).
Definition: BasicMinimumState.h:47
ROOT::Minuit2::BasicMinimumState::fNFcn
int fNFcn
Definition: BasicMinimumState.h:84
ROOT::Minuit2::StackAllocator::Deallocate
void Deallocate(void *p)
Definition: StackAllocator.h:103
ROOT::Minuit2::MinimumParameters::Vec
const MnAlgebraicVector & Vec() const
Definition: MinimumParameters.h:38
ROOT::Minuit2::BasicMinimumState::Edm
double Edm() const
Definition: BasicMinimumState.h:64
ROOT::Minuit2::BasicMinimumState::BasicMinimumState
BasicMinimumState(unsigned int n, double fval, double edm, int nfcn)
Constructor without parameter values, but with function value, edm and nfcn.
Definition: BasicMinimumState.h:30
ROOT::Minuit2::BasicMinimumState::fGradient
FunctionGradient fGradient
Definition: BasicMinimumState.h:82
ROOT::Minuit2::MinimumError::IsValid
bool IsValid() const
Definition: MinimumError.h:67
ROOT::Minuit2::FunctionGradient
Definition: FunctionGradient.h:21
ROOT::Minuit2::BasicMinimumState::fEDM
double fEDM
Definition: BasicMinimumState.h:83
ROOT::Minuit2::BasicMinimumState::Parameters
const MinimumParameters & Parameters() const
Definition: BasicMinimumState.h:57
ROOT::Minuit2::BasicMinimumState::size
int size() const
Definition: BasicMinimumState.h:59
ROOT::Minuit2::MinimumParameters::Fval
double Fval() const
Definition: MinimumParameters.h:40
ROOT::Minuit2::BasicMinimumState::fError
MinimumError fError
Definition: BasicMinimumState.h:81
ROOT::Minuit2::BasicMinimumState::BasicMinimumState
BasicMinimumState(const MinimumParameters &states, const MinimumError &err, const FunctionGradient &grad, double edm, int nfcn)
Constructor with parameters values, errors and gradient.
Definition: BasicMinimumState.h:37
ROOT::Minuit2::BasicMinimumState::HasCovariance
bool HasCovariance() const
Definition: BasicMinimumState.h:77
ROOT::Minuit2::BasicMinimumState
Definition: BasicMinimumState.h:25
ROOT::Minuit2::MinimumParameters
Definition: MinimumParameters.h:21
FunctionGradient.h
ROOT::Minuit2::BasicMinimumState::IsValid
bool IsValid() const
Definition: BasicMinimumState.h:67
ROOT::Minuit2::BasicMinimumState::fParameters
MinimumParameters fParameters
Definition: BasicMinimumState.h:80
ROOT::Minuit2::BasicMinimumState::Vec
const MnAlgebraicVector & Vec() const
Definition: BasicMinimumState.h:58
StackAllocator.h
ROOT::Minuit2::BasicMinimumState::Fval
double Fval() const
Definition: BasicMinimumState.h:63
ROOT::Minuit2::StackAllocator::Allocate
void * Allocate(size_t nBytes)
Definition: StackAllocator.h:71
ROOT::Minuit2::MinimumParameters::IsValid
bool IsValid() const
Definition: MinimumParameters.h:41
ROOT::Minuit2::StackAllocatorHolder::Get
static StackAllocator & Get()
Definition: StackAllocator.h:223
ROOT::Minuit2::LAVector::size
unsigned int size() const
Definition: LAVector.h:227
ROOT::Minuit2::MinimumError
MinimumError keeps the inv.
Definition: MinimumError.h:26
MinimumError.h
ROOT::Minuit2::BasicMinimumState::Error
const MinimumError & Error() const
Definition: BasicMinimumState.h:61
ROOT::Minuit2::BasicMinimumState::HasParameters
bool HasParameters() const
Definition: BasicMinimumState.h:76
MinimumParameters.h
ROOT::Minuit2::BasicMinimumState::Gradient
const FunctionGradient & Gradient() const
Definition: BasicMinimumState.h:62
ROOT::Minuit2::BasicMinimumState::NFcn
int NFcn() const
Definition: BasicMinimumState.h:65
ROOT::Minuit2::MinimumError::IsAvailable
bool IsAvailable() const
Definition: MinimumError.h:72
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4