Hi I am beginner in using ROOT, mybe for y is trivial but I do not manage to make it work a simple thing.
I have a ascii file with 8 columns ( file dumped from an SQLDB at Text(TAB delimited)) and I am trying to make a tree:
ex:
hfile = TFile::Open(filename,“RECREATE”);
TTree *qa = new TTree(“qa”,“TestBuilt”);
qa->Branch(“Index”, &Index, “Index/I”);
qa->Branch(“FHS”, &FHS, “FHS/F”);
qa->Branch(“Spe”, &Spe, “Spe/F”);
qa->Branch(“STI”, &STI, “STI/F”);
qa->Branch(“Dateandtime”, &Date, “Date/C”);
qa->Branch(“WDir”, &WDir, “WDir/C”);
qa->Branch(“WSpe”, &WSpe, “WSpe/F”);
…8 branches in total
and I am using the sscan (from tutorial cernbuild.C example)
char line[84];
while (fgets(&line, 84, fp)) {
sscanf(&line[0], “%d %f %f %f %s %s”, &Index, &FHS, &Spe, &STI, Date, WDir);
sscanf(&line[38], “%f %f %f %d %f %f”, &WSpe, …rest of 5variables
qa -> Fill()
So when I run it I have the following problems.
root stops working but it creates the rootfile
when I exit and restart root I look with the TBrowser, all first 6 leaves (of the friost 6 varaibles are correct) starting with the 7-th one the data are not read correct, like it does not parse correct the file.
I have no message error, except that root window is crashing (ps I am working onoly on Windows 7 root version 5.34/32 )
I tried with a line like
sscanf(&line[0], “%d %f %f %f %s %s %f %f %f %d %f %f”, &Index, &FHS, &Spe, &STI, Date, WDir, &WSpe, &Slip, &WHgh, &SSta, &Drfw, &Draf);
but I get the message that it cannot takes more then 12 variables.
Can y tell me where I am making the mistake?
Thanks
Sor