# Ntuple or TTree

**URL:** <https://root-forum.cern.ch/t/ntuple-or-ttree/39060>\
**Category:** Newbie\
**Created:** [April 24, 2020, 9:07am UTC](https://root-forum.cern.ch/t/ntuple-or-ttree/39060 "2020-04-24T09:07:03Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![RongkunWang](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rongkunwang/32/36036_2.png) [@RongkunWang](https://root-forum.cern.ch/u/RongkunWang)\
**Post date:** [April 27, 2020, 12:27pm UTC](https://root-forum.cern.ch/t/ntuple-or-ttree/39060/7 "2020-04-27T12:27:07Z")

</div>

In that case, you cannot dump your txt file into array even with the help of TTree, because array lives in the memory.

If you go line by line, and do analysis on the go, only each line’s content lives in the memory so you don’t have a problem. If one line is an event, you can fill to histogram with those contents, or do more things.

I found this thread where you can use TTree’s utility to create a TTree from the txt file, and uses TTree’s mechanism if you really wish to.

> [@Build a tree with text files](https://root-forum.cern.ch/t/build-a-tree-with-text-files/25219):
>
> Hi, Please consider that I am new to ROOT I want to create a tree with two different branches corresponding to two different data sets, and fill these two branches with two leaves: one for all the x coordinates and the second one for all the y coordinates. The issue is that I have huge data sets stored in 4 different text files. I hence have two questions: 1)Does it make sense to proceed this way (two branches with two leaves each for the 4 coordinates)? 2)If yes, how could I fill the leave…

If you are not restricted to c++, I recommend go python with numpy or panda dataframe for very efficient data processing with csv files, etc

---

_[View the full topic](https://root-forum.cern.ch/t/ntuple-or-ttree/39060)._
