Re: TTree with TClonesArray

From: William J. Deninger (deninger@uiuc.edu)
Date: Sun Jan 04 1998 - 20:39:58 MET


Hi again,

These classes were in fact compiled. And Test.C was checked both on CInt and
compiled.  The outcome is the same.  When one uses the class TBranch*
TTree::Branch(Text_t *const name, Text_t* classname, void* addobj, Int_t
bufsize = 32000, Int_t splitlevel = 1)
with the last parameter (the Int_t splitlevel ) = 1, and then TTree::Fill()
is called, a segment violation occurs and ROOT terminates.  When splitlevel
= 0, my class is correctly serialized and ROOT doesn't crash.  Why might my
simple class example below do that?

If this isn't occurring on anyone's platform, please let me know.  Does
anyone have a makefile or debug library so that I can track these things
down myself?  I'm running WinNT w/sp3.0 and MSVC v5.0.

William J Deninger
deninger@uiuc.edu

-----Original Message-----
From: Pasha Murat <murat@cdfsga.fnal.gov>
To: William J. Deninger <deninger@uiuc.edu>
Cc: roottalk@hpsalo.CERN.CH <roottalk@hpsalo.CERN.CH>
Date: Sunday, January 04, 1998 11:50 AM
Subject: TTree with TClonesArray


>
> As it has already been discussed a bunch of times on this mailing list
>it is not possible to the moment to derive *interpreted* classes from
TObject.
>It is related to the difficulties of "on-the-fly" construction of TObject
>virtual table. There are more details on roottalk digest.
>As this issue arises again and again (and undoubtedly is quite important)
it
>might be useful to add the discussion of it to ROOT manuals, if it is not
there
>yet.
> Regards, Pasha.
>---------------------------------------------------------------------------
-----
>William J. Deninger writes:
> > Hello,
> >
> > I'm having troubles with TTree::Fill() crashing ROOT with the following
> > example.  I've noticed that if the split option in tree->Branch is set
to 0,
> > things do run.  But I'm partial to having my tree automatically branched
if
> > possible.  I'm I doing something wrong here?
> >
> > Thanks again for all you help.
> >
> > William J Deninger
> > deninger@uiuc.edu
> > //_______________________
> > // Test.C
> > {
> > gROOT->Reset("a");
> > TFile *hfile = new TFile("d:/data/test.root","RECREATE","G2073_073");
> > hfile->SetCompressionLevel(1);
> >
>> tree = new TTree("tree","test tree");  <--- forgot to show this line last
time....
> > Simple *raw;
> > tree->Branch("test","Simple",&raw,10000,1);
> > raw = new Simple;
> > tree->Fill();
> > hfile->Write();
> > }
> >
> > //_______________________
> > // Simple.h
> > #include "TObject.h"
> > #include "MPXPAIR.h"
> > #include "TClonesArray.h"
> > class Simple : public TObject
> > {
> > public:
> >  Simple();
> >  virtual ~Simple();
> >  TClonesArray test;
> >  ClassDef(Simple,1)
> > };
> > //_______________________
> > // Simple.cpp
> > #include "Simple.h"
> > ClassImp(Simple)
> > Simple::Simple() : test("MPXPAIR", 10)
> >

> > }
> > Simple::~Simple()
> > {
> > }
> >
> >
>



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET