File indexing completed on 2025-01-18 10:11:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TChainIndex
0013 #define ROOT_TChainIndex
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #include "TVirtualIndex.h"
0032
0033 #include <vector>
0034 #include <utility>
0035
0036 class TTreeFormula;
0037 class TTreeIndex;
0038 class TChain;
0039
0040 class TChainIndex : public TVirtualIndex {
0041 public:
0042
0043 class TChainIndexEntry {
0044 void Swap(TChainIndexEntry &other);
0045
0046 public:
0047 TChainIndexEntry() : fMinIndexValue(0), fMinIndexValMinor(0),
0048 fMaxIndexValue(0), fMaxIndexValMinor(0),
0049 fTreeIndex(nullptr) {}
0050 TChainIndexEntry(const TChainIndexEntry &other);
0051 TChainIndexEntry &operator=(TChainIndexEntry other)
0052 {
0053 other.Swap(*this);
0054 return *this;
0055 }
0056 typedef std::pair<Long64_t, Long64_t> IndexValPair_t;
0057
0058 IndexValPair_t GetMinIndexValPair() const { return IndexValPair_t(fMinIndexValue, fMinIndexValMinor); }
0059 IndexValPair_t GetMaxIndexValPair() const { return IndexValPair_t(fMaxIndexValue, fMaxIndexValMinor); }
0060 void SetMinMaxFrom(const TTreeIndex *index );
0061
0062 Long64_t fMinIndexValue;
0063 Long64_t fMinIndexValMinor;
0064 Long64_t fMaxIndexValue;
0065 Long64_t fMaxIndexValMinor;
0066 TVirtualIndex* fTreeIndex;
0067
0068 };
0069 protected:
0070
0071 TString fMajorName;
0072 TString fMinorName;
0073 TTreeFormula *fMajorFormulaParent;
0074 TTreeFormula *fMinorFormulaParent;
0075 std::vector<TChainIndexEntry> fEntries;
0076
0077 std::pair<TVirtualIndex*, Int_t> GetSubTreeIndex(Long64_t major, Long64_t minor) const;
0078 void ReleaseSubTreeIndex(TVirtualIndex* index, Int_t treeNo) const;
0079 void DeleteIndices();
0080
0081 TTreeFormula *GetMajorFormulaParent(const TTree *parent);
0082 TTreeFormula *GetMinorFormulaParent(const TTree *parent);
0083
0084 public:
0085 TChainIndex();
0086 TChainIndex(const TTree *T, const char *majorname, const char *minorname);
0087 ~TChainIndex() override;
0088 void Append(const TVirtualIndex *, bool delaySort = false) override;
0089 Long64_t GetEntryNumberFriend(const TTree *parent) override;
0090 Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const override;
0091 Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const override;
0092 const char *GetMajorName() const override {return fMajorName.Data();}
0093 const char *GetMinorName() const override {return fMinorName.Data();}
0094 Long64_t GetN() const override {return fEntries.size();}
0095 bool IsValidFor(const TTree *parent) override;
0096 void UpdateFormulaLeaves(const TTree *parent) override;
0097 void SetTree(TTree *T) override;
0098 TObject *Clone(const char *newname = "") const override;
0099
0100 ClassDefOverride(TChainIndex,1)
0101 };
0102
0103 #endif