Re: [ROOT] tree->Branch problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jun 27 2001 - 11:28:42 MEST


Hi Jacek,

The default BuildIndex algorithms assumes that teh majorname & minorname are
positive. Note that you can specify a formula for the major and minor name
when you create the index. eg.
  tree.BuildIndex("xxx+1000", "yyy+256");
If you do this, you must be consistent when calling GetEntryNumberWithIndex
and specify the same offsets.

About your question #2
 You can set a bit via TObject::SetBit to specify if you have ownership or not
on one or more objects referenced by this object. You can also use an
additional data member, but bits are cleaner and more general, they do not
require a modification of the class.

About your question #3
Why don't you create a static object TWireInfo?
Note that in version 3.01, the way the dictionaries are built has been optimized
and a new function provided to initialize the dictionary(s). (see release notes)

Rene Brun

Jacek M. Holeczek wrote:
> 
> Hi,
> Many thanks for you help.
> Unfortunately your changes break my original idea.
> However, you did provide me with the required fixes :
>         1. I need to "branch->SetAutoDelete(kFALSE);" in order to get my
>            class working at all
>         2. I need to set "split = 1;" in order to get tree indexing
>            working (I don't remember if this is described anywhere)
> I've got some additional problems (as usually :-) :
> 1. Tree indexing does not work reliably :
>         root [6] gWireInfo->WireMapTree->GetEntryNumberWithIndex(800,-80)
>         (const Int_t)8 // that's fine
>         root [7] gWireInfo->WireMapTree->GetEntryNumberWithIndex(700,-70)
>         (const Int_t)(-1) // !!!!!!!!!!!!!!!!!!!!!!
>         root [8] gWireInfo->WireMapTree->GetEntryNumberWithIndex(600,-60)
>         (const Int_t)6 // that's fine
>         root [9] gWireInfo->WireMapTree->GetEntryNumberWithBestIndex(700,-70)
>         (const Int_t)6 // !!!!!!!!!!!!!!!!!!!!!!
> 2. Can I somehow "store" the information who is the "owner" of the TFile,
>    TTree object INSIDE of this object ? I mean, for example, I store the
>    "address" of the object that made "new TFile", "new TTree", so that I
>    could do "if (myTFileTTree->OnwnerAddress == this) delete myTFileTTree"
> 3. I'd like to be able to create the global instance of my object
>    automatically when the shared library is loaded, so I do :
>         globalWireInfo = new TWireInfo();
>    but then I get :
>         Warning in <TClass::TClass>: no dictionary for class TWireInfo is available
>         Warning in <TLeafObject::Streamer>: Cannot find class:TWireInfo
>    This is (I suppose) because the "compiler" creates the instance of the
>    TWireInfo class BEFORE CINT's table of classes was updated. I think I
>    can overcome it using something like this :
>         globalWireInfo = (MagicallyUpdateCintTable(), new TWireInfo());
>    Could you, please, provide me with the correct name of the magic
>    dictionary-updater function to call ?
> Thanks in advance,
> Jacek.
> P.S. Of course this was root 3.00/06 on a RH6.1/i386 machine. Jacek.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET