ROOT logo
// @(#)root/minuit2:$Id$
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
 *                                                                    *
 **********************************************************************/

#ifndef ROOT_Minuit2_MinosError
#define ROOT_Minuit2_MinosError

#include "Minuit2/MnCross.h"
#include <iostream>

namespace ROOT {

   namespace Minuit2 {

//____________________________________________________________________________________
/**
   Class holding the result of Minos (lower and upper values) for a specific parameter 
 */

class MinosError {

public:

   MinosError() : fParameter(0), fMinValue(0.), fUpper(MnCross()), fLower(MnCross()) {}
  
   MinosError(unsigned int par, double min, const MnCross& low, const MnCross& up) : fParameter(par), fMinValue(min), fUpper(up), fLower(low) {}

   ~MinosError() {}

   MinosError(const MinosError& err) : fParameter(err.fParameter), fMinValue(err.fMinValue), fUpper(err.fUpper),  fLower(err.fLower) {}

   MinosError& operator()(const MinosError& err) {
      fParameter = err.fParameter;
      fMinValue = err.fMinValue;
      fUpper = err.fUpper;
      fLower = err.fLower;
      return *this;
   }

   std::pair<double,double> operator()() const {
      return std::pair<double,double>(Lower(), Upper());
   }
   double Lower() const {
      if ( AtLowerLimit() ) return LowerState().Parameter( Parameter() ).LowerLimit() -  fMinValue;
      return -1.*LowerState().Error(Parameter())*(1. + fLower.Value());
   }
   double Upper() const {
      if ( AtUpperLimit() ) return UpperState().Parameter( Parameter() ).UpperLimit() -  fMinValue;  
      return UpperState().Error(Parameter())*(1. + fUpper.Value());
   }
   unsigned int Parameter() const {return fParameter;}
   const MnUserParameterState& LowerState() const {return fLower.State();}
   const MnUserParameterState& UpperState() const {return fUpper.State();}
   bool IsValid() const {return fLower.IsValid() && fUpper.IsValid();}
   bool LowerValid() const {return fLower.IsValid();}
   bool UpperValid() const {return fUpper.IsValid();}
   bool AtLowerLimit() const {return fLower.AtLimit();}
   bool AtUpperLimit() const {return fUpper.AtLimit();}
   bool AtLowerMaxFcn() const {return fLower.AtMaxFcn();}
   bool AtUpperMaxFcn() const {return fUpper.AtMaxFcn();}
   bool LowerNewMin() const {return fLower.NewMinimum();}
   bool UpperNewMin() const {return fUpper.NewMinimum();}
   unsigned int NFcn() const {return fUpper.NFcn() + fLower.NFcn();}
   double Min() const {return fMinValue;}

private:
  
   unsigned int fParameter;
   double fMinValue;
   MnCross fUpper;
   MnCross fLower;
};

  }  // namespace Minuit2

}  // namespace ROOT

#endif  // ROOT_Minuit2_MinosError
 MinosError.h:1
 MinosError.h:2
 MinosError.h:3
 MinosError.h:4
 MinosError.h:5
 MinosError.h:6
 MinosError.h:7
 MinosError.h:8
 MinosError.h:9
 MinosError.h:10
 MinosError.h:11
 MinosError.h:12
 MinosError.h:13
 MinosError.h:14
 MinosError.h:15
 MinosError.h:16
 MinosError.h:17
 MinosError.h:18
 MinosError.h:19
 MinosError.h:20
 MinosError.h:21
 MinosError.h:22
 MinosError.h:23
 MinosError.h:24
 MinosError.h:25
 MinosError.h:26
 MinosError.h:27
 MinosError.h:28
 MinosError.h:29
 MinosError.h:30
 MinosError.h:31
 MinosError.h:32
 MinosError.h:33
 MinosError.h:34
 MinosError.h:35
 MinosError.h:36
 MinosError.h:37
 MinosError.h:38
 MinosError.h:39
 MinosError.h:40
 MinosError.h:41
 MinosError.h:42
 MinosError.h:43
 MinosError.h:44
 MinosError.h:45
 MinosError.h:46
 MinosError.h:47
 MinosError.h:48
 MinosError.h:49
 MinosError.h:50
 MinosError.h:51
 MinosError.h:52
 MinosError.h:53
 MinosError.h:54
 MinosError.h:55
 MinosError.h:56
 MinosError.h:57
 MinosError.h:58
 MinosError.h:59
 MinosError.h:60
 MinosError.h:61
 MinosError.h:62
 MinosError.h:63
 MinosError.h:64
 MinosError.h:65
 MinosError.h:66
 MinosError.h:67
 MinosError.h:68
 MinosError.h:69
 MinosError.h:70
 MinosError.h:71
 MinosError.h:72
 MinosError.h:73
 MinosError.h:74
 MinosError.h:75
 MinosError.h:76
 MinosError.h:77
 MinosError.h:78
 MinosError.h:79
 MinosError.h:80
 MinosError.h:81
 MinosError.h:82
 MinosError.h:83