# How to get all the bin content from TEfficiency?

**URL:** <https://root-forum.cern.ch/t/how-to-get-all-the-bin-content-from-tefficiency/46267>\
**Category:** Newbie\
**Created:** [August 10, 2021, 8:48pm UTC](https://root-forum.cern.ch/t/how-to-get-all-the-bin-content-from-tefficiency/46267 "2021-08-10T20:48:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_rthur](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/_rthur/32/18547_2.png) [@\_rthur](https://root-forum.cern.ch/u/_rthur)\
**Post date:** [August 10, 2021, 8:48pm UTC](https://root-forum.cern.ch/t/how-to-get-all-the-bin-content-from-tefficiency/46267/1 "2021-08-10T20:48:13Z")

</div>

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

* * *

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [August 10, 2021, 9:44pm UTC](https://root-forum.cern.ch/t/how-to-get-all-the-bin-content-from-tefficiency/46267/2 "2021-08-10T21:44:37Z")

</div>

Hi Arturo,

I guess you can do it this way:

```auto
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());

```

---

<div class="post-metadata">

**Author:** ![\_rthur](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/_rthur/32/18547_2.png) [@\_rthur](https://root-forum.cern.ch/u/_rthur)\
**Post date:** [August 10, 2021, 10:00pm UTC](https://root-forum.cern.ch/t/how-to-get-all-the-bin-content-from-tefficiency/46267/3 "2021-08-10T22:00:51Z")

</div>

> [@yus](#):
>
> `pEff->GetTotalHistogram()->GetNbinsX())`

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