Hallo routers!
I want to open two textfiles which contain measured data and are formated like:
0.1 // line 1
0.2 // line 2
0.3 // line 3
[…]
For every file I want to create a new branch in my Tree T.
I am using TTree::ReadFile(, , ,)
My code looks like:
void openfile(){
gROOT->Reset();
TFile *f = new TFile("online.root","RECREATE");
TTree *T = new TTree("PD","data from txt file");
Double_t time;
Float_t teData;
T->Branch("Time", &time, "Time/D");
time = T->ReadFile("C:\\Users\\q349344\\Desktop\\time.txt", "F");
T->Branch("PD_Data", &teData, "PD_Data/F");
teData = T->ReadFile("C:\\Users\\q349344\\Desktop\\qiec.txt", "F");
T->Write();
}
To test the code, I wrote the text files manually. txt-file1 contains 2 points with the same value (1.0)
txt-file2 contains 3 points with the same value (2.0).
In this case my tree contains two branches. Both are filles with 4 entries and a RMS I can’t connect to the values I entered.
Thanks!