# TProfile2D mean of all bins

**URL:** <https://root-forum.cern.ch/t/tprofile2d-mean-of-all-bins/39587>\
**Category:** Newbie\
**Created:** [May 25, 2020, 12:44pm UTC](https://root-forum.cern.ch/t/tprofile2d-mean-of-all-bins/39587 "2020-05-25T12:44:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bomben](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/e9a140/32.png) [@bomben](https://root-forum.cern.ch/u/bomben)\
**Post date:** [May 25, 2020, 12:44pm UTC](https://root-forum.cern.ch/t/tprofile2d-mean-of-all-bins/39587/1 "2020-05-25T12:44:01Z")

</div>

Dear all,  
how do I get the average of all bins in a TProfile2D, please?  
My case is the following: I have a 2 efficiency map, let’s say 10x10 bins. Each bin contains  
the efficiency for a certain position. How do I get the average efficiency over the entire map, please?  
Shall I simply use TProfile2D::GetMean()? But I see the default option is axis=1 which means average with respect to X axis.

Many thanks in advance and kind regards,  
Marco Bomben

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 25, 2020, 2:02pm UTC](https://root-forum.cern.ch/t/tprofile2d-mean-of-all-bins/39587/2 "2020-05-25T14:02:39Z")

</div>

I might be wrong but what about using [GetSumOfWeights](https://root.cern/doc/master/classTH1.html#aeb8b68e267823506ef8c6efda8b27f0d) divided by the number of bins ?

---

<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:** [May 26, 2020, 12:57pm UTC](https://root-forum.cern.ch/t/tprofile2d-mean-of-all-bins/39587/3 "2020-05-26T12:57:10Z")

</div>

Yes, this is correct, it is the simplest solution.
