Strange behaviour using vectors

Hi everyone,

I see a very strange problem. I am producing a root file containing a bunch of vector and vector. I also #include and I am using namespace std;

I was trying both root 5.14 and 5.16 for this. Now, when I look at the created root file with the TBrowser and plot some variables, for some of them, I see this problem:

SysError in <TFile::Seek>: cannot seek to position 165256090887068555 in file FullRec-00001-new7.root, retpos=-1 (Invalid argument)
Error in <TFile::ReadBuffer>: error reading all requested bytes from file FullRec-00001-new7.root, got 281492 of 15663070
Error in <TBranchElement::GetBasket>: File: FullRec-00001-new7.root at byte:0, branch:El_charge, entry:1094, badread=0

And the number of entries differs by 1-3 out of 11200 from the nominal count. Then, when I click on the same variable again, I don’t get this warning and the count goes to the right number of entries 11197. But when I draw another variable in between and then go back to draw one of the “strange” ones again, the same thing happens…

Any ideas??

Thanks a lot,



Can you provide a complete set of instruction and files to reproduce this problem? (First idea is that the #include is executed too late).


Hi again,

I think I found the reason. It seems to be a problem for root when I try to write a std::vector of zero size into the root TTree. This was the case in some events…


A priori, writing std::vector with 0 elements should not be a problem … So I am still puzzled about this problem.