00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef ROOT_TChainIndex
00013 #define ROOT_TChainIndex
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef ROOT_TVirtualIndex
00032 #include "TVirtualIndex.h"
00033 #endif
00034 
00035 #include <vector>
00036 
00037 class TTreeFormula;
00038 class TChain;
00039 
00040 class TChainIndex : public TVirtualIndex {
00041 
00042 public:
00043    class TChainIndexEntry {
00044       
00045    public:
00046       TChainIndexEntry() : fMinIndexValue(0), fMaxIndexValue(0), fTreeIndex(0) {}
00047 
00048       Long64_t    fMinIndexValue;           
00049       Long64_t    fMaxIndexValue;           
00050       TVirtualIndex* fTreeIndex;            
00051                                             
00052    };
00053 protected:
00054 
00055    TString        fMajorName;               
00056    TString        fMinorName;               
00057    TTreeFormula  *fMajorFormulaParent;      
00058    TTreeFormula  *fMinorFormulaParent;      
00059    std::vector<TChainIndexEntry> fEntries; 
00060 
00061    std::pair<TVirtualIndex*, Int_t> GetSubTreeIndex(Int_t major, Int_t minor) const;
00062    void ReleaseSubTreeIndex(TVirtualIndex* index, Int_t treeNo) const;
00063    void DeleteIndices();
00064 
00065 public:
00066    TChainIndex();
00067    TChainIndex(const TTree *T, const char *majorname, const char *minorname);
00068    virtual               ~TChainIndex();
00069    virtual void           Append(const TVirtualIndex *, Bool_t delaySort = kFALSE);
00070    virtual Int_t          GetEntryNumberFriend(const TTree *T);
00071    virtual Long64_t       GetEntryNumberWithIndex(Int_t major, Int_t minor) const;
00072    virtual Long64_t       GetEntryNumberWithBestIndex(Int_t major, Int_t minor) const;
00073    const char            *GetMajorName()    const {return fMajorName.Data();}
00074    const char            *GetMinorName()    const {return fMinorName.Data();}
00075    virtual Long64_t       GetN()            const {return fEntries.size();}
00076    virtual TTreeFormula  *GetMajorFormulaParent(const TTree *T);
00077    virtual TTreeFormula  *GetMinorFormulaParent(const TTree *T);
00078    virtual void           UpdateFormulaLeaves(const TTree *parent);
00079    virtual void           SetTree(const TTree *T);
00080 
00081    ClassDef(TChainIndex,1)  
00082 };
00083 
00084 #endif
00085