ROOT » TREE » TREE » TEntryListArray

class TEntryListArray: public TEntryList


TEntryListArray: a list of entries and subentries in a TTree or TChain

TEntryListArray is an extension of TEntryList, used to hold selected entries and subentries (sublists) for when the user has a TTree with containers (vectors, arrays, ...).

Usage with TTree::Draw to select entries and subentries

  1. To fill a list elist :
         tree->Draw(">> elist", "x > 0", "entrylistarray");
        
  2. To use a list to select entries and subentries:
         tree->SetEntryList(elist);
         tree->Draw("y");
         tree->Draw("z");
      
Its main purpose is to improve the performance of a code that needs to apply complex cuts on TTree::Draw multiple times. After the first call above to TTree::Draw, a TEntryListArray is created and filled with the entries and the indices of the arrays that satisfied the selection cut (x > 0). In the subsequent calls to TTree::Draw, only these entries / subentries are used to fill histograms.

About the class

The class derives from TEntryList and can be used basically in the same way. This same class is used to keep entries and subentries, so there are two types of TEntryListArray's:
  1. The ones that only hold subentries
    • fEntry is set to the entry# for which the subentries correspond
    • fSubLists must be 0
  2. The ones that hold entries and eventually lists with subentries in fSubLists.
    • fEntry = -1 for those
    • If there are no sublists for a given entry, all the subentries will be used in the selection

Additions with respect to TEntryList

  1. Data members:
    • fSubLists: a container to hold the sublists
    • fEntry: the entry number if the list is used to hold subentries
    • fLastSubListQueried and fSubListIter: a pointer to the last sublist queried and an iterator to resume the loop from the last sublist queried (to speed up selection and insertion in TTree::Draw)
  2. Public methods:
    • Contains, Enter and Remove with subentry as argument
    • GetSubListForEntry: to return the sublist corresponding to the given entry
  3. Protected methods:
    • AddEntriesAndSubLists: called by Add when adding two TEntryList arrays with sublists
    • ConvertToTEntryListArray: convert TEntryList to TEntryListArray
    • RemoveSubList: to remove the given sublist
    • RemoveSubListForEntry: to remove the sublist corresponding to the given entry
    • SetEntry: to get / set a sublist for the given entry
 

Function Members (Methods)

public:
virtual~TEntryListArray()
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(const TEntryList* elist)
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 Int_tContains(Long64_t entry, TTree* tree = 0)
virtual Int_tContains(Long64_t entry, TTree* tree, Long64_t subentry)
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual voidTEntryList::DirectoryAutoAdd(TDirectory*)
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 Bool_tEnter(Long64_t entry, TTree* tree = 0)
virtual Bool_tEnter(Long64_t entry, TTree* tree, Long64_t subentry)
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 TEntryList*TEntryList::GetCurrentList() const
virtual TDirectory*TEntryList::GetDirectory() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Long64_tTEntryList::GetEntriesToProcess() const
virtual Long64_tTEntryList::GetEntry(Int_t index)
virtual Long64_tTEntryList::GetEntryAndTree(Int_t index, Int_t& treenum)
virtual TEntryList*TEntryList::GetEntryList(const char* treename, const char* filename, Option_t* opt = "")
virtual const char*TEntryList::GetFileName() const
virtual const char*TObject::GetIconName() const
virtual TList*TEntryList::GetLists() const
virtual Long64_tTEntryList::GetN() 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 Bool_tTEntryList::GetReapplyCut() const
virtual TEntryListArray*GetSubListForEntry(Long64_t entry, TTree* tree = 0)
virtual TList*GetSubLists() const
virtual const char*TNamed::GetTitle() const
virtual const char*TEntryList::GetTreeName() const
virtual Int_tTEntryList::GetTreeNumber() 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 Int_tTEntryList::Merge(TCollection* list)
virtual Long64_tTEntryList::Next()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
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)
virtual voidTEntryList::OptimizeStorage()
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(const Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
static Int_tTEntryList::Relocate(const char* fn, const char* newroot, const char* oldroot = 0, const char* enlnm = 0)
virtual Int_tTEntryList::RelocatePaths(const char* newloc, const char* oldloc = 0)
virtual Bool_tRemove(Long64_t entry, TTree* tree = 0)
virtual Bool_tRemove(Long64_t entry, TTree* tree, Long64_t subentry)
virtual voidReset()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
static Int_tTEntryList::Scan(const char* fn, TList* roots)
virtual Int_tTEntryList::ScanPaths(TList* roots, Bool_t notify = kTRUE)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTEntryList::SetDirectory(TDirectory* dir)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTEntryList::SetEntriesToProcess(Long64_t nen)
virtual voidTEntryList::SetFileName(const char* filename)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTEntryList::SetReapplyCut(Bool_t apply = kFALSE)TOGGLE GETTER
virtual voidTEntryList::SetShift(Bool_t shift)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidSetTree(const TTree* tree)
virtual voidSetTree(const char* treename, const char* filename)
virtual voidTEntryList::SetTreeName(const char* treename)
virtual voidTEntryList::SetTreeNumber(Int_t index)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidSubtract(const TEntryList* elist)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TEntryListArray()
TEntryListArray(const TTree* tree)
TEntryListArray(const TEntryListArray& elist)
TEntryListArray(const TEntryList& elist)
TEntryListArray(const char* name, const char* title)
TEntryListArray(const char* name, const char* title, const TTree* tree)
TEntryListArray(const char* name, const char* title, const char* treename, const char* filename)
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
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 voidAddEntriesAndSubLists(const TEntryList* elist)
virtual voidConvertToTEntryListArray(TEntryList* e)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTEntryList::GetFileName(const char* filename, TString& fn, Bool_t* = 0)
voidInit()
voidTObject::MakeZombie()
virtual Bool_tRemoveSubList(TEntryListArray* e, TTree* tree = 0)
virtual Bool_tRemoveSubListForEntry(Long64_t entry, TTree* tree = 0)
virtual TEntryListArray*SetEntry(Long64_t entry, TTree* tree = 0)

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TEntryList::(anonymous)TEntryList::kBlockSize
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
TObjArray*TEntryList::fBlocksblocks with indices of passing events (TEntryListBlocks)
TEntryList*TEntryList::fCurrent! currently filled entry list
TDirectory*TEntryList::fDirectory! Pointer to directory holding this tree
Long64_tTEntryList::fEntriesToProcessused on proof to set the number of entries to process in a packet
Long64_tfEntrythe entry number, when the list is used for subentries
TStringTEntryList::fFileNamename of the file, where the tree is
Long64_tTEntryList::fLastIndexQueried! used to optimize GetEntry() function from a loop
Long64_tTEntryList::fLastIndexReturned! used to optimize GetEntry() function from a loop
TEntryListArray*fLastSubListQueried! last sublist checked by GetSubListForEntry
TList*TEntryList::fListsa list of underlying entry lists for each tree of a chain
Long64_tTEntryList::fNnumber of entries in the list
Int_tTEntryList::fNBlocksnumber of TEntryListBlocks
TStringTNamed::fNameobject identifier
Bool_tTEntryList::fReapplyIf true, TTree::Draw will 'reapply' the original cut
Bool_tTEntryList::fShift! true when some sub-lists don't correspond to trees
ULong_tTEntryList::fStringHash! Hash value of a string of treename and filename
TIter*fSubListIter! to iterate over fSubLists and keep last one checked
TList*fSubListsa list of underlying entry lists for each event of a TEntryList
TStringTNamed::fTitleobject title
TStringTEntryList::fTreeNamename of the tree
Int_tTEntryList::fTreeNumber! the index of the tree in the chain (used when the entry

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void Init()
 Initialize data members, called by Reset
TEntryListArray()
default c-tor
TEntryListArray(const char* name, const char* title)
c-tor with name and title
TEntryListArray(const char* name, const char* title, const TTree* tree)
constructor with name and title, which also sets the tree
TEntryListArray(const char* name, const char* title, const char* treename, const char* filename)
c-tor with name and title, which also sets the treename and the filename
TEntryListArray(const TTree* tree)
c-tor, which sets the tree
TEntryListArray(const TEntryListArray& elist)
copy c-tor
TEntryListArray(const TEntryList& elist)
c-tor, from TEntryList
~TEntryListArray()
 d-tor
void Add(const TEntryList* elist)
Add 2 entry lists
void AddEntriesAndSubLists(const TEntryList* elist)
 The method that really adds two entry lists with sublists
 If lists are splitted (fLists != 0), look for the ones whose trees match and call the method for those lists.
 Add first the sublists, and then use TEntryList::Add to deal with the entries
Int_t Contains(Long64_t entry, TTree* tree, Long64_t subentry)
When tree = 0, returns from the current list
When tree != 0, finds the list corresponding to this tree
When tree is a chain, the entry is assumed to be global index and the local
entry is recomputed from the treeoffset information of the chain
void ConvertToTEntryListArray(TEntryList* e)
 Create a TEntryListArray based on the given TEntryList
 Called by SetTree when the given list is added to fLists
 Replace it by a TEntryListArray and delete the given list
Bool_t Enter(Long64_t entry, TTree* tree, Long64_t subentry)
Add entry #entry (, #subentry) to the list
When tree = 0, adds to the current list
When tree != 0, finds the list corresponding to this tree (or add a new one)
When tree is a chain, the entry is assumed to be global index and the local
entry is recomputed from the treeoffset information of the chain
TEntryListArray* GetSubListForEntry(Long64_t entry, TTree* tree = 0)
 Return the list holding the subentries for the given entry or 0
void Print(const Option_t* option = "") const
Print this list
option = "" - default - print the name of the tree and file
option = "all" - print all the entry numbers
option = "subentries" - print all the entry numbers and associated subentries
Bool_t Remove(Long64_t entry, TTree* tree, Long64_t subentry)
Remove entry #entry (, #subentry)  from the list
When tree = 0, removes from the current list
When tree != 0, finds the list, corresponding to this tree
When tree is a chain, the entry is assumed to be global index and the local
entry is recomputed from the treeoffset information of the chain
If subentry != -1, only the given subentry is removed
Bool_t RemoveSubList(TEntryListArray* e, TTree* tree = 0)
 Remove the given sublist and return true if succeeded
Bool_t RemoveSubListForEntry(Long64_t entry, TTree* tree = 0)
 Remove the sublists for the given entry --> not being used...
void Reset()
 Reset all entries and remove all sublists
TEntryListArray* SetEntry(Long64_t entry, TTree* tree = 0)
Create a sublist for the given entry and returns it --> should be called after calling GetSubListForEntry
void Subtract(const TEntryList* elist)
Remove all the entries (and subentries) of this entry list that are contained in elist
If for a given entry present in both lists, one has subentries and the other does not, the whole entry is removed
void SetTree(const char* treename, const char* filename)
If a list for a tree with such name and filename exists, sets it as the current sublist
If not, creates this list and sets it as the current sublist
TEntryListArray& operator=(const TEntryListArray& )
Int_t Contains(Long64_t entry, TTree* tree, Long64_t subentry)
Bool_t Enter(Long64_t entry, TTree* tree, Long64_t subentry)
Bool_t Remove(Long64_t entry, TTree* tree, Long64_t subentry)
void SetTree(const char* treename, const char* filename)
TList* GetSubLists() const