Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27class TTreeFormula;
28
29class TTreeIndex : public TVirtualIndex {
30protected:
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
44
45private:
46 TTreeIndex(const TTreeIndex&) = delete; // Not implemented.
47 TTreeIndex &operator=(const TTreeIndex&) = delete; // Not implemented.
48
49public:
50 TTreeIndex();
51 TTreeIndex(const TTree *T, const char *majorname, const char *minorname);
52 ~TTreeIndex() override;
53 void Append(const TVirtualIndex *,bool delaySort = false) override;
54 bool ConvertOldToNew();
55 Long64_t FindValues(Long64_t major, Long64_t minor) const;
56 Long64_t GetEntryNumberFriend(const TTree *parent) override;
57 Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const override;
58 Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const override;
59 virtual Long64_t *GetIndex() const {return fIndex;}
60 virtual Long64_t *GetIndexValues() const {return fIndexValues;}
61 virtual Long64_t *GetIndexValuesMinor() const;
62 const char *GetMajorName() const override {return fMajorName.Data();}
63 const char *GetMinorName() const override {return fMinorName.Data();}
64 Long64_t GetN() const override {return fN;}
67 bool IsValidFor(const TTree *parent) override;
68 void Print(Option_t *option="") const override;
69 void UpdateFormulaLeaves(const TTree *parent) override;
70 void SetTree(TTree *T) override;
71 TObject *Clone(const char *newname = "") const override;
72
73 ClassDefOverride(TTreeIndex,2); //A Tree Index with majorname and minorname.
74};
75
76#endif
77
long long Long64_t
Definition RtypesCore.h:69
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Used to pass a selection expression to the Tree drawing routine.
A Tree Index with majorname and minorname.
Definition TTreeIndex.h:29
TTreeIndex()
Default constructor for TTreeIndex.
virtual Long64_t * GetIndexValues() const
Definition TTreeIndex.h:60
virtual Long64_t * GetIndexValuesMinor() const
TTreeFormula * fMajorFormula
! Pointer to major TreeFormula
Definition TTreeIndex.h:37
TTreeFormula * fMajorFormulaParent
! Pointer to major TreeFormula in Parent tree (if any)
Definition TTreeIndex.h:39
Long64_t * fIndex
[fN] Index of sorted values
Definition TTreeIndex.h:36
Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const override
Return entry number corresponding to major and minor number.
TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
void SetTree(TTree *T) override
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
bool IsValidFor(const TTree *parent) override
Return true if index can be applied to the TTree.
Long64_t fN
Number of entries.
Definition TTreeIndex.h:33
virtual Long64_t * GetIndex() const
Definition TTreeIndex.h:59
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
TTreeFormula * fMinorFormula
! Pointer to minor TreeFormula
Definition TTreeIndex.h:38
void Append(const TVirtualIndex *, bool delaySort=false) override
Append 'add' to this index.
const char * GetMajorName() const override
Definition TTreeIndex.h:62
void UpdateFormulaLeaves(const TTree *parent) override
Called by TChain::LoadTree when the parent chain changes it's tree.
virtual TTreeFormula * GetMajorFormula()
Return a pointer to the TreeFormula corresponding to the majorname.
TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const override
Return entry number corresponding to major and minor number.
TObject * Clone(const char *newname="") const override
Create a deep copy of the TTreeIndex.
Long64_t GetEntryNumberFriend(const TTree *parent) override
Returns the entry number in this (friend) Tree corresponding to entry in the master Tree 'parent'.
Long64_t GetN() const override
Definition TTreeIndex.h:64
TString fMinorName
Index minor name.
Definition TTreeIndex.h:32
void Print(Option_t *option="") const override
Print the table with : serial number, majorname, minorname.
virtual TTreeFormula * GetMinorFormula()
Return a pointer to the TreeFormula corresponding to the minorname.
TTreeIndex(const TTreeIndex &)=delete
Long64_t * fIndexValues
[fN] Sorted index values, higher 64bits
Definition TTreeIndex.h:34
TString fMajorName
Index major name.
Definition TTreeIndex.h:31
Long64_t * fIndexValuesMinor
[fN] Sorted index values, lower 64bits
Definition TTreeIndex.h:35
~TTreeIndex() override
Destructor.
TTreeIndex & operator=(const TTreeIndex &)=delete
TTreeFormula * fMinorFormulaParent
! Pointer to minor TreeFormula in Parent tree (if any)
Definition TTreeIndex.h:40
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...
const char * GetMinorName() const override
Definition TTreeIndex.h:63
A TTree represents a columnar dataset.
Definition TTree.h:79
Abstract interface for Tree Index.