# Store and plot an array embedded into a vector using TNtuple

**URL:** <https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276>\
**Category:** ROOT\
**Created:** [May 21, 2015, 1:30pm UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276 "2015-05-21T13:30:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdkulkarni93](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@kdkulkarni93](https://root-forum.cern.ch/u/kdkulkarni93)\
**Post date:** [May 21, 2015, 1:30pm UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276/1 "2015-05-21T13:30:00Z")

</div>

Hi,

I am trying to add aprocess generated by pythia in a tree. I want to list variables like Pt, E etc in a NTuple named '‘data’. But with that I want to add number of events generated (Nevents) in the process in same NTuple.

Of course number of entries in Nevents and all other variables like Pt, E will be different and it is giving me error while combining these two things.

I have posted previous question but it was for TTree and not for TNtuple. Is it possible to add such things in same NTuple?

-------This was using TTree---------------  
[url][How to store and plot an array embedded into a vector](https://root-forum.cern.ch/t/how-to-store-and-plot-an-array-embedded-into-a-vector/18905/2)

Also please check attached file. That is what I want to produce using NTuple.

Thank you.  
[qcd.root](https://root-forum.cern.ch/uploads/default/original/2X/8/8f81d597c42222210ea881695666e3dbd6db49c2.root) (24.1 KB)

---

<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 21, 2015, 3:26pm UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276/2 "2015-05-21T15:26:42Z")

</div>

[TNtuple](https://root.cern.ch/root/html/TNtuple.html) is “A simple tree restricted to a list of float variables only.”

---

<div class="post-metadata">

**Author:** ![kdkulkarni93](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@kdkulkarni93](https://root-forum.cern.ch/u/kdkulkarni93)\
**Post date:** [May 21, 2015, 6:06pm UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276/3 "2015-05-21T18:06:49Z")

</div>

Dear Wile,

So is it not possible to make my desired NTuple? Is there any other way apart from I tried previously?

Thank you.

---

<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 21, 2015, 6:24pm UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276/4 "2015-05-21T18:24:37Z")

</div>

Try to ask the “Contact” persons of the “[CMS HEP Tutorial](http://ippog.web.cern.ch/resources/2012/cms-hep-tutorial)” for the source code which they use to create their trees.

---

<div class="post-metadata">

**Author:** ![kdkulkarni93](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@kdkulkarni93](https://root-forum.cern.ch/u/kdkulkarni93)\
**Post date:** [May 23, 2015, 5:16am UTC](https://root-forum.cern.ch/t/store-and-plot-an-array-embedded-into-a-vector-using-tntuple/19276/5 "2015-05-23T05:16:49Z")

</div>

Okay. I will ask. Thank you.
