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)
31 : fParameter(par), fMinParValue(value), fUpper(up), fLower(low)
32 {
33 }
34
36
39 {
40 }
41
42 MinosError &operator=(const MinosError &) = default;
43
45 {
48 fUpper = err.fUpper;
49 fLower = err.fLower;
50 return *this;
51 }
52
53 std::pair<double, double> operator()() const { return std::pair<double, double>(Lower(), Upper()); }
54 double Lower() const
55 {
56 if (AtLowerLimit())
58 if (LowerValid()) {
59 // Minos error is value - error - aopt * error where aopt is MnCross.Value()
60 // If value - error is below the limit, error must be truncated at limit
61 double err = LowerState().Error(Parameter());
62 // error is truncated if over the limit
63 if (LowerState().Parameter(Parameter()).HasLowerLimit())
64 err = std::min(err, fMinParValue - LowerState().Parameter(Parameter()).LowerLimit());
65 return -1. * err * (1. + fLower.Value());
66 }
67 // return Hessian Error in case is invalid
68 return -LowerState().Error(Parameter());
69 }
70 double Upper() const
71 {
72 if (AtUpperLimit())
74 if (UpperValid()) {
75 // Minos error is value + error + aopt * error where aopt is MnCross.Value()
76 // If value + error is over the limit, err must be truncated at limit
77 double err = UpperState().Error(Parameter());
78 if (UpperState().Parameter(Parameter()).HasUpperLimit())
79 err = std::min(err, UpperState().Parameter(Parameter()).UpperLimit() - fMinParValue);
80 return err * (1. + fUpper.Value());
81 }
82 // return Hessian Error in case is invalid
83 return UpperState().Error(Parameter());
84 }
85 unsigned int Parameter() const { return fParameter; }
86 const MnUserParameterState &LowerState() const { return fLower.State(); }
87 const MnUserParameterState &UpperState() const { return fUpper.State(); }
88 bool IsValid() const { return fLower.IsValid() && fUpper.IsValid(); }
89 bool LowerValid() const { return fLower.IsValid(); }
90 bool UpperValid() const { return fUpper.IsValid(); }
91 bool AtLowerLimit() const { return fLower.AtLimit(); }
92 bool AtUpperLimit() const { return fUpper.AtLimit(); }
93 bool AtLowerMaxFcn() const { return fLower.AtMaxFcn(); }
94 bool AtUpperMaxFcn() const { return fUpper.AtMaxFcn(); }
95 bool LowerNewMin() const { return fLower.NewMinimum(); }
96 bool UpperNewMin() const { return fUpper.NewMinimum(); }
97 unsigned int NFcn() const { return fUpper.NFcn() + fLower.NFcn(); }
98 // return parameter value at the minimum
99 double Min() const { return fMinParValue; }
100
101private:
102 unsigned int fParameter;
106};
107
108} // namespace Minuit2
109
110} // namespace ROOT
111
112#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:44
unsigned int NFcn() const
Definition MinosError.h:97
unsigned int Parameter() const
Definition MinosError.h:85
const MnUserParameterState & UpperState() const
Definition MinosError.h:87
bool AtUpperLimit() const
Definition MinosError.h:92
bool AtLowerMaxFcn() const
Definition MinosError.h:93
std::pair< double, double > operator()() const
Definition MinosError.h:53
const MnUserParameterState & LowerState() const
Definition MinosError.h:86
bool AtUpperMaxFcn() const
Definition MinosError.h:94
MinosError(const MinosError &err)
Definition MinosError.h:37
bool AtLowerLimit() const
Definition MinosError.h:91
MinosError & operator=(const MinosError &)=default
bool AtLimit() const
Definition MnCross.h:92
const MnUserParameterState & State() const
Definition MnCross.h:90
unsigned int NFcn() const
Definition MnCross.h:95
bool AtMaxFcn() const
Definition MnCross.h:93
bool IsValid() const
Definition MnCross.h:91
bool NewMinimum() const
Definition MnCross.h:94
double Value() const
Definition MnCross.h:89
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MinuitParameter & Parameter(unsigned int i) const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...