Reading from multiple csv files and filing a tree (creating a branch for branches)

Dear Root users,

I would like to create a tree that has branches coming off of branches. A background to the problem is as follows-

My data is grouped into (.csv) files named by the year the data within each file was taken. I would like to compile a large number of years worth of data and read this data into a tree. The first set of branches should indicate the date/year, whilst the branches running off of these should represent the columns of data within each file.

I currently have defined a TTree

TTree *year = new TTree(“Y”, “Year”)

I can read any individual data file into the tree

year->ReadFile()

However, I would like to run this over multiple files which represent data from different years. I have tried to use TChain, but I am not familiar with this and I’m unsure how to use this. I’d appreciate some advice on how to tackle this issue.

Using TChain it is quite simple. There is a small example here:
https://root.cern/doc/master/h1chain_8C.html

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.