// @(#)root/minuit:$Id$
// Author: L. Moneta Wed Oct 25 16:28:55 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Implementation file for class TMinuitMinimizer

#include "TMinuitMinimizer.h"
#include "Math/IFunction.h"
#include "Fit/ParameterSettings.h"

#include "TMinuit.h"
#include "TROOT.h"

#include "TGraph.h" // needed for scan 
#include "TError.h"

#include "TMatrixDSym.h" // needed for inverting the matrix

#include <iostream>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>

//______________________________________________________________________________
//
//  TMinuitMinimizer class implementing the ROOT::Math::Minimizer interface using 
//  TMinuit. 
//  This class is normally instantiates using the plug-in manager 
//  (plug-in with name Minuit or TMinuit)
//  In addition the user can choose the minimizer algorithm: Migrad (the default one), Simplex, or Minimize (combined Migrad + Simplex)
//  
//__________________________________________________________________________________________

// initialize the static instances


ROOT::Math::IMultiGenFunction * TMinuitMinimizer::fgFunc = 0; 
TMinuit * TMinuitMinimizer::fgMinuit = 0;
bool TMinuitMinimizer::fgUsed = false; 
bool TMinuitMinimizer::fgUseStaticMinuit = true;   // default case use static Minuit instance

ClassImp(TMinuitMinimizer)


TMinuitMinimizer::TMinuitMinimizer(ROOT::Minuit::EMinimizerType type, unsigned int ndim ) : 
   fUsed(false),
   fMinosRun(false),
   fDim(ndim),
   fType(type), 
   fMinuit(0)
{
   // Constructor for TMinuitMinimier class via an enumeration specifying the minimization 
   // algorithm type. Supported types are : kMigrad, kSimplex, kCombined (a combined 
   // Migrad + Simplex minimization) and kMigradImproved (a Migrad mininimization folloed by an 
   // improved search for global minima). The default type is Migrad (kMigrad). 

   // initialize if npar is given
   if (fDim > 0) InitTMinuit(fDim);   
}

TMinuitMinimizer::TMinuitMinimizer(const char *  type, unsigned int ndim ) : 
   fUsed(false),
   fMinosRun(false),
   fDim(ndim),
   fMinuit(0)
{
   // constructor from a char * for the algorithm type, used by the plug-in manager
   // The names supported (case unsensitive) are: 
   //  Migrad (default), Simplex, Minimize (for the combined Migrad+ Simplex) and Migrad_imp 

   // select type from the string
   std::string algoname(type);
   std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower ); 

   ROOT::Minuit::EMinimizerType algoType = ROOT::Minuit::kMigrad; 
   if (algoname == "simplex")   algoType = ROOT::Minuit::kSimplex; 
   if (algoname == "minimize" ) algoType = ROOT::Minuit::kCombined; 
   if (algoname == "migradimproved" ) algoType = ROOT::Minuit::kMigradImproved; 
   if (algoname == "scan" )           algoType = ROOT::Minuit::kScan; 
   if (algoname == "seek" )           algoType = ROOT::Minuit::kSeek; 

   fType = algoType; 

   // initialize if npar is given
   if (fDim > 0) InitTMinuit(fDim);

}

TMinuitMinimizer::~TMinuitMinimizer() 
{
   // Destructor implementation.
   if (fMinuit && !fgUseStaticMinuit) { 
      delete fMinuit; 
      fgMinuit = 0;
   }
}

TMinuitMinimizer::TMinuitMinimizer(const TMinuitMinimizer &) : 
   Minimizer()
{
   // Implementation of copy constructor (it is private).
}

TMinuitMinimizer & TMinuitMinimizer::operator = (const TMinuitMinimizer &rhs) 
{
   // Implementation of assignment operator (private)
   if (this == &rhs) return *this;  // time saving self-test
   return *this;
}

bool TMinuitMinimizer::UseStaticMinuit(bool on ) { 
   // static method to control usage of global TMinuit instance
   bool prev = fgUseStaticMinuit; 
   fgUseStaticMinuit = on; 
   return prev; 
}

void TMinuitMinimizer::InitTMinuit(int dim) {

   // when called a second time check dimension - create only if needed
   // initialize the minuit instance - recreating a new one if needed 
   if (fMinuit ==0 ||  dim > fMinuit->fMaxpar) { 

      // case not using the global instance - recreate it all the time 
      if (fgUseStaticMinuit) { 

         // re-use gMinuit as static instance of TMinuit
         // which can be accessed by the user after minimization
         // check if fgMinuit is different than gMinuit
         // case 1: fgMinuit not zero but fgMinuit has been deleted (not in gROOT): set to zero
         // case 2: fgMinuit not zero and exists in global list  : set fgMinuit to gMinuit 
         // case 3: fgMinuit zero - and gMinuit not zero: create a new instance locally to avoid conflict
         if (fgMinuit != gMinuit) { 
            // if object exists in gROOT remove it to avoid a memory leak 
            if (fgMinuit ) { 
               if (gROOT->GetListOfSpecials()->FindObject(fgMinuit) == 0) { 
                  // case 1: object does not exists in gROOT - means it has been deleted
                  fgMinuit = 0; 
               }
               else {
                  // case 2: object exists - but gMinuit points to something else
                  // restore gMinuit to the one used before by TMinuitMinimizer
                  gMinuit = fgMinuit; 
               }
            }
            else {
               // case 3: avoid reusing existing one - mantain fgMinuit to zero
               // otherwise we will get a double delete if user deletes externally gMinuit
               // in this case we will loose gMinuit instance
//                fgMinuit = gMinuit;
//                fgUsed = true;  // need to reset in case  other gMinuit instance is later used
            }
         }
         
         // check if need to create a new TMinuit instance
         if (fgMinuit == 0) {
            fgUsed = false;
            fgMinuit =  new TMinuit(dim);
         }   
         else if (fgMinuit->GetNumPars() != int(dim) ) { 
            delete fgMinuit; 
            fgUsed = false;
            fgMinuit =  new TMinuit(dim);
         }
      
         fMinuit = fgMinuit; 
      }
      
      else { 
         // re- create all the time a new instance of TMinuit (fgUseStaticMinuit is false)
         if (fMinuit) delete fMinuit; 
         fMinuit =  new TMinuit(dim);
         fgMinuit = fMinuit; 
         fgUsed = false; 
      }

   }  // endif fMinuit ==0 || dim > fMaxpar

   fDim = dim; 

   R__ASSERT(fMinuit);

   // set print level in TMinuit
   double arglist[1];
   int ierr= 0; 
   // TMinuit level is shift by 1 -1 means 0;
   arglist[0] = PrintLevel() - 1;
   fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
   if (PrintLevel() <= 0) SuppressMinuitWarnings();
}


void TMinuitMinimizer::SetFunction(const  ROOT::Math::IMultiGenFunction & func) { 
   // Set the objective function to be minimized, by passing a function object implement the 
   // basic multi-dim Function interface. In this case the derivatives will be 
   // calculated by Minuit 
   // Here a TMinuit instance is created since only at this point we know the number of parameters 


   fDim = func.NDim(); 

   // create TMinuit if needed
   InitTMinuit(fDim); 
   
   // assign to the static pointer (NO Thread safety here)
   fgFunc = const_cast<ROOT::Math::IMultiGenFunction *>(&func); 
   fMinuit->SetFCN(&TMinuitMinimizer::Fcn);

   // switch off gradient calculations
   double arglist[1]; 
   int ierr = 0;
   fMinuit->mnexcm("SET NOGrad",arglist,0,ierr);
}

void TMinuitMinimizer::SetFunction(const  ROOT::Math::IMultiGradFunction & func) { 
   // Set the objective function to be minimized, by passing a function object implement the 
   // multi-dim gradient Function interface. In this case the function derivatives are provided  
   // by the user via this interface and there not calculated by Minuit. 

   fDim = func.NDim(); 

   // create TMinuit if needed
   InitTMinuit(fDim); 
   
   // assign to the static pointer (NO Thread safety here)
   fgFunc = const_cast<ROOT::Math::IMultiGradFunction *>(&func); 
   fMinuit->SetFCN(&TMinuitMinimizer::FcnGrad);

   // set gradient 
   // by default do not check gradient calculation 
   // it cannot be done here, check can be done only after having defined the parameters
   double arglist[1]; 
   int ierr = 0;
   arglist[0] = 1; 
   fMinuit->mnexcm("SET GRAD",arglist,1,ierr);
}

void TMinuitMinimizer::Fcn( int &, double * , double & f, double * x , int /* iflag */) { 
   // implementation of FCN static function used internally by TMinuit.
   // Adapt IMultiGenFunction interface to TMinuit FCN static function
   f = fgFunc->operator()(x);
}

void TMinuitMinimizer::FcnGrad( int &, double * g, double & f, double * x , int iflag ) { 
   // implementation of FCN static function used internally by TMinuit.
   // Adapt IMultiGradFunction interface to TMinuit FCN static function in the case of user 
   // provided gradient.
   ROOT::Math::IMultiGradFunction * gFunc = dynamic_cast<ROOT::Math::IMultiGradFunction *> ( fgFunc); 

   assert(gFunc != 0);
   f = gFunc->operator()(x);

   // calculates also derivatives 
   if (iflag == 2) gFunc->Gradient(x,g);
}

bool TMinuitMinimizer::SetVariable(unsigned int ivar, const std::string & name, double val, double step) { 
   // set a free variable.
   if (!CheckMinuitInstance()) return false; 

   fUsed = fgUsed; 

   // clear after minimization when setting params
   if (fUsed) DoClear(); 

   // check if parameter was defined and in case it was fixed, release it 
   DoReleaseFixParameter(ivar);

   int iret = fMinuit->DefineParameter(ivar , name.c_str(), val, step, 0., 0. ); 
   return (iret == 0); 
}

bool TMinuitMinimizer::SetLimitedVariable(unsigned int ivar, const std::string & name, double val, double step, double lower, double upper) { 
   // set a limited variable.
   if (!CheckMinuitInstance()) return false; 

   fUsed = fgUsed; 

   // clear after minimization when setting params
   if (fUsed) DoClear(); 

   // check if parameter was defined and in case it was fixed, release it 
   DoReleaseFixParameter(ivar);

   int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, lower, upper ); 
   return (iret == 0); 
}

bool TMinuitMinimizer::SetLowerLimitedVariable(unsigned int  ivar , const std::string & name , double val , double step , double lower ) { 
   // set a lower limited variable
   // since is not supported in TMinuit , just use a artificial large value 
   Warning("TMinuitMinimizer::SetLowerLimitedVariable","not implemented - use as upper limit 1.E7 instead of +inf"); 
   return SetLimitedVariable(ivar, name, val , step, lower, lower+ 1.E7);  // use 1.E7 which will make TMinuit happy
}

bool TMinuitMinimizer::SetUpperLimitedVariable(unsigned int  ivar , const std::string & name , double val , double step , double upper ) { 
   // set a upper limited variable
   // since is not supported in TMinuit , just use a artificial large negative value 
   Warning("TMinuitMinimizer::SetUpperLimitedVariable","not implemented - use as lower limit -1.E7 instead of -inf"); 
   return SetLimitedVariable(ivar, name, val , step, upper -1.E7, upper);
}


bool TMinuitMinimizer::CheckMinuitInstance() const {
   // check instance of fMinuit
   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::CheckMinuitInstance","Invalid TMinuit pointer. Need to call first SetFunction"); 
      return false; 
   }
   return true; 
}

bool TMinuitMinimizer::CheckVarIndex(unsigned int ivar) const {
   // check index of Variable (assume fMinuit exists) 
   if ((int) ivar >= fMinuit->fNu ) {
      Error("TMinuitMinimizer::CheckVarIndex","Invalid parameter index"); 
      return false; 
   }
   return true; 
}


bool TMinuitMinimizer::SetFixedVariable(unsigned int ivar, const std::string & name, double val) { 
   // set a fixed variable.
   if (!CheckMinuitInstance()) return false; 

   // clear after minimization when setting params
   fUsed = fgUsed; 

   // clear after minimization when setting params
   if (fUsed) DoClear(); 

   // put an arbitrary step (0.1*abs(value) otherwise TMinuit consider the parameter as constant
   // constant parameters are treated differently (they are ignored inside TMinuit and not considered in the
   // total list of parameters) 
   double step = ( val != 0) ? 0.1 * std::abs(val) : 0.1;
   int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, 0., 0. ); 
   if (iret == 0) iret = fMinuit->FixParameter(ivar);
   return (iret == 0); 
}

bool TMinuitMinimizer::SetVariableValue(unsigned int ivar, double val) { 
   // set the value of an existing variable
   // parameter must exist or return false
   if (!CheckMinuitInstance()) return false; 

   double arglist[2]; 
   int ierr = 0; 

   arglist[0] = ivar+1;  // TMinuit starts from 1 
   arglist[1] = val;
   fMinuit->mnexcm("SET PAR",arglist,2,ierr);
   return (ierr==0);
}

bool TMinuitMinimizer::SetVariableStepSize(unsigned int ivar, double step) { 
   // set the step-size of an existing variable
   // parameter must exist or return false
   if (!CheckMinuitInstance()) return false; 
   // need to re-implement re-calling mnparm
   // get first current parameter values and limits
   double curval,err, lowlim, uplim;
   int iuint;  // internal index  
   TString name; 
   fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
   if (iuint == -1) return false; 
   int iret = fMinuit->DefineParameter(ivar, name, curval, step, lowlim, uplim ); 
   return (iret == 0); 
   
}

bool TMinuitMinimizer::SetVariableLowerLimit(unsigned int ivar, double lower ) { 
   // set the limits of an existing variable
   // parameter must exist or return false
   Warning("TMinuitMinimizer::SetVariableLowerLimit","not implemented - use as upper limit 1.E30 instead of +inf"); 
   return SetVariableLimits(ivar, lower, 1.E30);
}
bool TMinuitMinimizer::SetVariableUpperLimit(unsigned int ivar, double upper ) { 
   // set the limits of an existing variable
   // parameter must exist or return false
   Warning("TMinuitMinimizer::SetVariableUpperLimit","not implemented - - use as lower limit -1.E30 instead of +inf"); 
   return SetVariableLimits(ivar, -1.E30, upper);
}

bool TMinuitMinimizer::SetVariableLimits(unsigned int ivar, double lower, double upper) { 
   // set the limits of an existing variable
   // parameter must exist or return false

   if (!CheckMinuitInstance()) return false; 
   // need to re-implement re-calling mnparm
   // get first current parameter values and limits
   double curval,err, lowlim, uplim;
   int iuint;  // internal index  
   TString name; 
   fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
   if (iuint == -1) return false; 
   int iret = fMinuit->DefineParameter(ivar, name, curval, err, lower, upper ); 
   return (iret == 0); 
   
}

bool TMinuitMinimizer::FixVariable(unsigned int ivar) { 
   // Fix an existing variable
   if (!CheckMinuitInstance()) return false; 
   if (!CheckVarIndex(ivar)) return false; 
   int iret = fMinuit->FixParameter(ivar);
   return (iret == 0);
}

bool TMinuitMinimizer::ReleaseVariable(unsigned int ivar) { 
   // Fix an existing variable
   if (!CheckMinuitInstance()) return false; 
   if (!CheckVarIndex(ivar)) return false; 
   int iret = fMinuit->Release(ivar);
   return (iret == 0);
}

bool TMinuitMinimizer::IsFixedVariable(unsigned int ivar) const { 
   // query if variable is fixed
   if (!CheckMinuitInstance()) return false; 
   if (!CheckVarIndex(ivar)) return false; 
   return (fMinuit->fNiofex[ivar] == 0 );
} 

bool TMinuitMinimizer::GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings & var) const { 
   // retrieve variable settings (all set info on the variable)
   if (!CheckMinuitInstance()) return false; 
   if (!CheckVarIndex(ivar)) return false; 
   double curval,err, lowlim, uplim;
   int iuint;  // internal index  
   TString name; 
   fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
   if (iuint == -1) return false; 
   var.Set(name.Data(), curval, err, lowlim, uplim);
   if (IsFixedVariable(ivar)) var.Fix();
   return true; 
}



std::string TMinuitMinimizer::VariableName(unsigned int ivar) const { 
   // return the variable name
   if (!CheckMinuitInstance()) return std::string(); 
   if (!CheckVarIndex(ivar)) return std::string(); 
   return std::string(fMinuit->fCpnam[ivar]);
}

int TMinuitMinimizer::VariableIndex(const std::string & ) const { 
   // return variable index
   Error("TMinuitMinimizer::VariableIndex"," find index of a variable from its name  is not implemented in TMinuit");
   return -1;
}

bool TMinuitMinimizer::Minimize() { 
   // perform the minimization using the algorithm chosen previously by the user  
   // By default Migrad is used. 
   // Return true if the found minimum is valid and update internal chached values of 
   // minimum values, errors and covariance matrix. 
   // Status of minimizer is set to: 
   // migradResult + 10*minosResult + 100*hesseResult + 1000*improveResult


   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::Minimize","invalid TMinuit pointer. Need to call first SetFunction and SetVariable"); 
      return false; 
   }


   // total number of parameter defined in Minuit is fNu
   if (fMinuit->fNu <  static_cast<int>(fDim) ) { 
      Error("TMinuitMinimizer::Minimize","The total number of defined parameters is different than the function dimension, npar = %d, dim = %d",fMinuit->fNu, fDim);
      return false; 
   }

   int printlevel = PrintLevel(); 

   // total number of free parameter is 0
   if (fMinuit->fNpar <= 0) { 
      // retrieve parameters values  from TMinuit
      RetrieveParams(); 
      fMinuit->fAmin = (*fgFunc)(&fParams.front());
      if (printlevel > 0) Info("TMinuitMinimizer::Minimize","There are no free parameter - just compute the function value");
      return true; 
   }

 
   double arglist[10]; 
   int ierr = 0; 


   // set error and print level 
   arglist[0] = ErrorDef(); 
   fMinuit->mnexcm("SET Err",arglist,1,ierr);

   arglist[0] = printlevel - 1;
   fMinuit->mnexcm("SET PRINT",arglist,1,ierr);

   // suppress warning in case Printlevel() == 0 
   if (printlevel == 0)    fMinuit->mnexcm("SET NOW",arglist,0,ierr);

   // set precision if needed
   if (Precision() > 0)  { 
      arglist[0] = Precision();
      fMinuit->mnexcm("SET EPS",arglist,1,ierr);
   }

   // set strategy 
   int strategy = Strategy(); 
   if (strategy >=0 && strategy <=2 ) {
      arglist[0] = strategy;
      fMinuit->mnexcm("SET STR",arglist,1,ierr);
   }

   arglist[0] = MaxFunctionCalls(); 
   arglist[1] = Tolerance(); 
   
   int nargs = 2; 

   switch (fType){  
   case ROOT::Minuit::kMigrad: 
      // case of Migrad 
      fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);
      break; 
   case ROOT::Minuit::kCombined: 
      // case of combined (Migrad+ simplex)
      fMinuit->mnexcm("MINIMIZE",arglist,nargs,ierr);
      break; 
   case ROOT::Minuit::kSimplex: 
      // case of Simlex
      fMinuit->mnexcm("SIMPLEX",arglist,nargs,ierr);
      break; 
   case ROOT::Minuit::kScan: 
      // case of Scan (scan all parameters with default values)
      nargs = 0; 
      fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
      break; 
   case ROOT::Minuit::kSeek: 
      // case of Seek (random find minimum in a hypercube around current parameter values
      // use Tolerance as measures for standard deviation (if < 1) used default value in Minuit ( supposed to be  3)
      nargs = 1; 
      if (arglist[1] >= 1.) nargs = 2; 
      fMinuit->mnexcm("SEEK",arglist,nargs,ierr);
      break; 
   default: 
      // default: use Migrad 
      fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);

   }

   fgUsed = true; 
   fUsed = true;

   fStatus = ierr; 
   int minErrStatus = ierr;

   if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run MIGRAD - status %d",ierr);

   // run improved if needed
   if (ierr == 0 && fType == ROOT::Minuit::kMigradImproved) {
      fMinuit->mnexcm("IMPROVE",arglist,1,ierr);
      fStatus += 1000*ierr; 
      if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run IMPROVE - status %d",ierr);
   }


   // check if Hesse needs to be run 
   // Migrad runs inside it automatically for strategy >=1. Do also 
   // in case improve or other minimizers are used 
   if (minErrStatus == 0  && (IsValidError() || ( strategy >=1 && CovMatrixStatus() < 3) ) ) { 
      fMinuit->mnexcm("HESSE",arglist,1,ierr);
      fStatus += 100*ierr; 
      if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run HESSE - status %d",ierr);
   }

   // retrieve parameters and errors  from TMinuit
   RetrieveParams(); 

   if (minErrStatus == 0) { 

      // store global min results (only if minimization is OK)
      // ignore cases when Hesse or IMprove return error different than zero
      RetrieveErrorMatrix(); 

      // need to re-run Minos again if requested
      fMinosRun = false; 

      return true;

   }
   return false; 

}

void TMinuitMinimizer::RetrieveParams() {
   // retrieve from TMinuit minimum parameter values 
   // and errors

   assert(fMinuit != 0); 

   // get parameter values 
   if (fParams.size() != fDim) fParams.resize( fDim); 
   if (fErrors.size() != fDim) fErrors.resize( fDim); 
   for (unsigned int i = 0; i < fDim; ++i) { 
      fMinuit->GetParameter( i, fParams[i], fErrors[i]);
   }
}

void TMinuitMinimizer::RetrieveErrorMatrix() {
   // get covariance error matrix from TMinuit
   // when some parameters are fixed filled the corresponding rows and column with zero's

   assert(fMinuit != 0); 

   unsigned int nfree = NFree();

   unsigned int ndim2 = fDim*fDim; 
   if (fCovar.size() != ndim2 )  fCovar.resize(fDim*fDim); 
   if (nfree >= fDim) { // no fixed parameters 
      fMinuit->mnemat(&fCovar.front(), fDim); 
   } 
   else { 
      // case of fixed params need to take care 
      std::vector<double> tmpMat(nfree*nfree); 
      fMinuit->mnemat(&tmpMat.front(), nfree); 
      
      unsigned int l = 0; 
      for (unsigned int i = 0; i < fDim; ++i) { 
         
         if ( fMinuit->fNiofex[i] > 0 ) {  // not fixed ?
            unsigned int m = 0; 
            for (unsigned int j = 0; j <= i; ++j) { 
               if ( fMinuit->fNiofex[j] > 0 ) {  //not fixed
                  fCovar[i*fDim + j] = tmpMat[l*nfree + m];
                  fCovar[j*fDim + i] = fCovar[i*fDim + j]; 
                  m++;
               }
            }
            l++;
         }
      }
      
   }
}

unsigned int TMinuitMinimizer::NCalls() const { 
   // return total number of function calls
   if (fMinuit == 0) return 0; 
   return fMinuit->fNfcn;
}

double TMinuitMinimizer::MinValue() const { 
   // return minimum function value

   // use part of code from mnstat
   if (!fMinuit) return 0; 
   double minval = fMinuit->fAmin; 
   if (minval == fMinuit->fUndefi) return 0; 
   return minval; 
}

double TMinuitMinimizer::Edm() const { 
   // return expected distance from the minimum

   // use part of code from mnstat
   if (!fMinuit) return -1; 
   if (fMinuit->fAmin == fMinuit->fUndefi || fMinuit->fEDM == fMinuit->fBigedm) return fMinuit->fUp; 
   return fMinuit->fEDM; 
}

unsigned int TMinuitMinimizer::NFree() const { 
    // return number of free parameters 
   if (!fMinuit) return 0; 
   if (fMinuit->fNpar < 0) return 0; 
   return fMinuit->fNpar; 
}

bool TMinuitMinimizer::GetCovMatrix(double * cov) const { 
   // get covariance matrix
   int covStatus = CovMatrixStatus(); 
   if ( fCovar.size() != fDim*fDim || covStatus < 2) { 
      Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
      return false;
   }
   std::copy(fCovar.begin(), fCovar.end(), cov);
   TMatrixDSym cmat(fDim,cov);
   return true; 
}

bool TMinuitMinimizer::GetHessianMatrix(double * hes) const { 
   // get Hessian - inverse of covariance matrix 
   // just invert it 
   // but need to get the compact form to avoid the zero for the fixed parameters 
   int covStatus = CovMatrixStatus(); 
   if ( fCovar.size() != fDim*fDim || covStatus < 2) { 
      Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
      return false;
   }
   // case of fixed params need to take care 
   unsigned int nfree = NFree();
   TMatrixDSym mat(nfree);   
   fMinuit->mnemat(mat.GetMatrixArray(), nfree); 
   // invert the matrix
   // probably need to check if failed. In that case inverse is equal to original
   mat.Invert();
   
   unsigned int l = 0; 
   for (unsigned int i = 0; i < fDim; ++i) {       
      if ( fMinuit->fNiofex[i] > 0 ) {  // not fixed ?
         unsigned int m = 0; 
         for (unsigned int j = 0; j <= i; ++j) { 
            if ( fMinuit->fNiofex[j] > 0 ) {  //not fixed
               hes[i*fDim + j] =  mat(l,m);
               hes[j*fDim + i] = hes[i*fDim + j]; 
               m++;
            }
         }
         l++;
      }
   }
   return true;
}
//    if  ( fCovar.size() != fDim*fDim ) return false; 
//    TMatrixDSym mat(fDim, &fCovar.front() );
//    std::copy(mat.GetMatrixArray(), mat.GetMatrixArray()+ mat.GetNoElements(), hes);
//    return true; 
// }

int TMinuitMinimizer::CovMatrixStatus() const { 
   // return status of covariance matrix 
   //           status:  0= not calculated at all
   //                    1= approximation only, not accurate
   //                    2= full matrix, but forced positive-definite
   //                    3= full accurate covariance matrix

   // use part of code from mnstat
   if (!fMinuit) return 0; 
   if (fMinuit->fAmin == fMinuit->fUndefi) return 0; 
   return fMinuit->fISW[1];
}

double TMinuitMinimizer::GlobalCC(unsigned int i) const { 
   // global correlation coefficient for parameter i 
   if (!fMinuit) return 0; 
   if (!fMinuit->fGlobcc) return 0;
   if (int(i) >= fMinuit->fNu) return 0; 
   // get internal number in Minuit
   int iin = fMinuit->fNiofex[i];  
   // index in TMinuit starts from 1 
   if (iin < 1) return 0; 
   return fMinuit->fGlobcc[iin-1];   
}

bool TMinuitMinimizer::GetMinosError(unsigned int i, double & errLow, double & errUp, int ) { 
   // Perform Minos analysis for the given parameter  i 

   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::GetMinosError","invalid TMinuit pointer. Need to call first SetFunction and SetVariable"); 
      return false; 
   }

   // check if parameter is fixed
   if (fMinuit->fNiofex[i] == 0 ) { 
      if (PrintLevel() > 0) Info("TMinuitMinimizer::GetMinosError","Parameter %s is fixed. There are no Minos error to calculate. Ignored.",VariableName(i).c_str());
      errLow = 0; errUp = 0;
      return true;
   } 

   double arglist[2];
   int ierr = 0; 


   // set error, print level, precision and strategy if they have changed
   if (fMinuit->fUp != ErrorDef() ) { 
      arglist[0] = ErrorDef(); 
      fMinuit->mnexcm("SET Err",arglist,1,ierr);
   }
      
   if (fMinuit->fISW[4] != (PrintLevel()-1) ) { 
      arglist[0] = PrintLevel()-1; 
      fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
      // suppress warning in case Printlevel() == 0 
      if (PrintLevel() == 0)    fMinuit->mnexcm("SET NOW",arglist,0,ierr);
   }
   if (fMinuit->fIstrat != Strategy() ) { 
      arglist[0] = Strategy(); 
      fMinuit->mnexcm("SET STR",arglist,1,ierr);
   }

   if (Precision() > 0 &&  fMinuit->fEpsma2 != Precision() ) { 
      arglist[0] = Precision();
      fMinuit->mnexcm("SET EPS",arglist,1,ierr);
   }
   

   // syntax of MINOS is MINOS [maxcalls] [parno]
   // if parno = 0 all parameters are done 
   arglist[0] = MaxFunctionCalls(); 
   arglist[1] = i+1;  // par number starts from 1 in TMInuit
   
   int nargs = 2; 
   fMinuit->mnexcm("MINOS",arglist,nargs,ierr);
   bool isValid = (ierr == 0); 
   // check also the status from fCstatu
   if (isValid && fMinuit->fCstatu != "SUCCESSFUL") {
      if (fMinuit->fCstatu == "FAILURE" ) { 
         // in this case MINOS failed on all prameter, so it is not valid ! 
         ierr = 5; 
         isValid = false; 
      }   
      if (fMinuit->fCstatu == "PROBLEMS") ierr = 6; 
      ierr = 7;  // this should be the case UNCHANGED
   }

   fStatus += 10*ierr;

   fMinosRun = true; 

   double errParab = 0; 
   double gcor = 0; 
   // what returns if parameter fixed or constant or at limit ? 
   fMinuit->mnerrs(i,errUp,errLow, errParab, gcor); 

   // do not flag errors case of PROBLEMS or UNCHANGED (
   return isValid; 

}

void TMinuitMinimizer::DoClear() { 
   // reset TMinuit

   fMinuit->mncler();
   
   //reset the internal Minuit random generator to its initial state
   double val = 3;
   int inseed = 12345;
   fMinuit->mnrn15(val,inseed);

   fUsed = false; 
   fgUsed = false; 

}

void TMinuitMinimizer::DoReleaseFixParameter(int ivar) { 
   // check if a parameter is defined and in case it was fixed released
   // TMinuit is not able to release free parameters by redefining them
   // so we need to force the release
   if (fMinuit == 0) return; 
   if (fMinuit->GetNumFixedPars() == 0) return; 
   // check if parameter has already been defined
   if (int(ivar) >= fMinuit->GetNumPars() ) return;  
    
   // check if parameter is fixed
   for (int i = 0; i < fMinuit->fNpfix; ++i) { 
      if (fMinuit->fIpfix[i] == ivar+1 ) { 
         // parameter is fixed
         fMinuit->Release(ivar);
         return; 
      }
   }
    
}


void TMinuitMinimizer::PrintResults() { 
   // print-out results using classic Minuit format (mnprin)
   if (fMinuit == 0) return; 

   // print minimizer result
   if (PrintLevel() > 2) 
      fMinuit->mnprin(4,fMinuit->fAmin);
   else
      fMinuit->mnprin(3,fMinuit->fAmin);
}

void TMinuitMinimizer::SuppressMinuitWarnings(bool nowarn) { 
   // suppress Minuit2 warnings
   double arglist = 0; 
   int ierr = 0; 
   if (nowarn) 
      fMinuit->mnexcm("SET NOW",&arglist,0,ierr);
   else 
      fMinuit->mnexcm("SET WAR",&arglist,0,ierr);
}


bool TMinuitMinimizer::Contour(unsigned int ipar, unsigned int jpar, unsigned int &npoints, double * x, double * y) {
   // contour plot for parameter i and j
   // need a valid FunctionMinimum otherwise exits
   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::Contour"," invalid TMinuit instance");
      return false;
   }

   // set error and print level 
   double arglist[1];
   int ierr = 0; 
   arglist[0] = ErrorDef(); 
   fMinuit->mnexcm("SET Err",arglist,1,ierr);
      
   arglist[0] = PrintLevel()-1; 
   fMinuit->mnexcm("SET PRINT",arglist,1,ierr);

   // suppress warning in case Printlevel() == 0 
   if (PrintLevel() == 0)    fMinuit->mnexcm("SET NOW",arglist,0,ierr);

   // set precision if needed
   if (Precision() > 0)  { 
      arglist[0] = Precision();
      fMinuit->mnexcm("SET EPS",arglist,1,ierr);
   }


   if (npoints < 4) { 
      Error("TMinuitMinimizer::Contour","Cannot make contour with so few points");
      return false; 
   }
   int npfound = 0; 
   // parameter numbers in mncont start from zero
   fMinuit->mncont( ipar,jpar,npoints, x, y,npfound); 
   if (npfound<4) {
      // mncont did go wrong
      Error("TMinuitMinimizer::Contour","Cannot find more than 4 points");
      return false;
   }
   if (npfound!=(int)npoints) {
      // mncont did go wrong
      Warning("TMinuitMinimizer::Contour","Returning only %d points ",npfound);
      npoints = npfound;
   }
   return true; 
   
}

bool TMinuitMinimizer::Scan(unsigned int ipar, unsigned int & nstep, double * x, double * y, double xmin, double xmax) { 
   // scan a parameter (variable) around the minimum value
   // the parameters must have been set before 
   // if xmin=0 && xmax == 0  by default scan around 2 sigma of the error
   // if the errors  are also zero then scan from min and max of parameter range
   // (if parameters are limited Minuit scan from min and max instead of 2 sigma by default)
   // (force in that case to use errors)

   // scan is not implemented for TMinuit, the way to return the array is only via the graph 
   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::Scan"," invalid TMinuit instance");
      return false;
   }

   // case of default xmin and xmax
   if (xmin >= xmax && (int) ipar < fMinuit->GetNumPars() ) { 
      double val = 0; double err = 0;
      TString name; 
      double xlow = 0; double xup = 0 ;
      int iuint = 0; 
      // in mnpout index starts from ze
      fMinuit->mnpout( ipar, name, val, err, xlow, xup, iuint);
      // redefine 2 sigma for all parameters by default (TMinuit does 1 sigma and range if limited)
      if (iuint > 0 && err > 0) { 
         xmin = val - 2.*err; 
         xmax = val + 2 * err; 
      }
   }
   
   double arglist[4]; 
   int ierr = 0; 

   arglist[0] = PrintLevel()-1; 
   fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
   // suppress warning in case Printlevel() == 0 
   if (PrintLevel() == 0)    fMinuit->mnexcm("SET NOW",arglist,0,ierr);

   // set precision if needed
   if (Precision() > 0)  { 
      arglist[0] = Precision();
      fMinuit->mnexcm("SET EPS",arglist,1,ierr);
   }

   if (nstep == 0) return false; 
   arglist[0] = ipar+1;  // TMinuit starts from 1 
   arglist[1] = nstep+2; // TMinuit deletes two points
   int nargs = 2; 
   if (xmax > xmin ) { 
      arglist[2] = xmin; 
      arglist[3] = xmax; 
      nargs = 4; 
   }
   fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
   if (ierr) { 
      Error("TMinuitMinimizer::Scan"," Error executing command SCAN");
      return false;      
   }
   // get TGraph object
   TGraph * gr = dynamic_cast<TGraph *>(fMinuit->GetPlot() );
   if (!gr) {
      Error("TMinuitMinimizer::Scan"," Error in returned graph object");
      return false;      
   }
   nstep = std::min(gr->GetN(), (int) nstep); 


   std::copy(gr->GetX(), gr->GetX()+nstep, x);
   std::copy(gr->GetY(), gr->GetY()+nstep, y);
   nstep = gr->GetN(); 
   return true; 
}

bool TMinuitMinimizer::Hesse() { 
   // perform calculation of Hessian

   if (fMinuit == 0) { 
      Error("TMinuitMinimizer::Hesse","invalid TMinuit pointer. Need to call first SetFunction and SetVariable"); 
      return false; 
   }


   double arglist[10]; 
   int ierr = 0; 

   // set error and print level 
   arglist[0] = ErrorDef(); 
   fMinuit->mnexcm("SET ERR",arglist,1,ierr);

   int printlevel = PrintLevel(); 
   arglist[0] = printlevel - 1;
   fMinuit->mnexcm("SET PRINT",arglist,1,ierr);

   // suppress warning in case Printlevel() == 0 
   if (printlevel == 0)    fMinuit->mnexcm("SET NOW",arglist,0,ierr);

   // set precision if needed
   if (Precision() > 0)  { 
      arglist[0] = Precision();
      fMinuit->mnexcm("SET EPS",arglist,1,ierr);
   }

   arglist[0] = MaxFunctionCalls(); 

   fMinuit->mnexcm("HESSE",arglist,1,ierr);
   fStatus += 100*ierr; 

   if (ierr != 0) return false;    

   // retrieve results (parameter and error matrix)
   // only if result is OK

   RetrieveParams(); 
   RetrieveErrorMatrix(); 

   return true;
}


//    } // end namespace Fit

// } // end namespace ROOT

 TMinuitMinimizer.cxx:1
 TMinuitMinimizer.cxx:2
 TMinuitMinimizer.cxx:3
 TMinuitMinimizer.cxx:4
 TMinuitMinimizer.cxx:5
 TMinuitMinimizer.cxx:6
 TMinuitMinimizer.cxx:7
 TMinuitMinimizer.cxx:8
 TMinuitMinimizer.cxx:9
 TMinuitMinimizer.cxx:10
 TMinuitMinimizer.cxx:11
 TMinuitMinimizer.cxx:12
 TMinuitMinimizer.cxx:13
 TMinuitMinimizer.cxx:14
 TMinuitMinimizer.cxx:15
 TMinuitMinimizer.cxx:16
 TMinuitMinimizer.cxx:17
 TMinuitMinimizer.cxx:18
 TMinuitMinimizer.cxx:19
 TMinuitMinimizer.cxx:20
 TMinuitMinimizer.cxx:21
 TMinuitMinimizer.cxx:22
 TMinuitMinimizer.cxx:23
 TMinuitMinimizer.cxx:24
 TMinuitMinimizer.cxx:25
 TMinuitMinimizer.cxx:26
 TMinuitMinimizer.cxx:27
 TMinuitMinimizer.cxx:28
 TMinuitMinimizer.cxx:29
 TMinuitMinimizer.cxx:30
 TMinuitMinimizer.cxx:31
 TMinuitMinimizer.cxx:32
 TMinuitMinimizer.cxx:33
 TMinuitMinimizer.cxx:34
 TMinuitMinimizer.cxx:35
 TMinuitMinimizer.cxx:36
 TMinuitMinimizer.cxx:37
 TMinuitMinimizer.cxx:38
 TMinuitMinimizer.cxx:39
 TMinuitMinimizer.cxx:40
 TMinuitMinimizer.cxx:41
 TMinuitMinimizer.cxx:42
 TMinuitMinimizer.cxx:43
 TMinuitMinimizer.cxx:44
 TMinuitMinimizer.cxx:45
 TMinuitMinimizer.cxx:46
 TMinuitMinimizer.cxx:47
 TMinuitMinimizer.cxx:48
 TMinuitMinimizer.cxx:49
 TMinuitMinimizer.cxx:50
 TMinuitMinimizer.cxx:51
 TMinuitMinimizer.cxx:52
 TMinuitMinimizer.cxx:53
 TMinuitMinimizer.cxx:54
 TMinuitMinimizer.cxx:55
 TMinuitMinimizer.cxx:56
 TMinuitMinimizer.cxx:57
 TMinuitMinimizer.cxx:58
 TMinuitMinimizer.cxx:59
 TMinuitMinimizer.cxx:60
 TMinuitMinimizer.cxx:61
 TMinuitMinimizer.cxx:62
 TMinuitMinimizer.cxx:63
 TMinuitMinimizer.cxx:64
 TMinuitMinimizer.cxx:65
 TMinuitMinimizer.cxx:66
 TMinuitMinimizer.cxx:67
 TMinuitMinimizer.cxx:68
 TMinuitMinimizer.cxx:69
 TMinuitMinimizer.cxx:70
 TMinuitMinimizer.cxx:71
 TMinuitMinimizer.cxx:72
 TMinuitMinimizer.cxx:73
 TMinuitMinimizer.cxx:74
 TMinuitMinimizer.cxx:75
 TMinuitMinimizer.cxx:76
 TMinuitMinimizer.cxx:77
 TMinuitMinimizer.cxx:78
 TMinuitMinimizer.cxx:79
 TMinuitMinimizer.cxx:80
 TMinuitMinimizer.cxx:81
 TMinuitMinimizer.cxx:82
 TMinuitMinimizer.cxx:83
 TMinuitMinimizer.cxx:84
 TMinuitMinimizer.cxx:85
 TMinuitMinimizer.cxx:86
 TMinuitMinimizer.cxx:87
 TMinuitMinimizer.cxx:88
 TMinuitMinimizer.cxx:89
 TMinuitMinimizer.cxx:90
 TMinuitMinimizer.cxx:91
 TMinuitMinimizer.cxx:92
 TMinuitMinimizer.cxx:93
 TMinuitMinimizer.cxx:94
 TMinuitMinimizer.cxx:95
 TMinuitMinimizer.cxx:96
 TMinuitMinimizer.cxx:97
 TMinuitMinimizer.cxx:98
 TMinuitMinimizer.cxx:99
 TMinuitMinimizer.cxx:100
 TMinuitMinimizer.cxx:101
 TMinuitMinimizer.cxx:102
 TMinuitMinimizer.cxx:103
 TMinuitMinimizer.cxx:104
 TMinuitMinimizer.cxx:105
 TMinuitMinimizer.cxx:106
 TMinuitMinimizer.cxx:107
 TMinuitMinimizer.cxx:108
 TMinuitMinimizer.cxx:109
 TMinuitMinimizer.cxx:110
 TMinuitMinimizer.cxx:111
 TMinuitMinimizer.cxx:112
 TMinuitMinimizer.cxx:113
 TMinuitMinimizer.cxx:114
 TMinuitMinimizer.cxx:115
 TMinuitMinimizer.cxx:116
 TMinuitMinimizer.cxx:117
 TMinuitMinimizer.cxx:118
 TMinuitMinimizer.cxx:119
 TMinuitMinimizer.cxx:120
 TMinuitMinimizer.cxx:121
 TMinuitMinimizer.cxx:122
 TMinuitMinimizer.cxx:123
 TMinuitMinimizer.cxx:124
 TMinuitMinimizer.cxx:125
 TMinuitMinimizer.cxx:126
 TMinuitMinimizer.cxx:127
 TMinuitMinimizer.cxx:128
 TMinuitMinimizer.cxx:129
 TMinuitMinimizer.cxx:130
 TMinuitMinimizer.cxx:131
 TMinuitMinimizer.cxx:132
 TMinuitMinimizer.cxx:133
 TMinuitMinimizer.cxx:134
 TMinuitMinimizer.cxx:135
 TMinuitMinimizer.cxx:136
 TMinuitMinimizer.cxx:137
 TMinuitMinimizer.cxx:138
 TMinuitMinimizer.cxx:139
 TMinuitMinimizer.cxx:140
 TMinuitMinimizer.cxx:141
 TMinuitMinimizer.cxx:142
 TMinuitMinimizer.cxx:143
 TMinuitMinimizer.cxx:144
 TMinuitMinimizer.cxx:145
 TMinuitMinimizer.cxx:146
 TMinuitMinimizer.cxx:147
 TMinuitMinimizer.cxx:148
 TMinuitMinimizer.cxx:149
 TMinuitMinimizer.cxx:150
 TMinuitMinimizer.cxx:151
 TMinuitMinimizer.cxx:152
 TMinuitMinimizer.cxx:153
 TMinuitMinimizer.cxx:154
 TMinuitMinimizer.cxx:155
 TMinuitMinimizer.cxx:156
 TMinuitMinimizer.cxx:157
 TMinuitMinimizer.cxx:158
 TMinuitMinimizer.cxx:159
 TMinuitMinimizer.cxx:160
 TMinuitMinimizer.cxx:161
 TMinuitMinimizer.cxx:162
 TMinuitMinimizer.cxx:163
 TMinuitMinimizer.cxx:164
 TMinuitMinimizer.cxx:165
 TMinuitMinimizer.cxx:166
 TMinuitMinimizer.cxx:167
 TMinuitMinimizer.cxx:168
 TMinuitMinimizer.cxx:169
 TMinuitMinimizer.cxx:170
 TMinuitMinimizer.cxx:171
 TMinuitMinimizer.cxx:172
 TMinuitMinimizer.cxx:173
 TMinuitMinimizer.cxx:174
 TMinuitMinimizer.cxx:175
 TMinuitMinimizer.cxx:176
 TMinuitMinimizer.cxx:177
 TMinuitMinimizer.cxx:178
 TMinuitMinimizer.cxx:179
 TMinuitMinimizer.cxx:180
 TMinuitMinimizer.cxx:181
 TMinuitMinimizer.cxx:182
 TMinuitMinimizer.cxx:183
 TMinuitMinimizer.cxx:184
 TMinuitMinimizer.cxx:185
 TMinuitMinimizer.cxx:186
 TMinuitMinimizer.cxx:187
 TMinuitMinimizer.cxx:188
 TMinuitMinimizer.cxx:189
 TMinuitMinimizer.cxx:190
 TMinuitMinimizer.cxx:191
 TMinuitMinimizer.cxx:192
 TMinuitMinimizer.cxx:193
 TMinuitMinimizer.cxx:194
 TMinuitMinimizer.cxx:195
 TMinuitMinimizer.cxx:196
 TMinuitMinimizer.cxx:197
 TMinuitMinimizer.cxx:198
 TMinuitMinimizer.cxx:199
 TMinuitMinimizer.cxx:200
 TMinuitMinimizer.cxx:201
 TMinuitMinimizer.cxx:202
 TMinuitMinimizer.cxx:203
 TMinuitMinimizer.cxx:204
 TMinuitMinimizer.cxx:205
 TMinuitMinimizer.cxx:206
 TMinuitMinimizer.cxx:207
 TMinuitMinimizer.cxx:208
 TMinuitMinimizer.cxx:209
 TMinuitMinimizer.cxx:210
 TMinuitMinimizer.cxx:211
 TMinuitMinimizer.cxx:212
 TMinuitMinimizer.cxx:213
 TMinuitMinimizer.cxx:214
 TMinuitMinimizer.cxx:215
 TMinuitMinimizer.cxx:216
 TMinuitMinimizer.cxx:217
 TMinuitMinimizer.cxx:218
 TMinuitMinimizer.cxx:219
 TMinuitMinimizer.cxx:220
 TMinuitMinimizer.cxx:221
 TMinuitMinimizer.cxx:222
 TMinuitMinimizer.cxx:223
 TMinuitMinimizer.cxx:224
 TMinuitMinimizer.cxx:225
 TMinuitMinimizer.cxx:226
 TMinuitMinimizer.cxx:227
 TMinuitMinimizer.cxx:228
 TMinuitMinimizer.cxx:229
 TMinuitMinimizer.cxx:230
 TMinuitMinimizer.cxx:231
 TMinuitMinimizer.cxx:232
 TMinuitMinimizer.cxx:233
 TMinuitMinimizer.cxx:234
 TMinuitMinimizer.cxx:235
 TMinuitMinimizer.cxx:236
 TMinuitMinimizer.cxx:237
 TMinuitMinimizer.cxx:238
 TMinuitMinimizer.cxx:239
 TMinuitMinimizer.cxx:240
 TMinuitMinimizer.cxx:241
 TMinuitMinimizer.cxx:242
 TMinuitMinimizer.cxx:243
 TMinuitMinimizer.cxx:244
 TMinuitMinimizer.cxx:245
 TMinuitMinimizer.cxx:246
 TMinuitMinimizer.cxx:247
 TMinuitMinimizer.cxx:248
 TMinuitMinimizer.cxx:249
 TMinuitMinimizer.cxx:250
 TMinuitMinimizer.cxx:251
 TMinuitMinimizer.cxx:252
 TMinuitMinimizer.cxx:253
 TMinuitMinimizer.cxx:254
 TMinuitMinimizer.cxx:255
 TMinuitMinimizer.cxx:256
 TMinuitMinimizer.cxx:257
 TMinuitMinimizer.cxx:258
 TMinuitMinimizer.cxx:259
 TMinuitMinimizer.cxx:260
 TMinuitMinimizer.cxx:261
 TMinuitMinimizer.cxx:262
 TMinuitMinimizer.cxx:263
 TMinuitMinimizer.cxx:264
 TMinuitMinimizer.cxx:265
 TMinuitMinimizer.cxx:266
 TMinuitMinimizer.cxx:267
 TMinuitMinimizer.cxx:268
 TMinuitMinimizer.cxx:269
 TMinuitMinimizer.cxx:270
 TMinuitMinimizer.cxx:271
 TMinuitMinimizer.cxx:272
 TMinuitMinimizer.cxx:273
 TMinuitMinimizer.cxx:274
 TMinuitMinimizer.cxx:275
 TMinuitMinimizer.cxx:276
 TMinuitMinimizer.cxx:277
 TMinuitMinimizer.cxx:278
 TMinuitMinimizer.cxx:279
 TMinuitMinimizer.cxx:280
 TMinuitMinimizer.cxx:281
 TMinuitMinimizer.cxx:282
 TMinuitMinimizer.cxx:283
 TMinuitMinimizer.cxx:284
 TMinuitMinimizer.cxx:285
 TMinuitMinimizer.cxx:286
 TMinuitMinimizer.cxx:287
 TMinuitMinimizer.cxx:288
 TMinuitMinimizer.cxx:289
 TMinuitMinimizer.cxx:290
 TMinuitMinimizer.cxx:291
 TMinuitMinimizer.cxx:292
 TMinuitMinimizer.cxx:293
 TMinuitMinimizer.cxx:294
 TMinuitMinimizer.cxx:295
 TMinuitMinimizer.cxx:296
 TMinuitMinimizer.cxx:297
 TMinuitMinimizer.cxx:298
 TMinuitMinimizer.cxx:299
 TMinuitMinimizer.cxx:300
 TMinuitMinimizer.cxx:301
 TMinuitMinimizer.cxx:302
 TMinuitMinimizer.cxx:303
 TMinuitMinimizer.cxx:304
 TMinuitMinimizer.cxx:305
 TMinuitMinimizer.cxx:306
 TMinuitMinimizer.cxx:307
 TMinuitMinimizer.cxx:308
 TMinuitMinimizer.cxx:309
 TMinuitMinimizer.cxx:310
 TMinuitMinimizer.cxx:311
 TMinuitMinimizer.cxx:312
 TMinuitMinimizer.cxx:313
 TMinuitMinimizer.cxx:314
 TMinuitMinimizer.cxx:315
 TMinuitMinimizer.cxx:316
 TMinuitMinimizer.cxx:317
 TMinuitMinimizer.cxx:318
 TMinuitMinimizer.cxx:319
 TMinuitMinimizer.cxx:320
 TMinuitMinimizer.cxx:321
 TMinuitMinimizer.cxx:322
 TMinuitMinimizer.cxx:323
 TMinuitMinimizer.cxx:324
 TMinuitMinimizer.cxx:325
 TMinuitMinimizer.cxx:326
 TMinuitMinimizer.cxx:327
 TMinuitMinimizer.cxx:328
 TMinuitMinimizer.cxx:329
 TMinuitMinimizer.cxx:330
 TMinuitMinimizer.cxx:331
 TMinuitMinimizer.cxx:332
 TMinuitMinimizer.cxx:333
 TMinuitMinimizer.cxx:334
 TMinuitMinimizer.cxx:335
 TMinuitMinimizer.cxx:336
 TMinuitMinimizer.cxx:337
 TMinuitMinimizer.cxx:338
 TMinuitMinimizer.cxx:339
 TMinuitMinimizer.cxx:340
 TMinuitMinimizer.cxx:341
 TMinuitMinimizer.cxx:342
 TMinuitMinimizer.cxx:343
 TMinuitMinimizer.cxx:344
 TMinuitMinimizer.cxx:345
 TMinuitMinimizer.cxx:346
 TMinuitMinimizer.cxx:347
 TMinuitMinimizer.cxx:348
 TMinuitMinimizer.cxx:349
 TMinuitMinimizer.cxx:350
 TMinuitMinimizer.cxx:351
 TMinuitMinimizer.cxx:352
 TMinuitMinimizer.cxx:353
 TMinuitMinimizer.cxx:354
 TMinuitMinimizer.cxx:355
 TMinuitMinimizer.cxx:356
 TMinuitMinimizer.cxx:357
 TMinuitMinimizer.cxx:358
 TMinuitMinimizer.cxx:359
 TMinuitMinimizer.cxx:360
 TMinuitMinimizer.cxx:361
 TMinuitMinimizer.cxx:362
 TMinuitMinimizer.cxx:363
 TMinuitMinimizer.cxx:364
 TMinuitMinimizer.cxx:365
 TMinuitMinimizer.cxx:366
 TMinuitMinimizer.cxx:367
 TMinuitMinimizer.cxx:368
 TMinuitMinimizer.cxx:369
 TMinuitMinimizer.cxx:370
 TMinuitMinimizer.cxx:371
 TMinuitMinimizer.cxx:372
 TMinuitMinimizer.cxx:373
 TMinuitMinimizer.cxx:374
 TMinuitMinimizer.cxx:375
 TMinuitMinimizer.cxx:376
 TMinuitMinimizer.cxx:377
 TMinuitMinimizer.cxx:378
 TMinuitMinimizer.cxx:379
 TMinuitMinimizer.cxx:380
 TMinuitMinimizer.cxx:381
 TMinuitMinimizer.cxx:382
 TMinuitMinimizer.cxx:383
 TMinuitMinimizer.cxx:384
 TMinuitMinimizer.cxx:385
 TMinuitMinimizer.cxx:386
 TMinuitMinimizer.cxx:387
 TMinuitMinimizer.cxx:388
 TMinuitMinimizer.cxx:389
 TMinuitMinimizer.cxx:390
 TMinuitMinimizer.cxx:391
 TMinuitMinimizer.cxx:392
 TMinuitMinimizer.cxx:393
 TMinuitMinimizer.cxx:394
 TMinuitMinimizer.cxx:395
 TMinuitMinimizer.cxx:396
 TMinuitMinimizer.cxx:397
 TMinuitMinimizer.cxx:398
 TMinuitMinimizer.cxx:399
 TMinuitMinimizer.cxx:400
 TMinuitMinimizer.cxx:401
 TMinuitMinimizer.cxx:402
 TMinuitMinimizer.cxx:403
 TMinuitMinimizer.cxx:404
 TMinuitMinimizer.cxx:405
 TMinuitMinimizer.cxx:406
 TMinuitMinimizer.cxx:407
 TMinuitMinimizer.cxx:408
 TMinuitMinimizer.cxx:409
 TMinuitMinimizer.cxx:410
 TMinuitMinimizer.cxx:411
 TMinuitMinimizer.cxx:412
 TMinuitMinimizer.cxx:413
 TMinuitMinimizer.cxx:414
 TMinuitMinimizer.cxx:415
 TMinuitMinimizer.cxx:416
 TMinuitMinimizer.cxx:417
 TMinuitMinimizer.cxx:418
 TMinuitMinimizer.cxx:419
 TMinuitMinimizer.cxx:420
 TMinuitMinimizer.cxx:421
 TMinuitMinimizer.cxx:422
 TMinuitMinimizer.cxx:423
 TMinuitMinimizer.cxx:424
 TMinuitMinimizer.cxx:425
 TMinuitMinimizer.cxx:426
 TMinuitMinimizer.cxx:427
 TMinuitMinimizer.cxx:428
 TMinuitMinimizer.cxx:429
 TMinuitMinimizer.cxx:430
 TMinuitMinimizer.cxx:431
 TMinuitMinimizer.cxx:432
 TMinuitMinimizer.cxx:433
 TMinuitMinimizer.cxx:434
 TMinuitMinimizer.cxx:435
 TMinuitMinimizer.cxx:436
 TMinuitMinimizer.cxx:437
 TMinuitMinimizer.cxx:438
 TMinuitMinimizer.cxx:439
 TMinuitMinimizer.cxx:440
 TMinuitMinimizer.cxx:441
 TMinuitMinimizer.cxx:442
 TMinuitMinimizer.cxx:443
 TMinuitMinimizer.cxx:444
 TMinuitMinimizer.cxx:445
 TMinuitMinimizer.cxx:446
 TMinuitMinimizer.cxx:447
 TMinuitMinimizer.cxx:448
 TMinuitMinimizer.cxx:449
 TMinuitMinimizer.cxx:450
 TMinuitMinimizer.cxx:451
 TMinuitMinimizer.cxx:452
 TMinuitMinimizer.cxx:453
 TMinuitMinimizer.cxx:454
 TMinuitMinimizer.cxx:455
 TMinuitMinimizer.cxx:456
 TMinuitMinimizer.cxx:457
 TMinuitMinimizer.cxx:458
 TMinuitMinimizer.cxx:459
 TMinuitMinimizer.cxx:460
 TMinuitMinimizer.cxx:461
 TMinuitMinimizer.cxx:462
 TMinuitMinimizer.cxx:463
 TMinuitMinimizer.cxx:464
 TMinuitMinimizer.cxx:465
 TMinuitMinimizer.cxx:466
 TMinuitMinimizer.cxx:467
 TMinuitMinimizer.cxx:468
 TMinuitMinimizer.cxx:469
 TMinuitMinimizer.cxx:470
 TMinuitMinimizer.cxx:471
 TMinuitMinimizer.cxx:472
 TMinuitMinimizer.cxx:473
 TMinuitMinimizer.cxx:474
 TMinuitMinimizer.cxx:475
 TMinuitMinimizer.cxx:476
 TMinuitMinimizer.cxx:477
 TMinuitMinimizer.cxx:478
 TMinuitMinimizer.cxx:479
 TMinuitMinimizer.cxx:480
 TMinuitMinimizer.cxx:481
 TMinuitMinimizer.cxx:482
 TMinuitMinimizer.cxx:483
 TMinuitMinimizer.cxx:484
 TMinuitMinimizer.cxx:485
 TMinuitMinimizer.cxx:486
 TMinuitMinimizer.cxx:487
 TMinuitMinimizer.cxx:488
 TMinuitMinimizer.cxx:489
 TMinuitMinimizer.cxx:490
 TMinuitMinimizer.cxx:491
 TMinuitMinimizer.cxx:492
 TMinuitMinimizer.cxx:493
 TMinuitMinimizer.cxx:494
 TMinuitMinimizer.cxx:495
 TMinuitMinimizer.cxx:496
 TMinuitMinimizer.cxx:497
 TMinuitMinimizer.cxx:498
 TMinuitMinimizer.cxx:499
 TMinuitMinimizer.cxx:500
 TMinuitMinimizer.cxx:501
 TMinuitMinimizer.cxx:502
 TMinuitMinimizer.cxx:503
 TMinuitMinimizer.cxx:504
 TMinuitMinimizer.cxx:505
 TMinuitMinimizer.cxx:506
 TMinuitMinimizer.cxx:507
 TMinuitMinimizer.cxx:508
 TMinuitMinimizer.cxx:509
 TMinuitMinimizer.cxx:510
 TMinuitMinimizer.cxx:511
 TMinuitMinimizer.cxx:512
 TMinuitMinimizer.cxx:513
 TMinuitMinimizer.cxx:514
 TMinuitMinimizer.cxx:515
 TMinuitMinimizer.cxx:516
 TMinuitMinimizer.cxx:517
 TMinuitMinimizer.cxx:518
 TMinuitMinimizer.cxx:519
 TMinuitMinimizer.cxx:520
 TMinuitMinimizer.cxx:521
 TMinuitMinimizer.cxx:522
 TMinuitMinimizer.cxx:523
 TMinuitMinimizer.cxx:524
 TMinuitMinimizer.cxx:525
 TMinuitMinimizer.cxx:526
 TMinuitMinimizer.cxx:527
 TMinuitMinimizer.cxx:528
 TMinuitMinimizer.cxx:529
 TMinuitMinimizer.cxx:530
 TMinuitMinimizer.cxx:531
 TMinuitMinimizer.cxx:532
 TMinuitMinimizer.cxx:533
 TMinuitMinimizer.cxx:534
 TMinuitMinimizer.cxx:535
 TMinuitMinimizer.cxx:536
 TMinuitMinimizer.cxx:537
 TMinuitMinimizer.cxx:538
 TMinuitMinimizer.cxx:539
 TMinuitMinimizer.cxx:540
 TMinuitMinimizer.cxx:541
 TMinuitMinimizer.cxx:542
 TMinuitMinimizer.cxx:543
 TMinuitMinimizer.cxx:544
 TMinuitMinimizer.cxx:545
 TMinuitMinimizer.cxx:546
 TMinuitMinimizer.cxx:547
 TMinuitMinimizer.cxx:548
 TMinuitMinimizer.cxx:549
 TMinuitMinimizer.cxx:550
 TMinuitMinimizer.cxx:551
 TMinuitMinimizer.cxx:552
 TMinuitMinimizer.cxx:553
 TMinuitMinimizer.cxx:554
 TMinuitMinimizer.cxx:555
 TMinuitMinimizer.cxx:556
 TMinuitMinimizer.cxx:557
 TMinuitMinimizer.cxx:558
 TMinuitMinimizer.cxx:559
 TMinuitMinimizer.cxx:560
 TMinuitMinimizer.cxx:561
 TMinuitMinimizer.cxx:562
 TMinuitMinimizer.cxx:563
 TMinuitMinimizer.cxx:564
 TMinuitMinimizer.cxx:565
 TMinuitMinimizer.cxx:566
 TMinuitMinimizer.cxx:567
 TMinuitMinimizer.cxx:568
 TMinuitMinimizer.cxx:569
 TMinuitMinimizer.cxx:570
 TMinuitMinimizer.cxx:571
 TMinuitMinimizer.cxx:572
 TMinuitMinimizer.cxx:573
 TMinuitMinimizer.cxx:574
 TMinuitMinimizer.cxx:575
 TMinuitMinimizer.cxx:576
 TMinuitMinimizer.cxx:577
 TMinuitMinimizer.cxx:578
 TMinuitMinimizer.cxx:579
 TMinuitMinimizer.cxx:580
 TMinuitMinimizer.cxx:581
 TMinuitMinimizer.cxx:582
 TMinuitMinimizer.cxx:583
 TMinuitMinimizer.cxx:584
 TMinuitMinimizer.cxx:585
 TMinuitMinimizer.cxx:586
 TMinuitMinimizer.cxx:587
 TMinuitMinimizer.cxx:588
 TMinuitMinimizer.cxx:589
 TMinuitMinimizer.cxx:590
 TMinuitMinimizer.cxx:591
 TMinuitMinimizer.cxx:592
 TMinuitMinimizer.cxx:593
 TMinuitMinimizer.cxx:594
 TMinuitMinimizer.cxx:595
 TMinuitMinimizer.cxx:596
 TMinuitMinimizer.cxx:597
 TMinuitMinimizer.cxx:598
 TMinuitMinimizer.cxx:599
 TMinuitMinimizer.cxx:600
 TMinuitMinimizer.cxx:601
 TMinuitMinimizer.cxx:602
 TMinuitMinimizer.cxx:603
 TMinuitMinimizer.cxx:604
 TMinuitMinimizer.cxx:605
 TMinuitMinimizer.cxx:606
 TMinuitMinimizer.cxx:607
 TMinuitMinimizer.cxx:608
 TMinuitMinimizer.cxx:609
 TMinuitMinimizer.cxx:610
 TMinuitMinimizer.cxx:611
 TMinuitMinimizer.cxx:612
 TMinuitMinimizer.cxx:613
 TMinuitMinimizer.cxx:614
 TMinuitMinimizer.cxx:615
 TMinuitMinimizer.cxx:616
 TMinuitMinimizer.cxx:617
 TMinuitMinimizer.cxx:618
 TMinuitMinimizer.cxx:619
 TMinuitMinimizer.cxx:620
 TMinuitMinimizer.cxx:621
 TMinuitMinimizer.cxx:622
 TMinuitMinimizer.cxx:623
 TMinuitMinimizer.cxx:624
 TMinuitMinimizer.cxx:625
 TMinuitMinimizer.cxx:626
 TMinuitMinimizer.cxx:627
 TMinuitMinimizer.cxx:628
 TMinuitMinimizer.cxx:629
 TMinuitMinimizer.cxx:630
 TMinuitMinimizer.cxx:631
 TMinuitMinimizer.cxx:632
 TMinuitMinimizer.cxx:633
 TMinuitMinimizer.cxx:634
 TMinuitMinimizer.cxx:635
 TMinuitMinimizer.cxx:636
 TMinuitMinimizer.cxx:637
 TMinuitMinimizer.cxx:638
 TMinuitMinimizer.cxx:639
 TMinuitMinimizer.cxx:640
 TMinuitMinimizer.cxx:641
 TMinuitMinimizer.cxx:642
 TMinuitMinimizer.cxx:643
 TMinuitMinimizer.cxx:644
 TMinuitMinimizer.cxx:645
 TMinuitMinimizer.cxx:646
 TMinuitMinimizer.cxx:647
 TMinuitMinimizer.cxx:648
 TMinuitMinimizer.cxx:649
 TMinuitMinimizer.cxx:650
 TMinuitMinimizer.cxx:651
 TMinuitMinimizer.cxx:652
 TMinuitMinimizer.cxx:653
 TMinuitMinimizer.cxx:654
 TMinuitMinimizer.cxx:655
 TMinuitMinimizer.cxx:656
 TMinuitMinimizer.cxx:657
 TMinuitMinimizer.cxx:658
 TMinuitMinimizer.cxx:659
 TMinuitMinimizer.cxx:660
 TMinuitMinimizer.cxx:661
 TMinuitMinimizer.cxx:662
 TMinuitMinimizer.cxx:663
 TMinuitMinimizer.cxx:664
 TMinuitMinimizer.cxx:665
 TMinuitMinimizer.cxx:666
 TMinuitMinimizer.cxx:667
 TMinuitMinimizer.cxx:668
 TMinuitMinimizer.cxx:669
 TMinuitMinimizer.cxx:670
 TMinuitMinimizer.cxx:671
 TMinuitMinimizer.cxx:672
 TMinuitMinimizer.cxx:673
 TMinuitMinimizer.cxx:674
 TMinuitMinimizer.cxx:675
 TMinuitMinimizer.cxx:676
 TMinuitMinimizer.cxx:677
 TMinuitMinimizer.cxx:678
 TMinuitMinimizer.cxx:679
 TMinuitMinimizer.cxx:680
 TMinuitMinimizer.cxx:681
 TMinuitMinimizer.cxx:682
 TMinuitMinimizer.cxx:683
 TMinuitMinimizer.cxx:684
 TMinuitMinimizer.cxx:685
 TMinuitMinimizer.cxx:686
 TMinuitMinimizer.cxx:687
 TMinuitMinimizer.cxx:688
 TMinuitMinimizer.cxx:689
 TMinuitMinimizer.cxx:690
 TMinuitMinimizer.cxx:691
 TMinuitMinimizer.cxx:692
 TMinuitMinimizer.cxx:693
 TMinuitMinimizer.cxx:694
 TMinuitMinimizer.cxx:695
 TMinuitMinimizer.cxx:696
 TMinuitMinimizer.cxx:697
 TMinuitMinimizer.cxx:698
 TMinuitMinimizer.cxx:699
 TMinuitMinimizer.cxx:700
 TMinuitMinimizer.cxx:701
 TMinuitMinimizer.cxx:702
 TMinuitMinimizer.cxx:703
 TMinuitMinimizer.cxx:704
 TMinuitMinimizer.cxx:705
 TMinuitMinimizer.cxx:706
 TMinuitMinimizer.cxx:707
 TMinuitMinimizer.cxx:708
 TMinuitMinimizer.cxx:709
 TMinuitMinimizer.cxx:710
 TMinuitMinimizer.cxx:711
 TMinuitMinimizer.cxx:712
 TMinuitMinimizer.cxx:713
 TMinuitMinimizer.cxx:714
 TMinuitMinimizer.cxx:715
 TMinuitMinimizer.cxx:716
 TMinuitMinimizer.cxx:717
 TMinuitMinimizer.cxx:718
 TMinuitMinimizer.cxx:719
 TMinuitMinimizer.cxx:720
 TMinuitMinimizer.cxx:721
 TMinuitMinimizer.cxx:722
 TMinuitMinimizer.cxx:723
 TMinuitMinimizer.cxx:724
 TMinuitMinimizer.cxx:725
 TMinuitMinimizer.cxx:726
 TMinuitMinimizer.cxx:727
 TMinuitMinimizer.cxx:728
 TMinuitMinimizer.cxx:729
 TMinuitMinimizer.cxx:730
 TMinuitMinimizer.cxx:731
 TMinuitMinimizer.cxx:732
 TMinuitMinimizer.cxx:733
 TMinuitMinimizer.cxx:734
 TMinuitMinimizer.cxx:735
 TMinuitMinimizer.cxx:736
 TMinuitMinimizer.cxx:737
 TMinuitMinimizer.cxx:738
 TMinuitMinimizer.cxx:739
 TMinuitMinimizer.cxx:740
 TMinuitMinimizer.cxx:741
 TMinuitMinimizer.cxx:742
 TMinuitMinimizer.cxx:743
 TMinuitMinimizer.cxx:744
 TMinuitMinimizer.cxx:745
 TMinuitMinimizer.cxx:746
 TMinuitMinimizer.cxx:747
 TMinuitMinimizer.cxx:748
 TMinuitMinimizer.cxx:749
 TMinuitMinimizer.cxx:750
 TMinuitMinimizer.cxx:751
 TMinuitMinimizer.cxx:752
 TMinuitMinimizer.cxx:753
 TMinuitMinimizer.cxx:754
 TMinuitMinimizer.cxx:755
 TMinuitMinimizer.cxx:756
 TMinuitMinimizer.cxx:757
 TMinuitMinimizer.cxx:758
 TMinuitMinimizer.cxx:759
 TMinuitMinimizer.cxx:760
 TMinuitMinimizer.cxx:761
 TMinuitMinimizer.cxx:762
 TMinuitMinimizer.cxx:763
 TMinuitMinimizer.cxx:764
 TMinuitMinimizer.cxx:765
 TMinuitMinimizer.cxx:766
 TMinuitMinimizer.cxx:767
 TMinuitMinimizer.cxx:768
 TMinuitMinimizer.cxx:769
 TMinuitMinimizer.cxx:770
 TMinuitMinimizer.cxx:771
 TMinuitMinimizer.cxx:772
 TMinuitMinimizer.cxx:773
 TMinuitMinimizer.cxx:774
 TMinuitMinimizer.cxx:775
 TMinuitMinimizer.cxx:776
 TMinuitMinimizer.cxx:777
 TMinuitMinimizer.cxx:778
 TMinuitMinimizer.cxx:779
 TMinuitMinimizer.cxx:780
 TMinuitMinimizer.cxx:781
 TMinuitMinimizer.cxx:782
 TMinuitMinimizer.cxx:783
 TMinuitMinimizer.cxx:784
 TMinuitMinimizer.cxx:785
 TMinuitMinimizer.cxx:786
 TMinuitMinimizer.cxx:787
 TMinuitMinimizer.cxx:788
 TMinuitMinimizer.cxx:789
 TMinuitMinimizer.cxx:790
 TMinuitMinimizer.cxx:791
 TMinuitMinimizer.cxx:792
 TMinuitMinimizer.cxx:793
 TMinuitMinimizer.cxx:794
 TMinuitMinimizer.cxx:795
 TMinuitMinimizer.cxx:796
 TMinuitMinimizer.cxx:797
 TMinuitMinimizer.cxx:798
 TMinuitMinimizer.cxx:799
 TMinuitMinimizer.cxx:800
 TMinuitMinimizer.cxx:801
 TMinuitMinimizer.cxx:802
 TMinuitMinimizer.cxx:803
 TMinuitMinimizer.cxx:804
 TMinuitMinimizer.cxx:805
 TMinuitMinimizer.cxx:806
 TMinuitMinimizer.cxx:807
 TMinuitMinimizer.cxx:808
 TMinuitMinimizer.cxx:809
 TMinuitMinimizer.cxx:810
 TMinuitMinimizer.cxx:811
 TMinuitMinimizer.cxx:812
 TMinuitMinimizer.cxx:813
 TMinuitMinimizer.cxx:814
 TMinuitMinimizer.cxx:815
 TMinuitMinimizer.cxx:816
 TMinuitMinimizer.cxx:817
 TMinuitMinimizer.cxx:818
 TMinuitMinimizer.cxx:819
 TMinuitMinimizer.cxx:820
 TMinuitMinimizer.cxx:821
 TMinuitMinimizer.cxx:822
 TMinuitMinimizer.cxx:823
 TMinuitMinimizer.cxx:824
 TMinuitMinimizer.cxx:825
 TMinuitMinimizer.cxx:826
 TMinuitMinimizer.cxx:827
 TMinuitMinimizer.cxx:828
 TMinuitMinimizer.cxx:829
 TMinuitMinimizer.cxx:830
 TMinuitMinimizer.cxx:831
 TMinuitMinimizer.cxx:832
 TMinuitMinimizer.cxx:833
 TMinuitMinimizer.cxx:834
 TMinuitMinimizer.cxx:835
 TMinuitMinimizer.cxx:836
 TMinuitMinimizer.cxx:837
 TMinuitMinimizer.cxx:838
 TMinuitMinimizer.cxx:839
 TMinuitMinimizer.cxx:840
 TMinuitMinimizer.cxx:841
 TMinuitMinimizer.cxx:842
 TMinuitMinimizer.cxx:843
 TMinuitMinimizer.cxx:844
 TMinuitMinimizer.cxx:845
 TMinuitMinimizer.cxx:846
 TMinuitMinimizer.cxx:847
 TMinuitMinimizer.cxx:848
 TMinuitMinimizer.cxx:849
 TMinuitMinimizer.cxx:850
 TMinuitMinimizer.cxx:851
 TMinuitMinimizer.cxx:852
 TMinuitMinimizer.cxx:853
 TMinuitMinimizer.cxx:854
 TMinuitMinimizer.cxx:855
 TMinuitMinimizer.cxx:856
 TMinuitMinimizer.cxx:857
 TMinuitMinimizer.cxx:858
 TMinuitMinimizer.cxx:859
 TMinuitMinimizer.cxx:860
 TMinuitMinimizer.cxx:861
 TMinuitMinimizer.cxx:862
 TMinuitMinimizer.cxx:863
 TMinuitMinimizer.cxx:864
 TMinuitMinimizer.cxx:865
 TMinuitMinimizer.cxx:866
 TMinuitMinimizer.cxx:867
 TMinuitMinimizer.cxx:868
 TMinuitMinimizer.cxx:869
 TMinuitMinimizer.cxx:870
 TMinuitMinimizer.cxx:871
 TMinuitMinimizer.cxx:872
 TMinuitMinimizer.cxx:873
 TMinuitMinimizer.cxx:874
 TMinuitMinimizer.cxx:875
 TMinuitMinimizer.cxx:876
 TMinuitMinimizer.cxx:877
 TMinuitMinimizer.cxx:878
 TMinuitMinimizer.cxx:879
 TMinuitMinimizer.cxx:880
 TMinuitMinimizer.cxx:881
 TMinuitMinimizer.cxx:882
 TMinuitMinimizer.cxx:883
 TMinuitMinimizer.cxx:884
 TMinuitMinimizer.cxx:885
 TMinuitMinimizer.cxx:886
 TMinuitMinimizer.cxx:887
 TMinuitMinimizer.cxx:888
 TMinuitMinimizer.cxx:889
 TMinuitMinimizer.cxx:890
 TMinuitMinimizer.cxx:891
 TMinuitMinimizer.cxx:892
 TMinuitMinimizer.cxx:893
 TMinuitMinimizer.cxx:894
 TMinuitMinimizer.cxx:895
 TMinuitMinimizer.cxx:896
 TMinuitMinimizer.cxx:897
 TMinuitMinimizer.cxx:898
 TMinuitMinimizer.cxx:899
 TMinuitMinimizer.cxx:900
 TMinuitMinimizer.cxx:901
 TMinuitMinimizer.cxx:902
 TMinuitMinimizer.cxx:903
 TMinuitMinimizer.cxx:904
 TMinuitMinimizer.cxx:905
 TMinuitMinimizer.cxx:906
 TMinuitMinimizer.cxx:907
 TMinuitMinimizer.cxx:908
 TMinuitMinimizer.cxx:909
 TMinuitMinimizer.cxx:910
 TMinuitMinimizer.cxx:911
 TMinuitMinimizer.cxx:912
 TMinuitMinimizer.cxx:913
 TMinuitMinimizer.cxx:914
 TMinuitMinimizer.cxx:915
 TMinuitMinimizer.cxx:916
 TMinuitMinimizer.cxx:917
 TMinuitMinimizer.cxx:918
 TMinuitMinimizer.cxx:919
 TMinuitMinimizer.cxx:920
 TMinuitMinimizer.cxx:921
 TMinuitMinimizer.cxx:922
 TMinuitMinimizer.cxx:923
 TMinuitMinimizer.cxx:924
 TMinuitMinimizer.cxx:925
 TMinuitMinimizer.cxx:926
 TMinuitMinimizer.cxx:927
 TMinuitMinimizer.cxx:928
 TMinuitMinimizer.cxx:929
 TMinuitMinimizer.cxx:930
 TMinuitMinimizer.cxx:931
 TMinuitMinimizer.cxx:932
 TMinuitMinimizer.cxx:933
 TMinuitMinimizer.cxx:934
 TMinuitMinimizer.cxx:935
 TMinuitMinimizer.cxx:936
 TMinuitMinimizer.cxx:937
 TMinuitMinimizer.cxx:938
 TMinuitMinimizer.cxx:939
 TMinuitMinimizer.cxx:940
 TMinuitMinimizer.cxx:941
 TMinuitMinimizer.cxx:942
 TMinuitMinimizer.cxx:943
 TMinuitMinimizer.cxx:944
 TMinuitMinimizer.cxx:945
 TMinuitMinimizer.cxx:946
 TMinuitMinimizer.cxx:947
 TMinuitMinimizer.cxx:948
 TMinuitMinimizer.cxx:949
 TMinuitMinimizer.cxx:950
 TMinuitMinimizer.cxx:951
 TMinuitMinimizer.cxx:952
 TMinuitMinimizer.cxx:953
 TMinuitMinimizer.cxx:954
 TMinuitMinimizer.cxx:955
 TMinuitMinimizer.cxx:956
 TMinuitMinimizer.cxx:957
 TMinuitMinimizer.cxx:958
 TMinuitMinimizer.cxx:959
 TMinuitMinimizer.cxx:960
 TMinuitMinimizer.cxx:961
 TMinuitMinimizer.cxx:962
 TMinuitMinimizer.cxx:963
 TMinuitMinimizer.cxx:964
 TMinuitMinimizer.cxx:965
 TMinuitMinimizer.cxx:966
 TMinuitMinimizer.cxx:967
 TMinuitMinimizer.cxx:968
 TMinuitMinimizer.cxx:969
 TMinuitMinimizer.cxx:970
 TMinuitMinimizer.cxx:971
 TMinuitMinimizer.cxx:972
 TMinuitMinimizer.cxx:973
 TMinuitMinimizer.cxx:974
 TMinuitMinimizer.cxx:975
 TMinuitMinimizer.cxx:976
 TMinuitMinimizer.cxx:977
 TMinuitMinimizer.cxx:978
 TMinuitMinimizer.cxx:979
 TMinuitMinimizer.cxx:980
 TMinuitMinimizer.cxx:981
 TMinuitMinimizer.cxx:982
 TMinuitMinimizer.cxx:983
 TMinuitMinimizer.cxx:984
 TMinuitMinimizer.cxx:985
 TMinuitMinimizer.cxx:986
 TMinuitMinimizer.cxx:987
 TMinuitMinimizer.cxx:988
 TMinuitMinimizer.cxx:989
 TMinuitMinimizer.cxx:990
 TMinuitMinimizer.cxx:991
 TMinuitMinimizer.cxx:992
 TMinuitMinimizer.cxx:993
 TMinuitMinimizer.cxx:994
 TMinuitMinimizer.cxx:995
 TMinuitMinimizer.cxx:996
 TMinuitMinimizer.cxx:997
 TMinuitMinimizer.cxx:998
 TMinuitMinimizer.cxx:999
 TMinuitMinimizer.cxx:1000
 TMinuitMinimizer.cxx:1001
 TMinuitMinimizer.cxx:1002
 TMinuitMinimizer.cxx:1003
 TMinuitMinimizer.cxx:1004
 TMinuitMinimizer.cxx:1005
 TMinuitMinimizer.cxx:1006
 TMinuitMinimizer.cxx:1007
 TMinuitMinimizer.cxx:1008
 TMinuitMinimizer.cxx:1009
 TMinuitMinimizer.cxx:1010
 TMinuitMinimizer.cxx:1011
 TMinuitMinimizer.cxx:1012
 TMinuitMinimizer.cxx:1013
 TMinuitMinimizer.cxx:1014
 TMinuitMinimizer.cxx:1015
 TMinuitMinimizer.cxx:1016
 TMinuitMinimizer.cxx:1017
 TMinuitMinimizer.cxx:1018
 TMinuitMinimizer.cxx:1019
 TMinuitMinimizer.cxx:1020
 TMinuitMinimizer.cxx:1021
 TMinuitMinimizer.cxx:1022
 TMinuitMinimizer.cxx:1023
 TMinuitMinimizer.cxx:1024
 TMinuitMinimizer.cxx:1025
 TMinuitMinimizer.cxx:1026
 TMinuitMinimizer.cxx:1027
 TMinuitMinimizer.cxx:1028
 TMinuitMinimizer.cxx:1029
 TMinuitMinimizer.cxx:1030
 TMinuitMinimizer.cxx:1031
 TMinuitMinimizer.cxx:1032
 TMinuitMinimizer.cxx:1033
 TMinuitMinimizer.cxx:1034
 TMinuitMinimizer.cxx:1035
 TMinuitMinimizer.cxx:1036
 TMinuitMinimizer.cxx:1037
 TMinuitMinimizer.cxx:1038
 TMinuitMinimizer.cxx:1039
 TMinuitMinimizer.cxx:1040
 TMinuitMinimizer.cxx:1041
 TMinuitMinimizer.cxx:1042
 TMinuitMinimizer.cxx:1043
 TMinuitMinimizer.cxx:1044
 TMinuitMinimizer.cxx:1045
 TMinuitMinimizer.cxx:1046
 TMinuitMinimizer.cxx:1047
 TMinuitMinimizer.cxx:1048
 TMinuitMinimizer.cxx:1049
 TMinuitMinimizer.cxx:1050
 TMinuitMinimizer.cxx:1051
 TMinuitMinimizer.cxx:1052
 TMinuitMinimizer.cxx:1053
 TMinuitMinimizer.cxx:1054
 TMinuitMinimizer.cxx:1055
 TMinuitMinimizer.cxx:1056
 TMinuitMinimizer.cxx:1057
 TMinuitMinimizer.cxx:1058
 TMinuitMinimizer.cxx:1059
 TMinuitMinimizer.cxx:1060
 TMinuitMinimizer.cxx:1061
 TMinuitMinimizer.cxx:1062