Alexander, I do not understand what you want to do. TLeafS is a class used internally by the TTree system. You should not reference an object of this class in your Event structure. You can look at $ROOTSYS/test/Event for an example of Event structure. Rene Brun Alexander Zvyagin wrote: > IHEP, Protvino, Russia, 6-DEC-1997 > > I have problem with an object of TLeafS class. Below is my simple program. > What is wrong? > > Thanks, > Alexander Zvyagin. > > --------- file EVENT.h ------------- > #include <TObject.h> > #include <TLeafS.h> > > class EVENT : public TObject > { > public: > EVENT(void) {} > virtual ~EVENT() {} > void init(Short_t *buf) > { > l.SetLen(1); > l.SetAddress(buf); > } > private: > TLeafS l; > ClassDef(EVENT,1) // EVENT_GAMS84_DST class... > }; > ------------------------------------- > > --------- file test.c --------------- > #include <stream.h> > > #include <TROOT.h> > #include <TFile.h> > #include <TTree.h> > #include <TBranch.h> > > #include "EVENT.h" > > ClassImp(EVENT) > > int main(void) > { > TROOT main_root("main","main ..."); > TFile file("file.root","RECREATE", "root file", 9); > EVENT *event = new EVENT; > TTree tree("tree","tree ..."); > TBranch *branch_event = tree.Branch("This is one event.","EVENT",&event); > > Short_t var=6; > event->init(&var); > > cout << "1\n"; cout.flush(); > tree.Fill(); // *** Break *** segmentation violation > cout << "2\n"; cout.flush(); > > file.Write(); > file.Close(); > delete event; > return 0; > } > -------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET