Hi Haitao. TObjString is a string, so it may have a variable length, right ? I doubt you can use it in TClonesArray. Cheers Damir Haitao Liu wrote: > > 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(); > }; > > } > > ------------------------------------------------------------------------ > > Name: event.hh > event.hh Type: text/x-c++ > Encoding: base64 > > Name: track.hh > track.hh Type: text/english > Encoding: base64 > > Name: event.cxx > event.cxx Type: text/x-c > Encoding: base64 -- ===================================================================== | Damir Buskulic | Universite de Savoie/LAPP | | | Chemin de Bellevue, B.P. 110 | | Tel : +33 (0)450091600 | F-74941 Annecy-le-Vieux Cedex | | e-mail: buskulic@lapp.in2p3.fr | FRANCE | ===================================================================== mailto:buskulic@lapp.in2p3.fr
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET