# Histograms with TMVA

**URL:** <https://root-forum.cern.ch/t/histograms-with-tmva/8613>\
**Category:** TMVA\
**Created:** [July 10, 2009, 2:56pm UTC](https://root-forum.cern.ch/t/histograms-with-tmva/8613 "2009-07-10T14:56:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AarinGend](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@AarinGend](https://root-forum.cern.ch/u/AarinGend)\
**Post date:** [July 10, 2009, 2:56pm UTC](https://root-forum.cern.ch/t/histograms-with-tmva/8613/1 "2009-07-10T14:56:42Z")

</div>

Whenever I tried to use [method likelihood](http://root.cern.ch/root/html/TMVA__MethodLikelihood.html) in a c++ file on a histogram, it kept giving me the error:  
`TH1D' is not a member of`TMVA’.

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 😊

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?

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 11, 2009, 11:00am UTC](https://root-forum.cern.ch/t/histograms-with-tmva/8613/2 "2009-07-11T11:00:09Z")

</div>

Hi,

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](http://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.

---

<div class="post-metadata">

**Author:** ![cplager](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@cplager](https://root-forum.cern.ch/u/cplager)\
**Post date:** [July 11, 2009, 11:20pm UTC](https://root-forum.cern.ch/t/histograms-with-tmva/8613/3 "2009-07-11T23:20:05Z")

</div>

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++.

Cheers,  
Charles

---

<div class="post-metadata">

**Author:** ![AarinGend](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@AarinGend](https://root-forum.cern.ch/u/AarinGend)\
**Post date:** [July 16, 2009, 6:40pm UTC](https://root-forum.cern.ch/t/histograms-with-tmva/8613/4 "2009-07-16T18:40:48Z")

</div>

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.
