TTree with TClonesArray
Pasha Murat (murat@cdfsga.fnal.gov)
Sun, 4 Jan 1998 17:52:45 GMT
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);
>
> 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()
> {
> }
>
>