CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PSFitter::HybridMinimizer Class Reference

#include <HybridMinimizer.h>

Inheritance diagram for PSFitter::HybridMinimizer:

Public Types

enum  EMinimizerType {
  kMigrad, kSimplex, kCombined, kScan,
  kFumili
}
 

Public Member Functions

void Clear () override
 
bool Contour (unsigned int i, unsigned int j, unsigned int &npoints, double *xi, double *xj) override
 
double Correlation (unsigned int i, unsigned int j) const override
 
double CovMatrix (unsigned int i, unsigned int j) const override
 
int CovMatrixStatus () const override
 
double Edm () const override
 return expected distance reached from the minimum More...
 
const double * Errors () const override
 return errors at the minimum More...
 
bool GetCovMatrix (double *cov) const override
 
bool GetHessianMatrix (double *h) const override
 
bool GetMinosError (unsigned int i, double &errLow, double &errUp, int=0) override
 
double GlobalCC (unsigned int i) const override
 
bool Hesse () override
 
 HybridMinimizer (const char *type)
 
 HybridMinimizer (EMinimizerType type=kMigrad)
 
const double * MinGradient () const override
 return pointer to gradient values at the minimum More...
 
bool Minimize () override
 
double MinValue () const override
 return minimum function value More...
 
unsigned int NCalls () const override
 number of function calls to reach the minimum More...
 
unsigned int NDim () const override
 
unsigned int NFree () const override
 
void PrintResults () override
 print result of minimization More...
 
bool ProvidesError () const override
 minimizer provides error and error matrix More...
 
bool Scan (unsigned int i, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0) override
 
bool SetFixedVariable (unsigned int, const std::string &, double) override
 set fixed variable (override if minimizer supports them ) More...
 
void SetFunction (const ROOT::Math::IMultiGenFunction &func) override
 set the function to minimize More...
 
void SetFunction (const ROOT::Math::IMultiGradFunction &func) override
 set gradient the function to minimize More...
 
bool SetLimitedVariable (unsigned int ivar, const std::string &name, double val, double step, double, double) override
 set upper/lower limited variable (override if minimizer supports them ) More...
 
bool SetLowerLimitedVariable (unsigned int ivar, const std::string &name, double val, double step, double lower) override
 set lower limit variable (override if minimizer supports them ) More...
 
void SetMinimizerType (EMinimizerType type)
 
bool SetUpperLimitedVariable (unsigned int ivar, const std::string &name, double val, double step, double upper) override
 set upper limit variable (override if minimizer supports them ) More...
 
bool SetVariable (unsigned int ivar, const std::string &name, double val, double step) override
 set free variable More...
 
bool SetVariableValue (unsigned int ivar, double val) override
 set variable More...
 
bool SetVariableValues (const double *val) override
 
const ROOT::Minuit2::MnUserParameterState & State ()
 return the minimizer state (containing values, step size , etc..) More...
 
int VariableIndex (const std::string &name) const override
 
std::string VariableName (unsigned int ivar) const override
 get name of variables (override if minimizer support storing of variable names) More...
 
const double * X () const override
 return pointer to X values at the minimum More...
 
 ~HybridMinimizer () override
 

Protected Member Functions

bool ExamineMinimum (const ROOT::Minuit2::FunctionMinimum &min)
 examine the minimum result More...
 
virtual const ROOT::Minuit2::FCNBase * GetFCN () const
 
virtual const ROOT::Minuit2::ModularFunctionMinimizer * GetMinimizer () const
 
virtual void SetMinimizer (ROOT::Minuit2::ModularFunctionMinimizer *m)
 

Private Member Functions

 HybridMinimizer (const HybridMinimizer &)
 
HybridMinimizeroperator= (const HybridMinimizer &rhs)
 

Private Attributes

unsigned int fDim
 
std::vector< double > fErrors
 
ROOT::Minuit2::ModularFunctionMinimizer * fMinimizer
 
ROOT::Minuit2::FunctionMinimum * fMinimum
 
ROOT::Minuit2::FCNBase * fMinuitFCN
 
ROOT::Minuit2::MnUserParameterState fState
 
bool fUseFumili
 
std::vector< double > fValues
 

Detailed Description

Definition at line 44 of file HybridMinimizer.h.

Member Enumeration Documentation

◆ EMinimizerType

Enumerator
kMigrad 
kSimplex 
kCombined 
kScan 
kFumili 

Definition at line 46 of file HybridMinimizer.h.

Constructor & Destructor Documentation

◆ HybridMinimizer() [1/3]

PSFitter::HybridMinimizer::HybridMinimizer ( EMinimizerType  type = kMigrad)

Default constructor

Definition at line 73 of file HybridMinimizer.cc.

77  : Minimizer(), fDim(0), fMinimizer(nullptr), fMinuitFCN(nullptr), fMinimum(nullptr) {

◆ HybridMinimizer() [2/3]

PSFitter::HybridMinimizer::HybridMinimizer ( const char *  type)

Constructor with a char (used by PM)

Definition at line 79 of file HybridMinimizer.cc.

97  {
98  // Set minimizer algorithm type

◆ ~HybridMinimizer()

PSFitter::HybridMinimizer::~HybridMinimizer ( )
override

Destructor (no operations)

Definition at line 132 of file HybridMinimizer.cc.

139  : ROOT::Math::Minimizer() {
140  // Implementation of copy constructor.

◆ HybridMinimizer() [3/3]

PSFitter::HybridMinimizer::HybridMinimizer ( const HybridMinimizer )
private

Copy constructor

Definition at line 142 of file HybridMinimizer.cc.

143  {
144  // Implementation of assignment operator.

Member Function Documentation

◆ Clear()

void PSFitter::HybridMinimizer::Clear ( )
override

Definition at line 153 of file HybridMinimizer.cc.

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ Contour()

bool PSFitter::HybridMinimizer::Contour ( unsigned int  i,
unsigned int  j,
unsigned int &  npoints,
double *  xi,
double *  xj 
)
override

find the contour points (xi,xj) of the function for parameter i and j around the minimum The contour will be find for value of the function = Min + ErrorUp();

Definition at line 863 of file HybridMinimizer.cc.

863  {
864  MN_ERROR_MSG2("HybridMinimizer::Contour", " no function minimum existing. Must minimize function before");
865  return false;
866  }
867 
868  if (!fMinimum->IsValid()) {
869  MN_ERROR_MSG2("HybridMinimizer::Contour", "Invalid function minimum");
870  return false;
871  }
873 
874  fMinuitFCN->SetErrorDef(ErrorDef());
875  // if error def has been changed update it in FunctionMinimum
876  if (ErrorDef() != fMinimum->Up())
877  fMinimum->SetErrorDef(ErrorDef());
878 
879  // switch off Minuit2 printing (for level of 0,1)
880  int prev_level = (PrintLevel() <= 1) ? TurnOffPrintInfoLevel() : -2;
881 
882  MnPrint::SetLevel(PrintLevel());
883 
884  // set the precision if needed
885  if (Precision() > 0)
886  fState.SetPrecision(Precision());
887 
888  // eventually one should specify tolerance in contours
889  MnContours contour(*fMinuitFCN, *fMinimum, Strategy());
890 
891  if (prev_level > -2)
892  RestoreGlobalPrintLevel(prev_level);
893 
894  std::vector<std::pair<double, double> > result = contour(ipar, jpar, npoints);
895  if (result.size() != npoints) {
896  MN_ERROR_MSG2("HybridMinimizer::Contour", " Invalid result from MnContours");
897  return false;
898  }
899  for (unsigned int i = 0; i < npoints; ++i) {
900  x[i] = result[i].first;
901  y[i] = result[i].second;
902  }
903 
904  return true;
905  }
906 
907  bool HybridMinimizer::Hesse() {
908  // find Hessian (full second derivative calculations)

◆ Correlation()

double PSFitter::HybridMinimizer::Correlation ( unsigned int  i,
unsigned int  j 
) const
override

return correlation coefficient between variable i and j. If the variable is fixed or const the return value is zero

Definition at line 618 of file HybridMinimizer.cc.

634  {
635  // get global correlation coefficient for the parameter i. This is a number between zero and one which gives

◆ CovMatrix()

double PSFitter::HybridMinimizer::CovMatrix ( unsigned int  i,
unsigned int  j 
) const
override

return covariance matrix elements if the variable is fixed or const the value is zero The ordering of the variables is the same as in errors and parameter value. This is different from the direct interface of Minuit2 or TMinuit where the values were obtained only to variable parameters

Definition at line 545 of file HybridMinimizer.cc.

557  {
558  // get value of covariance matrices

◆ CovMatrixStatus()

int PSFitter::HybridMinimizer::CovMatrixStatus ( ) const
override

return the status of the covariance matrix status = -1 : not available (inversion failed or Hesse failed) status = 0 : available but not positive defined status = 1 : covariance only approximate status = 2 : full matrix but forced pos def status = 3 : full accurate matrix

Definition at line 978 of file HybridMinimizer.cc.

983  {
984  // case a function minimum is available
985  if (fMinimum->HasAccurateCovar())
986  return 3;
987  else if (fMinimum->HasMadePosDefCovar())
988  return 2;
989  else if (fMinimum->HasValidCovariance())
990  return 1;
991  else if (fMinimum->HasCovariance())
992  return 0;
993  return -1;
994  } else {
995  // case fMinimum is not available - use state information
996  return fState.CovarianceStatus();
997  }
998  return 0;
999  }
1000 
1001 } // namespace PSFitter

References fMinimum.

◆ Edm()

double PSFitter::HybridMinimizer::Edm ( ) const
inlineoverride

return expected distance reached from the minimum

Definition at line 133 of file HybridMinimizer.h.

134 { return fState.Edm(); }

◆ Errors()

const double * PSFitter::HybridMinimizer::Errors ( ) const
override

return errors at the minimum

Definition at line 524 of file HybridMinimizer.cc.

531  {
532  const MinuitParameter &par = paramsObj[i];
533  if (par.IsFixed() || par.IsConst())
534  fErrors[i] = 0;
535  else
536  fErrors[i] = par.Error();
537  }
538 
539  return &fErrors.front();
540  }
541 
542  double HybridMinimizer::CovMatrix(unsigned int i, unsigned int j) const {
543  // get value of covariance matrices (transform from external to internal indices)

References fErrors, and mps_fire::i.

◆ ExamineMinimum()

bool PSFitter::HybridMinimizer::ExamineMinimum ( const ROOT::Minuit2::FunctionMinimum &  min)
protected

examine the minimum result

study the function minimum

Definition at line 408 of file HybridMinimizer.cc.

410  {
411  /*
412  const std::vector<ROOT::Minuit2::MinimumState>& iterationStates = min.States();
413  std::cout << "Number of iterations " << iterationStates.size() << std::endl;
414  for (unsigned int i = 0; i < iterationStates.size(); ++i) {
415  //std::cout << iterationStates[i] << std::endl;
416  const ROOT::Minuit2::MinimumState & st = iterationStates[i];
417  std::cout << "----------> Iteration " << i << std::endl;
418  int pr = std::cout.precision(12);
419  std::cout << " FVAL = " << st.Fval() << " Edm = " << st.Edm() << " Nfcn = " << st.NFcn() << std::endl;
420  std::cout.precision(pr);
421  std::cout << " Error matrix change = " << st.Error().Dcovar() << std::endl;
422  std::cout << " Parameters : ";
423  // need to transform from internal to external
424  for (int j = 0; j < st.size() ; ++j) std::cout << " p" << j << " = " << fState.Int2ext( j, st.Vec()(j) );
425  std::cout << std::endl;
426  }
427 */
428  }
429 
430  fStatus = 0;
431  std::string txt;
432  if (min.HasMadePosDefCovar()) {
433  txt = "Covar was made pos def";
434  fStatus = 1;
435  }
436  if (min.HesseFailed()) {
437  txt = "Hesse is not valid";
438  fStatus = 2;
439  }
440  if (min.IsAboveMaxEdm()) {
441  txt = "Edm is above max";
442  fStatus = 3;
443  }
444  if (min.HasReachedCallLimit()) {
445  txt = "Reached call limit";
446  fStatus = 4;
447  }
448 
449  bool validMinimum = min.IsValid();
450  if (validMinimum) {
451  // print a warning message in case something is not ok
452  if (fStatus != 0 && debugLevel > 0)
453  MN_INFO_MSG2("HybridMinimizer::Minimize", txt);
454  } else {
455  // minimum is not valid when state is not valid and edm is over max or has passed call limits
456  if (fStatus == 0) {
457  // this should not happen
458  txt = "unknown failure";
459  fStatus = 5;
460  }
461  std::string msg = "Minimization did NOT converge, " + txt;
462  MN_INFO_MSG2("HybridMinimizer::Minimize", msg);
463  }
464 
465  if (debugLevel >= 1)
466  PrintResults();
467  return validMinimum;
468  }
469 
471  // print results of minimization

◆ GetCovMatrix()

bool PSFitter::HybridMinimizer::GetCovMatrix ( double *  cov) const
override

Fill the passed array with the covariance matrix elements if the variable is fixed or const the value is zero. The array will be filled as cov[i *ndim + j] The ordering of the variables is the same as in errors and parameter value. This is different from the direct interface of Minuit2 or TMinuit where the values were obtained only to variable parameters

Definition at line 560 of file HybridMinimizer.cc.

561  {
562  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst()) {
563  for (unsigned int j = 0; j < fDim; ++j) {
564  cov[i * fDim + j] = 0;
565  }
566  } else {
567  unsigned int l = fState.IntOfExt(i);
568  for (unsigned int j = 0; j < fDim; ++j) {
569  // could probably speed up this loop (if needed)
570  int k = i * fDim + j;
571  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst())
572  cov[k] = 0;
573  else {
574  // need to transform from external to internal indices)
575  // for taking care of the removed fixed row/columns in the Minuit2 representation
576  unsigned int m = fState.IntOfExt(j);
577  cov[k] = fState.Covariance()(l, m);
578  }
579  }
580  }
581  }
582  return true;
583  }
584 
585  bool HybridMinimizer::GetHessianMatrix(double *hess) const {
586  // get value of Hessian matrix

References fDim, fState, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, and visualization-live-secondInstance_cfg::m.

◆ GetFCN()

virtual const ROOT::Minuit2::FCNBase* PSFitter::HybridMinimizer::GetFCN ( ) const
inlineprotectedvirtual

Definition at line 266 of file HybridMinimizer.h.

References fMinuitFCN.

◆ GetHessianMatrix()

bool PSFitter::HybridMinimizer::GetHessianMatrix ( double *  h) const
override

Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second derivatives and is the inverse of the covariance matrix If the variable is fixed or const the values for that variables are zero. The array will be filled as h[i *ndim + j]

Definition at line 588 of file HybridMinimizer.cc.

590  {
591  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst()) {
592  for (unsigned int j = 0; j < fDim; ++j) {
593  hess[i * fDim + j] = 0;
594  }
595  } else {
596  unsigned int l = fState.IntOfExt(i);
597  for (unsigned int j = 0; j < fDim; ++j) {
598  // could probably speed up this loop (if needed)
599  int k = i * fDim + j;
600  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst())
601  hess[k] = 0;
602  else {
603  // need to transform from external to internal indices)
604  // for taking care of the removed fixed row/columns in the Minuit2 representation
605  unsigned int m = fState.IntOfExt(j);
606  hess[k] = fState.Hessian()(l, m);
607  }
608  }
609  }
610  }
611 
612  return true;
613  }
614 
615  double HybridMinimizer::Correlation(unsigned int i, unsigned int j) const {
616  // get correlation between parameter i and j

References fDim, fState, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, and visualization-live-secondInstance_cfg::m.

◆ GetMinimizer()

virtual const ROOT::Minuit2::ModularFunctionMinimizer* PSFitter::HybridMinimizer::GetMinimizer ( ) const
inlineprotectedvirtual

Definition at line 262 of file HybridMinimizer.h.

References fMinimizer.

◆ GetMinosError()

bool PSFitter::HybridMinimizer::GetMinosError ( unsigned int  i,
double &  errLow,
double &  errUp,
int  runopt = 0 
)
override

get the minos error for parameter i, return false if Minos failed A minimizaiton must be performed befre, return false if no minimization has been done In case of Minos failed the status error is updated as following status += 10 * minosStatus where the minos status is: status = 1 : maximum number of function calls exceeded when running for lower error status = 2 : maximum number of function calls exceeded when running for upper error status = 3 : new minimum found when running for lower error status = 4 : new minimum found when running for upper error status = 5 : any other failure

Definition at line 653 of file HybridMinimizer.cc.

663  {
664  return false;
665  }
666 
667  int debugLevel = PrintLevel();
668  // internal minuit messages
669  MnPrint::SetLevel(debugLevel);
670 
671  // to run minos I need function minimum class
672  // redo minimization from current state
673  // ROOT::Minuit2::FunctionMinimum min =
674  // GetMinimizer()->Minimize(*GetFCN(),fState, ROOT::Minuit2::MnStrategy(strategy), MaxFunctionCalls(), Tolerance());
675  // fState = min.UserState();
676  if (fMinimum == nullptr) {
677  MN_ERROR_MSG("HybridMinimizer::GetMinosErrors: failed - no function minimum existing");
678  return false;
679  }
680 
681  if (!fMinimum->IsValid()) {
682  MN_ERROR_MSG("HybridMinimizer::MINOS failed due to invalid function minimum");
683  return false;
684  }
685 
686  fMinuitFCN->SetErrorDef(ErrorDef());
687  // if error def has been changed update it in FunctionMinimum
688  if (ErrorDef() != fMinimum->Up())
689  fMinimum->SetErrorDef(ErrorDef());
690 
691  // switch off Minuit2 printing
692  int prev_level = (PrintLevel() <= 0) ? TurnOffPrintInfoLevel() : -2;
693 
694  // set the precision if needed
695  if (Precision() > 0)
696  fState.SetPrecision(Precision());
697 
698  ROOT::Minuit2::MnMinos minos(*fMinuitFCN, *fMinimum);
699 
700  // run MnCross
701  MnCross low;
702  MnCross up;
703  int maxfcn = MaxFunctionCalls();
704  double tol = Tolerance();
705 
706  // const char * par_name = fState.Name(i);
707 
708  // now input tolerance for migrad calls inside Minos (MnFunctionCross)
709  // before it was fixed to 0.05
710  // cut off too small tolerance (they are not needed)
711  tol = std::max(tol, 0.01);
712 
713  /*
714  if (PrintLevel() >=1) {
715  // print the real number of maxfcn used (defined in MnMinos)
716  int maxfcn_used = maxfcn;
717  if (maxfcn_used == 0) {
718  int nvar = fState.VariableParameters();
719  maxfcn_used = 2*(nvar+1)*(200 + 100*nvar + 5*nvar*nvar);
720  }
721 // std::cout << "HybridMinimizer::GetMinosError for parameter " << i << " " << par_name
722 // << " using max-calls " << maxfcn_used << ", tolerance " << tol << std::endl;
723  }
724  */
725 
726  if (runLower)
727  low = minos.Loval(i, maxfcn, tol);
728  if (runUpper)
729  up = minos.Upval(i, maxfcn, tol);
730 
731  ROOT::Minuit2::MinosError me(i, fMinimum->UserState().Value(i), low, up);
732 
733  if (prev_level > -2)
734  RestoreGlobalPrintLevel(prev_level);
735 
736  // debug result of Minos
737  // print error message in Minos
738 
739  if (debugLevel >= 1) {
740  /*
741  if (runLower) {
742  if (!me.LowerValid() )
743  std::cout << "Minos: Invalid lower error for parameter " << par_name << std::endl;
744  if(me.AtLowerLimit())
745  std::cout << "Minos: Parameter : " << par_name << " is at Lower limit."<<std::endl;
746  if(me.AtLowerMaxFcn())
747  std::cout << "Minos: Maximum number of function calls exceeded when running for lower error" <<std::endl;
748  if(me.LowerNewMin() )
749  std::cout << "Minos: New Minimum found while running Minos for lower error" <<std::endl;
750 
751  if (debugLevel > 1) std::cout << "Minos: Lower error for parameter " << par_name << " : " << me.Lower() << std::endl;
752 
753  }
754  if (runUpper) {
755  if (!me.UpperValid() )
756  std::cout << "Minos: Invalid upper error for parameter " << par_name << std::endl;
757  if(me.AtUpperLimit())
758  std::cout << "Minos: Parameter " << par_name << " is at Upper limit."<<std::endl;
759  if(me.AtUpperMaxFcn())
760  std::cout << "Minos: Maximum number of function calls exceeded when running for upper error" <<std::endl;
761  if(me.UpperNewMin() )
762  std::cout << "Minos: New Minimum found while running Minos for upper error" <<std::endl;
763 
764  if (debugLevel > 1) std::cout << "Minos: Upper error for parameter " << par_name << " : " << me.Upper() << std::endl;
765  }
766 */
767  }
768 
769  bool lowerInvalid = (runLower && !me.LowerValid());
770  bool upperInvalid = (runUpper && !me.UpperValid());
771  int mstatus = 0;
772  if (lowerInvalid || upperInvalid) {
773  // set status accroding to bit
774  // bit 1: lower invalid Minos errors
775  // bit 2: uper invalid Minos error
776  // bit 3: invalid because max FCN
777  // bit 4 : invalid because a new minimum has been found
778  if (lowerInvalid) {
779  mstatus |= 1;
780  if (me.AtLowerMaxFcn())
781  mstatus |= 4;
782  if (me.LowerNewMin())
783  mstatus |= 8;
784  }
785  if (upperInvalid) {
786  mstatus |= 3;
787  if (me.AtUpperMaxFcn())
788  mstatus |= 4;
789  if (me.UpperNewMin())
790  mstatus |= 8;
791  }
792  //std::cout << "Error running Minos for parameter " << i << std::endl;
793  fStatus += 10 * mstatus;
794  }
795 
796  errLow = me.Lower();
797  errUp = me.Upper();
798 
799  bool isValid = (runLower && me.LowerValid()) || (runUpper && me.UpperValid());
800  return isValid;
801  }
802 
803  bool HybridMinimizer::Scan(unsigned int ipar, unsigned int &nstep, double *x, double *y, double xmin, double xmax) {
804  // scan a parameter (variable) around the minimum value

◆ GlobalCC()

double PSFitter::HybridMinimizer::GlobalCC ( unsigned int  i) const
override

get global correlation coefficient for the variable i. This is a number between zero and one which gives the correlation between the i-th variable and that linear combination of all other variables which is most strongly correlated with i. If the variable is fixed or const the return value is zero

Definition at line 637 of file HybridMinimizer.cc.

650  {
651  // return the minos error for parameter i

◆ Hesse()

bool PSFitter::HybridMinimizer::Hesse ( )
override

perform a full calculation of the Hessian matrix for error calculation If a valid minimum exists the calculation is done on the minimum point otherwise is performed in the current set values of parameters Status code of minimizer is updated according to the following convention (in case Hesse failed) status += 100*hesseStatus where hesse status is: status = 1 : hesse failed status = 2 : matrix inversion failed status = 3 : matrix is not pos defined

Definition at line 910 of file HybridMinimizer.cc.

913  {
914  MN_ERROR_MSG2("HybridMinimizer::Hesse", "FCN function has not been set");
915  return false;
916  }
917 
918  int strategy = Strategy();
919  int maxfcn = MaxFunctionCalls();
920 
921  // switch off Minuit2 printing
922  int prev_level = (PrintLevel() <= 0) ? TurnOffPrintInfoLevel() : -2;
923 
924  MnPrint::SetLevel(PrintLevel());
925 
926  // set the precision if needed
927  if (Precision() > 0)
928  fState.SetPrecision(Precision());
929 
930  ROOT::Minuit2::MnHesse hesse(strategy);
931 
932  // case when function minimum exists
933  if (fMinimum) {
934  // run hesse and function minimum will be updated with Hesse result
935  hesse(*fMinuitFCN, *fMinimum, maxfcn);
936  fState = fMinimum->UserState();
937  }
938 
939  else {
940  // run Hesse on point stored in current state (independent of function minimum validity)
941  // (x == 0)
942  fState = hesse(*fMinuitFCN, fState, maxfcn);
943  }
944 
945  if (prev_level > -2)
946  RestoreGlobalPrintLevel(prev_level);
947 
948  if (PrintLevel() >= 3) {
949  // std::cout << "State returned from Hesse " << std::endl;
950  // std::cout << fState << std::endl;
951  }
952 
953  if (!fState.HasCovariance()) {
954  // if false means error is not valid and this is due to a failure in Hesse
955  if (PrintLevel() > 0)
956  MN_INFO_MSG2("HybridMinimizer::Hesse", "Hesse failed ");
957  // update minimizer error status
958  int hstatus = 4;
959  // information on error state can be retrieved only if fMinimum is available
960  if (fMinimum) {
961  if (fMinimum->Error().HesseFailed())
962  hstatus = 1;
963  if (fMinimum->Error().InvertFailed())
964  hstatus = 2;
965  else if (!(fMinimum->Error().IsPosDef()))
966  hstatus = 3;
967  }
968  fStatus += 100 * hstatus;
969  return false;
970  }
971 
972  return true;
973  }
974 
976  // return status of covariance matrix

◆ MinGradient()

const double* PSFitter::HybridMinimizer::MinGradient ( ) const
inlineoverride

return pointer to gradient values at the minimum

Definition at line 139 of file HybridMinimizer.h.

140 { return nullptr; } // not available in Minuit2

◆ Minimize()

bool PSFitter::HybridMinimizer::Minimize ( )
override

method to perform the minimization. Return false in case the minimization did not converge. In this case a status code different than zero is set (retrieved by the derived method Minimizer::Status() )"

status = 1 : Covariance was made pos defined status = 2 : Hesse is invalid status = 3 : Edm is above max status = 4 : Reached call limit status = 5 : Any other failure

Definition at line 298 of file HybridMinimizer.cc.

298  {
299  MN_ERROR_MSG2("HybridMinimizer::Minimize", "FCN function has not been set");
300  return false;
301  }
302 
303  assert(GetMinimizer() != nullptr);
304 
305  // delete result of previous minimization
306  if (fMinimum)
307  delete fMinimum;
308  fMinimum = nullptr;
309 
310  int maxfcn = MaxFunctionCalls();
311  double tol = Tolerance();
312  int strategyLevel = Strategy();
313  fMinuitFCN->SetErrorDef(ErrorDef());
314 
315  /*
316  if (PrintLevel() >=1) {
317  // print the real number of maxfcn used (defined in ModularFuncitonMinimizer)
318  int maxfcn_used = maxfcn;
319  if (maxfcn_used == 0) {
320  int nvar = fState.VariableParameters();
321  maxfcn_used = 200 + 100*nvar + 5*nvar*nvar;
322  }
323 // std::cout << "HybridMinimizer: Minimize with max-calls " << maxfcn_used
324 // << " convergence for edm < " << tol << " strategy "
325 // << strategyLevel << std::endl;
326  }
327  */
328 
329  // internal minuit messages
330  MnPrint::SetLevel(PrintLevel());
331 
332  // switch off Minuit2 printing
333  int prev_level = (PrintLevel() <= 0) ? TurnOffPrintInfoLevel() : -2;
334 
335  // set the precision if needed
336  if (Precision() > 0)
337  fState.SetPrecision(Precision());
338 
339  // set strategy and add extra options if needed
340  ROOT::Minuit2::MnStrategy strategy(strategyLevel);
341  ROOT::Math::IOptions *minuit2Opt = ROOT::Math::MinimizerOptions::FindDefault("Minuit2");
342  if (minuit2Opt) {
343  // set extra strategy options
344  int nGradCycles = strategy.GradientNCycles();
345  int nHessCycles = strategy.HessianNCycles();
346  int nHessGradCycles = strategy.HessianGradientNCycles();
347 
348  double gradTol = strategy.GradientTolerance();
349  double gradStepTol = strategy.GradientStepTolerance();
350  double hessStepTol = strategy.HessianStepTolerance();
351  double hessG2Tol = strategy.HessianG2Tolerance();
352 
353  minuit2Opt->GetValue("GradientNCycles", nGradCycles);
354  minuit2Opt->GetValue("HessianNCycles", nHessCycles);
355  minuit2Opt->GetValue("HessianGradientNCycles", nHessGradCycles);
356 
357  minuit2Opt->GetValue("GradientTolerance", gradTol);
358  minuit2Opt->GetValue("GradientStepTolerance", gradStepTol);
359  minuit2Opt->GetValue("HessianStepTolerance", hessStepTol);
360  minuit2Opt->GetValue("HessianG2Tolerance", hessG2Tol);
361 
362  strategy.SetGradientNCycles(nGradCycles);
363  strategy.SetHessianNCycles(nHessCycles);
364  strategy.SetHessianGradientNCycles(nHessGradCycles);
365 
366  strategy.SetGradientTolerance(gradTol);
367  strategy.SetGradientStepTolerance(gradStepTol);
368  strategy.SetHessianStepTolerance(hessStepTol);
369  strategy.SetHessianG2Tolerance(hessStepTol);
370 
371  if (PrintLevel() > 0) {
372  // std::cout << "HybridMinimizer::Minuit - Changing default stratgey options" << std::endl;
373  minuit2Opt->Print();
374  }
375  }
376 
377  const ROOT::Minuit2::FCNGradientBase *gradFCN = dynamic_cast<const ROOT::Minuit2::FCNGradientBase *>(fMinuitFCN);
378  if (gradFCN != nullptr) {
379  // use gradient
380  //SetPrintLevel(3);
381  ROOT::Minuit2::FunctionMinimum min = GetMinimizer()->Minimize(*gradFCN, fState, strategy, maxfcn, tol);
382  fMinimum = new ROOT::Minuit2::FunctionMinimum(min);
383  } else {
384  ROOT::Minuit2::FunctionMinimum min = GetMinimizer()->Minimize(*GetFCN(), fState, strategy, maxfcn, tol);
385  fMinimum = new ROOT::Minuit2::FunctionMinimum(min);
386  }
387 
388  // check if Hesse needs to be run
389  if (fMinimum->IsValid() && IsValidError() && fMinimum->State().Error().Dcovar() != 0) {
390  // run Hesse (Hesse will add results in the last state of fMinimum
391  ROOT::Minuit2::MnHesse hesse(strategy);
392  hesse(*fMinuitFCN, *fMinimum, maxfcn);
393  }
394 
395  // -2 is the highest low invalid value for gErrorIgnoreLevel
396  if (prev_level > -2)
397  RestoreGlobalPrintLevel(prev_level);
398 
399  fState = fMinimum->UserState();
400  bool ok = ExamineMinimum(*fMinimum);
401  //fMinimum = 0;
402  return ok;
403  }
404 
405  bool HybridMinimizer::ExamineMinimum(const ROOT::Minuit2::FunctionMinimum &min) {

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ MinValue()

double PSFitter::HybridMinimizer::MinValue ( ) const
inlineoverride

return minimum function value

Definition at line 130 of file HybridMinimizer.h.

131 { return fState.Fval(); }

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ NCalls()

unsigned int PSFitter::HybridMinimizer::NCalls ( ) const
inlineoverride

number of function calls to reach the minimum

Definition at line 142 of file HybridMinimizer.h.

143 { return fState.NFcn(); }

◆ NDim()

unsigned int PSFitter::HybridMinimizer::NDim ( ) const
inlineoverride

this is <= Function().NDim() which is the total number of variables (free+ constrained ones)

Definition at line 146 of file HybridMinimizer.h.

147 { return fDim; }

◆ NFree()

unsigned int PSFitter::HybridMinimizer::NFree ( ) const
inlineoverride

number of free variables (real dimension of the problem) this is <= Function().NDim() which is the total

Definition at line 150 of file HybridMinimizer.h.

151 { return fState.VariableParameters(); }

◆ operator=()

HybridMinimizer & PSFitter::HybridMinimizer::operator= ( const HybridMinimizer rhs)
private

Assignment operator

Definition at line 146 of file HybridMinimizer.cc.

150  {
151  // delete the state in case of consecutive minimizations

◆ PrintResults()

void PSFitter::HybridMinimizer::PrintResults ( )
override

print result of minimization

return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;

Definition at line 473 of file HybridMinimizer.cc.

474  {
475  // valid minimum
476  /*
477  std::cout << "HybridMinimizer : Valid minimum - status = " << fStatus << std::endl;
478  int pr = std::cout.precision(18);
479  std::cout << "FVAL = " << fState.Fval() << std::endl;
480  std::cout << "Edm = " << fState.Edm() << std::endl;
481  std::cout.precision(pr);
482  std::cout << "Nfcn = " << fState.NFcn() << std::endl;
483  for (unsigned int i = 0; i < fState.MinuitParameters().size(); ++i) {
484  const MinuitParameter & par = fState.Parameter(i);
485  std::cout << par.Name() << "\t = " << par.Value() << "\t ";
486  if (par.IsFixed() ) std::cout << "(fixed)" << std::endl;
487  else if (par.IsConst() ) std::cout << "(const)" << std::endl;
488  else if (par.HasLimits() )
489  std::cout << "+/- " << par.Error() << "\t(limited)"<< std::endl;
490  else
491  std::cout << "+/- " << par.Error() << std::endl;
492  }
493 */
494  } else {
495  /*
496  std::cout << "HybridMinimizer : Invalid Minimum - status = " << fStatus << std::endl;
497  std::cout << "FVAL = " << fState.Fval() << std::endl;
498  std::cout << "Edm = " << fState.Edm() << std::endl;
499  std::cout << "Nfcn = " << fState.NFcn() << std::endl;
500 */
501  }
502  }
503 
504  const double *HybridMinimizer::X() const {
505  // return values at minimum

◆ ProvidesError()

bool PSFitter::HybridMinimizer::ProvidesError ( ) const
inlineoverride

minimizer provides error and error matrix

Definition at line 153 of file HybridMinimizer.h.

154 { return true; }

◆ Scan()

bool PSFitter::HybridMinimizer::Scan ( unsigned int  i,
unsigned int &  nstep,
double *  x,
double *  y,
double  xmin = 0,
double  xmax = 0 
)
override

scan a parameter i around the minimum. A minimization must have been done before, return false if it is not the case

Definition at line 806 of file HybridMinimizer.cc.

809  {
810  MN_ERROR_MSG2("HybridMinimizer::Scan", " Function must be set before using Scan");
811  return false;
812  }
813 
814  if (ipar > fState.MinuitParameters().size()) {
815  MN_ERROR_MSG2("HybridMinimizer::Scan", " Invalid number. Minimizer variables must be set before using Scan");
816  return false;
817  }
818 
819  // switch off Minuit2 printing
820  int prev_level = (PrintLevel() <= 0) ? TurnOffPrintInfoLevel() : -2;
821 
822  MnPrint::SetLevel(PrintLevel());
823 
824  // set the precision if needed
825  if (Precision() > 0)
826  fState.SetPrecision(Precision());
827 
828  MnParameterScan scan(*fMinuitFCN, fState.Parameters());
829  double amin = scan.Fval(); // fcn value of the function before scan
830 
831  // first value is param value
832  std::vector<std::pair<double, double> > result = scan(ipar, nstep - 1, xmin, xmax);
833 
834  if (prev_level > -2)
835  RestoreGlobalPrintLevel(prev_level);
836 
837  if (result.size() != nstep) {
838  MN_ERROR_MSG2("HybridMinimizer::Scan", " Invalid result from MnParameterScan");
839  return false;
840  }
841  // sort also the returned points in x
842  std::sort(result.begin(), result.end());
843 
844  for (unsigned int i = 0; i < nstep; ++i) {
845  x[i] = result[i].first;
846  y[i] = result[i].second;
847  }
848 
849  // what to do if a new minimum has been found ?
850  // use that as new minimum
851  if (scan.Fval() < amin) {
852  if (PrintLevel() > 0)
853  MN_INFO_MSG2("HybridMinimizer::Scan", "A new minimum has been found");
854  fState.SetValue(ipar, scan.Parameters().Value(ipar));
855  }
856 
857  return true;
858  }
859 
860  bool HybridMinimizer::Contour(unsigned int ipar, unsigned int jpar, unsigned int &npoints, double *x, double *y) {
861  // contour plot for parameter i and j

◆ SetFixedVariable()

bool PSFitter::HybridMinimizer::SetFixedVariable ( unsigned int  ivar,
const std::string &  name,
double  val 
)
override

set fixed variable (override if minimizer supports them )

Definition at line 219 of file HybridMinimizer.cc.

220  : 0.1;
221  if (!SetVariable(ivar, name, val, step)) {
222  ivar = fState.Index(name);
223  }
224  fState.Fix(ivar);
225  return true;
226  }
227 
228  std::string HybridMinimizer::VariableName(unsigned int ivar) const {
229  // return the variable name

References fState, and Skims_PA_cff::name.

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ SetFunction() [1/2]

void PSFitter::HybridMinimizer::SetFunction ( const ROOT::Math::IMultiGenFunction &  func)
override

set the function to minimize

Definition at line 262 of file HybridMinimizer.cc.

264  {
265  fMinuitFCN = new ROOT::Minuit2::FCNAdapter<ROOT::Math::IMultiGenFunction>(func, ErrorDef());
266  } else {
267  // for Fumili the fit method function interface is required
268  const ROOT::Math::FitMethodFunction *fcnfunc = dynamic_cast<const ROOT::Math::FitMethodFunction *>(&func);
269  if (!fcnfunc) {
270  MN_ERROR_MSG("HybridMinimizer: Wrong Fit method function for Fumili");
271  return;
272  }
273  fMinuitFCN = new ROOT::Minuit2::FumiliFCNAdapter<ROOT::Math::FitMethodFunction>(*fcnfunc, fDim, ErrorDef());
274  }
275  }
276 
277  void HybridMinimizer::SetFunction(const ROOT::Math::IMultiGradFunction &func) {
278  // set function to be minimized

References fMinuitFCN, and TrackCollections2monitor_cff::func.

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ SetFunction() [2/2]

void PSFitter::HybridMinimizer::SetFunction ( const ROOT::Math::IMultiGradFunction &  func)
override

set gradient the function to minimize

Definition at line 280 of file HybridMinimizer.cc.

282  {
283  fMinuitFCN = new ROOT::Minuit2::FCNGradAdapter<ROOT::Math::IMultiGradFunction>(func, ErrorDef());
284  } else {
285  // for Fumili the fit method function interface is required
286  const ROOT::Math::FitMethodGradFunction *fcnfunc = dynamic_cast<const ROOT::Math::FitMethodGradFunction *>(&func);
287  if (!fcnfunc) {
288  MN_ERROR_MSG("HybridMinimizer: Wrong Fit method function for Fumili");
289  return;
290  }
291  fMinuitFCN = new ROOT::Minuit2::FumiliFCNAdapter<ROOT::Math::FitMethodGradFunction>(*fcnfunc, fDim, ErrorDef());
292  }
293  }
294 
296  // perform the minimization

References fMinuitFCN, and TrackCollections2monitor_cff::func.

◆ SetLimitedVariable()

bool PSFitter::HybridMinimizer::SetLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  lower,
double  upper 
)
override

set upper/lower limited variable (override if minimizer supports them )

Definition at line 210 of file HybridMinimizer.cc.

216  {
217  // add a fixed variable

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ SetLowerLimitedVariable()

bool PSFitter::HybridMinimizer::SetLowerLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  lower 
)
override

set lower limit variable (override if minimizer supports them )

Definition at line 192 of file HybridMinimizer.cc.

199  {

◆ SetMinimizer()

virtual void PSFitter::HybridMinimizer::SetMinimizer ( ROOT::Minuit2::ModularFunctionMinimizer *  m)
inlineprotectedvirtual

Definition at line 264 of file HybridMinimizer.h.

References fMinimizer, and visualization-live-secondInstance_cfg::m.

Referenced by SetMinimizerType().

◆ SetMinimizerType()

void PSFitter::HybridMinimizer::SetMinimizerType ( EMinimizerType  type)

Definition at line 100 of file HybridMinimizer.cc.

104  {
105  case kMigrad:
106  //std::cout << "HybridMinimizer: minimize using MIGRAD " << std::endl;
107  SetMinimizer(new ROOT::Minuit2::VariableMetricMinimizer());
108  return;
109  case kSimplex:
110  //std::cout << "HybridMinimizer: minimize using SIMPLEX " << std::endl;
111  SetMinimizer(new ROOT::Minuit2::SimplexMinimizer());
112  return;
113  case kCombined:
114  SetMinimizer(new ROOT::Minuit2::CombinedMinimizer());
115  return;
116  case kScan:
117  SetMinimizer(new ROOT::Minuit2::ScanMinimizer());
118  return;
119  case kFumili:
120  SetMinimizer(new ROOT::Minuit2::FumiliMinimizer());
121  fUseFumili = true;
122  return;
123  default:
124  //migrad minimizer
125  SetMinimizer(new ROOT::Minuit2::VariableMetricMinimizer());
126  }
127  }
128 
130  // Destructor implementation.

References fUseFumili, kCombined, kFumili, kMigrad, kScan, kSimplex, and SetMinimizer().

Referenced by PulseShapeFitOOTPileupCorrection::fit().

◆ SetUpperLimitedVariable()

bool PSFitter::HybridMinimizer::SetUpperLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  upper 
)
override

set upper limit variable (override if minimizer supports them )

Definition at line 201 of file HybridMinimizer.cc.

208  {

◆ SetVariable()

bool PSFitter::HybridMinimizer::SetVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step 
)
override

set free variable

Definition at line 164 of file HybridMinimizer.cc.

170  {
171  std::string txtmsg = "Parameter " + name + " has zero or invalid step size - consider it as constant ";
172  MN_INFO_MSG2("HybridMinimizer::SetVariable", txtmsg);
173  fState.Add(name, val);
174  } else
175  fState.Add(name, val, step);
176 
177  unsigned int minuit2Index = fState.Index(name);
178  if (minuit2Index != ivar) {
179  std::string txtmsg("Wrong index used for the variable " + name);
180  MN_INFO_MSG2("HybridMinimizer::SetVariable", txtmsg);
181  MN_INFO_VAL2("HybridMinimizer::SetVariable", minuit2Index);
182  return false;
183  }
184  fState.RemoveLimits(ivar);
185 
186  return true;
187  }
188 
190  unsigned int ivar, const std::string &name, double val, double step, double lower) {

References fState, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

◆ SetVariableValue()

bool PSFitter::HybridMinimizer::SetVariableValue ( unsigned int  ivar,
double  val 
)
override

set variable

Definition at line 244 of file HybridMinimizer.cc.

249  {
250  // set value for variable ivar (only for existing parameters)

◆ SetVariableValues()

bool PSFitter::HybridMinimizer::SetVariableValues ( const double *  val)
override

Definition at line 252 of file HybridMinimizer.cc.

259  {
260  // set function to be minimized

◆ State()

const ROOT::Minuit2::MnUserParameterState& PSFitter::HybridMinimizer::State ( )
inline

return the minimizer state (containing values, step size , etc..)

Definition at line 255 of file HybridMinimizer.h.

◆ VariableIndex()

int PSFitter::HybridMinimizer::VariableIndex ( const std::string &  name) const
override

get index of variable given a variable given a name return -1 if variable is not found

Definition at line 238 of file HybridMinimizer.cc.

241  {
242  // set value for variable ivar (only for existing parameters)

◆ VariableName()

std::string PSFitter::HybridMinimizer::VariableName ( unsigned int  ivar) const
override

get name of variables (override if minimizer support storing of variable names)

Definition at line 231 of file HybridMinimizer.cc.

235  {
236  // return the variable index

◆ X()

const double * PSFitter::HybridMinimizer::X ( ) const
override

return pointer to X values at the minimum

Definition at line 507 of file HybridMinimizer.cc.

514  {
515  fValues[i] = paramsObj[i].Value();
516  }
517 
518  return &fValues.front();
519  }
520 
521  const double *HybridMinimizer::Errors() const {
522  // return error at minimum (set to zero for fixed and constant params)

References fValues, and mps_fire::i.

Referenced by svgfig.Curve.Sample::__repr__(), and PulseShapeFitOOTPileupCorrection::fit().

Member Data Documentation

◆ fDim

unsigned int PSFitter::HybridMinimizer::fDim
private

Definition at line 272 of file HybridMinimizer.h.

Referenced by GetCovMatrix(), and GetHessianMatrix().

◆ fErrors

std::vector<double> PSFitter::HybridMinimizer::fErrors
mutableprivate

Definition at line 281 of file HybridMinimizer.h.

Referenced by Errors().

◆ fMinimizer

ROOT::Minuit2::ModularFunctionMinimizer* PSFitter::HybridMinimizer::fMinimizer
private

Definition at line 277 of file HybridMinimizer.h.

Referenced by GetMinimizer(), and SetMinimizer().

◆ fMinimum

ROOT::Minuit2::FunctionMinimum* PSFitter::HybridMinimizer::fMinimum
private

Definition at line 279 of file HybridMinimizer.h.

Referenced by CovMatrixStatus().

◆ fMinuitFCN

ROOT::Minuit2::FCNBase* PSFitter::HybridMinimizer::fMinuitFCN
private

Definition at line 278 of file HybridMinimizer.h.

Referenced by GetFCN(), and SetFunction().

◆ fState

ROOT::Minuit2::MnUserParameterState PSFitter::HybridMinimizer::fState
private

Definition at line 275 of file HybridMinimizer.h.

Referenced by GetCovMatrix(), GetHessianMatrix(), SetFixedVariable(), and SetVariable().

◆ fUseFumili

bool PSFitter::HybridMinimizer::fUseFumili
private

Definition at line 273 of file HybridMinimizer.h.

Referenced by SetMinimizerType().

◆ fValues

std::vector<double> PSFitter::HybridMinimizer::fValues
mutableprivate

Definition at line 280 of file HybridMinimizer.h.

Referenced by X().

npoints
static const int npoints
Definition: NuclearInteractionFTFSimulator.h:38
DDAxes::y
PSFitter::HybridMinimizer::SetVariable
bool SetVariable(unsigned int ivar, const std::string &name, double val, double step) override
set free variable
Definition: HybridMinimizer.cc:164
mps_fire.i
i
Definition: mps_fire.py:428
METSignificanceParams_cfi.jpar
jpar
Definition: METSignificanceParams_cfi.py:19
PSFitter::HybridMinimizer::kFumili
Definition: HybridMinimizer.h:46
PSFitter::HybridMinimizer::PrintResults
void PrintResults() override
print result of minimization
Definition: HybridMinimizer.cc:473
PSFitter::HybridMinimizer::kCombined
Definition: HybridMinimizer.h:46
step
step
Definition: StallMonitor.cc:94
min
T min(T a, T b)
Definition: MathUtil.h:58
PSFitter::HybridMinimizer::CovMatrixStatus
int CovMatrixStatus() const override
Definition: HybridMinimizer.cc:978
PSFitter::HybridMinimizer::~HybridMinimizer
~HybridMinimizer() override
Definition: HybridMinimizer.cc:132
PSFitter::HybridMinimizer::fValues
std::vector< double > fValues
Definition: HybridMinimizer.h:280
PSFitter::HybridMinimizer::GetMinimizer
virtual const ROOT::Minuit2::ModularFunctionMinimizer * GetMinimizer() const
Definition: HybridMinimizer.h:262
PSFitter::HybridMinimizer::Correlation
double Correlation(unsigned int i, unsigned int j) const override
Definition: HybridMinimizer.cc:618
cms::cuda::assert
assert(be >=bs)
HLT_FULL_cff.debugLevel
debugLevel
Definition: HLT_FULL_cff.py:84848
mps_check.msg
tuple msg
Definition: mps_check.py:285
DDAxes::x
PSFitter::HybridMinimizer::GetHessianMatrix
bool GetHessianMatrix(double *h) const override
Definition: HybridMinimizer.cc:588
PSFitter::HybridMinimizer::Errors
const double * Errors() const override
return errors at the minimum
Definition: HybridMinimizer.cc:524
PSFitter::HybridMinimizer::SetFunction
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the function to minimize
Definition: HybridMinimizer.cc:262
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
PSFitter::HybridMinimizer::fMinimum
ROOT::Minuit2::FunctionMinimum * fMinimum
Definition: HybridMinimizer.h:279
PSFitter::TurnOffPrintInfoLevel
int TurnOffPrintInfoLevel()
Definition: HybridMinimizer.cc:68
PSFitter::HybridMinimizer::fState
ROOT::Minuit2::MnUserParameterState fState
Definition: HybridMinimizer.h:275
PSFitter::HybridMinimizer::GetFCN
virtual const ROOT::Minuit2::FCNBase * GetFCN() const
Definition: HybridMinimizer.h:266
PSFitter::HybridMinimizer::X
const double * X() const override
return pointer to X values at the minimum
Definition: HybridMinimizer.cc:507
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
PSFitter::HybridMinimizer::SetLowerLimitedVariable
bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower) override
set lower limit variable (override if minimizer supports them )
Definition: HybridMinimizer.cc:192
PSFitter::RestoreGlobalPrintLevel
void RestoreGlobalPrintLevel(int)
Definition: HybridMinimizer.cc:70
dqmdumpme.k
k
Definition: dqmdumpme.py:60
PSFitter::HybridMinimizer::fDim
unsigned int fDim
Definition: HybridMinimizer.h:272
PSFitter::HybridMinimizer::SetMinimizer
virtual void SetMinimizer(ROOT::Minuit2::ModularFunctionMinimizer *m)
Definition: HybridMinimizer.h:264
PSFitter::HybridMinimizer::Scan
bool Scan(unsigned int i, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0) override
Definition: HybridMinimizer.cc:806
PSFitter::HybridMinimizer::Hesse
bool Hesse() override
Definition: HybridMinimizer.cc:910
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PSFitter::HybridMinimizer::Minimize
bool Minimize() override
Definition: HybridMinimizer.cc:298
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PSFitter::HybridMinimizer::fMinuitFCN
ROOT::Minuit2::FCNBase * fMinuitFCN
Definition: HybridMinimizer.h:278
PSFitter::HybridMinimizer::kScan
Definition: HybridMinimizer.h:46
PSFitter::HybridMinimizer::fErrors
std::vector< double > fErrors
Definition: HybridMinimizer.h:281
PSFitter::HybridMinimizer::fMinimizer
ROOT::Minuit2::ModularFunctionMinimizer * fMinimizer
Definition: HybridMinimizer.h:277
PSFitter::HybridMinimizer::kMigrad
Definition: HybridMinimizer.h:46
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
PSFitter::HybridMinimizer::EMinimizerType
EMinimizerType
Definition: HybridMinimizer.h:46
g4SimHits_cfi.Tolerance
Tolerance
Definition: g4SimHits_cfi.py:64
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
PSFitter::HybridMinimizer::CovMatrix
double CovMatrix(unsigned int i, unsigned int j) const override
Definition: HybridMinimizer.cc:545
PSFitter::HybridMinimizer::kSimplex
Definition: HybridMinimizer.h:46
heppy_batch.val
val
Definition: heppy_batch.py:351
PSFitter::HybridMinimizer::VariableName
std::string VariableName(unsigned int ivar) const override
get name of variables (override if minimizer support storing of variable names)
Definition: HybridMinimizer.cc:231
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
mps_fire.result
result
Definition: mps_fire.py:311
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
PSFitter::HybridMinimizer::fUseFumili
bool fUseFumili
Definition: HybridMinimizer.h:273
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
up
Definition: BitonicSort.h:7
PSFitter::HybridMinimizer::Contour
bool Contour(unsigned int i, unsigned int j, unsigned int &npoints, double *xi, double *xj) override
Definition: HybridMinimizer.cc:863
PSFitter::HybridMinimizer::ExamineMinimum
bool ExamineMinimum(const ROOT::Minuit2::FunctionMinimum &min)
examine the minimum result
Definition: HybridMinimizer.cc:408