How to use chains

Hi everybody,

I’m new in the forum and a rookie in c++ and root. I guess my question is simple but I’m not able to solve it . I wrote a litte c++ macro for root which allows me to read a specific ascii file into a tree and a root file, creating a 2DProfile histo and to fit this histo. Now I have many many of these ascii files and I should use them all together to get more data for a better fit.
Is there a simple way to use chains to carry together all my ascii files into one tree so that I can use the whole data collection for my fitting?

I’d be glad to here from anybody of you. Thanks a lot,

Please do not post the same question to 2 different places.
I already answered your question at the CINT Forum



thanks for your fast response. I’m aware of the annoying nature of double posted questions and I only posted ALMOST the same request into ‘ROOT Discussion’ because it refers to another topic namely CHAINS.

thanks again,

Sorry, I thought that it was the same message.

The answer to your question depends if you want to make the conversion ascii->root once per file and then use the root file many times or not.

ROOT files are in general much more compact (typically a factor 5 or more) and reading from a ROOT file is also much faster.
I recommend converting your ascii files first and then make a TChain
to process all your files.
It may also be more efficient to merge all your files into one single file.


Hi Rene,

I think I try to convert all the files into root files and get them together then using TChains. This might be the more convenient way instead of writing all the ascii files into one big ascii file.

Thanks for the hint,