Convert canvas into histogram in root

Dear experts,

I am sorry to bother you. I am trying to implement your code in my program, but using pyroot. I can make it work and I don’t know what more to do.

Thanks for your time and I apologize again.

Diego