# Convert some data into root format

**URL:** <https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551>\
**Category:** Newbie\
**Created:** [February 15, 2021, 3:19pm UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551 "2021-02-15T15:19:45Z")\
**Posts on this page:** 5\
**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:** [February 15, 2021, 3:19pm UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551/1 "2021-02-15T15:19:45Z")

</div>

Hi  
I got a script which converts the given data from the software into root format for a single file. I am able to do that thing.  
Now my problem is regarding the conversion of a large number of files into root format.

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

* * *

---

<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:** [February 15, 2021, 3:25pm UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551/2 "2021-02-15T15:25:17Z")

</div>

Could you please look at the following script and suggest me something so that I may be able to convert a large number of files into root format?

[candle2root\_drawAll.C](https://root-forum.cern.ch/uploads/short-url/ii9cwTCAdeGhNMYbYZNkcJuT9Rp.C) (859 Bytes) [candle2root\_v1.cpp](https://root-forum.cern.ch/uploads/short-url/v0kWEZNkmOBWONXehS4wSvBpjEG.cpp) (7.5 KB)

[https://drive.google.com/file/d/1p9XY2UshFthOt1A9pp765KsP97bN5oaG/view?usp=sharing](https://drive.google.com/file/d/1p9XY2UshFthOt1A9pp765KsP97bN5oaG/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 15, 2021, 4:49pm UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551/3 "2021-02-15T16:49:51Z")

</div>

How should we run your script ?

---

<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:** [February 16, 2021, 4:47am UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551/4 "2021-02-16T04:47:49Z")

</div>

@couet  
To compile this code run:  
g++ -Wall -std=c++11 -o candle2root candle2root\_v1.cpp `root-config --cflags --glibs` -lSpectrum

---

<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:** [February 16, 2021, 5:52am UTC](https://root-forum.cern.ch/t/convert-some-data-into-root-format/43551/5 "2021-02-16T05:52:08Z")

</div>

Since your code takes the file name as argument, you don’t even need ROOT to do what you want; you can just make a shell (or python or whatever you prefer) script that loops over the list of files calling your executable for each one, something like (of course this is not actual code):

```auto
 for f in filelist:
  ./candle2root f

```
