Convert some data into root format

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

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 (859 Bytes) candle2root_v1.cpp (7.5 KB)

How should we run your script ?

To compile this code run:
g++ -Wall -std=c++11 -o candle2root candle2root_v1.cpp root-config --cflags --glibs -lSpectrum

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):

 for f in filelist:
  ./candle2root f