Dear Rooters,
I have present my problem sometimes ago, but I think I have resolved this
problem at that time. Now I become more confused.
First, as said in the mannul. Object stored by TClonesArray should be fixed
size. In my class Track, it contains TObjString. I think that should be OK,
right? But I should use Delete() instead of Clear() I think.
I want shrink my Event, so I use TClonesArray::Remove() and then Compress.
I get segmentation fault when I try to read next event in TTree. I can not
understand that.
Then I use a tricky method, I modify the source of TClonesArray to allow the
call of TCloneArray::AddLast(). Then it works. If I do not use TTree, I can
shrink my Event and then write to file and read again. But when I use TTree,
I get some problem. It seems work for the first look. When I try to look the
TTree again, I find all other things works but TObjString was destroyed.
For my understanding, I have destroyed the internal structure of TClonesArray
a little bit. fKeep is different with, fCont. But I think for the Streamer to
output,fKeep is not involve.
Thanks for attention
Attached was the head file . and the Shrink method I has use.
void
Ana::Shrink(TTree *newTree, int type){
newTree->Branch("Event","Event",&pevent,3200,0);
for (int i = 0 ; i < Entries; i++){
TrackTree->GetEntry(i);
pevent->FindSuperTracks();
pevent->Shrink(type);
newTree->Fill();
};
}
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET