Hi Rene,
the bug appears when you make the following sequence of calls:
- read first entry in a tree
- read last entry in the tree
- write something into the tree
In this case if you have more than one basket filled in the tree you
kill root.
Check the code below:
Adding these line kills the tree:
Int_t N = TradeTree->GetEntries();
if (N) {
TradeTree->GetEntry(0);
TradeTree->GetEntry(N-1);
}
You can change TTrade to your lovely test class.
Sincerely,
Anton
write.C
{
gROOT->Reset();
TFile *File = new TFile("c:\\root\\data\\test.root", "UPDATE");
TTrade *Trade = new TTrade();
TTree *Tree = new TTree("TradeTree", "");
TradeTree ->Branch("Trade", "TTrade", &Trade, 4*1024, 1);
TradeTree ->Write();
for(Int_t i=0;i<20000;i++) {
Int_t N = TradeTree->GetEntries();
if (N) {
TradeTree->GetEntry(0);
TradeTree->GetEntry(N-1);
}
Trade->Set(i,i,i,i);
TradeTree->Fill();
}
Tree->AutoSave();
delete Tree;
delete File;
}
read.C
{
gROOT->Reset();
TFile *File = new TFile("c:\\root\\data\\test.root", "UPDATE");
TTrade *Trade = new TTrade();
TTree *Tree = (TTree*)File.Get("TradeTree");
Tree->SetBranchAddress("Trade", &Trade);
Tree->Print();
Int_t N = Tree->GetEntries();
for(Int_t i=0;i<N;i++) {
Tree->GetEntry(i);
Trade->Print();
}
Trade->Set(0,0,0,0);
printf("Printing second time ... \n");
for(Int_t i=0;i<10;i++) {
Tree->GetEntry(i);
Trade->Print();
}
}
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET