# Histogram construction~

**URL:** <https://root-forum.cern.ch/t/histogram-construction/37755>\
**Category:** Newbie\
**Created:** [January 29, 2020, 5:42am UTC](https://root-forum.cern.ch/t/histogram-construction/37755 "2020-01-29T05:42:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![christie](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@christie](https://root-forum.cern.ch/u/christie)\
**Post date:** [January 29, 2020, 5:42am UTC](https://root-forum.cern.ch/t/histogram-construction/37755/1 "2020-01-29T05:42:31Z")

</div>

Hello ROOT experts,

I’m new to ROOT and ROOT forum. Your help will be appreciated!  
I want to construct a histogram of Pt within a certain azimuth range as follows:

azimuth (in radians): 8 bins from -pi to pi  
Pt (GeV/c) : 6 bins from 0 to 0.5

Kindly help me with a code to construct this histogram.  
\_  
_ROOT Version:_ 6.16/00  
_Platform:_ macosx64  
_Compiler:_ clang-1100.0.33.17

---

<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:** [January 29, 2020, 6:10am UTC](https://root-forum.cern.ch/t/histogram-construction/37755/2 "2020-01-29T06:10:00Z")

</div>

Create and fill: [https://root.cern.ch/root/roottalk/roottalk04/0861.html](https://root.cern.ch/root/roottalk/roottalk04/0861.html)  
For histogram reference, read here: [https://root.cern.ch/root/html530/TH1.html](https://root.cern.ch/root/html530/TH1.html)  
To draw, just use Draw(); for the example above, it would be:

```auto
  Eta_Pt->Draw();

```

Check all draw options here: [https://root.cern.ch/doc/master/classTHistPainter.html#HP01c](https://root.cern.ch/doc/master/classTHistPainter.html#HP01c)

---

<div class="post-metadata">

**Author:** ![christie](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@christie](https://root-forum.cern.ch/u/christie)\
**Post date:** [January 29, 2020, 6:44am UTC](https://root-forum.cern.ch/t/histogram-construction/37755/3 "2020-01-29T06:44:56Z")

</div>

Hello dastudillo,  
I have checked the links you suggested.

Instead of a 2D histogram of Eta vs Pt, I rather want a 1D histogram filled with a 2 dimensional array.  
I want Pt to explicitly depend on Eta.  
Are you able to help me with a code?  
Thanks~
