### Tree Libraries

#### 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, ...). End_Html

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

#### Others changes

- Reduced the memory used by a TTree in half by refactoring the code reading and writing the TBasket data; A single transient buffer holding the compressed data is now managed by TTree (and could be made thread local) rather than having one per TBranch.
- Updated TBranchElement::Unroll to no longer split a base class that can not be split (i.e. respect the information returned by TStreamerElement::CannotSplit (and thus TClass::CanSplit). This disabling is currently _not_ done automatically for backward compatibility reasons and because
  - Without TClass::SetCanSplit there was no way to force the splitting (short of setting the split level lower)
  - Some classes still requires a custom streamer solely to read older data files (for example for file written before the advent of StreamerInfo) and are such not necessary to be used when writting (and schema evolution rules can not yet be used in this case).
- Allowed removing branches when cloning a TNtuple.
- Added an option value ("cachedbranches") to the Print() function of TTreeCache to be able to print the list of cached branches.
- Made the ownership of the TBranch by fBranch clearer (and thus allow the 'reuse' of TTree object without memory leak)
- Introduced GetLeaf(branchname,leafname) used in TTreeFormula to avoid ambiguity in the syntax introduced by too many slashes
- Improved performance of `TTree::GetEntry`. With this changes the 'overhead' compare to protobuf goes from 48% to 24%. (This does not include the cost of the file opening which can be comparatively large for small files. For the example used in the comparison the cost `TFile::Open` is 8% of the cost of 100000 calls to `TTree::GetEntry`)
- Prevented the use of non-existent memory when reading in an object that is part of an STL collection and which used to contains an embedded object (and this data member has been removed).
- Now properly recognize a TClonesArray data member even if the requested type was a typedef (to TClonesArray) that is in a namespace (for example edm::Event::ContaierType).