Using root 3.01-06 on Redhat 6.2 Linux with kernel 2.2.19-6.2.7 (Ok, I should upgrade). I have a TTree which contains TBranch that holds a class MyClass which inherits from TObject. I want to customize the output by writing my own MyClass::Streamer() method, but for some reason I have not understood from various documentation my customized method does not get called. How can I fix this ? The following root scripts illustrate what "works" and what does "not work". By "work" I mean the MyClass::Streamer() is called. MyClass is loaded as a shared library in an interactive root session. { // This root script proves that MyClass::Streamer() is called TFile* f = new TFile("test.root","RECREATE"); MyClass* myclass = new MyClass(); myclass->Init(); for (Int_t i = 0; i < 20; i++) { myclass->Process(); myclass->Write(); } } { // This root script shows MyClass::Streamer() is NOT called. // But I want mytree to contain customized output from MyClass::Streamer MyClass* myclass = new MyClass(); TTree *mytree = new TTree("T", "test tree"); mytree->Branch("test1", myclass->IsA()->GetName(), &myclass); TFile* f = new TFile("test.root","RECREATE"); myclass->Init(); for (Int_t i=0; i < 20; i++) { myclass->Process(); mytree->Fill(); } } I think this is enough to illustrate, but in case you need to see MyClass and other details, see http://www.jlab.org/~rom/rootex1/streamex1.html (I didn't want to fill up everyone's mailbox.) Thanks ! ------------------------------------------------------ Robert W. Michaels www.jlab.org/~rom phone (757) 269 7410 pager (757) 584 7410 Thomas Jefferson National Accelerator Facility 12000 Jefferson Ave, Newport News, VA 23606 USA
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET