00001 // @(#)root/treeplayer:$Id: TTreeIndex.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Rene Brun 05/07/2004 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TTreeIndex 00013 #define ROOT_TTreeIndex 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TTreeIndex // 00019 // // 00020 // A Tree Index with majorname and minorname. // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 00025 #ifndef ROOT_TVirtualIndex 00026 #include "TVirtualIndex.h" 00027 #endif 00028 #ifndef ROOT_TTreeFormula 00029 #include "TTreeFormula.h" 00030 #endif 00031 00032 class TTreeIndex : public TVirtualIndex { 00033 00034 protected: 00035 TString fMajorName; // Index major name 00036 TString fMinorName; // Index minor name 00037 Long64_t fN; // Number of entries 00038 Long64_t *fIndexValues; //[fN] Sorted index values 00039 Long64_t *fIndex; //[fN] Index of sorted values 00040 TTreeFormula *fMajorFormula; //! Pointer to major TreeFormula 00041 TTreeFormula *fMinorFormula; //! Pointer to minor TreeFormula 00042 TTreeFormula *fMajorFormulaParent; //! Pointer to major TreeFormula in Parent tree (if any) 00043 TTreeFormula *fMinorFormulaParent; //! Pointer to minor TreeFormula in Parent tree (if any) 00044 00045 public: 00046 TTreeIndex(); 00047 TTreeIndex(const TTree *T, const char *majorname, const char *minorname); 00048 virtual ~TTreeIndex(); 00049 virtual void Append(const TVirtualIndex *,Bool_t delaySort = kFALSE); 00050 virtual Int_t GetEntryNumberFriend(const TTree *T); 00051 virtual Long64_t GetEntryNumberWithIndex(Int_t major, Int_t minor) const; 00052 virtual Long64_t GetEntryNumberWithBestIndex(Int_t major, Int_t minor) const; 00053 virtual Long64_t *GetIndexValues() const {return fIndexValues;} 00054 virtual Long64_t *GetIndex() const {return fIndex;} 00055 const char *GetMajorName() const {return fMajorName.Data();} 00056 const char *GetMinorName() const {return fMinorName.Data();} 00057 virtual Long64_t GetN() const {return fN;} 00058 virtual TTreeFormula *GetMajorFormula(); 00059 virtual TTreeFormula *GetMinorFormula(); 00060 virtual TTreeFormula *GetMajorFormulaParent(const TTree *T); 00061 virtual TTreeFormula *GetMinorFormulaParent(const TTree *T); 00062 virtual void Print(Option_t *option="") const; 00063 virtual void UpdateFormulaLeaves(const TTree *parent); 00064 virtual void SetTree(const TTree *T); 00065 00066 ClassDef(TTreeIndex,1); //A Tree Index with majorname and minorname. 00067 }; 00068 00069 #endif 00070