How to get all the bin content from TEfficiency?

Dear experts,

I have tried to get all the bin content from a TEfficiency, but I can’t find a way. The available functions TEfficiency::GetEfficiency, TEfficiency::GetEfficiencyErrorLow, and TEfficiency::GetEfficiencyErrorUp expect a bin number, but I don’t find a way to get all the bins the TEfficiency has. So, to summarize, how can I get the total number of bins? Is there a more direct/efficient/better way of achieving this?

Thanks,
Arturo

ROOT Version: 6.22.06
Platform: Linux, Ubuntu 20.04
Compiler: gcc 9.03, c++11


1 Like

Hi Arturo,

I guess you can do it this way:

TEfficiency* pEff = new TEfficiency("eff","my efficiency;x;#epsilon", 42, 0, 10); // basic ctor of TEfficiency
printf("pEff has %i bin(s)\n", pEff->GetTotalHistogram()->GetNbinsX());
2 Likes

Thank you! That does the trick. I also found that piece of info in the documentation. I didn’t read it carefully enough.