Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MinosError.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_MinosError
11#define ROOT_Minuit2_MinosError
12
13#include "Minuit2/MnCross.h"
14#include <utility>
15
16namespace ROOT {
17
18namespace Minuit2 {
19
20//____________________________________________________________________________________
21/**
22 Class holding the result of Minos (lower and upper values) for a specific parameter
23 */
24
26
27public:
29
30 MinosError(unsigned int par, double value, const MnCross &low, const MnCross &up)
32 {
33 }
34
37 {
38 }
39
40 MinosError &operator=(const MinosError &) = default;
41
43 {
46 fUpper = err.fUpper;
47 fLower = err.fLower;
48 return *this;
49 }
50
51 std::pair<double, double> operator()() const { return std::pair<double, double>(Lower(), Upper()); }
52 double Lower() const
53 {
54 if (AtLowerLimit())
55 return LowerState().Parameter(Parameter()).LowerLimit() - fMinParValue;
56 if (LowerValid()) {
57 // Minos error is value - error - aopt * error where aopt is MnCross.Value()
58 // If value - error is below the limit, error must be truncated at limit
59 double err = LowerState().Error(Parameter());
60 // error is truncated if over the limit
61 if (LowerState().Parameter(Parameter()).HasLowerLimit())
62 err = std::min(err, fMinParValue - LowerState().Parameter(Parameter()).LowerLimit());
63 return -1. * err * (1. + fLower.Value());
64 }
65 // return Hessian Error in case is invalid
66 return -LowerState().Error(Parameter());
67 }
68 double Upper() const
69 {
70 if (AtUpperLimit())
71 return UpperState().Parameter(Parameter()).UpperLimit() - fMinParValue;
72 if (UpperValid()) {
73 // Minos error is value + error + aopt * error where aopt is MnCross.Value()
74 // If value + error is over the limit, err must be truncated at limit
75 double err = UpperState().Error(Parameter());
76 if (UpperState().Parameter(Parameter()).HasUpperLimit())
77 err = std::min(err, UpperState().Parameter(Parameter()).UpperLimit() - fMinParValue);
78 return err * (1. + fUpper.Value());
79 }
80 // return Hessian Error in case is invalid
81 return UpperState().Error(Parameter());
82 }
83 unsigned int Parameter() const { return fParameter; }
84 const MnUserParameterState &LowerState() const { return fLower.State(); }
85 const MnUserParameterState &UpperState() const { return fUpper.State(); }
86 bool IsValid() const { return fLower.IsValid() && fUpper.IsValid(); }
87 bool LowerValid() const { return fLower.IsValid(); }
88 bool UpperValid() const { return fUpper.IsValid(); }
89 bool AtLowerLimit() const { return fLower.AtLimit(); }
90 bool AtUpperLimit() const { return fUpper.AtLimit(); }
91 bool AtLowerMaxFcn() const { return fLower.AtMaxFcn(); }
92 bool AtUpperMaxFcn() const { return fUpper.AtMaxFcn(); }
93 bool LowerNewMin() const { return fLower.NewMinimum(); }
94 bool UpperNewMin() const { return fUpper.NewMinimum(); }
95 unsigned int NFcn() const { return fUpper.NFcn() + fLower.NFcn(); }
96 // return parameter value at the minimum
97 double Min() const { return fMinParValue; }
98
99private:
100 unsigned int fParameter;
104};
105
106} // namespace Minuit2
107
108} // namespace ROOT
109
110#endif // ROOT_Minuit2_MinosError
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Class holding the result of Minos (lower and upper values) for a specific parameter.
Definition MinosError.h:25
MinosError(unsigned int par, double value, const MnCross &low, const MnCross &up)
Definition MinosError.h:30
MinosError & operator()(const MinosError &err)
Definition MinosError.h:42
unsigned int NFcn() const
Definition MinosError.h:95
unsigned int Parameter() const
Definition MinosError.h:83
const MnUserParameterState & UpperState() const
Definition MinosError.h:85
bool AtUpperLimit() const
Definition MinosError.h:90
bool AtLowerMaxFcn() const
Definition MinosError.h:91
std::pair< double, double > operator()() const
Definition MinosError.h:51
const MnUserParameterState & LowerState() const
Definition MinosError.h:84
bool AtUpperMaxFcn() const
Definition MinosError.h:92
MinosError(const MinosError &err)
Definition MinosError.h:35
bool AtLowerLimit() const
Definition MinosError.h:89
MinosError & operator=(const MinosError &)=default
bool AtLimit() const
Definition MnCross.h:90
const MnUserParameterState & State() const
Definition MnCross.h:88
unsigned int NFcn() const
Definition MnCross.h:93
bool AtMaxFcn() const
Definition MnCross.h:91
bool IsValid() const
Definition MnCross.h:89
bool NewMinimum() const
Definition MnCross.h:92
double Value() const
Definition MnCross.h:87
class which holds the external user and/or internal Minuit representation of the parameters and error...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...