Re: Need with advice

Pasha Murat (murat@cdfsga.fnal.gov)
Sat, 20 Jun 1998 17:11:51 -0500 (CDT)


Nikolay I. Root writes:
> 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 ?

Hello Nikolay,

ROOT "constructs" event automatically when reading it from a file,
see example in $ROOTSYS/test/MainEvent.cxx. You only need to tell ROOT
about the address of Event object where you want the data to be read in.
>
> 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()) ?

No , there is no such a method, you may use customized Event::Streamer
instead.

... snip..

> The idea :
> Before writing 'events' - set fDecay and fCombination to 0 to keep disk space.
> Before reading - set gDecay, tune the 'internals' and

Customized Streamer function seems to be the best place for such
an action -
just don't stream fDecay etc out. Also don't forget to tell rootcint
that you don't want it to generate Streamer automatically - put
line like

#pragma link C++ class Event-;

(note "-") into your LinkDef.h.

... snip..

> 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)

Look into the end of this file, or search for Event::Streamer in it,
it should be in there.

Regards, Pasha.