Hello Root,
I am writing a "translation class" that I would like to have mimic the
behavior of a TChain, so that programs that currently use TChain can use
my new class to read non-root data directly.
My first try, I made a new class derived from TTree, gave this class
some branches, and then fill the branches in an over-written GetEntry().
This mostly seemed to work, however, to get a program to accept this
"TTree like" object, I need to cast it to a (TChain *). This gives
problems when the programs calls a method that does not exist in TTree
(segfault).
Second try I figured I just derive from TChain instead of TTree, and
since TChain derives itself from TTree, everything should still work.
Not so.
The following does not work on a TChain:
Int_t *myint = new Int_t();
TChain *ch = new TChain("CLASEVENT","Test me");
TBranch *chb = ch->Bronch("HEADER","THEADERClass",&myint);
*** Break *** segmentation violation
BUT:
TTree *te = new TTree("CLASEVENT","Test me");
TBranch *chb = te->Bronch("HEADER","THEADERClass",&myint);
No problem.
This puzzles me, since the "Bronch" (or "Branch" for that matter)
methods are defined only in TTree, and not overwritten in TChain.
Could someone explain how I can initialize branches on a TChain, when
they are NOT read from a file, and not even connected to a file?
Thank you much,
Maurik Holtrop
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET