This is an old revision of the document!
To read data from a text file into a tree all you need are the following two lines
TTree *myTree = new TTree("mytree","data from ascii file"); Long64_t nlines = myTree->ReadFile(filename,"col1:col2:col3");
If you do not give the structure, the first line of your file must contain the tree definition
bin:hist1:hist2 1 12 13 [...]
To use this tree you then need to get the branch names
TTree *myTree = new TTree("mytree","data from ascii file"); Long64_t nlines = myTree->ReadFile(filename); TString col0Name = T->GetListOfBranches()->At(0)->GetName(); TString col1Name = T->GetListOfBranches()->At(1)->GetName(); TString col2Name = T->GetListOfBranches()->At(2)->GetName(); Float_t bin,hist1,hist2; T->SetBranchAddress(col0Name.Data(),&bin); T->SetBranchAddress(col1Name.Data(),&hist1); T->SetBranchAddress(col2Name.Data(),&hist2);