Get value from TH1

I’m trying to extract a point value from a TH1I (in attached), I want to get the value= 15000. I tried with GetBinContent , GetBin, GetMean… but I don’t obtain the right value 15000.

Some one can help me? thanks a lot in advance :slight_smile:

trigger.root (3.8 KB)


I think you want TH1::GetBinContent:

$ root trigger.root
root [0] 
Attaching file trigger.root as _file0...
root [1] auto h = (TH1I*) _file0->Get("Triggers")
root [2] h->GetBinContent(1)
(double) 15000.000000

Thank a lot!!! works both solutions :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.