# Transforming TEfficiency to it's inverse efficiency (show 1-itself)

**URL:** <https://root-forum.cern.ch/t/transforming-tefficiency-to-its-inverse-efficiency-show-1-itself/33908>\
**Category:** Newbie\
**Created:** [May 5, 2019, 9:42am UTC](https://root-forum.cern.ch/t/transforming-tefficiency-to-its-inverse-efficiency-show-1-itself/33908 "2019-05-05T09:42:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![armin.kadlecsik](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@armin.kadlecsik](https://root-forum.cern.ch/u/armin.kadlecsik)\
**Post date:** [May 5, 2019, 9:42am UTC](https://root-forum.cern.ch/t/transforming-tefficiency-to-its-inverse-efficiency-show-1-itself/33908/1 "2019-05-05T09:42:21Z")

</div>

Hello,

Currently, I am creating a TEfficiency histogram using the constructor TEfficiency(const TH1 &passed, const TH1 &total) with TH1F histograms as arguments.  
This gets me the efficiency results I’m expecting, however, I also wish to create the “inverse efficiency”: where each bin content is 1-itself.  
For example, if in a bin the efficiency was 0.15, then in the new TEfficiency I wish to make, the bin should have 0.85 efficiency.

What is the best way to go about this? Can I somehow iterate over all bins of a TEfficiency, and modify the content of each bin, or is there a possible built-in function that does exactly this and I’m missing it?

Thank you

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [May 6, 2019, 6:24am UTC](https://root-forum.cern.ch/t/transforming-tefficiency-to-its-inverse-efficiency-show-1-itself/33908/2 "2019-05-06T06:24:03Z")

</div>

I think that the best way is to create a _not-passed_ histogram using the negative of the _passed_ condition and use that as your _passed_ histrogram in the constructor, with the same total histogram. You can also just subtract the _passed_ from the _total_ histogram to create the _not-passed_ histogram.

---

<div class="post-metadata">

**Author:** ![armin.kadlecsik](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@armin.kadlecsik](https://root-forum.cern.ch/u/armin.kadlecsik)\
**Post date:** [May 6, 2019, 2:29pm UTC](https://root-forum.cern.ch/t/transforming-tefficiency-to-its-inverse-efficiency-show-1-itself/33908/3 "2019-05-06T14:29:56Z")

</div>

I am wondering why I had not thought of that earlier. Thank you 🙂
