This shows you the differences between two versions of the page.
| Next revision | Previous revisionNext revisionBoth sides next revision | ||
| root:loadtext [2010/11/09 16:33] – created nchiap | root:loadtext [2010/11/10 12:17] – nchiap | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| To read data from a text file into a tree all you need are the following two lines | To read data from a text file into a tree all you need are the following two lines | ||
| <code C++> | <code C++> | ||
| - | TTree *myTree = new TTree(" | + | TTree *myTree = new TTree(" |
| Long64_t nlines = myTree-> | Long64_t nlines = myTree-> | ||
| + | </ | ||
| + | |||
| + | |||
| + | If you do not give the structure, the first line of your file must contain the tree definition | ||
| + | <code text input.csv> | ||
| + | bin: | ||
| + | 1 12 13 | ||
| + | [...] | ||
| + | </ | ||
| + | |||
| + | To use this tree you then need to get the branch names | ||
| + | <code C++> | ||
| + | TTree *myTree = new TTree(" | ||
| + | Long64_t nlines = myTree-> | ||
| + | |||
| + | TString col0Name = T-> | ||
| + | TString col1Name = T-> | ||
| + | TString col2Name = T-> | ||
| + | |||
| + | Float_t bin, | ||
| + | T-> | ||
| + | T-> | ||
| + | T-> | ||
| </ | </ | ||