Using the new Minimizer class on ROOT 5

Hello,

I am facing problems while using the new Minimizer class in ROOT5. Following is the minimization part of a code I am trying to run:

  const char * minName = "Minuit2" ;
  const char *algoName = "" ;
  int randomSeed = -1 ;

   ROOT::Math::Minimizer* min = 
      ROOT::Math::Factory::CreateMinimizer(minName, algoName);
   min->SetMaxFunctionCalls(10000000); // for Minuit/Minuit2 
   min->SetMaxIterations(10000000);  // for GSL 
   min->SetTolerance(0.001);
   min->SetPrintLevel(4);

   ROOT::Math::Functor f(&likelihood,30);
   min->SetFunction(f);

  for(int j=0; j<npar; j++) { 
     min->SetVariable(j, parName[j].c_str(), par[j], stepSize[j]);
   }
    min->Minimize(); 
 
   cout<<"Covariance matrix status: "<<min->CovMatrixStatus()<<endl;
   double covmat[30][30];
   min->GetCovMatrix(*covmat) ;

   cout<<"Covariance matrix..."<<endl;
   for(int i=0; i<30; i++) {
      for(int j=0; j<30; j++) {
          cout<<covmat[i][j]<<"\t" ;
      }
      cout<<endl;
   }
  const double *outpar = min->X();
  const double *err = min->Errors();

On running it with ROOT5, I get the following error:

Error in <TUnixSystem::DynamicPathName>: Minuit2[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/anita/root/lib:/usr/lib/x86_64-linux-gnu:/home/anita/products/RooUnfold/:/home/anita/products/EVTGEN/external/HepMC/lib:/home/anita/products/EVTGEN/external/PHOTOS/lib:/home/anita/products/pythia8235/lib:/home/anita/products/EVTGEN/external/TAUOLA/lib:/home/anita/products/EVTGEN/evtgen/lib:/home/anita/HEP/GEANT/GEANT4.10/geant4.10.00.p04-install/lib:/home/anita/HEP/CLHEP/clhep-2.1.4.1/CLHEP-install/lib:/home/anita/HEP/GEANT/GEANT4.10/geant4.10.00.p04-install/lib:/home/anita/root/lib::/home/anita/HEP/CLHEP/clhep-2.1.4.1/CLHEP-install/lib:/home/anita/products/pythia8235/lib:/home/anita/products/gsl25/lib:/home/anita/products/fastjet-3.3.2-install/lib:.:/home/anita/root/lib::/home/anita/root/cint/cint/stl
Error: illegal pointer to class object min 0x0 1729  MinimizerCheck.C:714:
*** Interpreter error recovered ***

Afterwards, I tried to run one of the similar ROOT tutorials, NumericalMinimization.C. I again got the following error:

Processing NumericalMinimization.C...
Error in <TUnixSystem::DynamicPathName>: Minuit2[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /home/anita/root/lib:/usr/lib/x86_64-linux-gnu:/home/anita/products/RooUnfold/:/home/anita/products/EVTGEN/external/HepMC/lib:/home/anita/products/EVTGEN/external/PHOTOS/lib:/home/anita/products/pythia8235/lib:/home/anita/products/EVTGEN/external/TAUOLA/lib:/home/anita/products/EVTGEN/evtgen/lib:/home/anita/HEP/GEANT/GEANT4.10/geant4.10.00.p04-install/lib:/home/anita/HEP/CLHEP/clhep-2.1.4.1/CLHEP-install/lib:/home/anita/HEP/GEANT/GEANT4.10/geant4.10.00.p04-install/lib:/home/anita/root/lib::/home/anita/HEP/CLHEP/clhep-2.1.4.1/CLHEP-install/lib:/home/anita/products/pythia8235/lib:/home/anita/products/gsl25/lib:/home/anita/products/fastjet-3.3.2-install/lib:.:/home/anita/root/lib::/home/anita/root/cint/cint/stl
Error: illegal pointer to class object min 0x0 1729  NumericalMinimization.C:51:
*** Interpreter error recovered ***

I do not understand the problem. Is there any way I can use this Minimizer class with ROOT5?
Also, these codes work perfectly fine with ROOT6.

Thanks for any help.

Anita


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Check if your ROOT has “minuit2” enabled:
root-config --features

If not, you will need to rebuild your ROOT 5 from scratch.

Try to run the macro version which comes with your ROOT:
${ROOTSYS}/tutorials/fit/NumericalMinimization.C

Thank you for your help. It appears I indeed did not enable minuit2 while installing ROOT5, but did enable it for ROOT6.
Thanks again!

Anita

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.