class TTreeIndex: public TVirtualIndex


A Tree Index with majorname and minorname.


Function Members (Methods)

public:
TTreeIndex()
TTreeIndex(const TTreeIndex&)
TTreeIndex(const TTree* T, const char* majorname, const char* minorname)
virtual~TTreeIndex()
voidTObject::AbstractMethod(const char* method) const
virtual voidAppend(const TVirtualIndex*, Bool_t delaySort = kFALSE)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetEntryNumberFriend(const TTree* T)
virtual Long64_tGetEntryNumberWithBestIndex(Int_t major, Int_t minor) const
virtual Long64_tGetEntryNumberWithIndex(Int_t major, Int_t minor) const
virtual const char*TObject::GetIconName() const
virtual Long64_t*GetIndex() const
virtual Long64_t*GetIndexValues() const
virtual TTreeFormula*GetMajorFormula()
virtual TTreeFormula*GetMajorFormulaParent(const TTree* T)
virtual const char*GetMajorName() const
virtual TTreeFormula*GetMinorFormula()
virtual TTreeFormula*GetMinorFormulaParent(const TTree* T)
virtual const char*GetMinorName() const
virtual Long64_tGetN() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual TTree*TVirtualIndex::GetTree() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TTreeIndex&operator=(const TTreeIndex&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidSetTree(const TTree* T)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidUpdateFormulaLeaves(const TTree* parent)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
Long64_t*fIndex[fN] Index of sorted values
Long64_t*fIndexValues[fN] Sorted index values
TTreeFormula*fMajorFormula! Pointer to major TreeFormula
TTreeFormula*fMajorFormulaParent! Pointer to major TreeFormula in Parent tree (if any)
TStringfMajorNameIndex major name
TTreeFormula*fMinorFormula! Pointer to minor TreeFormula
TTreeFormula*fMinorFormulaParent! Pointer to minor TreeFormula in Parent tree (if any)
TStringfMinorNameIndex minor name
Long64_tfNNumber of entries
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
TTree*TVirtualIndex::fTree! pointer to Tree

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TTreeIndex(const TTreeIndex& )
 Default constructor for TTreeIndex
TTreeIndex(const TTree* T, const char* majorname, const char* minorname)
 Normal constructor for TTreeIndex

 Build an index table using the leaves of Tree T with  major & minor names
 The index is built with the expressions given in "majorname" and "minorname".

 a Long64_t array fIndexValues is built with:
    major = the value of majorname converted to an integer
    minor = the value of minorname converted to an integer
    fIndexValues[i] = major<<31 + minor
 This array is sorted. The sorted fIndex[i] contains the serial number
 in the Tree corresponding to the pair "major,minor" in fIndexvalues[i].

  Once the index is computed, one can retrieve one entry via
    T->GetEntryWithIndex(majornumber, minornumber)
 Example:
  tree.BuildIndex("Run","Event"); //creates an index using leaves Run and Event
  tree.GetEntryWithIndex(1234,56789); //reads entry corresponding to
                                        Run=1234 and Event=56789

 Note that majorname and minorname may be expressions using original
 Tree variables eg: "run-90000", "event +3*xx". However the result
 must be integer.
 In case an expression is specified, the equivalent expression must be computed
 when calling GetEntryWithIndex.

 To build an index with only majorname, specify minorname="0" (default)

    TreeIndex and Friend Trees

 Assuming a parent Tree T and a friend Tree TF, the following cases are supported:
 CASE 1: T->GetEntry(entry) is called
         In this case, the serial number entry is used to retrieve
         the data in both Trees.
 CASE 2: T->GetEntry(entry) is called, TF has a TreeIndex
         the expressions given in major/minorname of TF are used
         to compute the value pair major,minor with the data in T.
         TF->GetEntryWithIndex(major,minor) is then called (tricky case!)
 CASE 3: T->GetEntryWithIndex(major,minor) is called.
         It is assumed that both T and TF have a TreeIndex built using
         the same major and minor name.

    Saving the TreeIndex

 Once the index is built, it can be saved with the TTree object
 with tree.Write(); (if the file has been open in "update" mode).

 The most convenient place to create the index is at the end of
 the filling process just before saving the Tree header.
 If a previous index was computed, it is redefined by this new call.

 Note that this function can also be applied to a TChain.

 The return value is the number of entries in the Index (< 0 indicates failure)

 It is possible to play with different TreeIndex in the same Tree.
 see comments in TTree::SetTreeIndex.
~TTreeIndex()
 Destructor.
void Append(const TVirtualIndex* , Bool_t delaySort = kFALSE)
 Append 'add' to this index.  Entry 0 in add will become entry n+1 in this.
 If delaySort is true, do not sort the value, then you must call
 Append(0,kFALSE);
Int_t GetEntryNumberFriend(const TTree* T)
 returns the entry number in this friend Tree corresponding to entry in
 the master Tree T.
 In case this friend Tree and T do not share an index with the same
 major and minor name, the entry serial number in the friend tree
 and in the master Tree are assumed to be the same
Long64_t GetEntryNumberWithBestIndex(Int_t major, Int_t minor) const
 Return entry number corresponding to major and minor number
 Note that this function returns only the entry number, not the data
 To read the data corresponding to an entry number, use TTree::GetEntryWithIndex
 the BuildIndex function has created a table of Double_t* of sorted values
 corresponding to val = major<<31 + minor;
 The function performs binary search in this sorted table.
 If it finds a pair that maches val, it returns directly the
 index in the table.
 If an entry corresponding to major and minor is not found, the function
 returns the index of the major,minor pair immediatly lower than the
 requested value, ie it will return -1 if the pair is lower than
 the first entry in the index.

 See also GetEntryNumberWithIndex
Long64_t GetEntryNumberWithIndex(Int_t major, Int_t minor) const
 Return entry number corresponding to major and minor number
 Note that this function returns only the entry number, not the data
 To read the data corresponding to an entry number, use TTree::GetEntryWithIndex
 the BuildIndex function has created a table of Double_t* of sorted values
 corresponding to val = major<<31 + minor;
 The function performs binary search in this sorted table.
 If it finds a pair that maches val, it returns directly the
 index in the table, otherwise it returns -1.

 See also GetEntryNumberWithBestIndex
TTreeFormula * GetMajorFormula()
 return a pointer to the TreeFormula corresponding to the majorname
TTreeFormula * GetMinorFormula()
 return a pointer to the TreeFormula corresponding to the minorname
TTreeFormula * GetMajorFormulaParent(const TTree* T)
 return a pointer to the TreeFormula corresponding to the majorname in parent tree T
TTreeFormula * GetMinorFormulaParent(const TTree* T)
 return a pointer to the TreeFormula corresponding to the minorname in parent tree T
void Print(Option_t* option = "") const
 print the table with : serial number, majorname, minorname
 if option = "10" print only the first 10 entries
 if option = "100" print only the first 100 entries
 if option = "1000" print only the first 1000 entries
void Streamer(TBuffer& b)
 Stream an object of class TTreeIndex.
 Note that this Streamer should be changed to an automatic Streamer
 once TStreamerInfo supports an index of type Long64_t
void UpdateFormulaLeaves(const TTree* parent)
 Called by TChain::LoadTree when the parent chain changes it's tree.
void SetTree(const TTree* T)
 this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves
 when a new Tree is loaded.
 Because Trees in a TChain may have a different list of leaves, one
 must update the leaves numbers in the TTreeFormula used by the TreeIndex.
TTreeIndex(const TTreeIndex& )
Long64_t * GetIndexValues()
{return fIndexValues;}
Long64_t * GetIndex()
{return fIndex;}
const char * GetMajorName()
{return fMajorName.Data();}
const char * GetMinorName()
{return fMinorName.Data();}
Long64_t GetN()
{return fN;}

Author: Rene Brun 05/07/2004
Last change: root/treeplayer:$Id: TTreeIndex.h 20882 2007-11-19 11:31:26Z rdm $
Last generated: 2008-06-25 08:54
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.