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:

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:


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 (, see e.g. the “Beginner” section in the list of books.