Hi,
I have a problem with creating a ROOT-Tree with a self made class.
What I want to do is to create a TTree, filling it with a class Test:
Test.hh:
class Test :public TObject {
public:
Int_t fTest;
ClassDef(Test,1)
};
The main program looks like this:
#include "Test.hh"
void main(void)
{
// creating new TFile
TFile* f=new TFile("tree4.root","RECREATE");
// creating new TTree
TTree* t4=new TTree("t4","tree");
// pointer to new Object
Test* test=new Test();
// creating new branch
t4.Branch("test","Test",&test, 16000,2);
// filling tree with random values
for (int ev=0;ev<100;ev++) {
Int_t value=int(gRandom->Rndm()*100);
test->fTest=value;
t4.Fill();
}
f->Write();
f->Close();
}
But this does not work! A segmentation occurs instead.
I am working with ROOT Version 3.05/02 with Linux version 2.4.17.
Can someone help me?
Alex
--------------------------------------------------------------
Alexander Dietz
Max Planck Institut fuer Kernphysik
Saupfercheckweg 1
Postfach 10 39 80
D-69029 Heidelberg
Phone: +49 6221 516 259
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET