[ROOT] indirect use of TRef with TChain

From: Mathieu Ribordy (mathieu.ribordy@desy.de)
Date: Tue Oct 08 2002 - 16:21:00 MEST


Hi,

I got a problem when dealing with chains and indirect references:

a TFile has
- a one entry tree, the detector
- a tree with events, connected to the detector via a TRef

when I use only one TFile, the reference to the detector is correctly
set, after having used once the detector tree (I guess loading the
detector into the memory sets the TRef). Then I can use event methods
using the detector info (same with an event and a detector chain set
from only one file, it works)

Now I want to use a TChain, with multiple files. It works well when I
use event methods not referring indirectly to the detector:
ev->Draw("event.hits.GetOM().GetCoo().Z()"); // to draw the z-coo of the
hits

but it fails in this case (seg viol because of nil ptr), where a loop on
hits calling hit->GetOM() is performed in Q():
ev->Draw("event.tracks[10].Q()");

because, unfortunately, the reference of the hits to the detector is
hit->GetOM() = NULL. So it crashes.

Question: why are the reference of the hits to the detector modules
correctly set, but not for the track (it is not automatic). The
references should be set automatically, as the full event is retrieved
in mem.

Maybe the right question is: how do I force the Draw method to retrieve
not only the full event but also the references, when indirect ?

Any help ?
    thanks a lot
        Mathieu



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:13 MET