# Convert multiple data files into root files and store it in Tree

**URL:** <https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345>\
**Category:** Newbie\
**Created:** [July 9, 2020, 9:34pm UTC](https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345 "2020-07-09T21:34:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [July 9, 2020, 9:34pm UTC](https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345/1 "2020-07-09T21:34:09Z")

</div>

I have multiple data files. Now I want to draw histogram from each data file and store them in “.root” extension. And after that storing those root files into a common tree.

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [July 10, 2020, 6:19am UTC](https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345/2 "2020-07-10T06:19:56Z")

</div>

Depending on the format of your data files, it might be straightforward. If you search on the forum, I’m sure you will find some hints. I would also suggest to start with the [ROOT Primer](https://root.cern/primer/) and the [tree tutorials](https://root.cern/doc/master/group __tutorial__ tree.html)

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [July 12, 2020, 5:34pm UTC](https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345/3 "2020-07-12T17:34:45Z")

</div>

Thanks for replying @bellenot  
The data is in .dat format and i am able to write only one dat file into tree. But what if I want to convert 10000 .dat files into root file via tree.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [July 12, 2020, 5:50pm UTC](https://root-forum.cern.ch/t/convert-multiple-data-files-into-root-files-and-store-it-in-tree/40345/4 "2020-07-12T17:50:46Z")

</div>

Then you can loop over your 1000 files, read them, and write all in the same tree. If you can do it with one, you can do it for as many you want…
