TEntryListArray

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 that fullfil a cut on an array (fTracks.fPx)

  1. To fill a list elist :
         tree->Draw(">> elist", "fTracks.fPx > 0", "entrylistarray"); 
        
  2. To use a list to select entries and subentries:
         tree->SetEntryList(elist);
         tree->Draw("fTracks.fPx");
         tree->Draw("fTracks.fPy");
      

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 (fTracks.fPx > 0). In the subsequent calls to TTree::Draw, only these entries / subentries are used to fill histograms (e.g: tree->Draw("fTracks.fPx") will only display values that match "fTracks.fPx>0").

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# to 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:

Release notes TEntryListArray

TEntryListArray

TEntryListArray is an extension of TEntryList, used to hold selected entries and subentries (sublists) of a TTree. It is useful in case of a TTree with containers (vectors, arrays, ...). A typical example is the case when each entry of a TTree corresponds to physics events and each subentry (index of arrays) represents a particle.

Its main purpose is to improve the performance of a code that needs to apply complex selections (cuts) on TTree::Draw multiple times. Evaluating such cuts can be time consuming for large trees due to the need for loading the associated information (branches). This operation is done once with the use of a TEntryListArray. Subsequent calls to TTree::Draw only need to load the requested branches for histogramming, while using only the entries and subentries that satisfied the previous selection.

TTree

  • New functionality: use of TEntryListArray to select entries and subentries. If the option "entrylistarray" is specified, a TEntryListArray is created and filled with the entries and subentries that pass the given selection. If TTree::Draw is called after a TEntryList is set, only the selected entries and subentries are used to fill histograms or create new entrylists.

-- BrunoLenzi - 12-Jul-2011

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2011-08-19 - BrunoLenzi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback