TLeafS

From: Alexander Zvyagin (zvyagin@mx.ihep.su)
Date: Sat Dec 06 1997 - 14:13:42 MET


                                           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