Logo ROOT  
Reference Guide
TChainIndex.h
Go to the documentation of this file.
1 // @(#)root/treeplayer:$Id$
2 // Author: Marek Biskup 07/06/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TChainIndex
13 #define ROOT_TChainIndex
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 //
18 // TChainIndex
19 //
20 // A Chain Index with majorname and minorname.
21 // It uses tree indices of all the trees in the chain instead of building
22 // a new index.
23 // The index values from the first tree should be less then
24 // all the index values from the second tree, and so on.
25 // If a tree in the chain doesn't have an index the index will be created
26 // and kept inside this chain index.
27 //
28 //////////////////////////////////////////////////////////////////////////
29 
30 
31 #include "TVirtualIndex.h"
32 
33 #include <vector>
34 #include <utility>
35 
36 class TTreeFormula;
37 class TTreeIndex;
38 class TChain;
39 
40 class TChainIndex : public TVirtualIndex {
41 
42 public:
44  // holds a description of indices of trees in the chain.
45  public:
48  fTreeIndex(0) {}
49 
50  typedef std::pair<Long64_t, Long64_t> IndexValPair_t;
51 
54  void SetMinMaxFrom(const TTreeIndex *index );
55 
56  Long64_t fMinIndexValue; // the minimum value of the index (upper bits)
57  Long64_t fMinIndexValMinor; // the minimum value of the index (lower bits)
58  Long64_t fMaxIndexValue; // the maximum value of the index (upper bits)
59  Long64_t fMaxIndexValMinor; // the maximum value of the index (lower bits)
60  TVirtualIndex* fTreeIndex; // the tree index in case it was created in the constructor,
61  // otherwise 0
62  };
63 protected:
64 
65  TString fMajorName; // Index major name
66  TString fMinorName; // Index minor name
67  TTreeFormula *fMajorFormulaParent; //! Pointer to major TreeFormula in Parent tree (if any)
68  TTreeFormula *fMinorFormulaParent; //! Pointer to minor TreeFormula in Parent tree (if any)
69  std::vector<TChainIndexEntry> fEntries; // descriptions of indices of trees in the chain.
70 
71  std::pair<TVirtualIndex*, Int_t> GetSubTreeIndex(Long64_t major, Long64_t minor) const;
72  void ReleaseSubTreeIndex(TVirtualIndex* index, Int_t treeNo) const;
73  void DeleteIndices();
74 
77 
78 public:
79  TChainIndex();
80  TChainIndex(const TTree *T, const char *majorname, const char *minorname);
81  virtual ~TChainIndex();
82  virtual void Append(const TVirtualIndex *, Bool_t delaySort = kFALSE);
83  virtual Long64_t GetEntryNumberFriend(const TTree *parent);
84  virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const;
85  virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const;
86  const char *GetMajorName() const {return fMajorName.Data();}
87  const char *GetMinorName() const {return fMinorName.Data();}
88  virtual Long64_t GetN() const {return fEntries.size();}
89  virtual Bool_t IsValidFor(const TTree *parent);
90  virtual void UpdateFormulaLeaves(const TTree *parent);
91  virtual void SetTree(const TTree *T);
92 
93  ClassDef(TChainIndex,1) //A Tree Index with majorname and minorname.
94 };
95 
96 #endif
97 
TChainIndex::DeleteIndices
void DeleteIndices()
Delete all the indices which were built by this object.
Definition: TChainIndex.cxx:167
TChainIndex::GetSubTreeIndex
std::pair< TVirtualIndex *, Int_t > GetSubTreeIndex(Long64_t major, Long64_t minor) const
Returns a TVirtualIndex for a tree which holds the entry with the specified major and minor values an...
Definition: TChainIndex.cxx:196
TChainIndex::IsValidFor
virtual Bool_t IsValidFor(const TTree *parent)
Return kTRUE if index can be applied to the TTree.
Definition: TChainIndex.cxx:370
TChainIndex::TChainIndexEntry
Definition: TChainIndex.h:43
TChainIndex
Definition: TChainIndex.h:40
TChainIndex::TChainIndexEntry::GetMinIndexValPair
IndexValPair_t GetMinIndexValPair() const
Definition: TChainIndex.h:52
TVirtualIndex
Definition: TVirtualIndex.h:30
TString::Data
const char * Data() const
Definition: TString.h:369
TChainIndex::GetEntryNumberWithBestIndex
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
See TTreeIndex::GetEntryNumberWithBestIndex for details.
Definition: TChainIndex.cxx:290
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TChainIndex::TChainIndexEntry::fMinIndexValMinor
Long64_t fMinIndexValMinor
Definition: TChainIndex.h:57
TTree
Definition: TTree.h:79
TChainIndex::~TChainIndex
virtual ~TChainIndex()
The destructor.
Definition: TChainIndex.cxx:183
TChainIndex::GetEntryNumberFriend
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
See TTreeIndex::GetEntryNumberFriend for description.
Definition: TChainIndex.cxx:258
TChainIndex::fMinorName
TString fMinorName
Definition: TChainIndex.h:66
TChainIndex::TChainIndexEntry::fTreeIndex
TVirtualIndex * fTreeIndex
Definition: TChainIndex.h:60
TChainIndex::TChainIndexEntry::IndexValPair_t
std::pair< Long64_t, Long64_t > IndexValPair_t
Definition: TChainIndex.h:50
TChainIndex::GetMinorName
const char * GetMinorName() const
Definition: TChainIndex.h:87
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
TChainIndex::SetTree
virtual void SetTree(const TTree *T)
See TTreeIndex::SetTree.
Definition: TChainIndex.cxx:402
TChainIndex::GetMinorFormulaParent
TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree T.
Definition: TChainIndex.cxx:350
TChainIndex::GetMajorName
const char * GetMajorName() const
Definition: TChainIndex.h:86
TChainIndex::TChainIndexEntry::fMinIndexValue
Long64_t fMinIndexValue
Definition: TChainIndex.h:56
TChainIndex::fMajorFormulaParent
TTreeFormula * fMajorFormulaParent
Definition: TChainIndex.h:67
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TVirtualIndex.h
TChainIndex::TChainIndexEntry::fMaxIndexValue
Long64_t fMaxIndexValue
Definition: TChainIndex.h:58
TTreeFormula
Definition: TTreeFormula.h:58
TChainIndex::fEntries
std::vector< TChainIndexEntry > fEntries
Pointer to minor TreeFormula in Parent tree (if any)
Definition: TChainIndex.h:69
TChainIndex::ReleaseSubTreeIndex
void ReleaseSubTreeIndex(TVirtualIndex *index, Int_t treeNo) const
Releases the tree index got using GetSubTreeIndex.
Definition: TChainIndex.cxx:247
TChainIndex::Append
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Add an index to this chain.
Definition: TChainIndex.cxx:137
TTreeIndex
Definition: TTreeIndex.h:29
TChainIndex::TChainIndexEntry::TChainIndexEntry
TChainIndexEntry()
Definition: TChainIndex.h:46
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TChainIndex::GetEntryNumberWithIndex
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Returns the entry number with given index values.
Definition: TChainIndex.cxx:310
TChainIndex::TChainIndexEntry::GetMaxIndexValPair
IndexValPair_t GetMaxIndexValPair() const
Definition: TChainIndex.h:53
TChainIndex::UpdateFormulaLeaves
virtual void UpdateFormulaLeaves(const TTree *parent)
Updates the parent formulae.
Definition: TChainIndex.cxx:384
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:52
TChain
Definition: TChain.h:33
TChainIndex::TChainIndex
TChainIndex()
Default constructor for TChainIndex.
Definition: TChainIndex.cxx:47
TChainIndex::fMajorName
TString fMajorName
Definition: TChainIndex.h:65
TChainIndex::GetMajorFormulaParent
TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree T.
Definition: TChainIndex.cxx:333
TChainIndex::fMinorFormulaParent
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
Definition: TChainIndex.h:68
TChainIndex::TChainIndexEntry::SetMinMaxFrom
void SetMinMaxFrom(const TTreeIndex *index)
Definition: TChainIndex.cxx:34
TChainIndex::GetN
virtual Long64_t GetN() const
Definition: TChainIndex.h:88
TChainIndex::TChainIndexEntry::fMaxIndexValMinor
Long64_t fMaxIndexValMinor
Definition: TChainIndex.h:59
int