[ROOT] TTree of myclass

From: kevin reil (kevin.reil@gmail.com)
Date: Wed Sep 15 2004 - 23:06:41 MEST


Hi all,

I have a file which is a one branch tree of a small class (TRun)

  TRun *trun=new TRun();
  TTree *tree = new TTree("mytree","My ROOT Tree");
  tree->Branch("TRunBranch","TRun",&trun,32000,99);

  for (loop...) {
    trun->FillFrom(nt,i);
    tree->Fill();
  }
write and close.

If I start root, load the TRun library and then the file created I can 

{
  TFile *f2 = new TFile("/home/reil/flash/data/trun_test.root","OPEN");
  TRun *temprun;
  TRun *trun;
  TTree *tree =(TTree*)gROOT->FindObject("mytree");
  Int_t nruns=(Int_t)tree->GetEntries();
 
  tree->SetBranchAddress("TRunBranch",&temprun);
  tree->Dump();
  for (Int_t i=0; i<nruns; ++i) {
    tree->GetEntry(i);

and now use my class (loaded into temprun)

In a compiled program (e165), at the line
    tree->GetEntry(i);

line I crash with 
 *** Break *** segmentation violation
 Generating stack trace...
/usr/bin/addr2line: e165: No such file or directory
/usr/bin/addr2line: e165: No such file or directory
/usr/bin/addr2line: e165: No such file or directory
 0x00298121 in TClass::BuildRealData(void*) + 0x511 from
/data/root/lib/libCore.so
 0x002af21f in TStreamerInfo::BuildOld() + 0x71 from /data/root/lib/libCore.so
 0x0029bc00 in TClass::GetStreamerInfo(int) + 0x1a8 from
/data/root/lib/libCore.so
 0x00ee01d8 in TBranchElement::GetInfo() + 0xda from /data/root/lib/libTree.so
 0x00ee1794 in TBranchElement::SetAddress(void*) + 0x8e from
/data/root/lib/libTree.so
 0x00f02376 in TTree::SetBranchAddress(char const*, void*) + 0xc0 from
/data/root/lib/libTree.so
 0x08049efd in Analyze() + 0x289 from e165
 0x0804a990 in main + 0xc8 from e165
 0x06dff770 in __libc_start_main + 0xf0 from /lib/tls/libc.so.6
 0x08049be5 in TFile::TFile[in-charge](char const*, char const*, char
const*, int) + 0x31 from e165
Aborted

Is there something obvious here that I am missing? Or would I need a
detailed debug?

 *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   4.00/08    10 August 2004   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
Linux  2.4.22-1.2197.nptl #1 Thu Jul 1 15:14:28 EDT 2004 i686 i686
i386 GNU/Linux

Thanks,
Kevin



-- 
|------------------------------------|---------------------------------|
| Kevin Reil                         | 2575 Sand Hill Road, MS 26      |
| X2447, 103D A&E Bldg. 041          | Menlo Park, CA 94025            |
|------------------------------------|---------------------------------|
| http://www.slac.stanford.edu/~reil | Office (650) 926-2447           |
| reil@slac.stanford.edu             | Home   (650) 938-1767           |
| http://reil.no-ip.org              | Fax    (650) 926-5368           |
|----------------------------------------------------------------------|
|                    And my father dwelt in a tent.                    |
|----------------------------------------------------------------------|



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET