Histograms with TMVA

Whenever I tried to use method likelihood in a c++ file on a histogram, it kept giving me the error:
TH1D' is not a member ofTMVA’.

I have been looking for a list of members of TMVA but haven’t found it. Am I doing something wrong? The declaration i used was:

TMVA::MethodBase("", “h2”, TMVA::TH1D h2& , “”, 0);

were h2 was:
TH1D h2(“h2”, “gauss1”, numbins2 , lowbound, highbound);

Sorry for my beginners ignorance :blush:

I was also looking for a tutorial of how to use this and couldn’t find one. Does anyone have an example code that is a c++ file?


this one line is full of C++ errors:

  • you cannot create an instance of MethodBase because it’s an abstract class,
  • TH1D is not part of the TMVA namespace,
  • `TMVA::TH1D h2&’ is not a valid parameter.

Maybe the TMVA users guide root.cern.ch/root/html/TMVA_Index.html will help with the first problem. You should (really!) learn C++ to solve the other problems. There is no way that you can use ROOT or TMVA without knowing the basics of C++.

Cheers, Axel.

For what it’s worth:

Walter Brown will be offering a “Beginner’s Accelerated C++” class in July at CERN and August at FNAL. I know many people who have taken it and recommend it. I second Axel’s comment that one will be much more productive in Root with a better knowledge of C++.


To rephrase my question, how do you calculate the maximum likelihood for every bin of a histogram?

I have been doing some reading and have tried using TFactory, but with minimal success.

Thank you for any and all help.