ROOT logo
// @(#)root/treeplayer:$Id$
// Author: Rene Brun   05/07/2004

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

#ifndef ROOT_TTreeIndex
#define ROOT_TTreeIndex


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeIndex                                                           //
//                                                                      //
// A Tree Index with majorname and minorname.                           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


#ifndef ROOT_TVirtualIndex
#include "TVirtualIndex.h"
#endif
#ifndef ROOT_TTreeFormula
#include "TTreeFormula.h"
#endif

class TTreeIndex : public TVirtualIndex {

protected:
   TString        fMajorName;           // Index major name
   TString        fMinorName;           // Index minor name
   Long64_t       fN;                   // Number of entries
   Long64_t      *fIndexValues;         //[fN] Sorted index values, higher 64bits
   Long64_t      *fIndexValuesMinor;    //[fN] Sorted index values, lower 64bits
   Long64_t      *fIndex;               //[fN] Index of sorted values
   TTreeFormula  *fMajorFormula;        //! Pointer to major TreeFormula
   TTreeFormula  *fMinorFormula;        //! Pointer to minor TreeFormula
   TTreeFormula  *fMajorFormulaParent;  //! Pointer to major TreeFormula in Parent tree (if any)
   TTreeFormula  *fMinorFormulaParent;  //! Pointer to minor TreeFormula in Parent tree (if any)

private:
   TTreeIndex(const TTreeIndex&);            // Not implemented.
   TTreeIndex &operator=(const TTreeIndex&); // Not implemented.

public:
   TTreeIndex();
   TTreeIndex(const TTree *T, const char *majorname, const char *minorname);
   virtual               ~TTreeIndex();
   virtual void           Append(const TVirtualIndex *,Bool_t delaySort = kFALSE);
   bool                   ConvertOldToNew();
   Long64_t               FindValues(Long64_t major, Long64_t minor) const;
   virtual Long64_t       GetEntryNumberFriend(const TTree *parent);
   virtual Long64_t       GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const;
   virtual Long64_t       GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const;
   virtual Long64_t      *GetIndex()        const {return fIndex;}
   virtual Long64_t      *GetIndexValues()  const {return fIndexValues;}
   virtual Long64_t      *GetIndexValuesMinor()  const;
   const char            *GetMajorName()    const {return fMajorName.Data();}
   const char            *GetMinorName()    const {return fMinorName.Data();}
   virtual Long64_t       GetN()            const {return fN;}
   virtual TTreeFormula  *GetMajorFormula();
   virtual TTreeFormula  *GetMinorFormula();
   virtual TTreeFormula  *GetMajorFormulaParent(const TTree *parent);
   virtual TTreeFormula  *GetMinorFormulaParent(const TTree *parent);
   virtual void           Print(Option_t *option="") const;
   virtual void           UpdateFormulaLeaves(const TTree *parent);
   virtual void           SetTree(const TTree *T);
   
   ClassDef(TTreeIndex,2);  //A Tree Index with majorname and minorname.
};

#endif

 TTreeIndex.h:1
 TTreeIndex.h:2
 TTreeIndex.h:3
 TTreeIndex.h:4
 TTreeIndex.h:5
 TTreeIndex.h:6
 TTreeIndex.h:7
 TTreeIndex.h:8
 TTreeIndex.h:9
 TTreeIndex.h:10
 TTreeIndex.h:11
 TTreeIndex.h:12
 TTreeIndex.h:13
 TTreeIndex.h:14
 TTreeIndex.h:15
 TTreeIndex.h:16
 TTreeIndex.h:17
 TTreeIndex.h:18
 TTreeIndex.h:19
 TTreeIndex.h:20
 TTreeIndex.h:21
 TTreeIndex.h:22
 TTreeIndex.h:23
 TTreeIndex.h:24
 TTreeIndex.h:25
 TTreeIndex.h:26
 TTreeIndex.h:27
 TTreeIndex.h:28
 TTreeIndex.h:29
 TTreeIndex.h:30
 TTreeIndex.h:31
 TTreeIndex.h:32
 TTreeIndex.h:33
 TTreeIndex.h:34
 TTreeIndex.h:35
 TTreeIndex.h:36
 TTreeIndex.h:37
 TTreeIndex.h:38
 TTreeIndex.h:39
 TTreeIndex.h:40
 TTreeIndex.h:41
 TTreeIndex.h:42
 TTreeIndex.h:43
 TTreeIndex.h:44
 TTreeIndex.h:45
 TTreeIndex.h:46
 TTreeIndex.h:47
 TTreeIndex.h:48
 TTreeIndex.h:49
 TTreeIndex.h:50
 TTreeIndex.h:51
 TTreeIndex.h:52
 TTreeIndex.h:53
 TTreeIndex.h:54
 TTreeIndex.h:55
 TTreeIndex.h:56
 TTreeIndex.h:57
 TTreeIndex.h:58
 TTreeIndex.h:59
 TTreeIndex.h:60
 TTreeIndex.h:61
 TTreeIndex.h:62
 TTreeIndex.h:63
 TTreeIndex.h:64
 TTreeIndex.h:65
 TTreeIndex.h:66
 TTreeIndex.h:67
 TTreeIndex.h:68
 TTreeIndex.h:69
 TTreeIndex.h:70
 TTreeIndex.h:71
 TTreeIndex.h:72
 TTreeIndex.h:73
 TTreeIndex.h:74
 TTreeIndex.h:75
 TTreeIndex.h:76
 TTreeIndex.h:77
 TTreeIndex.h:78