# Multiply 2D TEfficiency with a TH2D

**URL:** <https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010>\
**Category:** Newbie\
**Created:** [September 27, 2021, 9:46am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010 "2021-09-27T09:46:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jack1](https://root-forum.cern.ch/u/jack1)\
**Post date:** [September 27, 2021, 9:46am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010/1 "2021-09-27T09:46:21Z")

</div>

Hi everyone, I have built and filled a 2D TEfficiency object with the probability of tagging a jet with a secondary vertex as a function of its momenta and pseudo-rapidity. However the tracking setup of my simulation uses a device which reduce the background, but also affects my efficiencies. So I would like to correct my 2D TEfficiency with some factors depending on the momenta and pseudorapidity, and so from other simulations I have built a correction matrix as a TH2D.  
Now I would like to multiply my 2D TEfficiency with the TH2D correction matrix, however I can’t find a Multiply() method for the TEfficiency. I could use GetBinContent and do this manually for each bin, but I fear I would lose information about the errors. Is there a way to achieve my goal?  
I am using ROOT 6.22/06.  
Thank you kindly,  
Giacomo

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [September 28, 2021, 8:03am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010/2 "2021-09-28T08:03:12Z")

</div>

Hi,

I suspect the correction is affecting in a different way the two input histograms to the TEfficiency class.  
So, you should not correct the resulting TEfficiency, but correct the input histograms applying weights to them and then compute the TEfficiency. It supports computation of the error also in this case taking into account the weights of the histograms.

Lorenzo

---

<div class="post-metadata">

**Author:** ![jack1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jack1](https://root-forum.cern.ch/u/jack1)\
**Post date:** [September 28, 2021, 8:14am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010/3 "2021-09-28T08:14:31Z")

</div>

Hi Lorenzo,  
Thank you for the answer. I tried that, but I found out that the TEfficiency constructor I wanted to use, being  
TEfficiency(const [TH1]&passed, const [TH1]&[total])  
, takes as input only TH1, while I am working in two dimensions with TH2D…is there a workaround?  
Thank you,

Giacomo

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [September 28, 2021, 8:16am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010/4 "2021-09-28T08:16:49Z")

</div>

Hi,  
The `TH2D` class derives from the base histogram interface `TH1` that represents histogram in 1 and multiple dimensions. See inheritance figure in [ROOT: TH1 Class Reference](https://root.cern.ch/doc/master/classTH1.html)

You can then pass TH2 objects in the TEfficiency constructor.

Lorenzo

---

<div class="post-metadata">

**Author:** ![jack1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jack1](https://root-forum.cern.ch/u/jack1)\
**Post date:** [September 28, 2021, 8:56am UTC](https://root-forum.cern.ch/t/multiply-2d-tefficiency-with-a-th2d/47010/5 "2021-09-28T08:56:27Z")

</div>

Thank you 🙂
