Dear ROOT team. Now ROOT project looks more attractive than PAW (for me) and I plan to move my analysis code to ROOT (==> to C++). Just now I try to design a 'Event' interface for CMD2 detector. And I have a lot of Q's - mainly to 'internals' of RTTI implementation. I spent some time to learn tutorials, but ... Q1: how to 'construct' events during reading from TFile ? I want to keep in the *.root file a 'partially constructed' event and add (generate) some fields while reading. ==> Q2: Is there a method in TObject that called just after reading from buffer (i.e. virtual void TObject::Validate()) ? Let me explain - what I mean ... Here - a truncated version of my Event class. I try to design it for conversion from DST files to TTree and I want use it for 'inspecting' events in ROOT framework. class CMD2Event : public TObject { private: CMD2EventHeader fHead; // CMD2 Event header Float_t fBeamEnergy; Float_t fXBeam; Float_t fYBeam; TClonesArray *fVertecies; // List of recon. vertecies TClonesArray *fTracks; // List of recon. tracks TClonesArray *fZClusters; // List of recon. Z-clusters TClonesArray *fCSIClusters; // List of recon. CsI clusters TClonesArray *fBGOClusters; // List of recon. BGO clusters protected: TClonesArray *fPhotons; // Reconstructed photons TClonesArray *fCharged; // Reconstructed charged particles public: TDecayMask *fDecay; // Assumed Decay Mask TSortedList *fCombinations; // Sorted (by xi2) list of combinations public: CMD2Event(); virtual ~CMD2Event(); void MatchDecay() { // Do the kinematic reconstruction if(fDecay) { fCombinations = fDecay->Match(*this);}; }; void SetFromZEBRA(); // Fill the event from ZEBRA storage void SetEvent() { SetFromZEBRA(); MatchDecay(); }; void SetDecayMask(TDecayMask *m) { fDecay = m; MatchDecay(); }; void SetBeam(Float_t e,Float_t x=0, Float_t y=0) { fBeamEnergy = e; fXBeam = x; fYBeam = y; MatchDecay(); }; TDecayMask* GetDecayMask() { return fDecay; }; TSortedList* GetDecays() { return fCombination; }; Float_t BeamEnergy() { return fBeamEnergy; }; Float_t XBeam() { return fXBeam; }; Float_t YBeam() { return fYBeam; }; ClassDef(CMD2Event,1) // CMD2 Event }; The central part (for analysis) - fields 'fDecay' and 'fCombinations'. 'fDecay' is a pointer to some global var. like gDecay = TDecayMask("phi -> K+ K-") or gDecay = TDecayMask("phi -> omega pi0, omega -> pi+ pi- pi0") with other 'internals' concerning - how to match to 'event'. 'fCombinations' - list of TDecay combinations to reflect links between 'pi0' and 'measured' photons. This class should export smth like decay->Particle("omega")->Energy() and so on. The idea : Before writing 'events' - set fDecay and fCombination to 0 to keep disk space. Before reading - set gDecay, tune the 'internals' and loop over events to fill histos. But for this, I need to place smth like if( !fDecay && gpDecay ) { fDecay = gpDecay; MatchEvent(); } into ... what ??? (my opinion: the best place - Event::Validate() in Event.C) For reading from FZ-file - the problem solved with a SetEvent method. How to do in case of TFile ? If I need to rewrite the Streamer method, how to generate 'default' version of Event::Streamer ? (I look into EventCint.C, but see only some CINT internal names) And how to automate this ? ( the only thing that I need - to add the call to Validate(b.ReadVersion()) just after 'standard' staff, that changes with time ... ) Is there other way (may be more simple) for the same things ? Sorry for this long long Q2 !!! (and for my ugly English ...) Thanks in advance. Nikolay Root BINP, Novosibirsk email : nroot@inp.nsk.su
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET