Logo ROOT  
Reference Guide
TEntryListArray.h
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Bruno Lenzi 12/07/2011
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, 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_TEntryListArray
13#define ROOT_TEntryListArray
14
15#include "TEntryList.h"
16
17class TTree;
18class TDirectory;
19class TObjArray;
20class TString;
21
22class TList;
23class TCollection;
24class TIter;
25
27
28private:
29 TEntryListArray& operator=(const TEntryListArray&); // Not implemented
30
31protected:
32 TList *fSubLists; ///< a list of underlying entry lists for each event of a TEntryList
33 Long64_t fEntry; ///< the entry number, when the list is used for subentries
34 TEntryListArray *fLastSubListQueried; ///<! last sublist checked by GetSubListForEntry
35 TIter *fSubListIter; ///<! to iterate over fSubLists and keep last one checked
36
37 void Init();
38 virtual void AddEntriesAndSubLists(const TEntryList *elist);
40// virtual TList* GetSubLists() const {
41// return fSubLists;
42// };
44 virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree = 0);
45 virtual TEntryListArray* SetEntry(Long64_t entry, TTree *tree = 0);
46
47
48public:
50 TEntryListArray(const char *name, const char *title);
51 TEntryListArray(const char *name, const char *title, const TTree *tree);
52 TEntryListArray(const char *name, const char *title, const char *treename, const char *filename);
54 TEntryListArray(const TEntryListArray& elist);
55 TEntryListArray(const TEntryList& elist); // to convert TEL to TELA
56 virtual ~TEntryListArray();
57
58 virtual void Add(const TEntryList *elist);
59 virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry);
60 virtual Int_t Contains(Long64_t entry, TTree *tree = 0) {
61 return TEntryList::Contains(entry, tree);
62 };
63 virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry);
64 virtual Bool_t Enter(Long64_t entry, TTree *tree = 0) {
65 return Enter(entry, tree, -1);
66 };
67// virtual Bool_t Enter(Long64_t entry, TTree *tree, const TEntryList *e);
69 virtual void Print(const Option_t* option = "") const;
70 virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry);
71 virtual Bool_t Remove(Long64_t entry, TTree *tree = 0) {
72 return Remove(entry, tree, -1);
73 };
74 virtual void Reset();
75
76 virtual void SetTree(const char *treename, const char *filename);
77 virtual void SetTree(const TTree *tree) {
78 TEntryList::SetTree(tree); // will take treename and filename from the tree and call the method above
79 }
80 virtual void Subtract(const TEntryList *elist);
81 virtual TList* GetSubLists() const {
82 return fSubLists;
83 };
84
85 ClassDef(TEntryListArray, 1); //A list of entries and subentries in a TTree
86};
87#endif
#define e(i)
Definition: RSha256.hxx:103
bool Bool_t
Definition: RtypesCore.h:61
long long Long64_t
Definition: RtypesCore.h:71
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
Collection abstract base class.
Definition: TCollection.h:63
Describe directory structure in memory.
Definition: TDirectory.h:40
A list of entries and subentries in a TTree or TChain.
virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree=0)
Remove the sublists for the given entry --> not being used...
virtual ~TEntryListArray()
d-tor
virtual void SetTree(const TTree *tree)
If a list for a tree with such name and filename exists, sets it as the current sublist If not,...
virtual void Reset()
Reset all entries and remove all sublists.
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
void Init()
Initialize data members, called by Reset.
TEntryListArray * fLastSubListQueried
! last sublist checked by GetSubListForEntry
TEntryListArray & operator=(const TEntryListArray &)
virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry)
Remove entry #entry (, #subentry) from the list.
TList * fSubLists
a list of underlying entry lists for each event of a TEntryList
virtual 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,...
virtual TEntryListArray * SetEntry(Long64_t entry, TTree *tree=0)
Create a sublist for the given entry and returns it --> should be called after calling GetSubListForE...
virtual Bool_t RemoveSubList(TEntryListArray *e, TTree *tree=0)
Remove the given sublist and return true if succeeded.
TEntryListArray()
Default c-tor.
virtual void Add(const TEntryList *elist)
Add 2 entry lists.
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
virtual void ConvertToTEntryListArray(TEntryList *e)
Create a TEntryListArray based on the given TEntryList Called by SetTree when the given list is added...
virtual void Print(const Option_t *option="") const
Print this list.
Long64_t fEntry
the entry number, when the list is used for subentries
virtual TList * GetSubLists() const
virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry)
virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry)
Add entry #entry (, #subentry) to the list.
virtual void AddEntriesAndSubLists(const TEntryList *elist)
The method that really adds two entry lists with sublists If lists are splitted (fLists !...
virtual Bool_t Remove(Long64_t entry, TTree *tree=0)
Remove entry #entry from the list.
TIter * fSubListIter
! to iterate over fSubLists and keep last one checked
virtual void Subtract(const TEntryList *elist)
Remove all the entries (and subentries) of this entry list that are contained in elist.
virtual TEntryListArray * GetSubListForEntry(Long64_t entry, TTree *tree=0)
Return the list holding the subentries for the given entry or 0.
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:26
virtual void SetTree(const TTree *tree)
If a list for a tree with such name and filename exists, sets it as the current sublist If not,...
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
Definition: TEntryList.cxx:519
A doubly linked list.
Definition: TList.h:44
An array of TObjects.
Definition: TObjArray.h:37
Basic string class.
Definition: TString.h:131
A TTree represents a columnar dataset.
Definition: TTree.h:78
Definition: tree.py:1