# Working with a histogram

**URL:** <https://root-forum.cern.ch/t/working-with-a-histogram/49139>\
**Category:** Newbie\
**Tags:** hist\
**Created:** [March 11, 2022, 9:13pm UTC](https://root-forum.cern.ch/t/working-with-a-histogram/49139 "2022-03-11T21:13:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russell\_Marroquin](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/russell_marroquin/32/26386_2.png) [@Russell\_Marroquin](https://root-forum.cern.ch/u/Russell_Marroquin)\
**Post date:** [March 11, 2022, 9:13pm UTC](https://root-forum.cern.ch/t/working-with-a-histogram/49139/1 "2022-03-11T21:13:54Z")

</div>

Hi everyone,

I am newbie, and I have a quick question. Hopefully, you will be able to help me. I have a 1D histogram, which is a projectionX() of a TH2D histogram, and I am wondering if it is possible to get the entries from the 1D histogram. In essence, is it possible to get the x and y values into an array or variable? Please, let me know if anything above does not make sense.

Thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [March 12, 2022, 4:14am UTC](https://root-forum.cern.ch/t/working-with-a-histogram/49139/2 "2022-03-12T04:14:52Z")

</div>

Read about GetBincenter and GetBinContent in the documentation for histograms:  
[https://root.cern/doc/master/classTH1.html](https://root.cern/doc/master/classTH1.html)  
In short, loop over the bins (from 1 to nbins) and use those methods to get the info.

---

<div class="post-metadata">

**Author:** ![Russell\_Marroquin](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/russell_marroquin/32/26386_2.png) [@Russell\_Marroquin](https://root-forum.cern.ch/u/Russell_Marroquin)\
**Post date:** [March 23, 2022, 4:42pm UTC](https://root-forum.cern.ch/t/working-with-a-histogram/49139/3 "2022-03-23T16:42:23Z")

</div>

@dastudillo Thank you so much for your help.
