I tried to create a TFile (with UPDATE option) which contains one single tree and which is created (with the same name) and closed three times.
Normally, i should have one single TFile which contains three trees, for example mytree;1 , mytree;2 and mytree;3.
In fact the TFile contains four trees named mytree;1, mytree;3, mytree;5 and mytree;6. So i can’t read them correctly.
Morever, if i see the number of entries of each tree i haven’t got the right number of entries :
Run 0–> i should have 1100000 entries, i obtain 982893 (mytree;1)
Run 1–>I should have 1200000 entries, i obtain 982893 (mytree;3)
Run 2–> I should have 1500000 entries, i obtain 982893 (mytree;5)
If i see the tree which shouldn’t be created, i obtain 1500000 entries which is the right number of entries for Run2.
If i use the method Print() each time a tree shoulb be end of writting, I obtain :
Run 0 --> 1100000 entries
Run 1–>1200000 entries
Run 2–>1500000 entries
It seems to be that trees are written correctly and there is a problem when reading them.
Can anybody help me?
I join a small code to test it–> just extract it, do make and ./Event. It will create the TFile
tree.tar (8.31 KB)
The result is correct. Your Tree is autosaved by default every 100 MBytes (non compressed).
My problem is when i want ro read TFile and its tree.
So i did it in interactive mode :
TTree* t = (TTree*)f.Get(“mytree;1”);
I have got 982893 entries instead of 1 100 000!
When i tried to read mytree;3 (mytree;2 doesn’t exist) i have got 982893 entries instead of 1 200 000.
I expect to have 3 trees : mytree;1, mytree;2, mytree;3 with 1 100 000 entries for mytree;1, 1 200 000 entries for mytree;2 and 1 500 000 entries for mytree;3.
I have got in fact 4 trees (see using TBrowser) and i made only 3 iterations.
If i divide the number of entries by 10, i have 3 trees with the right number of entries.
So there are 2 problems :
–> I made 3 iterations on TFile with UPDATE option so i should have 3 trees. In fact i have 4 trees. Why?
–>when i try to read these trees, the number of entries isn’t correct. Maybe the sytem didn’t read correctly the tree. Maybe it didn’t know where the tree starts and where it ends.
Perhaps should i do something special?