Re: drawing ntuple while filling in a linked member

Rene Brun (Rene.Brun@cern.ch)
Wed, 21 Jan 1998 13:40:21 +0100


Dirk Meier wrote:

> Hi,
>
> I am excecuting a .C macro in CINT which calls in a loop
> a member of a class which is linked to ROOT.
> In this member I am filling an Ntuple.
> The Ntuple is filled correctly, which I see after my .C
> macro has finished (I can look at the ntuple with ->Draw(..)).
> Now, when I try to Draw() the ntuple during filling inside
> the filling loop I get a segmentation fault.
>
> here is my .C
> with Examination* e; // *e is object of my class
> // linked to ROOT
>
> ...
> while(e->NextRawEvent() == kTRUE) { // reads data from disk
> ....
> e->FillNtuple(); // fills an ntuple
> ...
> e->GetTrackHitNtuple()->Draw("ut-u:vt","plane == 3"); // see below...
> }
> ...
>
> the Ntuple is declared private in my class Examination.h as
> NTuple* fNtData;
>
> and in a constructor for the object e
> fNtData = new TNtuple("A","B","plane:u:ut:vt");
>
> The member GetTrackHitNtuple() is
> TNtuple* Examination::GetTrackHitNtuple(){
> return fNtData;
> }
>
> and root knows about the pointer to the Ntuple:
> root [2] e->GetTrackHitNtuple()
> (class TNtuple*)0x40b953c0
>
> But this ntuple can only be drawn when the .C finished. Why?
>

Thanks for reporting this problem. It is now fixed in our development
version.

Rene Brun