// @(#)root/cont:$Id$
// Author: Fons Rademakers   10/10/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtree                                                               //
//                                                                      //
// B-tree class. TBtree inherits from the TSeqCollection ABC.           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////
//BEGIN_HTML <!--
/* -->
<h2>B-tree Implementation notes</h2>

This implements B-trees with several refinements. Most of them can be found
in Knuth Vol 3, but some were developed to adapt to restrictions imposed
by C++. First, a restatement of Knuth's properties that a B-tree must
satisfy, assuming we make the enhancement he suggests in the paragraph
at the bottom of page 476. Instead of storing null pointers to non-existent
nodes (which Knuth calls the leaves) we utilize the space to store keys.
Therefore, what Knuth calls level (l-1) is the bottom of our tree, and
we call the nodes at this level LeafNodes. Other nodes are called InnerNodes.
The other enhancement we have adopted is in the paragraph at the bottom of
page 477: overflow control.
<p>
The following are modifications of Knuth's properties on page 478:
<p>
<ol>
<li>  Every InnerNode has at most Order keys, and at most Order+1 sub-trees.
<li>  Every LeafNode has at most 2*(Order+1) keys.
<li>  An InnerNode with k keys has k+1 sub-trees.
<li>  Every InnerNode that is not the root has at least InnerLowWaterMark keys.
<li>  Every LeafNode that is not the root has at least LeafLowWaterMark keys.
<li>  If the root is a LeafNode, it has at least one key.
<li>  If the root is an InnerNode, it has at least one key and two sub-trees.
<li>  All LeafNodes are the same distance from the root as all the other
      LeafNodes.
<li>  For InnerNode n with key n[i].key, then sub-tree n[i-1].tree contains
      all keys &lt; n[i].key, and sub-tree n[i].tree contains all keys
      &gt;= n[i].key.
<li>  Order is at least 3.
</ol>
<p>
The values of InnerLowWaterMark and LeafLowWaterMark may actually be set
by the user when the tree is initialized, but currently they are set
automatically to:
<p><pre>
        InnerLowWaterMark = ceiling(Order/2)
        LeafLowWaterMark  = Order - 1
</pre><p>
If the tree is only filled, then all the nodes will be at least 2/3 full.
They will almost all be exactly 2/3 full if the elements are added to the
tree in order (either increasing or decreasing). [Knuth says McCreight's
experiments showed almost 100% memory utilization. I don't see how that
can be given the algorithms that Knuth gives. McCreight must have used
a different scheme for balancing. [No, he used a different scheme for
splitting: he did a two-way split instead of the three way split as we do
here. Which means that McCreight does better on insertion of ordered data,
but we should do better on insertion of random data.]]
<p>
It must also be noted that B-trees were designed for DISK access algorithms,
not necessarily in-memory sorting, as we intend it to be used here. However,
if the order is kept small (&lt; 6?) any inefficiency is negligible for
in-memory sorting. Knuth points out that balanced trees are actually
preferable for memory sorting. I'm not sure that I believe this, but
it's interesting. Also, deleting elements from balanced binary trees, being
beyond the scope of Knuth's book (p. 465), is beyond my scope. B-trees
are good enough.
<p>
A B-tree is declared to be of a certain ORDER (3 by default). This number
determines the number of keys contained in any interior node of the tree.
Each interior node will contain ORDER keys, and therefore ORDER+1 pointers
to sub-trees. The keys are numbered and indexed 1 to ORDER while the
pointers are numbered and indexed 0 to ORDER. The 0th ptr points to the
sub-tree of all elements that are less than key[1]. Ptr[1] points to the
sub-tree that contains all the elements greater than key[1] and less than
key[2]. etc. The array of pointers and keys is allocated as ORDER+1
pairs of keys and nodes, meaning that one key field (key[0]) is not used
and therefore wasted.  Given that the number of interior nodes is
small, that this waste allows fewer cases of special code, and that it
is useful in certain of the methods, it was felt to be a worthwhile waste.
<p>
The size of the exterior nodes (leaf nodes) does not need to be related to
the size of the interior nodes at all. Since leaf nodes contain only
keys, they may be as large or small as we like independent of the size
of the interior nodes. For no particular reason other than it seems like
a good idea, we will allocate 2*(ORDER+1) keys in each leaf node, and they
will be numbered and indexed from 0 to 2*ORDER+1. It does have the advantage
of keeping the size of the leaf and interior arrays the same, so that if we
find allocation and de-allocation of these arrays expensive, we can modify
their allocation to use a garbage ring, or something.
<p>
Both of these numbers will be run-time constants associated with each tree
(each tree at run-time can be of a different order). The variable "order"
is the order of the tree, and the inclusive upper limit on the indices of
the keys in the interior nodes.  The variable "order2" is the inclusive
upper limit on the indices of the leaf nodes, and is designed
<p><pre>
    (1) to keep the sizes of the two kinds of nodes the same;
    (2) to keep the expressions involving the arrays of keys looking
        somewhat the same:   lower limit        upper limit
          for inner nodes:        1                order
          for leaf  nodes:        0                order2
        Remember that index 0 of the inner nodes is special.
</pre><p>
Currently, order2 = 2*(order+1).
<p><pre>
 Picture: (also see Knuth Vol 3 pg 478)

           +--+--+--+--+--+--...
           |  |  |  |  |  |
 parent---&gt;|  |     |     |
           |  |     |     |
           +*-+*-+*-+--+--+--...
            |  |  |
       +----+  |  +-----+
       |       +-----+  |
       V             |  V
       +----------+  |  +----------+
       |          |  |  |          |
 this-&gt;|          |  |  |          |&lt;--sib
       +----------+  |  +----------+
                     V
                    data
</pre><p>
It is conceptually VERY convenient to think of the data as being the
very first element of the sib node. Any primitive that tells sib to
perform some action on n nodes should include this 'hidden' element.
For InnerNodes, the hidden element has (physical) index 0 in the array,
and in LeafNodes, the hidden element has (virtual) index -1 in the array.
Therefore, there are two 'size' primitives for nodes:
<p><pre>
Psize       - the physical size: how many elements are contained in the
              array in the node.
Vsize       - the 'virtual' size; if the node is pointed to by
              element 0 of the parent node, then Vsize == Psize;
              otherwise the element in the parent item that points to this
              node 'belongs' to this node, and Vsize == Psize+1;
</pre><p>
Parent nodes are always InnerNodes.
<p>
These are the primitive operations on Nodes:
<p><pre>
Append(elt)     - adds an element to the end of the array of elements in a
                  node.  It must never be called where appending the element
                  would fill the node.
Split()         - divide a node in two, and create two new nodes.
SplitWith(sib)  - create a third node between this node and the sib node,
                  divvying up the elements of their arrays.
PushLeft(n)     - move n elements into the left sibling
PushRight(n)    - move n elements into the right sibling
BalanceWithRight() - even up the number of elements in the two nodes.
BalanceWithLeft()  - ditto
</pre><p>
To allow this implementation of btrees to also be an implementation of
sorted arrays/lists, the overhead is included to allow O(log n) access
of elements by their rank (`give me the 5th largest element').
Therefore, each Item keeps track of the number of keys in and below it
in the tree (remember, each item's tree is all keys to the RIGHT of the
item's own key).
<p><pre>
[ [ &lt; 0 1 2 3 &gt; 4 &lt; 5 6 7 &gt; 8 &lt; 9 10 11 12 &gt; ] 13 [ &lt; 14 15 16 &gt; 17 &lt; 18 19 20 &gt; ] ]
   4  1 1 1 1   4   1 1 1   5   1  1  1  1      7  3   1  1  1    4    1  1  1
</pre><p>
<!--*/
// -->END_HTML

#include <stdlib.h>
#include "TBtree.h"


ClassImp(TBtree)

//______________________________________________________________________________
TBtree::TBtree(int order)
{
   // Create a B-tree of certain order (by default 3).

   Init(order);
}

//______________________________________________________________________________
TBtree::~TBtree()
{
   // Delete B-tree. Objects are not deleted unless the TBtree is the
   // owner (set via SetOwner()).

   if (fRoot) {
      Clear();
      SafeDelete(fRoot);
   }
}

//______________________________________________________________________________
void TBtree::Add(TObject *obj)
{
   // Add object to B-tree.

   if (IsArgNull("Add", obj)) return;
   if (!obj->IsSortable()) {
      Error("Add", "object must be sortable");
      return;
   }
   if (!fRoot) {
      fRoot = new TBtLeafNode(0, obj, this);
      R__CHECK(fRoot != 0);
      IncrNofKeys();
   } else {
      TBtNode *loc;
      Int_t idx;
      if (fRoot->Found(obj, &loc, &idx) != 0) {
         // loc and idx are set to either where the object
         // was found, or where it should go in the Btree.
         // Nothing is here now, but later we might give the user
         // the ability to declare a B-tree as `unique elements only',
         // in which case we would handle an exception here.
      }
      loc->Add(obj, idx);
   }
}

//______________________________________________________________________________
TObject *TBtree::After(const TObject *) const
{
   // Cannot use this method since B-tree decides order.

   MayNotUse("After");
   return 0;
}

//______________________________________________________________________________
TObject *TBtree::Before(const TObject *) const
{
   // May not use this method since B-tree decides order.

   MayNotUse("Before");
   return 0;
}

//______________________________________________________________________________
void TBtree::Clear(Option_t *)
{
   // Remove all objects from B-tree. Does NOT delete objects unless the TBtree
   // is the owner (set via SetOwner()).

   if (IsOwner())
      Delete();
   else {
      SafeDelete(fRoot);
      fSize = 0;
   }
}

//______________________________________________________________________________
void TBtree::Delete(Option_t *)
{
   // Remove all objects from B-tree AND delete all heap based objects.

   for (Int_t i = 0; i < fSize; i++) {
      TObject *obj = At(i);
      if (obj && obj->IsOnHeap())
         TCollection::GarbageCollect(obj);
   }
   SafeDelete(fRoot);
   fSize = 0;
}

//______________________________________________________________________________
TObject *TBtree::FindObject(const char *name) const
{
   // Find object using its name (see object's GetName()). Requires sequential
   // search of complete tree till object is found.

   return TCollection::FindObject(name);
}

//______________________________________________________________________________
TObject *TBtree::FindObject(const TObject *obj) const
{
   // Find object using the objects Compare() member function.

   if (!obj->IsSortable()) {
      Error("FindObject", "object must be sortable");
      return 0;
   }
   if (!fRoot)
      return 0;
   else {
      TBtNode *loc;
      Int_t idx;
      return fRoot->Found(obj, &loc, &idx);
   }
}

//______________________________________________________________________________
Int_t TBtree::IdxAdd(const TObject &obj)
{
   // Add object and return its index in the tree.

   Int_t r;
   if (!obj.IsSortable()) {
      Error("IdxAdd", "object must be sortable");
      return -1;
   }
   if (!fRoot) {
      fRoot = new TBtLeafNode(0, &obj, this);
      R__ASSERT(fRoot != 0);
      IncrNofKeys();
      r = 0;
   } else {
      TBtNode *loc;
      int idx;
      if (fRoot->Found(&obj, &loc, &idx) != 0) {
         // loc and idx are set to either where the object
         // was found, or where it should go in the Btree.
         // Nothing is here now, but later we might give the user
         // the ability to declare a B-tree as `unique elements only',
         // in which case we would handle an exception here.
         // std::cerr << "Multiple entry warning\n";
      } else {
         R__CHECK(loc->fIsLeaf);
      }
      if (loc->fIsLeaf) {
         if (loc->fParent == 0)
            r = idx;
         else
            r = idx + loc->fParent->FindRankUp(loc);
      } else {
         TBtInnerNode *iloc = (TBtInnerNode*) loc;
         r = iloc->FindRankUp(iloc->GetTree(idx));
      }
      loc->Add(&obj, idx);
   }
   R__CHECK(r == Rank(&obj) || &obj == (*this)[r]);
   return r;
}

//______________________________________________________________________________
void TBtree::Init(Int_t order)
{
   // Initialize a B-tree.

   if (order < 3) {
      Warning("Init", "order must be at least 3");
      order = 3;
   }
   fRoot   = 0;
   fOrder  = order;
   fOrder2 = 2 * (fOrder+1);
   fLeafMaxIndex  = fOrder2 - 1;     // fItem[0..fOrder2-1]
   fInnerMaxIndex = fOrder;          // fItem[1..fOrder]
   //
   // the low water marks trigger an exploration for balancing
   // or merging nodes.
   // When the size of a node falls below X, then it must be possible to
   // either balance this node with another node, or it must be possible
   // to merge this node with another node.
   // This can be guaranteed only if (this->Size() < (MaxSize()-1)/2).
   //
   //

   // == MaxSize() satisfies the above because we compare
   // lowwatermark with fLast
   fLeafLowWaterMark  = ((fLeafMaxIndex+1)-1) / 2 - 1;
   fInnerLowWaterMark = (fOrder-1) / 2;
}

//______________________________________________________________________________
//void TBtree::PrintOn(std::ostream& out) const
//{
//   // Print a B-tree.
//
//   if (!fRoot)
//      out << "<empty>";
//   else
//      fRoot->PrintOn(out);
//}

//______________________________________________________________________________
TIterator *TBtree::MakeIterator(Bool_t dir) const
{
   // Returns a B-tree iterator.

   return new TBtreeIter(this, dir);
}

//______________________________________________________________________________
Int_t TBtree::Rank(const TObject *obj) const
{
   // Returns the rank of the object in the tree.

   if (!obj->IsSortable()) {
      Error("Rank", "object must be sortable");
      return -1;
   }
   if (!fRoot)
      return -1;
   else
      return fRoot->FindRank(obj);
}

//______________________________________________________________________________
TObject *TBtree::Remove(TObject *obj)
{
   // Remove an object from the tree.

   if (!obj->IsSortable()) {
      Error("Remove", "object must be sortable");
      return 0;
   }
   if (!fRoot)
      return 0;

   TBtNode *loc;
   Int_t idx;
   TObject *ob = fRoot->Found(obj, &loc, &idx);
   if (!ob)
      return 0;
   loc->Remove(idx);
   return ob;
}

//______________________________________________________________________________
void TBtree::RootIsFull()
{
   // The root of the tree is full. Create an InnerNode that
   // points to it, and then inform the InnerNode that it is full.

   TBtNode *oldroot = fRoot;
   fRoot = new TBtInnerNode(0, this, oldroot);
   R__ASSERT(fRoot != 0);
   oldroot->Split();
}

//______________________________________________________________________________
void TBtree::RootIsEmpty()
{
   // If root is empty clean up its space.

   if (fRoot->fIsLeaf) {
      TBtLeafNode *lroot = (TBtLeafNode*)fRoot;
      R__CHECK(lroot->Psize() == 0);
      delete lroot;
      fRoot = 0;
   } else {
      TBtInnerNode *iroot = (TBtInnerNode*)fRoot;
      R__CHECK(iroot->Psize() == 0);
      fRoot = iroot->GetTree(0);
      fRoot->fParent = 0;
      delete iroot;
   }
}

//_______________________________________________________________________
void TBtree::Streamer(TBuffer &b)
{
   // Stream all objects in the btree to or from the I/O buffer.

   UInt_t R__s, R__c;
   if (b.IsReading()) {
      b.ReadVersion(&R__s, &R__c);   //Version_t v = b.ReadVersion();
      b >> fOrder;
      b >> fOrder2;
      b >> fInnerLowWaterMark;
      b >> fLeafLowWaterMark;
      b >> fInnerMaxIndex;
      b >> fLeafMaxIndex;
      TSeqCollection::Streamer(b);
      b.CheckByteCount(R__s, R__c,TBtree::IsA());
   } else {
      R__c = b.WriteVersion(TBtree::IsA(), kTRUE);
      b << fOrder;
      b << fOrder2;
      b << fInnerLowWaterMark;
      b << fLeafLowWaterMark;
      b << fInnerMaxIndex;
      b << fLeafMaxIndex;
      TSeqCollection::Streamer(b);
      b.SetByteCount(R__c, kTRUE);
   }
}


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtItem                                                              //
//                                                                      //
// Item stored in inner nodes of a TBtree.                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

//______________________________________________________________________________
TBtItem::TBtItem()
{
   // Create an item to be stored in the tree. An item contains a counter
   // of the number of keys (i.e. objects) in the node. A pointer to the
   // node and a pointer to the object being stored.

   fNofKeysInTree = 0;
   fTree = 0;
   fKey  = 0;
}

//______________________________________________________________________________
TBtItem::TBtItem(TBtNode *n, TObject *obj)
{
   // Create an item to be stored in the tree. An item contains a counter
   // of the number of keys (i.e. objects) in the node. A pointer to the
   // node and a pointer to the object being stored.

   fNofKeysInTree = n->NofKeys()+1;
   fTree = n;
   fKey  = obj;
}

//______________________________________________________________________________
TBtItem::TBtItem(TObject *obj, TBtNode *n)
{
   // Create an item to be stored in the tree. An item contains a counter
   // of the number of keys (i.e. objects) in the node. A pointer to the
   // node and a pointer to the object being stored.

   fNofKeysInTree = n->NofKeys()+1;
   fTree = n;
   fKey  = obj;
}

//______________________________________________________________________________
TBtItem::~TBtItem()
{
   // Delete a tree item.
}


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtNode                                                              //
//                                                                      //
// Abstract base class (ABC) of a TBtree node.                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

//______________________________________________________________________________
TBtNode::TBtNode(Int_t isleaf, TBtInnerNode *p, TBtree *t)
{
   // Create a B-tree node.

   fLast   = -1;
   fIsLeaf = isleaf;
   fParent = p;
   if (p == 0) {
      R__CHECK(t != 0);
      fTree = t;
   } else
#ifdef cxxbug
//  BUG in the cxx compiler. cxx complains that it cannot access fTree
//  from TBtInnerNode. To reproduce the cxx bug uncomment the following line
//  and delete the line after.
//    fTree = p->fTree;
      fTree = p->GetParentTree();
#else
      fTree = p->fTree;
#endif
}

//______________________________________________________________________________
TBtNode::~TBtNode()
{
   // Delete a B-tree node.
}


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtreeIter                                                           //
//                                                                      //
// Iterator of btree.                                                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

ClassImp(TBtreeIter)

//______________________________________________________________________________
TBtreeIter::TBtreeIter(const TBtree *t, Bool_t dir)
            : fTree(t), fCurCursor(0), fCursor(0), fDirection(dir)
{
   // Create a B-tree iterator.

   Reset();
}

//______________________________________________________________________________
TBtreeIter::TBtreeIter(const TBtreeIter &iter) : TIterator(iter)
{
   // Copy ctor.

   fTree      = iter.fTree;
   fCursor    = iter.fCursor;
   fCurCursor = iter.fCurCursor;
   fDirection = iter.fDirection;
}

//______________________________________________________________________________
TIterator &TBtreeIter::operator=(const TIterator &rhs)
{
   // Overridden assignment operator.

   if (this != &rhs && rhs.IsA() == TBtreeIter::Class()) {
      const TBtreeIter &rhs1 = (const TBtreeIter &)rhs;
      fTree      = rhs1.fTree;
      fCursor    = rhs1.fCursor;
      fCurCursor = rhs1.fCurCursor;
      fDirection = rhs1.fDirection;
   }
   return *this;
}

//______________________________________________________________________________
TBtreeIter &TBtreeIter::operator=(const TBtreeIter &rhs)
{
   // Overloaded assignment operator.

   if (this != &rhs) {
      fTree      = rhs.fTree;
      fCursor    = rhs.fCursor;
      fCurCursor = rhs.fCurCursor;
      fDirection = rhs.fDirection;
   }
   return *this;
}

//______________________________________________________________________________
void TBtreeIter::Reset()
{
   // Reset the B-tree iterator.

   if (fDirection == kIterForward)
      fCursor = 0;
   else
      fCursor = fTree->GetSize() - 1;

   fCurCursor = fCursor;
}

//______________________________________________________________________________
TObject *TBtreeIter::Next()
{
   // Get next object from B-tree. Returns 0 when no more objects in tree.

   fCurCursor = fCursor;
   if (fDirection == kIterForward) {
      if (fCursor < fTree->GetSize())
         return (*fTree)[fCursor++];
   } else {
      if (fCursor >= 0)
         return (*fTree)[fCursor--];
   }
   return 0;
}

//______________________________________________________________________________
Bool_t TBtreeIter::operator!=(const TIterator &aIter) const
{
   // This operator compares two TIterator objects.

   if (nullptr == (&aIter))
      return (fCurCursor < fTree->GetSize());

   if (aIter.IsA() == TBtreeIter::Class()) {
      const TBtreeIter &iter(dynamic_cast<const TBtreeIter &>(aIter));
      return (fCurCursor != iter.fCurCursor);
   }
   return false; // for base class we don't implement a comparison
}

//______________________________________________________________________________
Bool_t TBtreeIter::operator!=(const TBtreeIter &aIter) const
{
   // This operator compares two TBtreeIter objects.

   if (nullptr == (&aIter))
      return (fCurCursor < fTree->GetSize());
   return (fCurCursor != aIter.fCurCursor);
}

//______________________________________________________________________________
TObject* TBtreeIter::operator*() const
{
   // Return current object or nullptr.

   return (((fCurCursor >= 0) && (fCurCursor < fTree->GetSize())) ?
           (*fTree)[fCurCursor] : nullptr);
}


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtInnerNode                                                         //
//                                                                      //
// Inner node of a TBtree.                                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

//______________________________________________________________________________
TBtInnerNode::TBtInnerNode(TBtInnerNode *p, TBtree *t) : TBtNode(0,p,t)
{
   // Create a B-tree innernode.

   const Int_t index = MaxIndex() + 1;
   fItem = new TBtItem[ index ];
   if (fItem == 0)
      ::Fatal("TBtInnerNode::TBtInnerNode", "no more memory");
}

//______________________________________________________________________________
TBtInnerNode::TBtInnerNode(TBtInnerNode *parent, TBtree *tree, TBtNode *oldroot)
                : TBtNode(0, parent, tree)
{
   // Called only by TBtree to initialize the TBtInnerNode that is
   // about to become the root.

   fItem = new TBtItem[MaxIndex()+1];
   if (fItem == 0)
      ::Fatal("TBtInnerNode::TBtInnerNode", "no more memory");
   Append(0, oldroot);
}

//______________________________________________________________________________
TBtInnerNode::~TBtInnerNode()
{
   // Constructor.

   if (fLast > 0)
      delete fItem[0].fTree;
   for (Int_t i = 1; i <= fLast; i++)
      delete fItem[i].fTree;

   delete [] fItem;
}

//______________________________________________________________________________
void TBtInnerNode::Add(const TObject *obj, Int_t index)
{
   // This is called only from TBtree::Add().

   R__ASSERT(index >= 1 && obj->IsSortable());
   TBtLeafNode *ln = GetTree(index-1)->LastLeafNode();
   ln->Add(obj, ln->fLast+1);
}

//______________________________________________________________________________
void TBtInnerNode::AddElt(TBtItem &itm, Int_t at)
{
   // Add one element.

   R__ASSERT(0 <= at && at <= fLast+1);
   R__ASSERT(fLast < MaxIndex());
   for (Int_t i = fLast+1; i > at ; i--)
      GetItem(i) = GetItem(i-1);
   SetItem(at, itm);
   fLast++;
}

//______________________________________________________________________________
void TBtInnerNode::AddElt(Int_t at, TObject *k, TBtNode *t)
{
   // Add one element.

   TBtItem newitem(k, t);
   AddElt(newitem, at);
}

//______________________________________________________________________________
void TBtInnerNode::Add(TBtItem &itm, Int_t at)
{
   // Add one element.

   AddElt(itm, at);
   if (IsFull())
      InformParent();
}

//______________________________________________________________________________
void TBtInnerNode::Add(Int_t at, TObject *k, TBtNode *t)
{
   // Add one element.

   TBtItem newitem(k, t);
   Add(newitem, at);
}

//______________________________________________________________________________
void TBtInnerNode::AppendFrom(TBtInnerNode *src, Int_t start, Int_t stop)
{
   // This should never create a full node that is, it is not used
   // anywhere where THIS could possibly be near full.

   if (start > stop)
      return;
   R__ASSERT(0 <= start && start <= src->fLast);
   R__ASSERT(0 <= stop  && stop  <= src->fLast );
   R__ASSERT(fLast + stop - start + 1 < MaxIndex()); // full-node check
   for (Int_t i = start; i <= stop; i++)
      SetItem(++fLast, src->GetItem(i));
}

//______________________________________________________________________________
void TBtInnerNode::Append(TObject *d, TBtNode *n)
{
   // Never called from anywhere where it might fill up THIS.

   R__ASSERT(fLast < MaxIndex());
   if (d) R__ASSERT(d->IsSortable());
   SetItem(++fLast, d, n);
}

//______________________________________________________________________________
void TBtInnerNode::Append(TBtItem &itm)
{
   // Append itm to this tree.

   R__ASSERT(fLast < MaxIndex());
   SetItem(++fLast, itm);
}

//______________________________________________________________________________
void TBtInnerNode::BalanceWithLeft(TBtInnerNode *leftsib, Int_t pidx)
{
   // THIS has more than LEFTSIB. Move some item from THIS to LEFTSIB.
   // PIDX is the index of the parent item that will change when keys
   // are moved.

   R__ASSERT(Vsize() >= leftsib->Psize());
   R__ASSERT(fParent->GetTree(pidx) == this);
   Int_t newThisSize = (Vsize() + leftsib->Psize())/2;
   Int_t noFromThis = Psize() - newThisSize;
   PushLeft(noFromThis, leftsib, pidx);
}

//______________________________________________________________________________
void TBtInnerNode::BalanceWithRight(TBtInnerNode *rightsib, Int_t pidx)
{
   // THIS has more than RIGHTSIB. Move some items from THIS to RIGHTSIB.
   // PIDX is the index of the parent item that will change when keys
   // are moved.

   R__ASSERT(Psize() >= rightsib->Vsize());
   R__ASSERT(fParent->GetTree(pidx) == rightsib);
   Int_t newThisSize = (Psize() + rightsib->Vsize())/2;
   Int_t noFromThis = Psize() - newThisSize;
   PushRight(noFromThis, rightsib, pidx);
}

//______________________________________________________________________________
void TBtInnerNode::BalanceWith(TBtInnerNode *rightsib, Int_t pindx)
{
   // PINDX is the index of the parent item whose key will change when
   // keys are shifted from one InnerNode to the other.

   if (Psize() < rightsib->Vsize())
      rightsib->BalanceWithLeft(this, pindx);
   else
      BalanceWithRight(rightsib, pindx);
}

//______________________________________________________________________________
void TBtInnerNode::DecrNofKeys(TBtNode *that)
{
   // THAT is a child of THIS that has just shrunk by 1.

   Int_t i = IndexOf(that);
   fItem[i].fNofKeysInTree--;
   if (fParent != 0)
      fParent->DecrNofKeys(this);
   else
      fTree->DecrNofKeys();
}

//______________________________________________________________________________
Int_t TBtInnerNode::FindRank(const TObject *what) const
{
   // Recursively look for WHAT starting in the current node.

   if (((TObject *)what)->Compare(GetKey(1)) < 0)
      return GetTree(0)->FindRank(what);
   Int_t sum = GetNofKeys(0);
   for (Int_t i = 1; i < fLast; i++) {
      if (((TObject*)what)->Compare(GetKey(i)) == 0)
         return sum;
      sum++;
      if (((TObject *)what)->Compare(GetKey(i+1)) < 0)
         return sum + GetTree(i)->FindRank(what);
      sum += GetNofKeys(i);
   }
   if (((TObject*)what)->Compare(GetKey(fLast)) == 0)
      return sum;
   sum++;
   // *what > GetKey(fLast), so recurse on last fItem.fTree
   return sum + GetTree(fLast)->FindRank(what);
}

//______________________________________________________________________________
Int_t TBtInnerNode::FindRankUp(const TBtNode *that) const
{
   // FindRankUp is FindRank in reverse.
   // Whereas FindRank looks for the object and computes the rank
   // along the way while walking DOWN the tree, FindRankUp already
   // knows where the object is and has to walk UP the tree from the
   // object to compute the rank.

   Int_t l   = IndexOf(that);
   Int_t sum = 0;
   for (Int_t i = 0; i < l; i++)
      sum += GetNofKeys(i);
   return sum + l + (fParent == 0 ? 0 : fParent->FindRankUp(this));
}

//______________________________________________________________________________
TBtLeafNode *TBtInnerNode::FirstLeafNode()
{
   // Return the first leaf node.

   return GetTree(0)->FirstLeafNode();
}

//______________________________________________________________________________
TObject *TBtInnerNode::Found(const TObject *what, TBtNode **which, Int_t *where)
{
   // Recursively look for WHAT starting in the current node.

   R__ASSERT(what->IsSortable());
   for (Int_t i = 1 ; i <= fLast; i++) {
      if (GetKey(i)->Compare(what) == 0) {
         // then could go in either fItem[i].fTree or fItem[i-1].fTree
         // should go in one with the most room, but that's kinda
         // hard to calculate, so we'll stick it in fItem[i].fTree
         *which = this;
         *where = i;
         return GetKey(i);
      }
      if (GetKey(i)->Compare(what) > 0)
         return GetTree(i-1)->Found(what, which, where);
   }
   // *what > *(*this)[fLast].fKey, so recurse on last fItem.fTree
   return GetTree(fLast)->Found(what, which, where);
}

//______________________________________________________________________________
void TBtInnerNode::IncrNofKeys(TBtNode *that)
{
   // THAT is a child of THIS that has just grown by 1.

   Int_t i = IndexOf(that);
   fItem[i].fNofKeysInTree++;
   if (fParent != 0)
      fParent->IncrNofKeys(this);
   else
      fTree->IncrNofKeys();
}

//______________________________________________________________________________
Int_t TBtInnerNode::IndexOf(const TBtNode *that) const
{
   // Returns a number in the range 0 to this->fLast
   // 0 is returned if THAT == fTree[0].

   for (Int_t i = 0; i <= fLast; i++)
      if (GetTree(i) == that)
         return i;
   R__CHECK(0);
   return 0;
}

//______________________________________________________________________________
void TBtInnerNode::InformParent()
{
   // Tell the parent that we are full.

   if (fParent == 0) {
      // then this is the root of the tree and needs to be split
      // inform the btree.
      R__ASSERT(fTree->fRoot == this);
      fTree->RootIsFull();
   } else
      fParent->IsFull(this);
}

//______________________________________________________________________________
void TBtInnerNode::IsFull(TBtNode *that)
{
   // The child node THAT is full. We will either redistribute elements
   // or create a new node and then redistribute.
   // In an attempt to minimize the number of splits, we adopt the following
   // strategy:
   //  * redistribute if possible
   //  * if not possible, then split with a sibling

   if (that->fIsLeaf) {
      TBtLeafNode *leaf = (TBtLeafNode *)that;
      TBtLeafNode *left = 0;
      TBtLeafNode *right= 0;
      // split LEAF only if both sibling nodes are full.
      Int_t leafidx = IndexOf(leaf);
      Int_t hasRightSib = (leafidx < fLast) &&
                           ((right = (TBtLeafNode*)GetTree(leafidx+1)) != 0);
      Int_t hasLeftSib  = (leafidx > 0) &&
                           ((left = (TBtLeafNode*)GetTree(leafidx-1)) != 0);
      Int_t rightSibFull = (hasRightSib && right->IsAlmostFull());
      Int_t leftSibFull  = (hasLeftSib  && left->IsAlmostFull());
      if (rightSibFull) {
         if (leftSibFull) {
            // both full, so pick one to split with
            left->SplitWith(leaf, leafidx);
         } else if (hasLeftSib) {
            // left sib not full, so balance with it
            leaf->BalanceWithLeft(left, leafidx);
         } else {
            // there is no left sibling, so split with right
            leaf->SplitWith(right, leafidx+1);
         }
      } else if (hasRightSib) {
         // right sib not full, so balance with it
         leaf->BalanceWithRight(right, leafidx+1);
      } else if (leftSibFull) {
         // no right sib, and left sib is full, so split with it
         left->SplitWith(leaf, leafidx);
      } else if (hasLeftSib) {
         // left sib not full so balance with it
         leaf->BalanceWithLeft(left, leafidx);
      } else {
         // neither a left or right sib; should never happen
         R__CHECK(0);
      }
   } else {
      TBtInnerNode *inner = (TBtInnerNode *)that;
      // split INNER only if both sibling nodes are full
      Int_t inneridx = IndexOf(inner);
      TBtInnerNode *left = 0;
      TBtInnerNode *right= 0;
      Int_t hasRightSib = (inneridx < fLast) &&
                           ((right = (TBtInnerNode*)GetTree(inneridx+1)) != 0);
      Int_t hasLeftSib  = (inneridx > 0) &&
                           ((left=(TBtInnerNode*)GetTree(inneridx-1)) != 0);
      Int_t rightSibFull = (hasRightSib && right->IsAlmostFull());
      Int_t leftSibFull  = (hasLeftSib  && left->IsAlmostFull());
      if (rightSibFull) {
         if (leftSibFull) {
            left->SplitWith(inner, inneridx);
         } else if (hasLeftSib) {
            inner->BalanceWithLeft(left, inneridx);
         } else {
            // there is no left sibling
            inner->SplitWith(right, inneridx+1);
         }
      } else if (hasRightSib) {
         inner->BalanceWithRight(right, inneridx+1);
      } else if (leftSibFull) {
         left->SplitWith(inner, inneridx);
      } else if (hasLeftSib) {
         inner->BalanceWithLeft(left, inneridx);
      } else {
         R__CHECK(0);
      }
   }
}

//______________________________________________________________________________
void TBtInnerNode::IsLow(TBtNode *that)
{
   // The child node THAT is <= half full. We will either redistribute
   // elements between children, or THAT will be merged with another child.
   // In an attempt to minimize the number of mergers, we adopt the following
   // strategy:
   //  * redistribute if possible
   //  * if not possible, then merge with a sibling

   if (that->fIsLeaf) {
      TBtLeafNode *leaf = (TBtLeafNode *)that;
      TBtLeafNode *left = 0;
      TBtLeafNode *right= 0;
      // split LEAF only if both sibling nodes are full.
      Int_t leafidx = IndexOf(leaf);
      Int_t hasRightSib = (leafidx < fLast) &&
                           ((right = (TBtLeafNode*)GetTree(leafidx+1)) != 0);
      Int_t hasLeftSib  = (leafidx > 0) &&
                           ((left = (TBtLeafNode*)GetTree(leafidx-1)) != 0);
      if (hasRightSib && (leaf->Psize() + right->Vsize()) >= leaf->MaxPsize()) {
         // then cannot merge,
         // and balancing this and rightsib will leave them both
         // more than half full
         leaf->BalanceWith(right, leafidx+1);
      } else if (hasLeftSib && (leaf->Vsize() + left->Psize()) >= leaf->MaxPsize()) {
         // ditto
         left->BalanceWith(leaf, leafidx);
      } else if (hasLeftSib) {
         // then they should be merged
         left->MergeWithRight(leaf, leafidx);
      } else if (hasRightSib) {
         leaf->MergeWithRight(right, leafidx+1);
      } else {
         R__CHECK(0); // should never happen
      }
   } else {
      TBtInnerNode *inner = (TBtInnerNode *)that;

      Int_t inneridx = IndexOf(inner);
      TBtInnerNode *left = 0;
      TBtInnerNode *right= 0;
      Int_t hasRightSib = (inneridx < fLast) &&
                           ((right = (TBtInnerNode*)GetTree(inneridx+1)) != 0);
      Int_t hasLeftSib  = (inneridx > 0) &&
                           ((left = (TBtInnerNode*)GetTree(inneridx-1)) != 0);
      if (hasRightSib && (inner->Psize() + right->Vsize()) >= inner->MaxPsize()) {
         // cannot merge
         inner->BalanceWith(right, inneridx+1);
      } else if (hasLeftSib && (inner->Vsize() + left->Psize()) >= inner->MaxPsize()) {
         // cannot merge
         left->BalanceWith(inner, inneridx);
      } else if (hasLeftSib) {
         left->MergeWithRight(inner, inneridx);
      } else if (hasRightSib) {
         inner->MergeWithRight(right, inneridx+1);
      } else {
         R__CHECK(0);
      }
   }
}

//______________________________________________________________________________
TBtLeafNode *TBtInnerNode::LastLeafNode()
{
   // Return the last leaf node.

   return GetTree(fLast)->LastLeafNode();
}

//______________________________________________________________________________
void TBtInnerNode::MergeWithRight(TBtInnerNode *rightsib, Int_t pidx)
{
   // Merge the 2 part of the tree.

   R__ASSERT(Psize() + rightsib->Vsize() < MaxIndex());
   if (rightsib->Psize() > 0)
      rightsib->PushLeft(rightsib->Psize(), this, pidx);
   rightsib->SetKey(0, fParent->GetKey(pidx));
   AppendFrom(rightsib, 0, 0);
   fParent->IncNofKeys(pidx-1, rightsib->GetNofKeys(0)+1);
   fParent->RemoveItem(pidx);
   delete rightsib;
}

//______________________________________________________________________________
Int_t TBtInnerNode::NofKeys() const
{
   // Number of key.

   Int_t sum = 0;
   for (Int_t i = 0; i <= fLast; i++)
      sum += GetNofKeys(i);
   return sum + Psize();
}

//______________________________________________________________________________
TObject *TBtInnerNode::operator[](Int_t idx) const
{
   // return an element.

   for (Int_t j = 0; j <= fLast; j++) {
      Int_t r;
      if (idx < (r = GetNofKeys(j)))
         return (*GetTree(j))[idx];
      if (idx == r) {
         if (j == fLast) {
            ::Error("TBtInnerNode::operator[]", "should not happen, 0 returned");
            return 0;
         } else
            return GetKey(j+1);
      }
      idx -= r+1; // +1 because of the key in the node
   }
   ::Error("TBtInnerNode::operator[]", "should not happen, 0 returned");
   return 0;
}

//______________________________________________________________________________
void TBtInnerNode::PushLeft(Int_t noFromThis, TBtInnerNode *leftsib, Int_t pidx)
{
   // noFromThis==1 => moves the parent item into the leftsib,
   // and the first item in this's array into the parent item.

   R__ASSERT(fParent->GetTree(pidx) == this);
   R__ASSERT(noFromThis > 0 && noFromThis <= Psize());
   R__ASSERT(noFromThis + leftsib->Psize() < MaxPsize());
   SetKey(0, fParent->GetKey(pidx)); // makes AppendFrom's job easier
   leftsib->AppendFrom(this, 0, noFromThis-1);
   ShiftLeft(noFromThis);
   fParent->SetKey(pidx, GetKey(0));
   fParent->SetNofKeys(pidx-1, leftsib->NofKeys());
   fParent->SetNofKeys(pidx, NofKeys());
}

//______________________________________________________________________________
void TBtInnerNode::PushRight(Int_t noFromThis, TBtInnerNode *rightsib, Int_t pidx)
{
   // The operation is three steps:
   //  Step I.   Make room for the incoming keys in RIGHTSIB.
   //  Step II.  Move the items from THIS into RIGHTSIB.
   //  Step III. Update the length of THIS.

   R__ASSERT(noFromThis > 0 && noFromThis <= Psize());
   R__ASSERT(noFromThis + rightsib->Psize() < rightsib->MaxPsize());
   R__ASSERT(fParent->GetTree(pidx) == rightsib);

   //
   // Step I. Make space for noFromThis items
   //
   Int_t start = fLast - noFromThis + 1;
   Int_t tgt, src;
   tgt = rightsib->fLast + noFromThis;
   src = rightsib->fLast;
   rightsib->fLast = tgt;
   rightsib->SetKey(0, fParent->GetKey(pidx));
   IncNofKeys(0);
   while (src >= 0) {
      // do this kind of assignment on TBtInnerNode items only when
      // the parent fields of the moved items do not change, as they
      // don't here.
      // Otherwise, use SetItem so the parents are updated appropriately.
      rightsib->GetItem(tgt--) = rightsib->GetItem(src--);
   }

   // Step II. Move the items from THIS into RIGHTSIB
   for (Int_t i = fLast; i >= start; i-- ) {
      // this is the kind of assignment to use when parents change
      rightsib->SetItem(tgt--, GetItem(i));
   }
   fParent->SetKey(pidx, rightsib->GetKey(0));
   DecNofKeys(0);
   R__CHECK(tgt == -1);

   // Step III.
   fLast -= noFromThis;

   // Step VI.  update NofKeys
   fParent->SetNofKeys(pidx-1, NofKeys());
   fParent->SetNofKeys(pidx, rightsib->NofKeys());
}

//______________________________________________________________________________
void TBtInnerNode::Remove(Int_t index)
{
   // Remove an element.

   R__ASSERT(index >= 1 && index <= fLast);
   TBtLeafNode *lf = GetTree(index)->FirstLeafNode();
   SetKey(index, lf->fItem[0]);
   lf->RemoveItem(0);
}

//______________________________________________________________________________
void TBtInnerNode::RemoveItem(Int_t index)
{
   // Remove an item.

   R__ASSERT(index >= 1 && index <= fLast);
   for (Int_t to = index; to < fLast; to++)
      fItem[to] = fItem[to+1];
   fLast--;
   if (IsLow()) {
      if (fParent == 0) {
         // then this is the root; when only one child, make the child the root
         if (Psize() == 0)
            fTree->RootIsEmpty();
      } else
         fParent->IsLow(this);
   }
}

//______________________________________________________________________________
void TBtInnerNode::ShiftLeft(Int_t cnt)
{
   // Shift to the left.

   if (cnt <= 0)
      return;
   for (Int_t i = cnt; i <= fLast; i++)
      GetItem(i-cnt) = GetItem(i);
   fLast -= cnt;
}

//______________________________________________________________________________
void TBtInnerNode::Split()
{
   // This function is called only when THIS is the only descendent
   // of the root node, and THIS needs to be split.
   // Assumes that idx of THIS in fParent is 0.

   TBtInnerNode *newnode = new TBtInnerNode(fParent);
   R__CHECK(newnode != 0);
   fParent->Append(GetKey(fLast), newnode);
   newnode->AppendFrom(this, fLast, fLast);
   fLast--;
   fParent->IncNofKeys(1, newnode->GetNofKeys(0));
   fParent->DecNofKeys(0, newnode->GetNofKeys(0));
   BalanceWithRight(newnode, 1);
}

//______________________________________________________________________________
void TBtInnerNode::SplitWith(TBtInnerNode *rightsib, Int_t keyidx)
{
   // THIS and SIB are too full; create a NEWNODE, and balance
   // the number of keys between the three of them.
   //
   // picture: (also see Knuth Vol 3 pg 478)
   //               keyidx keyidx+1
   //            +--+--+--+--+--+--...
   //            |  |  |  |  |  |
   // fParent--->|  |     |     |
   //            |  |     |     |
   //            +*-+*-+*-+--+--+--...
   //             |  |  |
   //        +----+  |  +-----+
   //        |       +-----+  |
   //        V             |  V
   //        +----------+  |  +----------+
   //        |          |  |  |          |
   //  this->|          |  |  |          |<--sib
   //        +----------+  |  +----------+
   //                      V
   //                    data
   //
   // keyidx is the index of where the sibling is, and where the
   // newly created node will be recorded (sibling will be moved to
   // keyidx+1)

   R__ASSERT(keyidx > 0 && keyidx <= fParent->fLast);

   rightsib->SetKey(0, fParent->GetKey(keyidx));
   Int_t nofKeys      = Psize() + rightsib->Vsize();
   Int_t newSizeThis  = nofKeys / 3;
   Int_t newSizeNew   = (nofKeys - newSizeThis) / 2;
   Int_t newSizeSib   = (nofKeys - newSizeThis - newSizeNew);
   Int_t noFromThis   = Psize() - newSizeThis;
   Int_t noFromSib    = rightsib->Vsize() - newSizeSib;
   // because of their smaller size, this TBtInnerNode may not have to
   // give up any elements to the new node.  I.e., noFromThis == 0.
   // This will not happen for TBtLeafNodes.
   // We handle this by pulling an item from the rightsib.
   R__CHECK(noFromThis >= 0);
   R__CHECK(noFromSib >= 1);
   TBtInnerNode *newNode = new TBtInnerNode(fParent);
   R__CHECK(newNode != 0);
   if (noFromThis > 0) {
      newNode->Append(GetItem(fLast));
      fParent->AddElt(keyidx, GetKey(fLast--), newNode);
      if (noFromThis > 2)
         this->PushRight(noFromThis-1, newNode, keyidx);
      rightsib->PushLeft(noFromSib, newNode, keyidx+1);
   } else {
      // pull an element from the rightsib
      newNode->Append(rightsib->GetItem(0));
      fParent->AddElt(keyidx+1, rightsib->GetKey(1), rightsib);
      rightsib->ShiftLeft(1);
      fParent->SetTree(keyidx, newNode);
      rightsib->PushLeft(noFromSib-1, newNode, keyidx+1);
   }
   fParent->SetNofKeys(keyidx-1, this->NofKeys());
   fParent->SetNofKeys(keyidx, newNode->NofKeys());
   fParent->SetNofKeys(keyidx+1, rightsib->NofKeys());
   if (fParent->IsFull())
      fParent->InformParent();
}


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBtLeafNode                                                          //
//                                                                      //
// Leaf node of a TBtree.                                               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

//______________________________________________________________________________
TBtLeafNode::TBtLeafNode(TBtInnerNode *p, const TObject *obj, TBtree *t): TBtNode(1, p, t)
{
   // Constructor.

   fItem = new TObject *[MaxIndex()+1];
   memset(fItem, 0, (MaxIndex()+1)*sizeof(TObject*));

   R__ASSERT(fItem != 0);
   if (obj != 0)
      fItem[++fLast] = (TObject*)obj;   // cast const away
}

//______________________________________________________________________________
TBtLeafNode::~TBtLeafNode()
{
   // Destructor.

   delete [] fItem;
}

//______________________________________________________________________________
void TBtLeafNode::Add(const TObject *obj, Int_t index)
{
   // Add the object OBJ to the leaf node, inserting it at location INDEX
   // in the fItem array.

   R__ASSERT(obj->IsSortable());
   R__ASSERT(0 <= index && index <= fLast+1);
   R__ASSERT(fLast <= MaxIndex());
   for (Int_t i = fLast+1; i > index ; i--)
      fItem[i] = fItem[i-1];
   fItem[index] = (TObject *)obj;
   fLast++;

   // check for overflow
   if (fParent == 0)
      fTree->IncrNofKeys();
   else
      fParent->IncrNofKeys(this);

   if (IsFull()) {
      // it's full; tell parent node
      if (fParent == 0) {
         // this occurs when this leaf is the only node in the
         // btree, and this->fTree->fRoot == this
         R__CHECK(fTree->fRoot == this);
         // in which case we inform the btree, which can be
         // considered the parent of this node
         fTree->RootIsFull();
      } else {
         // the parent is responsible for splitting/balancing subnodes
         fParent->IsFull(this);
      }
   }
}

//______________________________________________________________________________
void TBtLeafNode::AppendFrom(TBtLeafNode *src, Int_t start, Int_t stop)
{
   // A convenience function, does not worry about the element in
   // the parent, simply moves elements from SRC[start] to SRC[stop]
   // into the current array.
   // This should never create a full node.
   // That is, it is not used anywhere where THIS could possibly be
   // near full.
   // Does NOT handle nofKeys.

   if (start > stop)
      return;
   R__ASSERT(0 <= start && start <= src->fLast);
   R__ASSERT(0 <= stop  && stop  <= src->fLast);
   R__ASSERT(fLast + stop - start + 1 < MaxIndex()); // full-node check
   for (Int_t i = start; i <= stop; i++)
      fItem[++fLast] = src->fItem[i];
   R__CHECK(fLast < MaxIndex());
}

//______________________________________________________________________________
void TBtLeafNode::Append(TObject *obj)
{
   // Never called from anywhere where it might fill up THIS
   // does NOT handle nofKeys.

   R__ASSERT(obj->IsSortable());
   fItem[++fLast] = obj;
   R__CHECK(fLast < MaxIndex());
}

//______________________________________________________________________________
void TBtLeafNode::BalanceWithLeft(TBtLeafNode *leftsib, Int_t pidx)
{
   // THIS has more than LEFTSIB;  move some items from THIS to LEFTSIB.

   R__ASSERT(Vsize() >= leftsib->Psize());
   Int_t newThisSize = (Vsize() + leftsib->Psize())/2;
   Int_t noFromThis  = Psize() - newThisSize;
   PushLeft(noFromThis, leftsib, pidx);
}

//______________________________________________________________________________
void TBtLeafNode::BalanceWithRight(TBtLeafNode *rightsib, Int_t pidx)
{
   // THIS has more than RIGHTSIB;  move some items from THIS to RIGHTSIB.

   R__ASSERT(Psize() >= rightsib->Vsize());
   Int_t newThisSize = (Psize() + rightsib->Vsize())/2;
   Int_t noFromThis  = Psize() - newThisSize;
   PushRight(noFromThis, rightsib, pidx);
}

//______________________________________________________________________________
void TBtLeafNode::BalanceWith(TBtLeafNode *rightsib, Int_t pidx)
{
   // PITEM is the parent item whose key will change when keys are shifted
   // from one LeafNode to the other.

   if (Psize() < rightsib->Vsize())
      rightsib->BalanceWithLeft(this, pidx);
   else
      BalanceWithRight(rightsib, pidx);
}

//______________________________________________________________________________
Int_t TBtLeafNode::FindRank(const TObject *what) const
{
   // WHAT was not in any inner node; it is either here, or it's
   // not in the tree.

   for (Int_t i = 0; i <= fLast; i++) {
      if (fItem[i]->Compare(what) == 0)
         return i;
      if (fItem[i]->Compare(what) > 0)
         return -1;
   }
   return -1;
}

//______________________________________________________________________________
TBtLeafNode *TBtLeafNode::FirstLeafNode()
{
   // Return the first node.

   return this;
}

//______________________________________________________________________________
TObject *TBtLeafNode::Found(const TObject *what, TBtNode **which, Int_t *where)
{
   // WHAT was not in any inner node; it is either here, or it's
   // not in the tree.

   R__ASSERT(what->IsSortable());
   for (Int_t i = 0; i <= fLast; i++) {
      if (fItem[i]->Compare(what) == 0) {
         *which = this;
         *where = i;
         return fItem[i];
      }
      if (fItem[i]->Compare(what) > 0) {
         *which = this;
         *where = i;
         return 0;
      }
   }
   *which = this;
   *where = fLast+1;
   return 0;
}

//______________________________________________________________________________
Int_t TBtLeafNode::IndexOf(const TObject *that) const
{
   // Returns a number in the range 0 to MaxIndex().

   for (Int_t i = 0; i <= fLast; i++) {
      if (fItem[i] == that)
         return i;
   }
   R__CHECK(0);
   return -1;
}

//______________________________________________________________________________
TBtLeafNode *TBtLeafNode::LastLeafNode()
{
   // return the last node.
   return this;
}

//______________________________________________________________________________
void TBtLeafNode::MergeWithRight(TBtLeafNode *rightsib, Int_t pidx)
{
   // Merge.

   R__ASSERT(Psize() + rightsib->Vsize() < MaxPsize());
   rightsib->PushLeft(rightsib->Psize(), this, pidx);
   Append(fParent->GetKey(pidx));
   fParent->SetNofKeys(pidx-1, NofKeys());
   fParent->RemoveItem(pidx);
   delete rightsib;
}

//______________________________________________________________________________
Int_t TBtLeafNode::NofKeys(Int_t ) const
{
   // Return the number of keys.
   return 1;
}

//______________________________________________________________________________
Int_t TBtLeafNode::NofKeys() const
{
   // Return the number of keys.
   return Psize();
}

//______________________________________________________________________________
//void TBtLeafNode::PrintOn(std::ostream& out) const
//{
//    out << " < ";
//    for (Int_t i = 0; i <= fLast; i++)
//        out << *fItem[i] << " " ;
//    out << "> ";
//}

//______________________________________________________________________________
void TBtLeafNode::PushLeft(Int_t noFromThis, TBtLeafNode *leftsib, Int_t pidx)
{
   // noFromThis==1 => moves the parent item into the leftsib,
   // and the first item in this's array into the parent item.

   R__ASSERT(noFromThis > 0 && noFromThis <= Psize());
   R__ASSERT(noFromThis + leftsib->Psize() < MaxPsize());
   R__ASSERT(fParent->GetTree(pidx) == this);
   leftsib->Append(fParent->GetKey(pidx));
   if (noFromThis > 1)
      leftsib->AppendFrom(this, 0, noFromThis-2);
   fParent->SetKey(pidx, fItem[noFromThis-1]);
   ShiftLeft(noFromThis);
   fParent->SetNofKeys(pidx-1, leftsib->NofKeys());
   fParent->SetNofKeys(pidx, NofKeys());
}

//______________________________________________________________________________
void TBtLeafNode::PushRight(Int_t noFromThis, TBtLeafNode *rightsib, Int_t pidx)
{
   // noFromThis==1 => moves the parent item into the
   // rightsib, and the last item in this's array into the parent
   // item.

   R__ASSERT(noFromThis > 0 && noFromThis <= Psize());
   R__ASSERT(noFromThis + rightsib->Psize() < MaxPsize());
   R__ASSERT(fParent->GetTree(pidx) == rightsib);
   // The operation is five steps:
   //  Step I.   Make room for the incoming keys in RIGHTSIB.
   //  Step II.  Move the key in the parent into RIGHTSIB.
   //  Step III. Move the items from THIS into RIGHTSIB.
   //  Step IV.  Move the item from THIS into the parent.
   //  Step V.   Update the length of THIS.
   //
   // Step I.: make space for noFromThis items
   //
   Int_t start = fLast - noFromThis + 1;
   Int_t tgt, src;
   tgt = rightsib->fLast + noFromThis;
   src = rightsib->fLast;
   rightsib->fLast = tgt;
   while (src >= 0)
      rightsib->fItem[tgt--] = rightsib->fItem[src--];

   // Step II. Move the key from the parent into place
   rightsib->fItem[tgt--] = fParent->GetKey(pidx);

   // Step III.Move the items from THIS into RIGHTSIB
   for (Int_t i = fLast; i > start; i--)
      rightsib->fItem[tgt--] = fItem[i];
   R__CHECK(tgt == -1);

   // Step IV.
   fParent->SetKey(pidx, fItem[start]);

   // Step V.
   fLast -= noFromThis;

   // Step VI.  update nofKeys
   fParent->SetNofKeys(pidx-1, NofKeys());
   fParent->SetNofKeys(pidx, rightsib->NofKeys());
}

//______________________________________________________________________________
void TBtLeafNode::Remove(Int_t index)
{
   // Remove an element.

   R__ASSERT(index >= 0 && index <= fLast);
   for (Int_t to = index; to < fLast; to++)
      fItem[to] = fItem[to+1];
   fLast--;
   if (fParent == 0)
      fTree->DecrNofKeys();
   else
      fParent->DecrNofKeys(this);
   if (IsLow()) {
      if (fParent == 0) {
         // then this is the root; when no keys left, inform the tree
         if (Psize() == 0)
            fTree->RootIsEmpty();
      } else
         fParent->IsLow(this);
   }
}

//______________________________________________________________________________
void TBtLeafNode::ShiftLeft(Int_t cnt)
{
   // Shift.

   if (cnt <= 0)
      return;
   for (Int_t i = cnt; i <= fLast; i++)
      fItem[i-cnt] = fItem[i];
   fLast -= cnt;
}

//______________________________________________________________________________
void TBtLeafNode::Split()
{
   // This function is called only when THIS is the only descendent
   // of the root node, and THIS needs to be split.
   // Assumes that idx of THIS in Parent is 0.

   TBtLeafNode *newnode = new TBtLeafNode(fParent);
   R__ASSERT(newnode != 0);
   fParent->Append(fItem[fLast--], newnode);
   fParent->SetNofKeys(0, fParent->GetTree(0)->NofKeys());
   fParent->SetNofKeys(1, fParent->GetTree(1)->NofKeys());
   BalanceWithRight(newnode, 1);
}

//______________________________________________________________________________
void TBtLeafNode::SplitWith(TBtLeafNode *rightsib, Int_t keyidx)
{
   // Split.

   R__ASSERT(fParent == rightsib->fParent);
   R__ASSERT(keyidx > 0 && keyidx <= fParent->fLast);
   Int_t nofKeys      = Psize() + rightsib->Vsize();
   Int_t newSizeThis  = nofKeys / 3;
   Int_t newSizeNew   = (nofKeys - newSizeThis) / 2;
   Int_t newSizeSib   = (nofKeys - newSizeThis - newSizeNew);
   Int_t noFromThis   = Psize() - newSizeThis;
   Int_t noFromSib    = rightsib->Vsize() - newSizeSib;
   R__CHECK(noFromThis >= 0);
   R__CHECK(noFromSib >= 1);
   TBtLeafNode *newNode  = new TBtLeafNode(fParent);
   R__ASSERT(newNode != 0);
   fParent->AddElt(keyidx, fItem[fLast--], newNode);
   fParent->SetNofKeys(keyidx, 0);
   fParent->DecNofKeys(keyidx-1);
   this->PushRight(noFromThis-1, newNode, keyidx);
   rightsib->PushLeft(noFromSib, newNode, keyidx+1);
   if (fParent->IsFull())
      fParent->InformParent();
}
 TBtree.cxx:1
 TBtree.cxx:2
 TBtree.cxx:3
 TBtree.cxx:4
 TBtree.cxx:5
 TBtree.cxx:6
 TBtree.cxx:7
 TBtree.cxx:8
 TBtree.cxx:9
 TBtree.cxx:10
 TBtree.cxx:11
 TBtree.cxx:12
 TBtree.cxx:13
 TBtree.cxx:14
 TBtree.cxx:15
 TBtree.cxx:16
 TBtree.cxx:17
 TBtree.cxx:18
 TBtree.cxx:19
 TBtree.cxx:20
 TBtree.cxx:21
 TBtree.cxx:22
 TBtree.cxx:23
 TBtree.cxx:24
 TBtree.cxx:25
 TBtree.cxx:26
 TBtree.cxx:27
 TBtree.cxx:28
 TBtree.cxx:29
 TBtree.cxx:30
 TBtree.cxx:31
 TBtree.cxx:32
 TBtree.cxx:33
 TBtree.cxx:34
 TBtree.cxx:35
 TBtree.cxx:36
 TBtree.cxx:37
 TBtree.cxx:38
 TBtree.cxx:39
 TBtree.cxx:40
 TBtree.cxx:41
 TBtree.cxx:42
 TBtree.cxx:43
 TBtree.cxx:44
 TBtree.cxx:45
 TBtree.cxx:46
 TBtree.cxx:47
 TBtree.cxx:48
 TBtree.cxx:49
 TBtree.cxx:50
 TBtree.cxx:51
 TBtree.cxx:52
 TBtree.cxx:53
 TBtree.cxx:54
 TBtree.cxx:55
 TBtree.cxx:56
 TBtree.cxx:57
 TBtree.cxx:58
 TBtree.cxx:59
 TBtree.cxx:60
 TBtree.cxx:61
 TBtree.cxx:62
 TBtree.cxx:63
 TBtree.cxx:64
 TBtree.cxx:65
 TBtree.cxx:66
 TBtree.cxx:67
 TBtree.cxx:68
 TBtree.cxx:69
 TBtree.cxx:70
 TBtree.cxx:71
 TBtree.cxx:72
 TBtree.cxx:73
 TBtree.cxx:74
 TBtree.cxx:75
 TBtree.cxx:76
 TBtree.cxx:77
 TBtree.cxx:78
 TBtree.cxx:79
 TBtree.cxx:80
 TBtree.cxx:81
 TBtree.cxx:82
 TBtree.cxx:83
 TBtree.cxx:84
 TBtree.cxx:85
 TBtree.cxx:86
 TBtree.cxx:87
 TBtree.cxx:88
 TBtree.cxx:89
 TBtree.cxx:90
 TBtree.cxx:91
 TBtree.cxx:92
 TBtree.cxx:93
 TBtree.cxx:94
 TBtree.cxx:95
 TBtree.cxx:96
 TBtree.cxx:97
 TBtree.cxx:98
 TBtree.cxx:99
 TBtree.cxx:100
 TBtree.cxx:101
 TBtree.cxx:102
 TBtree.cxx:103
 TBtree.cxx:104
 TBtree.cxx:105
 TBtree.cxx:106
 TBtree.cxx:107
 TBtree.cxx:108
 TBtree.cxx:109
 TBtree.cxx:110
 TBtree.cxx:111
 TBtree.cxx:112
 TBtree.cxx:113
 TBtree.cxx:114
 TBtree.cxx:115
 TBtree.cxx:116
 TBtree.cxx:117
 TBtree.cxx:118
 TBtree.cxx:119
 TBtree.cxx:120
 TBtree.cxx:121
 TBtree.cxx:122
 TBtree.cxx:123
 TBtree.cxx:124
 TBtree.cxx:125
 TBtree.cxx:126
 TBtree.cxx:127
 TBtree.cxx:128
 TBtree.cxx:129
 TBtree.cxx:130
 TBtree.cxx:131
 TBtree.cxx:132
 TBtree.cxx:133
 TBtree.cxx:134
 TBtree.cxx:135
 TBtree.cxx:136
 TBtree.cxx:137
 TBtree.cxx:138
 TBtree.cxx:139
 TBtree.cxx:140
 TBtree.cxx:141
 TBtree.cxx:142
 TBtree.cxx:143
 TBtree.cxx:144
 TBtree.cxx:145
 TBtree.cxx:146
 TBtree.cxx:147
 TBtree.cxx:148
 TBtree.cxx:149
 TBtree.cxx:150
 TBtree.cxx:151
 TBtree.cxx:152
 TBtree.cxx:153
 TBtree.cxx:154
 TBtree.cxx:155
 TBtree.cxx:156
 TBtree.cxx:157
 TBtree.cxx:158
 TBtree.cxx:159
 TBtree.cxx:160
 TBtree.cxx:161
 TBtree.cxx:162
 TBtree.cxx:163
 TBtree.cxx:164
 TBtree.cxx:165
 TBtree.cxx:166
 TBtree.cxx:167
 TBtree.cxx:168
 TBtree.cxx:169
 TBtree.cxx:170
 TBtree.cxx:171
 TBtree.cxx:172
 TBtree.cxx:173
 TBtree.cxx:174
 TBtree.cxx:175
 TBtree.cxx:176
 TBtree.cxx:177
 TBtree.cxx:178
 TBtree.cxx:179
 TBtree.cxx:180
 TBtree.cxx:181
 TBtree.cxx:182
 TBtree.cxx:183
 TBtree.cxx:184
 TBtree.cxx:185
 TBtree.cxx:186
 TBtree.cxx:187
 TBtree.cxx:188
 TBtree.cxx:189
 TBtree.cxx:190
 TBtree.cxx:191
 TBtree.cxx:192
 TBtree.cxx:193
 TBtree.cxx:194
 TBtree.cxx:195
 TBtree.cxx:196
 TBtree.cxx:197
 TBtree.cxx:198
 TBtree.cxx:199
 TBtree.cxx:200
 TBtree.cxx:201
 TBtree.cxx:202
 TBtree.cxx:203
 TBtree.cxx:204
 TBtree.cxx:205
 TBtree.cxx:206
 TBtree.cxx:207
 TBtree.cxx:208
 TBtree.cxx:209
 TBtree.cxx:210
 TBtree.cxx:211
 TBtree.cxx:212
 TBtree.cxx:213
 TBtree.cxx:214
 TBtree.cxx:215
 TBtree.cxx:216
 TBtree.cxx:217
 TBtree.cxx:218
 TBtree.cxx:219
 TBtree.cxx:220
 TBtree.cxx:221
 TBtree.cxx:222
 TBtree.cxx:223
 TBtree.cxx:224
 TBtree.cxx:225
 TBtree.cxx:226
 TBtree.cxx:227
 TBtree.cxx:228
 TBtree.cxx:229
 TBtree.cxx:230
 TBtree.cxx:231
 TBtree.cxx:232
 TBtree.cxx:233
 TBtree.cxx:234
 TBtree.cxx:235
 TBtree.cxx:236
 TBtree.cxx:237
 TBtree.cxx:238
 TBtree.cxx:239
 TBtree.cxx:240
 TBtree.cxx:241
 TBtree.cxx:242
 TBtree.cxx:243
 TBtree.cxx:244
 TBtree.cxx:245
 TBtree.cxx:246
 TBtree.cxx:247
 TBtree.cxx:248
 TBtree.cxx:249
 TBtree.cxx:250
 TBtree.cxx:251
 TBtree.cxx:252
 TBtree.cxx:253
 TBtree.cxx:254
 TBtree.cxx:255
 TBtree.cxx:256
 TBtree.cxx:257
 TBtree.cxx:258
 TBtree.cxx:259
 TBtree.cxx:260
 TBtree.cxx:261
 TBtree.cxx:262
 TBtree.cxx:263
 TBtree.cxx:264
 TBtree.cxx:265
 TBtree.cxx:266
 TBtree.cxx:267
 TBtree.cxx:268
 TBtree.cxx:269
 TBtree.cxx:270
 TBtree.cxx:271
 TBtree.cxx:272
 TBtree.cxx:273
 TBtree.cxx:274
 TBtree.cxx:275
 TBtree.cxx:276
 TBtree.cxx:277
 TBtree.cxx:278
 TBtree.cxx:279
 TBtree.cxx:280
 TBtree.cxx:281
 TBtree.cxx:282
 TBtree.cxx:283
 TBtree.cxx:284
 TBtree.cxx:285
 TBtree.cxx:286
 TBtree.cxx:287
 TBtree.cxx:288
 TBtree.cxx:289
 TBtree.cxx:290
 TBtree.cxx:291
 TBtree.cxx:292
 TBtree.cxx:293
 TBtree.cxx:294
 TBtree.cxx:295
 TBtree.cxx:296
 TBtree.cxx:297
 TBtree.cxx:298
 TBtree.cxx:299
 TBtree.cxx:300
 TBtree.cxx:301
 TBtree.cxx:302
 TBtree.cxx:303
 TBtree.cxx:304
 TBtree.cxx:305
 TBtree.cxx:306
 TBtree.cxx:307
 TBtree.cxx:308
 TBtree.cxx:309
 TBtree.cxx:310
 TBtree.cxx:311
 TBtree.cxx:312
 TBtree.cxx:313
 TBtree.cxx:314
 TBtree.cxx:315
 TBtree.cxx:316
 TBtree.cxx:317
 TBtree.cxx:318
 TBtree.cxx:319
 TBtree.cxx:320
 TBtree.cxx:321
 TBtree.cxx:322
 TBtree.cxx:323
 TBtree.cxx:324
 TBtree.cxx:325
 TBtree.cxx:326
 TBtree.cxx:327
 TBtree.cxx:328
 TBtree.cxx:329
 TBtree.cxx:330
 TBtree.cxx:331
 TBtree.cxx:332
 TBtree.cxx:333
 TBtree.cxx:334
 TBtree.cxx:335
 TBtree.cxx:336
 TBtree.cxx:337
 TBtree.cxx:338
 TBtree.cxx:339
 TBtree.cxx:340
 TBtree.cxx:341
 TBtree.cxx:342
 TBtree.cxx:343
 TBtree.cxx:344
 TBtree.cxx:345
 TBtree.cxx:346
 TBtree.cxx:347
 TBtree.cxx:348
 TBtree.cxx:349
 TBtree.cxx:350
 TBtree.cxx:351
 TBtree.cxx:352
 TBtree.cxx:353
 TBtree.cxx:354
 TBtree.cxx:355
 TBtree.cxx:356
 TBtree.cxx:357
 TBtree.cxx:358
 TBtree.cxx:359
 TBtree.cxx:360
 TBtree.cxx:361
 TBtree.cxx:362
 TBtree.cxx:363
 TBtree.cxx:364
 TBtree.cxx:365
 TBtree.cxx:366
 TBtree.cxx:367
 TBtree.cxx:368
 TBtree.cxx:369
 TBtree.cxx:370
 TBtree.cxx:371
 TBtree.cxx:372
 TBtree.cxx:373
 TBtree.cxx:374
 TBtree.cxx:375
 TBtree.cxx:376
 TBtree.cxx:377
 TBtree.cxx:378
 TBtree.cxx:379
 TBtree.cxx:380
 TBtree.cxx:381
 TBtree.cxx:382
 TBtree.cxx:383
 TBtree.cxx:384
 TBtree.cxx:385
 TBtree.cxx:386
 TBtree.cxx:387
 TBtree.cxx:388
 TBtree.cxx:389
 TBtree.cxx:390
 TBtree.cxx:391
 TBtree.cxx:392
 TBtree.cxx:393
 TBtree.cxx:394
 TBtree.cxx:395
 TBtree.cxx:396
 TBtree.cxx:397
 TBtree.cxx:398
 TBtree.cxx:399
 TBtree.cxx:400
 TBtree.cxx:401
 TBtree.cxx:402
 TBtree.cxx:403
 TBtree.cxx:404
 TBtree.cxx:405
 TBtree.cxx:406
 TBtree.cxx:407
 TBtree.cxx:408
 TBtree.cxx:409
 TBtree.cxx:410
 TBtree.cxx:411
 TBtree.cxx:412
 TBtree.cxx:413
 TBtree.cxx:414
 TBtree.cxx:415
 TBtree.cxx:416
 TBtree.cxx:417
 TBtree.cxx:418
 TBtree.cxx:419
 TBtree.cxx:420
 TBtree.cxx:421
 TBtree.cxx:422
 TBtree.cxx:423
 TBtree.cxx:424
 TBtree.cxx:425
 TBtree.cxx:426
 TBtree.cxx:427
 TBtree.cxx:428
 TBtree.cxx:429
 TBtree.cxx:430
 TBtree.cxx:431
 TBtree.cxx:432
 TBtree.cxx:433
 TBtree.cxx:434
 TBtree.cxx:435
 TBtree.cxx:436
 TBtree.cxx:437
 TBtree.cxx:438
 TBtree.cxx:439
 TBtree.cxx:440
 TBtree.cxx:441
 TBtree.cxx:442
 TBtree.cxx:443
 TBtree.cxx:444
 TBtree.cxx:445
 TBtree.cxx:446
 TBtree.cxx:447
 TBtree.cxx:448
 TBtree.cxx:449
 TBtree.cxx:450
 TBtree.cxx:451
 TBtree.cxx:452
 TBtree.cxx:453
 TBtree.cxx:454
 TBtree.cxx:455
 TBtree.cxx:456
 TBtree.cxx:457
 TBtree.cxx:458
 TBtree.cxx:459
 TBtree.cxx:460
 TBtree.cxx:461
 TBtree.cxx:462
 TBtree.cxx:463
 TBtree.cxx:464
 TBtree.cxx:465
 TBtree.cxx:466
 TBtree.cxx:467
 TBtree.cxx:468
 TBtree.cxx:469
 TBtree.cxx:470
 TBtree.cxx:471
 TBtree.cxx:472
 TBtree.cxx:473
 TBtree.cxx:474
 TBtree.cxx:475
 TBtree.cxx:476
 TBtree.cxx:477
 TBtree.cxx:478
 TBtree.cxx:479
 TBtree.cxx:480
 TBtree.cxx:481
 TBtree.cxx:482
 TBtree.cxx:483
 TBtree.cxx:484
 TBtree.cxx:485
 TBtree.cxx:486
 TBtree.cxx:487
 TBtree.cxx:488
 TBtree.cxx:489
 TBtree.cxx:490
 TBtree.cxx:491
 TBtree.cxx:492
 TBtree.cxx:493
 TBtree.cxx:494
 TBtree.cxx:495
 TBtree.cxx:496
 TBtree.cxx:497
 TBtree.cxx:498
 TBtree.cxx:499
 TBtree.cxx:500
 TBtree.cxx:501
 TBtree.cxx:502
 TBtree.cxx:503
 TBtree.cxx:504
 TBtree.cxx:505
 TBtree.cxx:506
 TBtree.cxx:507
 TBtree.cxx:508
 TBtree.cxx:509
 TBtree.cxx:510
 TBtree.cxx:511
 TBtree.cxx:512
 TBtree.cxx:513
 TBtree.cxx:514
 TBtree.cxx:515
 TBtree.cxx:516
 TBtree.cxx:517
 TBtree.cxx:518
 TBtree.cxx:519
 TBtree.cxx:520
 TBtree.cxx:521
 TBtree.cxx:522
 TBtree.cxx:523
 TBtree.cxx:524
 TBtree.cxx:525
 TBtree.cxx:526
 TBtree.cxx:527
 TBtree.cxx:528
 TBtree.cxx:529
 TBtree.cxx:530
 TBtree.cxx:531
 TBtree.cxx:532
 TBtree.cxx:533
 TBtree.cxx:534
 TBtree.cxx:535
 TBtree.cxx:536
 TBtree.cxx:537
 TBtree.cxx:538
 TBtree.cxx:539
 TBtree.cxx:540
 TBtree.cxx:541
 TBtree.cxx:542
 TBtree.cxx:543
 TBtree.cxx:544
 TBtree.cxx:545
 TBtree.cxx:546
 TBtree.cxx:547
 TBtree.cxx:548
 TBtree.cxx:549
 TBtree.cxx:550
 TBtree.cxx:551
 TBtree.cxx:552
 TBtree.cxx:553
 TBtree.cxx:554
 TBtree.cxx:555
 TBtree.cxx:556
 TBtree.cxx:557
 TBtree.cxx:558
 TBtree.cxx:559
 TBtree.cxx:560
 TBtree.cxx:561
 TBtree.cxx:562
 TBtree.cxx:563
 TBtree.cxx:564
 TBtree.cxx:565
 TBtree.cxx:566
 TBtree.cxx:567
 TBtree.cxx:568
 TBtree.cxx:569
 TBtree.cxx:570
 TBtree.cxx:571
 TBtree.cxx:572
 TBtree.cxx:573
 TBtree.cxx:574
 TBtree.cxx:575
 TBtree.cxx:576
 TBtree.cxx:577
 TBtree.cxx:578
 TBtree.cxx:579
 TBtree.cxx:580
 TBtree.cxx:581
 TBtree.cxx:582
 TBtree.cxx:583
 TBtree.cxx:584
 TBtree.cxx:585
 TBtree.cxx:586
 TBtree.cxx:587
 TBtree.cxx:588
 TBtree.cxx:589
 TBtree.cxx:590
 TBtree.cxx:591
 TBtree.cxx:592
 TBtree.cxx:593
 TBtree.cxx:594
 TBtree.cxx:595
 TBtree.cxx:596
 TBtree.cxx:597
 TBtree.cxx:598
 TBtree.cxx:599
 TBtree.cxx:600
 TBtree.cxx:601
 TBtree.cxx:602
 TBtree.cxx:603
 TBtree.cxx:604
 TBtree.cxx:605
 TBtree.cxx:606
 TBtree.cxx:607
 TBtree.cxx:608
 TBtree.cxx:609
 TBtree.cxx:610
 TBtree.cxx:611
 TBtree.cxx:612
 TBtree.cxx:613
 TBtree.cxx:614
 TBtree.cxx:615
 TBtree.cxx:616
 TBtree.cxx:617
 TBtree.cxx:618
 TBtree.cxx:619
 TBtree.cxx:620
 TBtree.cxx:621
 TBtree.cxx:622
 TBtree.cxx:623
 TBtree.cxx:624
 TBtree.cxx:625
 TBtree.cxx:626
 TBtree.cxx:627
 TBtree.cxx:628
 TBtree.cxx:629
 TBtree.cxx:630
 TBtree.cxx:631
 TBtree.cxx:632
 TBtree.cxx:633
 TBtree.cxx:634
 TBtree.cxx:635
 TBtree.cxx:636
 TBtree.cxx:637
 TBtree.cxx:638
 TBtree.cxx:639
 TBtree.cxx:640
 TBtree.cxx:641
 TBtree.cxx:642
 TBtree.cxx:643
 TBtree.cxx:644
 TBtree.cxx:645
 TBtree.cxx:646
 TBtree.cxx:647
 TBtree.cxx:648
 TBtree.cxx:649
 TBtree.cxx:650
 TBtree.cxx:651
 TBtree.cxx:652
 TBtree.cxx:653
 TBtree.cxx:654
 TBtree.cxx:655
 TBtree.cxx:656
 TBtree.cxx:657
 TBtree.cxx:658
 TBtree.cxx:659
 TBtree.cxx:660
 TBtree.cxx:661
 TBtree.cxx:662
 TBtree.cxx:663
 TBtree.cxx:664
 TBtree.cxx:665
 TBtree.cxx:666
 TBtree.cxx:667
 TBtree.cxx:668
 TBtree.cxx:669
 TBtree.cxx:670
 TBtree.cxx:671
 TBtree.cxx:672
 TBtree.cxx:673
 TBtree.cxx:674
 TBtree.cxx:675
 TBtree.cxx:676
 TBtree.cxx:677
 TBtree.cxx:678
 TBtree.cxx:679
 TBtree.cxx:680
 TBtree.cxx:681
 TBtree.cxx:682
 TBtree.cxx:683
 TBtree.cxx:684
 TBtree.cxx:685
 TBtree.cxx:686
 TBtree.cxx:687
 TBtree.cxx:688
 TBtree.cxx:689
 TBtree.cxx:690
 TBtree.cxx:691
 TBtree.cxx:692
 TBtree.cxx:693
 TBtree.cxx:694
 TBtree.cxx:695
 TBtree.cxx:696
 TBtree.cxx:697
 TBtree.cxx:698
 TBtree.cxx:699
 TBtree.cxx:700
 TBtree.cxx:701
 TBtree.cxx:702
 TBtree.cxx:703
 TBtree.cxx:704
 TBtree.cxx:705
 TBtree.cxx:706
 TBtree.cxx:707
 TBtree.cxx:708
 TBtree.cxx:709
 TBtree.cxx:710
 TBtree.cxx:711
 TBtree.cxx:712
 TBtree.cxx:713
 TBtree.cxx:714
 TBtree.cxx:715
 TBtree.cxx:716
 TBtree.cxx:717
 TBtree.cxx:718
 TBtree.cxx:719
 TBtree.cxx:720
 TBtree.cxx:721
 TBtree.cxx:722
 TBtree.cxx:723
 TBtree.cxx:724
 TBtree.cxx:725
 TBtree.cxx:726
 TBtree.cxx:727
 TBtree.cxx:728
 TBtree.cxx:729
 TBtree.cxx:730
 TBtree.cxx:731
 TBtree.cxx:732
 TBtree.cxx:733
 TBtree.cxx:734
 TBtree.cxx:735
 TBtree.cxx:736
 TBtree.cxx:737
 TBtree.cxx:738
 TBtree.cxx:739
 TBtree.cxx:740
 TBtree.cxx:741
 TBtree.cxx:742
 TBtree.cxx:743
 TBtree.cxx:744
 TBtree.cxx:745
 TBtree.cxx:746
 TBtree.cxx:747
 TBtree.cxx:748
 TBtree.cxx:749
 TBtree.cxx:750
 TBtree.cxx:751
 TBtree.cxx:752
 TBtree.cxx:753
 TBtree.cxx:754
 TBtree.cxx:755
 TBtree.cxx:756
 TBtree.cxx:757
 TBtree.cxx:758
 TBtree.cxx:759
 TBtree.cxx:760
 TBtree.cxx:761
 TBtree.cxx:762
 TBtree.cxx:763
 TBtree.cxx:764
 TBtree.cxx:765
 TBtree.cxx:766
 TBtree.cxx:767
 TBtree.cxx:768
 TBtree.cxx:769
 TBtree.cxx:770
 TBtree.cxx:771
 TBtree.cxx:772
 TBtree.cxx:773
 TBtree.cxx:774
 TBtree.cxx:775
 TBtree.cxx:776
 TBtree.cxx:777
 TBtree.cxx:778
 TBtree.cxx:779
 TBtree.cxx:780
 TBtree.cxx:781
 TBtree.cxx:782
 TBtree.cxx:783
 TBtree.cxx:784
 TBtree.cxx:785
 TBtree.cxx:786
 TBtree.cxx:787
 TBtree.cxx:788
 TBtree.cxx:789
 TBtree.cxx:790
 TBtree.cxx:791
 TBtree.cxx:792
 TBtree.cxx:793
 TBtree.cxx:794
 TBtree.cxx:795
 TBtree.cxx:796
 TBtree.cxx:797
 TBtree.cxx:798
 TBtree.cxx:799
 TBtree.cxx:800
 TBtree.cxx:801
 TBtree.cxx:802
 TBtree.cxx:803
 TBtree.cxx:804
 TBtree.cxx:805
 TBtree.cxx:806
 TBtree.cxx:807
 TBtree.cxx:808
 TBtree.cxx:809
 TBtree.cxx:810
 TBtree.cxx:811
 TBtree.cxx:812
 TBtree.cxx:813
 TBtree.cxx:814
 TBtree.cxx:815
 TBtree.cxx:816
 TBtree.cxx:817
 TBtree.cxx:818
 TBtree.cxx:819
 TBtree.cxx:820
 TBtree.cxx:821
 TBtree.cxx:822
 TBtree.cxx:823
 TBtree.cxx:824
 TBtree.cxx:825
 TBtree.cxx:826
 TBtree.cxx:827
 TBtree.cxx:828
 TBtree.cxx:829
 TBtree.cxx:830
 TBtree.cxx:831
 TBtree.cxx:832
 TBtree.cxx:833
 TBtree.cxx:834
 TBtree.cxx:835
 TBtree.cxx:836
 TBtree.cxx:837
 TBtree.cxx:838
 TBtree.cxx:839
 TBtree.cxx:840
 TBtree.cxx:841
 TBtree.cxx:842
 TBtree.cxx:843
 TBtree.cxx:844
 TBtree.cxx:845
 TBtree.cxx:846
 TBtree.cxx:847
 TBtree.cxx:848
 TBtree.cxx:849
 TBtree.cxx:850
 TBtree.cxx:851
 TBtree.cxx:852
 TBtree.cxx:853
 TBtree.cxx:854
 TBtree.cxx:855
 TBtree.cxx:856
 TBtree.cxx:857
 TBtree.cxx:858
 TBtree.cxx:859
 TBtree.cxx:860
 TBtree.cxx:861
 TBtree.cxx:862
 TBtree.cxx:863
 TBtree.cxx:864
 TBtree.cxx:865
 TBtree.cxx:866
 TBtree.cxx:867
 TBtree.cxx:868
 TBtree.cxx:869
 TBtree.cxx:870
 TBtree.cxx:871
 TBtree.cxx:872
 TBtree.cxx:873
 TBtree.cxx:874
 TBtree.cxx:875
 TBtree.cxx:876
 TBtree.cxx:877
 TBtree.cxx:878
 TBtree.cxx:879
 TBtree.cxx:880
 TBtree.cxx:881
 TBtree.cxx:882
 TBtree.cxx:883
 TBtree.cxx:884
 TBtree.cxx:885
 TBtree.cxx:886
 TBtree.cxx:887
 TBtree.cxx:888
 TBtree.cxx:889
 TBtree.cxx:890
 TBtree.cxx:891
 TBtree.cxx:892
 TBtree.cxx:893
 TBtree.cxx:894
 TBtree.cxx:895
 TBtree.cxx:896
 TBtree.cxx:897
 TBtree.cxx:898
 TBtree.cxx:899
 TBtree.cxx:900
 TBtree.cxx:901
 TBtree.cxx:902
 TBtree.cxx:903
 TBtree.cxx:904
 TBtree.cxx:905
 TBtree.cxx:906
 TBtree.cxx:907
 TBtree.cxx:908
 TBtree.cxx:909
 TBtree.cxx:910
 TBtree.cxx:911
 TBtree.cxx:912
 TBtree.cxx:913
 TBtree.cxx:914
 TBtree.cxx:915
 TBtree.cxx:916
 TBtree.cxx:917
 TBtree.cxx:918
 TBtree.cxx:919
 TBtree.cxx:920
 TBtree.cxx:921
 TBtree.cxx:922
 TBtree.cxx:923
 TBtree.cxx:924
 TBtree.cxx:925
 TBtree.cxx:926
 TBtree.cxx:927
 TBtree.cxx:928
 TBtree.cxx:929
 TBtree.cxx:930
 TBtree.cxx:931
 TBtree.cxx:932
 TBtree.cxx:933
 TBtree.cxx:934
 TBtree.cxx:935
 TBtree.cxx:936
 TBtree.cxx:937
 TBtree.cxx:938
 TBtree.cxx:939
 TBtree.cxx:940
 TBtree.cxx:941
 TBtree.cxx:942
 TBtree.cxx:943
 TBtree.cxx:944
 TBtree.cxx:945
 TBtree.cxx:946
 TBtree.cxx:947
 TBtree.cxx:948
 TBtree.cxx:949
 TBtree.cxx:950
 TBtree.cxx:951
 TBtree.cxx:952
 TBtree.cxx:953
 TBtree.cxx:954
 TBtree.cxx:955
 TBtree.cxx:956
 TBtree.cxx:957
 TBtree.cxx:958
 TBtree.cxx:959
 TBtree.cxx:960
 TBtree.cxx:961
 TBtree.cxx:962
 TBtree.cxx:963
 TBtree.cxx:964
 TBtree.cxx:965
 TBtree.cxx:966
 TBtree.cxx:967
 TBtree.cxx:968
 TBtree.cxx:969
 TBtree.cxx:970
 TBtree.cxx:971
 TBtree.cxx:972
 TBtree.cxx:973
 TBtree.cxx:974
 TBtree.cxx:975
 TBtree.cxx:976
 TBtree.cxx:977
 TBtree.cxx:978
 TBtree.cxx:979
 TBtree.cxx:980
 TBtree.cxx:981
 TBtree.cxx:982
 TBtree.cxx:983
 TBtree.cxx:984
 TBtree.cxx:985
 TBtree.cxx:986
 TBtree.cxx:987
 TBtree.cxx:988
 TBtree.cxx:989
 TBtree.cxx:990
 TBtree.cxx:991
 TBtree.cxx:992
 TBtree.cxx:993
 TBtree.cxx:994
 TBtree.cxx:995
 TBtree.cxx:996
 TBtree.cxx:997
 TBtree.cxx:998
 TBtree.cxx:999
 TBtree.cxx:1000
 TBtree.cxx:1001
 TBtree.cxx:1002
 TBtree.cxx:1003
 TBtree.cxx:1004
 TBtree.cxx:1005
 TBtree.cxx:1006
 TBtree.cxx:1007
 TBtree.cxx:1008
 TBtree.cxx:1009
 TBtree.cxx:1010
 TBtree.cxx:1011
 TBtree.cxx:1012
 TBtree.cxx:1013
 TBtree.cxx:1014
 TBtree.cxx:1015
 TBtree.cxx:1016
 TBtree.cxx:1017
 TBtree.cxx:1018
 TBtree.cxx:1019
 TBtree.cxx:1020
 TBtree.cxx:1021
 TBtree.cxx:1022
 TBtree.cxx:1023
 TBtree.cxx:1024
 TBtree.cxx:1025
 TBtree.cxx:1026
 TBtree.cxx:1027
 TBtree.cxx:1028
 TBtree.cxx:1029
 TBtree.cxx:1030
 TBtree.cxx:1031
 TBtree.cxx:1032
 TBtree.cxx:1033
 TBtree.cxx:1034
 TBtree.cxx:1035
 TBtree.cxx:1036
 TBtree.cxx:1037
 TBtree.cxx:1038
 TBtree.cxx:1039
 TBtree.cxx:1040
 TBtree.cxx:1041
 TBtree.cxx:1042
 TBtree.cxx:1043
 TBtree.cxx:1044
 TBtree.cxx:1045
 TBtree.cxx:1046
 TBtree.cxx:1047
 TBtree.cxx:1048
 TBtree.cxx:1049
 TBtree.cxx:1050
 TBtree.cxx:1051
 TBtree.cxx:1052
 TBtree.cxx:1053
 TBtree.cxx:1054
 TBtree.cxx:1055
 TBtree.cxx:1056
 TBtree.cxx:1057
 TBtree.cxx:1058
 TBtree.cxx:1059
 TBtree.cxx:1060
 TBtree.cxx:1061
 TBtree.cxx:1062
 TBtree.cxx:1063
 TBtree.cxx:1064
 TBtree.cxx:1065
 TBtree.cxx:1066
 TBtree.cxx:1067
 TBtree.cxx:1068
 TBtree.cxx:1069
 TBtree.cxx:1070
 TBtree.cxx:1071
 TBtree.cxx:1072
 TBtree.cxx:1073
 TBtree.cxx:1074
 TBtree.cxx:1075
 TBtree.cxx:1076
 TBtree.cxx:1077
 TBtree.cxx:1078
 TBtree.cxx:1079
 TBtree.cxx:1080
 TBtree.cxx:1081
 TBtree.cxx:1082
 TBtree.cxx:1083
 TBtree.cxx:1084
 TBtree.cxx:1085
 TBtree.cxx:1086
 TBtree.cxx:1087
 TBtree.cxx:1088
 TBtree.cxx:1089
 TBtree.cxx:1090
 TBtree.cxx:1091
 TBtree.cxx:1092
 TBtree.cxx:1093
 TBtree.cxx:1094
 TBtree.cxx:1095
 TBtree.cxx:1096
 TBtree.cxx:1097
 TBtree.cxx:1098
 TBtree.cxx:1099
 TBtree.cxx:1100
 TBtree.cxx:1101
 TBtree.cxx:1102
 TBtree.cxx:1103
 TBtree.cxx:1104
 TBtree.cxx:1105
 TBtree.cxx:1106
 TBtree.cxx:1107
 TBtree.cxx:1108
 TBtree.cxx:1109
 TBtree.cxx:1110
 TBtree.cxx:1111
 TBtree.cxx:1112
 TBtree.cxx:1113
 TBtree.cxx:1114
 TBtree.cxx:1115
 TBtree.cxx:1116
 TBtree.cxx:1117
 TBtree.cxx:1118
 TBtree.cxx:1119
 TBtree.cxx:1120
 TBtree.cxx:1121
 TBtree.cxx:1122
 TBtree.cxx:1123
 TBtree.cxx:1124
 TBtree.cxx:1125
 TBtree.cxx:1126
 TBtree.cxx:1127
 TBtree.cxx:1128
 TBtree.cxx:1129
 TBtree.cxx:1130
 TBtree.cxx:1131
 TBtree.cxx:1132
 TBtree.cxx:1133
 TBtree.cxx:1134
 TBtree.cxx:1135
 TBtree.cxx:1136
 TBtree.cxx:1137
 TBtree.cxx:1138
 TBtree.cxx:1139
 TBtree.cxx:1140
 TBtree.cxx:1141
 TBtree.cxx:1142
 TBtree.cxx:1143
 TBtree.cxx:1144
 TBtree.cxx:1145
 TBtree.cxx:1146
 TBtree.cxx:1147
 TBtree.cxx:1148
 TBtree.cxx:1149
 TBtree.cxx:1150
 TBtree.cxx:1151
 TBtree.cxx:1152
 TBtree.cxx:1153
 TBtree.cxx:1154
 TBtree.cxx:1155
 TBtree.cxx:1156
 TBtree.cxx:1157
 TBtree.cxx:1158
 TBtree.cxx:1159
 TBtree.cxx:1160
 TBtree.cxx:1161
 TBtree.cxx:1162
 TBtree.cxx:1163
 TBtree.cxx:1164
 TBtree.cxx:1165
 TBtree.cxx:1166
 TBtree.cxx:1167
 TBtree.cxx:1168
 TBtree.cxx:1169
 TBtree.cxx:1170
 TBtree.cxx:1171
 TBtree.cxx:1172
 TBtree.cxx:1173
 TBtree.cxx:1174
 TBtree.cxx:1175
 TBtree.cxx:1176
 TBtree.cxx:1177
 TBtree.cxx:1178
 TBtree.cxx:1179
 TBtree.cxx:1180
 TBtree.cxx:1181
 TBtree.cxx:1182
 TBtree.cxx:1183
 TBtree.cxx:1184
 TBtree.cxx:1185
 TBtree.cxx:1186
 TBtree.cxx:1187
 TBtree.cxx:1188
 TBtree.cxx:1189
 TBtree.cxx:1190
 TBtree.cxx:1191
 TBtree.cxx:1192
 TBtree.cxx:1193
 TBtree.cxx:1194
 TBtree.cxx:1195
 TBtree.cxx:1196
 TBtree.cxx:1197
 TBtree.cxx:1198
 TBtree.cxx:1199
 TBtree.cxx:1200
 TBtree.cxx:1201
 TBtree.cxx:1202
 TBtree.cxx:1203
 TBtree.cxx:1204
 TBtree.cxx:1205
 TBtree.cxx:1206
 TBtree.cxx:1207
 TBtree.cxx:1208
 TBtree.cxx:1209
 TBtree.cxx:1210
 TBtree.cxx:1211
 TBtree.cxx:1212
 TBtree.cxx:1213
 TBtree.cxx:1214
 TBtree.cxx:1215
 TBtree.cxx:1216
 TBtree.cxx:1217
 TBtree.cxx:1218
 TBtree.cxx:1219
 TBtree.cxx:1220
 TBtree.cxx:1221
 TBtree.cxx:1222
 TBtree.cxx:1223
 TBtree.cxx:1224
 TBtree.cxx:1225
 TBtree.cxx:1226
 TBtree.cxx:1227
 TBtree.cxx:1228
 TBtree.cxx:1229
 TBtree.cxx:1230
 TBtree.cxx:1231
 TBtree.cxx:1232
 TBtree.cxx:1233
 TBtree.cxx:1234
 TBtree.cxx:1235
 TBtree.cxx:1236
 TBtree.cxx:1237
 TBtree.cxx:1238
 TBtree.cxx:1239
 TBtree.cxx:1240
 TBtree.cxx:1241
 TBtree.cxx:1242
 TBtree.cxx:1243
 TBtree.cxx:1244
 TBtree.cxx:1245
 TBtree.cxx:1246
 TBtree.cxx:1247
 TBtree.cxx:1248
 TBtree.cxx:1249
 TBtree.cxx:1250
 TBtree.cxx:1251
 TBtree.cxx:1252
 TBtree.cxx:1253
 TBtree.cxx:1254
 TBtree.cxx:1255
 TBtree.cxx:1256
 TBtree.cxx:1257
 TBtree.cxx:1258
 TBtree.cxx:1259
 TBtree.cxx:1260
 TBtree.cxx:1261
 TBtree.cxx:1262
 TBtree.cxx:1263
 TBtree.cxx:1264
 TBtree.cxx:1265
 TBtree.cxx:1266
 TBtree.cxx:1267
 TBtree.cxx:1268
 TBtree.cxx:1269
 TBtree.cxx:1270
 TBtree.cxx:1271
 TBtree.cxx:1272
 TBtree.cxx:1273
 TBtree.cxx:1274
 TBtree.cxx:1275
 TBtree.cxx:1276
 TBtree.cxx:1277
 TBtree.cxx:1278
 TBtree.cxx:1279
 TBtree.cxx:1280
 TBtree.cxx:1281
 TBtree.cxx:1282
 TBtree.cxx:1283
 TBtree.cxx:1284
 TBtree.cxx:1285
 TBtree.cxx:1286
 TBtree.cxx:1287
 TBtree.cxx:1288
 TBtree.cxx:1289
 TBtree.cxx:1290
 TBtree.cxx:1291
 TBtree.cxx:1292
 TBtree.cxx:1293
 TBtree.cxx:1294
 TBtree.cxx:1295
 TBtree.cxx:1296
 TBtree.cxx:1297
 TBtree.cxx:1298
 TBtree.cxx:1299
 TBtree.cxx:1300
 TBtree.cxx:1301
 TBtree.cxx:1302
 TBtree.cxx:1303
 TBtree.cxx:1304
 TBtree.cxx:1305
 TBtree.cxx:1306
 TBtree.cxx:1307
 TBtree.cxx:1308
 TBtree.cxx:1309
 TBtree.cxx:1310
 TBtree.cxx:1311
 TBtree.cxx:1312
 TBtree.cxx:1313
 TBtree.cxx:1314
 TBtree.cxx:1315
 TBtree.cxx:1316
 TBtree.cxx:1317
 TBtree.cxx:1318
 TBtree.cxx:1319
 TBtree.cxx:1320
 TBtree.cxx:1321
 TBtree.cxx:1322
 TBtree.cxx:1323
 TBtree.cxx:1324
 TBtree.cxx:1325
 TBtree.cxx:1326
 TBtree.cxx:1327
 TBtree.cxx:1328
 TBtree.cxx:1329
 TBtree.cxx:1330
 TBtree.cxx:1331
 TBtree.cxx:1332
 TBtree.cxx:1333
 TBtree.cxx:1334
 TBtree.cxx:1335
 TBtree.cxx:1336
 TBtree.cxx:1337
 TBtree.cxx:1338
 TBtree.cxx:1339
 TBtree.cxx:1340
 TBtree.cxx:1341
 TBtree.cxx:1342
 TBtree.cxx:1343
 TBtree.cxx:1344
 TBtree.cxx:1345
 TBtree.cxx:1346
 TBtree.cxx:1347
 TBtree.cxx:1348
 TBtree.cxx:1349
 TBtree.cxx:1350
 TBtree.cxx:1351
 TBtree.cxx:1352
 TBtree.cxx:1353
 TBtree.cxx:1354
 TBtree.cxx:1355
 TBtree.cxx:1356
 TBtree.cxx:1357
 TBtree.cxx:1358
 TBtree.cxx:1359
 TBtree.cxx:1360
 TBtree.cxx:1361
 TBtree.cxx:1362
 TBtree.cxx:1363
 TBtree.cxx:1364
 TBtree.cxx:1365
 TBtree.cxx:1366
 TBtree.cxx:1367
 TBtree.cxx:1368
 TBtree.cxx:1369
 TBtree.cxx:1370
 TBtree.cxx:1371
 TBtree.cxx:1372
 TBtree.cxx:1373
 TBtree.cxx:1374
 TBtree.cxx:1375
 TBtree.cxx:1376
 TBtree.cxx:1377
 TBtree.cxx:1378
 TBtree.cxx:1379
 TBtree.cxx:1380
 TBtree.cxx:1381
 TBtree.cxx:1382
 TBtree.cxx:1383
 TBtree.cxx:1384
 TBtree.cxx:1385
 TBtree.cxx:1386
 TBtree.cxx:1387
 TBtree.cxx:1388
 TBtree.cxx:1389
 TBtree.cxx:1390
 TBtree.cxx:1391
 TBtree.cxx:1392
 TBtree.cxx:1393
 TBtree.cxx:1394
 TBtree.cxx:1395
 TBtree.cxx:1396
 TBtree.cxx:1397
 TBtree.cxx:1398
 TBtree.cxx:1399
 TBtree.cxx:1400
 TBtree.cxx:1401
 TBtree.cxx:1402
 TBtree.cxx:1403
 TBtree.cxx:1404
 TBtree.cxx:1405
 TBtree.cxx:1406
 TBtree.cxx:1407
 TBtree.cxx:1408
 TBtree.cxx:1409
 TBtree.cxx:1410
 TBtree.cxx:1411
 TBtree.cxx:1412
 TBtree.cxx:1413
 TBtree.cxx:1414
 TBtree.cxx:1415
 TBtree.cxx:1416
 TBtree.cxx:1417
 TBtree.cxx:1418
 TBtree.cxx:1419
 TBtree.cxx:1420
 TBtree.cxx:1421
 TBtree.cxx:1422
 TBtree.cxx:1423
 TBtree.cxx:1424
 TBtree.cxx:1425
 TBtree.cxx:1426
 TBtree.cxx:1427
 TBtree.cxx:1428
 TBtree.cxx:1429
 TBtree.cxx:1430
 TBtree.cxx:1431
 TBtree.cxx:1432
 TBtree.cxx:1433
 TBtree.cxx:1434
 TBtree.cxx:1435
 TBtree.cxx:1436
 TBtree.cxx:1437
 TBtree.cxx:1438
 TBtree.cxx:1439
 TBtree.cxx:1440
 TBtree.cxx:1441
 TBtree.cxx:1442
 TBtree.cxx:1443
 TBtree.cxx:1444
 TBtree.cxx:1445
 TBtree.cxx:1446
 TBtree.cxx:1447
 TBtree.cxx:1448
 TBtree.cxx:1449
 TBtree.cxx:1450
 TBtree.cxx:1451
 TBtree.cxx:1452
 TBtree.cxx:1453
 TBtree.cxx:1454
 TBtree.cxx:1455
 TBtree.cxx:1456
 TBtree.cxx:1457
 TBtree.cxx:1458
 TBtree.cxx:1459
 TBtree.cxx:1460
 TBtree.cxx:1461
 TBtree.cxx:1462
 TBtree.cxx:1463
 TBtree.cxx:1464
 TBtree.cxx:1465
 TBtree.cxx:1466
 TBtree.cxx:1467
 TBtree.cxx:1468
 TBtree.cxx:1469
 TBtree.cxx:1470
 TBtree.cxx:1471
 TBtree.cxx:1472
 TBtree.cxx:1473
 TBtree.cxx:1474
 TBtree.cxx:1475
 TBtree.cxx:1476
 TBtree.cxx:1477
 TBtree.cxx:1478
 TBtree.cxx:1479
 TBtree.cxx:1480
 TBtree.cxx:1481
 TBtree.cxx:1482
 TBtree.cxx:1483
 TBtree.cxx:1484
 TBtree.cxx:1485
 TBtree.cxx:1486
 TBtree.cxx:1487
 TBtree.cxx:1488
 TBtree.cxx:1489
 TBtree.cxx:1490
 TBtree.cxx:1491
 TBtree.cxx:1492
 TBtree.cxx:1493
 TBtree.cxx:1494
 TBtree.cxx:1495
 TBtree.cxx:1496
 TBtree.cxx:1497
 TBtree.cxx:1498
 TBtree.cxx:1499
 TBtree.cxx:1500
 TBtree.cxx:1501
 TBtree.cxx:1502
 TBtree.cxx:1503
 TBtree.cxx:1504
 TBtree.cxx:1505
 TBtree.cxx:1506
 TBtree.cxx:1507
 TBtree.cxx:1508
 TBtree.cxx:1509
 TBtree.cxx:1510
 TBtree.cxx:1511
 TBtree.cxx:1512
 TBtree.cxx:1513
 TBtree.cxx:1514
 TBtree.cxx:1515
 TBtree.cxx:1516
 TBtree.cxx:1517
 TBtree.cxx:1518
 TBtree.cxx:1519
 TBtree.cxx:1520
 TBtree.cxx:1521
 TBtree.cxx:1522
 TBtree.cxx:1523
 TBtree.cxx:1524
 TBtree.cxx:1525
 TBtree.cxx:1526
 TBtree.cxx:1527
 TBtree.cxx:1528
 TBtree.cxx:1529
 TBtree.cxx:1530
 TBtree.cxx:1531
 TBtree.cxx:1532
 TBtree.cxx:1533
 TBtree.cxx:1534
 TBtree.cxx:1535
 TBtree.cxx:1536
 TBtree.cxx:1537
 TBtree.cxx:1538
 TBtree.cxx:1539
 TBtree.cxx:1540
 TBtree.cxx:1541
 TBtree.cxx:1542
 TBtree.cxx:1543
 TBtree.cxx:1544
 TBtree.cxx:1545
 TBtree.cxx:1546
 TBtree.cxx:1547
 TBtree.cxx:1548
 TBtree.cxx:1549
 TBtree.cxx:1550
 TBtree.cxx:1551
 TBtree.cxx:1552
 TBtree.cxx:1553
 TBtree.cxx:1554
 TBtree.cxx:1555
 TBtree.cxx:1556
 TBtree.cxx:1557
 TBtree.cxx:1558
 TBtree.cxx:1559
 TBtree.cxx:1560
 TBtree.cxx:1561
 TBtree.cxx:1562
 TBtree.cxx:1563
 TBtree.cxx:1564
 TBtree.cxx:1565
 TBtree.cxx:1566
 TBtree.cxx:1567
 TBtree.cxx:1568
 TBtree.cxx:1569
 TBtree.cxx:1570
 TBtree.cxx:1571
 TBtree.cxx:1572
 TBtree.cxx:1573
 TBtree.cxx:1574
 TBtree.cxx:1575
 TBtree.cxx:1576
 TBtree.cxx:1577
 TBtree.cxx:1578
 TBtree.cxx:1579
 TBtree.cxx:1580
 TBtree.cxx:1581
 TBtree.cxx:1582
 TBtree.cxx:1583
 TBtree.cxx:1584
 TBtree.cxx:1585
 TBtree.cxx:1586
 TBtree.cxx:1587
 TBtree.cxx:1588
 TBtree.cxx:1589
 TBtree.cxx:1590
 TBtree.cxx:1591
 TBtree.cxx:1592
 TBtree.cxx:1593
 TBtree.cxx:1594
 TBtree.cxx:1595
 TBtree.cxx:1596
 TBtree.cxx:1597
 TBtree.cxx:1598
 TBtree.cxx:1599
 TBtree.cxx:1600
 TBtree.cxx:1601
 TBtree.cxx:1602
 TBtree.cxx:1603
 TBtree.cxx:1604
 TBtree.cxx:1605
 TBtree.cxx:1606
 TBtree.cxx:1607
 TBtree.cxx:1608
 TBtree.cxx:1609
 TBtree.cxx:1610
 TBtree.cxx:1611
 TBtree.cxx:1612
 TBtree.cxx:1613
 TBtree.cxx:1614
 TBtree.cxx:1615
 TBtree.cxx:1616
 TBtree.cxx:1617
 TBtree.cxx:1618
 TBtree.cxx:1619
 TBtree.cxx:1620
 TBtree.cxx:1621
 TBtree.cxx:1622
 TBtree.cxx:1623
 TBtree.cxx:1624
 TBtree.cxx:1625
 TBtree.cxx:1626
 TBtree.cxx:1627
 TBtree.cxx:1628
 TBtree.cxx:1629
 TBtree.cxx:1630
 TBtree.cxx:1631
 TBtree.cxx:1632
 TBtree.cxx:1633
 TBtree.cxx:1634
 TBtree.cxx:1635
 TBtree.cxx:1636
 TBtree.cxx:1637
 TBtree.cxx:1638
 TBtree.cxx:1639
 TBtree.cxx:1640
 TBtree.cxx:1641
 TBtree.cxx:1642
 TBtree.cxx:1643
 TBtree.cxx:1644
 TBtree.cxx:1645
 TBtree.cxx:1646
 TBtree.cxx:1647
 TBtree.cxx:1648
 TBtree.cxx:1649
 TBtree.cxx:1650
 TBtree.cxx:1651
 TBtree.cxx:1652
 TBtree.cxx:1653
 TBtree.cxx:1654
 TBtree.cxx:1655
 TBtree.cxx:1656
 TBtree.cxx:1657
 TBtree.cxx:1658
 TBtree.cxx:1659
 TBtree.cxx:1660
 TBtree.cxx:1661
 TBtree.cxx:1662
 TBtree.cxx:1663
 TBtree.cxx:1664
 TBtree.cxx:1665
 TBtree.cxx:1666
 TBtree.cxx:1667
 TBtree.cxx:1668
 TBtree.cxx:1669
 TBtree.cxx:1670
 TBtree.cxx:1671
 TBtree.cxx:1672
 TBtree.cxx:1673
 TBtree.cxx:1674
 TBtree.cxx:1675
 TBtree.cxx:1676
 TBtree.cxx:1677
 TBtree.cxx:1678
 TBtree.cxx:1679
 TBtree.cxx:1680
 TBtree.cxx:1681
 TBtree.cxx:1682
 TBtree.cxx:1683
 TBtree.cxx:1684
 TBtree.cxx:1685
 TBtree.cxx:1686
 TBtree.cxx:1687
 TBtree.cxx:1688
 TBtree.cxx:1689
 TBtree.cxx:1690
 TBtree.cxx:1691
 TBtree.cxx:1692
 TBtree.cxx:1693
 TBtree.cxx:1694
 TBtree.cxx:1695
 TBtree.cxx:1696
 TBtree.cxx:1697
 TBtree.cxx:1698
 TBtree.cxx:1699
 TBtree.cxx:1700
 TBtree.cxx:1701
 TBtree.cxx:1702
 TBtree.cxx:1703
 TBtree.cxx:1704
 TBtree.cxx:1705
 TBtree.cxx:1706
 TBtree.cxx:1707
 TBtree.cxx:1708
 TBtree.cxx:1709
 TBtree.cxx:1710
 TBtree.cxx:1711
 TBtree.cxx:1712
 TBtree.cxx:1713
 TBtree.cxx:1714
 TBtree.cxx:1715
 TBtree.cxx:1716
 TBtree.cxx:1717
 TBtree.cxx:1718
 TBtree.cxx:1719
 TBtree.cxx:1720
 TBtree.cxx:1721
 TBtree.cxx:1722
 TBtree.cxx:1723
 TBtree.cxx:1724
 TBtree.cxx:1725
 TBtree.cxx:1726
 TBtree.cxx:1727
 TBtree.cxx:1728
 TBtree.cxx:1729
 TBtree.cxx:1730
 TBtree.cxx:1731
 TBtree.cxx:1732
 TBtree.cxx:1733
 TBtree.cxx:1734
 TBtree.cxx:1735
 TBtree.cxx:1736
 TBtree.cxx:1737
 TBtree.cxx:1738
 TBtree.cxx:1739
 TBtree.cxx:1740
 TBtree.cxx:1741
 TBtree.cxx:1742
 TBtree.cxx:1743
 TBtree.cxx:1744
 TBtree.cxx:1745
 TBtree.cxx:1746
 TBtree.cxx:1747
 TBtree.cxx:1748
 TBtree.cxx:1749
 TBtree.cxx:1750
 TBtree.cxx:1751
 TBtree.cxx:1752
 TBtree.cxx:1753
 TBtree.cxx:1754
 TBtree.cxx:1755