hi - won't it work if you declare a reconstructed data to be a branch of the tree where you keep THE data? With the raw data being another branch of that tree? The reconstructed branch could reside in a separate file, for example and you won'n need any backward-looking pointers at all... best, pasha Rutger van der Eijk wrote: > > Hi, > > I have a problem storing reconstructed data together with raw data in one > file. I think it boils down to the following: > > In a raw data file ("RawFile.root") I have a TTree ("rawTree") with a > single branch of RawEvent s. Where the RawEvent has, among other items, a > TClonesArray of RawHit s. I.e.; > > --------- > class RawHit; > > class RawEvent { > private: > > TClonesArray* fRawHitCont; // clones array of RawHit (owner) > ... > public: > > ... > } > --------- > > In a reconstruction program I read the raw events from the raw data file. > And reconstruct some objects (tracks, etc..). Some of the reconstructed > objects have pointers to raw objects (e.g. a Track has pointers to hits). > Therefore in the reconstructed event class has, among pointers to the > reconstructed objects, a pointer to the RawEvent. I.e., > > --------- > class RecoEvent { > private: > RawEvent* fRawEvent; // pntr to raw event > TClonesArray* fTrackCont; // clonesarray of Track (owner) > ... > public: > > ... > } > > class Track { > private: > TList* fHitCont; // container with RawHit (not owner) > > ... > public: > > ... > } > ---------- > > Now I want to store this whole structure in a new file ("RecoFile.root"). > So I fill a branch in a TTree ("recoTree") in the file "RecoFile.root" > with RecoEvent s. This in order to have as well the raw as the > reconstructed information in a single file, such that further analysis can > be done on this file without the raw file. > > The problem: > If I just use the standard created streamers in the simple case above the > RawHit s are written twice. Hence when I read back the file the RawHit > objects pointed to by the Track s are not the same as the RawHit s > pointed to by RawEvent. > > So, I think for some reason the mechanism that ensures objects are written > only once (for objects pointed to multiple times) does not work. I suspect > it has something to do with the fact that the RawEvent I READ is in a > different tree (RawTree) than the reconstructed event (RecoTree). But I do > want to SAVE the RawEvent in the reconstructed tree via the RecoEvent. > What am I doing wrong, and how can I achieve what I want? > > thanks, > > Rutger
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET