Logo ROOT   6.10/09
Reference Guide
TTreeIndex.h
Go to the documentation of this file.
1 // @(#)root/treeplayer:$Id$
2 // Author: Rene Brun 05/07/2004
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_TTreeIndex
13 #define ROOT_TTreeIndex
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TTreeIndex //
19 // //
20 // A Tree Index with majorname and minorname. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #include "TVirtualIndex.h"
26 #include "TTreeFormula.h"
27 
28 class TTreeIndex : public TVirtualIndex {
29 
30 protected:
31  TString fMajorName; // Index major name
32  TString fMinorName; // Index minor name
33  Long64_t fN; // Number of entries
34  Long64_t *fIndexValues; //[fN] Sorted index values, higher 64bits
35  Long64_t *fIndexValuesMinor; //[fN] Sorted index values, lower 64bits
36  Long64_t *fIndex; //[fN] Index of sorted values
37  TTreeFormula *fMajorFormula; //! Pointer to major TreeFormula
38  TTreeFormula *fMinorFormula; //! Pointer to minor TreeFormula
39  TTreeFormula *fMajorFormulaParent; //! Pointer to major TreeFormula in Parent tree (if any)
40  TTreeFormula *fMinorFormulaParent; //! Pointer to minor TreeFormula in Parent tree (if any)
41 
42 private:
43  TTreeIndex(const TTreeIndex&); // Not implemented.
44  TTreeIndex &operator=(const TTreeIndex&); // Not implemented.
45 
46 public:
47  TTreeIndex();
48  TTreeIndex(const TTree *T, const char *majorname, const char *minorname);
49  virtual ~TTreeIndex();
50  virtual void Append(const TVirtualIndex *,Bool_t delaySort = kFALSE);
51  bool ConvertOldToNew();
52  Long64_t FindValues(Long64_t major, Long64_t minor) const;
53  virtual Long64_t GetEntryNumberFriend(const TTree *parent);
54  virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const;
55  virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const;
56  virtual Long64_t *GetIndex() const {return fIndex;}
57  virtual Long64_t *GetIndexValues() const {return fIndexValues;}
58  virtual Long64_t *GetIndexValuesMinor() const;
59  const char *GetMajorName() const {return fMajorName.Data();}
60  const char *GetMinorName() const {return fMinorName.Data();}
61  virtual Long64_t GetN() const {return fN;}
62  virtual TTreeFormula *GetMajorFormula();
63  virtual TTreeFormula *GetMinorFormula();
64  virtual TTreeFormula *GetMajorFormulaParent(const TTree *parent);
65  virtual TTreeFormula *GetMinorFormulaParent(const TTree *parent);
66  virtual void Print(Option_t *option="") const;
67  virtual void UpdateFormulaLeaves(const TTree *parent);
68  virtual void SetTree(const TTree *T);
69 
70  ClassDef(TTreeIndex,2); //A Tree Index with majorname and minorname.
71 };
72 
73 #endif
74 
TString fMinorName
Definition: TTreeIndex.h:32
long long Long64_t
Definition: RtypesCore.h:69
virtual TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
Definition: TTreeIndex.cxx:480
Abstract interface for Tree Index.
Definition: TVirtualIndex.h:29
virtual Long64_t GetN() const
Definition: TTreeIndex.h:61
TTreeIndex & operator=(const TTreeIndex &)
const char Option_t
Definition: RtypesCore.h:62
TString fMajorName
Definition: TTreeIndex.h:31
double T(double x)
Definition: ChebyshevPol.h:34
virtual void UpdateFormulaLeaves(const TTree *parent)
Called by TChain::LoadTree when the parent chain changes it's tree.
Definition: TTreeIndex.cxx:580
Long64_t * fIndexValuesMinor
Definition: TTreeIndex.h:35
Basic string class.
Definition: TString.h:129
const char * GetMinorName() const
Definition: TTreeIndex.h:60
TTreeFormula * fMajorFormulaParent
Pointer to minor TreeFormula.
Definition: TTreeIndex.h:39
bool Bool_t
Definition: RtypesCore.h:59
A Tree Index with majorname and minorname.
Definition: TTreeIndex.h:28
const char * GetMajorName() const
Definition: TTreeIndex.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:297
Long64_t fN
Definition: TTreeIndex.h:33
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
virtual Long64_t * GetIndexValuesMinor() const
Definition: TTreeIndex.cxx:427
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
Definition: TTreeIndex.h:40
virtual TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
Definition: TTreeIndex.cxx:461
Long64_t * fIndex
Definition: TTreeIndex.h:36
virtual Long64_t * GetIndex() const
Definition: TTreeIndex.h:56
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
Returns the entry number in this (friend) Tree corresponding to entry in the master Tree 'parent'...
Definition: TTreeIndex.cxx:319
virtual Long64_t * GetIndexValues() const
Definition: TTreeIndex.h:57
virtual void Print(Option_t *option="") const
Print the table with : serial number, majorname, minorname.
Definition: TTreeIndex.cxx:503
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
Definition: TTreeIndex.cxx:389
virtual TTreeFormula * GetMajorFormula()
Return a pointer to the TreeFormula corresponding to the majorname.
Definition: TTreeIndex.cxx:437
virtual ~TTreeIndex()
Destructor.
Definition: TTreeIndex.cxx:199
const Bool_t kFALSE
Definition: RtypesCore.h:92
virtual void SetTree(const TTree *T)
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
Definition: TTreeIndex.cxx:599
virtual TTreeFormula * GetMinorFormula()
Return a pointer to the TreeFormula corresponding to the minorname.
Definition: TTreeIndex.cxx:449
Long64_t FindValues(Long64_t major, Long64_t minor) const
find position where major|minor values are in the IndexValues tables this is the index in IndexValues...
Definition: TTreeIndex.cxx:354
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
Definition: TTreeIndex.cxx:297
Long64_t * fIndexValues
Definition: TTreeIndex.h:34
TTreeFormula * fMajorFormula
Definition: TTreeIndex.h:37
A TTree object has a header with a name and a title.
Definition: TTree.h:78
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
Definition: TTreeIndex.cxx:414
TTreeIndex()
Default constructor for TTreeIndex.
Definition: TTreeIndex.cxx:46
TTreeFormula * fMinorFormula
Pointer to major TreeFormula.
Definition: TTreeIndex.h:38
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Append 'add' to this index.
Definition: TTreeIndex.cxx:216
const char * Data() const
Definition: TString.h:347