Logo ROOT   6.08/07
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 #ifndef ROOT_TEntryList
16 #include "TEntryList.h"
17 #endif
18 
19 class TTree;
20 class TDirectory;
21 class TObjArray;
22 class TString;
23 
24 class TList;
25 class TCollection;
26 class TIter;
27 
28 class TEntryListArray : public TEntryList {
29 
30 private:
31  TEntryListArray& operator=(const TEntryListArray&); // Not implemented
32 
33 protected:
34  TList *fSubLists; ///< a list of underlying entry lists for each event of a TEntryList
35  Long64_t fEntry; ///< the entry number, when the list is used for subentries
36  TEntryListArray *fLastSubListQueried; ///<! last sublist checked by GetSubListForEntry
37  TIter *fSubListIter; ///<! to iterate over fSubLists and keep last one checked
38 
39  void Init();
40  virtual void AddEntriesAndSubLists(const TEntryList *elist);
41  virtual void ConvertToTEntryListArray(TEntryList *e);
42 // virtual TList* GetSubLists() const {
43 // return fSubLists;
44 // };
46  virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree = 0);
47  virtual TEntryListArray* SetEntry(Long64_t entry, TTree *tree = 0);
48 
49 
50 public:
52  TEntryListArray(const char *name, const char *title);
53  TEntryListArray(const char *name, const char *title, const TTree *tree);
54  TEntryListArray(const char *name, const char *title, const char *treename, const char *filename);
55  TEntryListArray(const TTree *tree);
56  TEntryListArray(const TEntryListArray& elist);
57  TEntryListArray(const TEntryList& elist); // to convert TEL to TELA
58  virtual ~TEntryListArray();
59 
60  virtual void Add(const TEntryList *elist);
61  virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry);
62  virtual Int_t Contains(Long64_t entry, TTree *tree = 0) {
63  return TEntryList::Contains(entry, tree);
64  };
65  virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry);
66  virtual Bool_t Enter(Long64_t entry, TTree *tree = 0) {
67  return Enter(entry, tree, -1);
68  };
69 // virtual Bool_t Enter(Long64_t entry, TTree *tree, const TEntryList *e);
70  virtual TEntryListArray* GetSubListForEntry(Long64_t entry, TTree *tree = 0);
71  virtual void Print(const Option_t* option = "") const;
72  virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry);
73  virtual Bool_t Remove(Long64_t entry, TTree *tree = 0) {
74  return Remove(entry, tree, -1);
75  };
76  virtual void Reset();
77 
78  virtual void SetTree(const char *treename, const char *filename);
79  virtual void SetTree(const TTree *tree) {
80  TEntryList::SetTree(tree); // will take treename and filename from the tree and call the method above
81  }
82  virtual void Subtract(const TEntryList *elist);
83  virtual TList* GetSubLists() const {
84  return fSubLists;
85  };
86 
87  ClassDef(TEntryListArray, 1); //A list of entries and subentries in a TTree
88 };
89 #endif
90 // @(#)root/tree:$Id$
91 // Author: Bruno Lenzi 12/07/2011
92 
93 /*************************************************************************
94  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
95  * All rights reserved. *
96  * *
97  * For the licensing terms see $ROOTSYS/LICENSE. *
98  * For the list of contributors see $ROOTSYS/README/CREDITS. *
99  *************************************************************************/
100 
101 #ifndef ROOT_TEntryListArray
102 #define ROOT_TEntryListArray
103 
104 #ifndef ROOT_TEntryList
105 #include "TEntryList.h"
106 #endif
107 
108 class TTree;
109 class TDirectory;
110 class TObjArray;
111 class TString;
112 
113 class TList;
114 class TCollection;
115 class TIter;
116 
117 class TEntryListArray : public TEntryList {
118 
119 private:
120  TEntryListArray& operator=(const TEntryListArray&); // Not implemented
121 
122 protected:
123  TList *fSubLists; //a list of underlying entry lists for each event of a TEntryList
124  Long64_t fEntry; // the entry number, when the list is used for subentries
125  TEntryListArray *fLastSubListQueried; //! last sublist checked by GetSubListForEntry
126  TIter *fSubListIter; //! to iterate over fSubLists and keep last one checked
127 
128  void Init();
129  virtual void AddEntriesAndSubLists(const TEntryList *elist);
130  virtual void ConvertToTEntryListArray(TEntryList *e);
131 // virtual TList* GetSubLists() const {
132 // return fSubLists;
133 // };
135  virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree = 0);
136  virtual TEntryListArray* SetEntry(Long64_t entry, TTree *tree = 0);
137 
138 
139 public:
140  TEntryListArray();
141  TEntryListArray(const char *name, const char *title);
142  TEntryListArray(const char *name, const char *title, const TTree *tree);
143  TEntryListArray(const char *name, const char *title, const char *treename, const char *filename);
144  TEntryListArray(const TTree *tree);
145  TEntryListArray(const TEntryListArray& elist);
146  TEntryListArray(const TEntryList& elist); // to convert TEL to TELA
147  virtual ~TEntryListArray();
148 
149  virtual void Add(const TEntryList *elist);
150  virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry);
151  virtual Int_t Contains(Long64_t entry, TTree *tree = 0) {
152  return TEntryList::Contains(entry, tree);
153  };
154  virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry);
155  virtual Bool_t Enter(Long64_t entry, TTree *tree = 0) {
156  return Enter(entry, tree, -1);
157  };
158 // virtual Bool_t Enter(Long64_t entry, TTree *tree, const TEntryList *e);
159  virtual TEntryListArray* GetSubListForEntry(Long64_t entry, TTree *tree = 0);
160  virtual void Print(const Option_t* option = "") const;
161  virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry);
162  virtual Bool_t Remove(Long64_t entry, TTree *tree = 0) {
163  return Remove(entry, tree, -1);
164  };
165  virtual void Reset();
166 
167  virtual void SetTree(const char *treename, const char *filename);
168  virtual void SetTree(const TTree *tree) {
169  TEntryList::SetTree(tree); // will take treename and filename from the tree and call the method above
170  }
171  virtual void Subtract(const TEntryList *elist);
172  virtual TList* GetSubLists() const {
173  return fSubLists;
174  };
175 
176  ClassDef(TEntryListArray, 1); //A list of entries and subentries in a TTree
177 };
178 #endif
virtual void AddEntriesAndSubLists(const TEntryList *elist)
The method that really adds two entry lists with sublists If lists are splitted (fLists != 0)...
virtual void Print(const Option_t *option="") const
Print this list.
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...
An array of TObjects.
Definition: TObjArray.h:39
long long Long64_t
Definition: RtypesCore.h:69
A list of entries and subentries in a TTree or TChain.
virtual Bool_t Remove(Long64_t entry, TTree *tree=0)
Remove entry #entry from the list.
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry)
Add entry #entry (, #subentry) to the list.
virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry)
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
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 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...
void Init()
Initialize data members, called by Reset.
virtual TEntryListArray * GetSubListForEntry(Long64_t entry, TTree *tree=0)
Return the list holding the subentries for the given entry or 0.
#define ClassDef(name, id)
Definition: Rtypes.h:254
TEntryListArray & operator=(const TEntryListArray &)
virtual Bool_t RemoveSubList(TEntryListArray *e, TTree *tree=0)
Remove the given sublist and return true if succeeded.
TEntryListArray()
Default c-tor.
A doubly linked list.
Definition: TList.h:47
TList * fSubLists
a list of underlying entry lists for each event of a TEntryList
Long64_t fEntry
the entry number, when the list is used for subentries
TEntryListArray * fLastSubListQueried
! last sublist checked by GetSubListForEntry
virtual TList * GetSubLists() const
Collection abstract base class.
Definition: TCollection.h:48
virtual void Reset()
Reset all entries and remove all sublists.
virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry)
Remove entry #entry (, #subentry) from the list.
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
Definition: TEntryList.cxx:519
virtual void Subtract(const TEntryList *elist)
Remove all the entries (and subentries) of this entry list that are contained in elist.
Describe directory structure in memory.
Definition: TDirectory.h:44
TIter * fSubListIter
! to iterate over fSubLists and keep last one checked
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
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 ~TEntryListArray()
d-tor
virtual Int_t Contains(Long64_t entry, TTree *tree=0)
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:98
virtual void ConvertToTEntryListArray(TEntryList *e)
Create a TEntryListArray based on the given TEntryList Called by SetTree when the given list is added...
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:27
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
char name[80]
Definition: TGX11.cxx:109
virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree=0)
Remove the sublists for the given entry –> not being used...
virtual void Add(const TEntryList *elist)
Add 2 entry lists.