GetBinContent()

Hiya!

I am trying to access the number of data points in each bin in order to multiply the number by a user defined function. To access the number of data points I use the command GetBinContent. However I received the error “Function GetBinContent() is not defined in current scope”.
What am I doing wrong?
If I am able to access the bin content how is it possible to multiply it by a user defined function?

Thanks! :slight_smile:

http://root.cern.ch/phpBB3/search.php?keywords=GetBinContent
https://www.google.com/search?q=GetBinContent&sitesearch=root.cern.ch

Hi! Thanks for the reply. I have now, following the syntax in the documentation, used the line

Double_t GetBinContent = hist -> GetBinContent(Int_t bin) one where “one” is a constant declared above. However I still get the same error. So do I need to declare GetBinContent somewhere else in my code or include a new library?

Thanks again! :slight_smile:

https://www.google.com/search?&q=c%2B%2B+tutorial

Hi,

This forum needs a list of FAQs.

@march90: Please please spend some time to learn the basics of C++. I am
pretty sure that 2 weeks of exercises while take you a long way in avoiding
unproductive confusion, uncertainty and wrong results in the long run. Also,
you wouldn’t touch whatever complicated equipment you are using without at
least a brief look at some sort of manual. There is a lot of excellent information
on C++ over at stackoverflow (http://stackoverflow.com/questions/tagged/c%2B%2B?sort=faq&pagesize=50), see e.g. the “Beginner” section in the list of books.