#ifndef ROOT_TChainIndex
#define ROOT_TChainIndex
#ifndef ROOT_TVirtualIndex
#include "TVirtualIndex.h"
#endif
#include <vector>
class TTreeFormula;
class TChain;
class TChainIndex : public TVirtualIndex {
public:
class TChainIndexEntry {
public:
TChainIndexEntry() : fMinIndexValue(0), fMaxIndexValue(0), fTreeIndex(0) {}
Long64_t fMinIndexValue;
Long64_t fMaxIndexValue;
TVirtualIndex* fTreeIndex;
};
protected:
TString fMajorName;
TString fMinorName;
TTreeFormula *fMajorFormulaParent;
TTreeFormula *fMinorFormulaParent;
std::vector<TChainIndexEntry> fEntries;
std::pair<TVirtualIndex*, Int_t> GetSubTreeIndex(Int_t major, Int_t minor) const;
void ReleaseSubTreeIndex(TVirtualIndex* index, Int_t treeNo) const;
void DeleteIndices();
public:
TChainIndex();
TChainIndex(const TTree *T, const char *majorname, const char *minorname);
virtual ~TChainIndex();
virtual void Append(const TVirtualIndex *, Bool_t delaySort = kFALSE);
virtual Int_t GetEntryNumberFriend(const TTree *T);
virtual Long64_t GetEntryNumberWithIndex(Int_t major, Int_t minor) const;
virtual Long64_t GetEntryNumberWithBestIndex(Int_t major, Int_t minor) const;
const char *GetMajorName() const {return fMajorName.Data();}
const char *GetMinorName() const {return fMinorName.Data();}
virtual Long64_t GetN() const {return fEntries.size();}
virtual TTreeFormula *GetMajorFormulaParent(const TTree *T);
virtual TTreeFormula *GetMinorFormulaParent(const TTree *T);
virtual void UpdateFormulaLeaves(const TTree *parent);
virtual void SetTree(const TTree *T);
ClassDef(TChainIndex,1)
};
#endif