Unable getting the integral form the histo

Hey all, I believe my problem is trivial but I can not sole it.

I have a file with the integral in it, just want to get the Integral of the histo.
Below I attach my code.

Thank you in advance for your help!

Dear michael91,

Not sure to understand what the problem is. Do you get a crash or a weird value for the integral?
Anyhow, your code looks fine.
I would just make sure that ’ f->Get ’ returns a histogram object, i.e. that the histogram is really found in the file and it is as you expect.

G Ganis

TH1F *h1; gDirectory->GetObject(“h_iEta1_hitPos”, h1);