fill tree bombs in a simple case

David Urner (urner@uinpluxa.npl.uiuc.edu)
Thu, 6 Nov 97 16:51:06 CST


Hi,
I'm trying to write a macro with a very basic tree.
I first load a simple class called Mytest, which contains just 4 variables
with .L help.cpp. It has the following form:

#include "help.h"

Mytest::Mytest()
{

}
Mytest::~Mytest()
{

}

void Mytest::Streamer(TBuffer &R__b)
{
// Stream an object of class Geometry.

}

where help.h has the form:

class Mytest
{
public:
Mytest();
virtual ~Mytest();

void Streamer(TBuffer& R__b);
Int_t Run_number;
Int_t Record_number;
Int_t Fill_number;
Int_t Nrhits;
};

I'm booking the tree then the following way:

{
TFile *hfile = new TFile("Test.root","RECREATE","Junk");
TTree *treetrace = new TTree("treetrace","example",1024);
Int_t split=0;
Int_t bsize = 64000;
Mytest *mytest = new Mytest;
treetrace->Branch("mytest","Mytest",&mytest,bsize,split);
treetrace->Fill();
}

At the comand treetrace->Fill() I get a segmentation violation.
What could the reason be?
I'm running this on a hp system 10.

cheers
David