William J. Deninger wrote: > 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() > { > } In your program above, you should replace the statement: Simple *raw; by Simple *raw = new Simple; The point is that the pointer given to TTree::Branch must be initialized. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET