# How to create a histogram TH2F

**URL:** <https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167>\
**Category:** Newbie\
**Created:** [May 20, 2019, 2:53pm UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167 "2019-05-20T14:53:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ideaisgenerator](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ideaisgenerator/32/19208_2.png) [@ideaisgenerator](https://root-forum.cern.ch/u/ideaisgenerator)\
**Post date:** [May 20, 2019, 2:53pm UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167/1 "2019-05-20T14:53:25Z")

</div>

Hi everyone. How to draw a histogram of accumulated energy in different volumes?

---

<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 20, 2019, 2:56pm UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167/2 "2019-05-20T14:56:40Z")

</div>

[https://root.cern/doc/master/classTHistPainter.html#HP01c](https://root.cern/doc/master/classTHistPainter.html#HP01c)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 20, 2019, 3:08pm UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167/3 "2019-05-20T15:08:49Z")

</div>

I suspect it’s about “how to create”, not “how to draw”.

---

<div class="post-metadata">

**Author:** ![ideaisgenerator](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ideaisgenerator/32/19208_2.png) [@ideaisgenerator](https://root-forum.cern.ch/u/ideaisgenerator)\
**Post date:** [May 20, 2019, 3:41pm UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167/6 "2019-05-20T15:41:18Z")

</div>

I do not know how to sum up the energy of the particles that fell into the volume.

---

<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 21, 2019, 6:40am UTC](https://root-forum.cern.ch/t/how-to-create-a-histogram-th2f/34167/7 "2019-05-21T06:40:52Z")

</div>

> [@ideaisgenerator](#):
>
> I do not know how to sum up the energy of the particles that fell into the volume.

That’s what [TH2::Fill](https://root.cern/doc/master/classTH2.html#a9d1a326ec5cef292722a357746c5a795) is doing.
