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


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

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.

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