Logo ROOT   6.10/09
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 
17 class TTree;
18 class TDirectory;
19 class TObjArray;
20 class TString;
21 
22 class TList;
23 class TCollection;
24 class TIter;
25 
26 class TEntryListArray : public TEntryList {
27 
28 private:
29  TEntryListArray& operator=(const TEntryListArray&); // Not implemented
30 
31 protected:
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);
39  virtual void ConvertToTEntryListArray(TEntryList *e);
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 
48 public:
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);
53  TEntryListArray(const TTree *tree);
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);
68  virtual TEntryListArray* GetSubListForEntry(Long64_t entry, TTree *tree = 0);
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
88 // @(#)root/tree:$Id$
89 // Author: Bruno Lenzi 12/07/2011
90 
91 /*************************************************************************
92  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
93  * All rights reserved. *
94  * *
95  * For the licensing terms see $ROOTSYS/LICENSE. *
96  * For the list of contributors see $ROOTSYS/README/CREDITS. *
97  *************************************************************************/
98 
99 #ifndef ROOT_TEntryListArray
100 #define ROOT_TEntryListArray
101 
102 #include "TEntryList.h"
103 
104 class TTree;
105 class TDirectory;
106 class TObjArray;
107 class TString;
108 
109 class TList;
110 class TCollection;
111 class TIter;
112 
113 class TEntryListArray : public TEntryList {
114 
115 private:
116  TEntryListArray& operator=(const TEntryListArray&); // Not implemented
117 
118 protected:
119  TList *fSubLists; //a list of underlying entry lists for each event of a TEntryList
120  Long64_t fEntry; // the entry number, when the list is used for subentries
121  TEntryListArray *fLastSubListQueried; //! last sublist checked by GetSubListForEntry
122  TIter *fSubListIter; //! to iterate over fSubLists and keep last one checked
123 
124  void Init();
125  virtual void AddEntriesAndSubLists(const TEntryList *elist);
126  virtual void ConvertToTEntryListArray(TEntryList *e);
127 // virtual TList* GetSubLists() const {
128 // return fSubLists;
129 // };
131  virtual Bool_t RemoveSubListForEntry(Long64_t entry, TTree *tree = 0);
132  virtual TEntryListArray* SetEntry(Long64_t entry, TTree *tree = 0);
133 
134 
135 public:
136  TEntryListArray();
137  TEntryListArray(const char *name, const char *title);
138  TEntryListArray(const char *name, const char *title, const TTree *tree);
139  TEntryListArray(const char *name, const char *title, const char *treename, const char *filename);
140  TEntryListArray(const TTree *tree);
141  TEntryListArray(const TEntryListArray& elist);
142  TEntryListArray(const TEntryList& elist); // to convert TEL to TELA
143  virtual ~TEntryListArray();
144 
145  virtual void Add(const TEntryList *elist);
146  virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry);
147  virtual Int_t Contains(Long64_t entry, TTree *tree = 0) {
148  return TEntryList::Contains(entry, tree);
149  };
150  virtual Bool_t Enter(Long64_t entry, TTree *tree, Long64_t subentry);
151  virtual Bool_t Enter(Long64_t entry, TTree *tree = 0) {
152  return Enter(entry, tree, -1);
153  };
154 // virtual Bool_t Enter(Long64_t entry, TTree *tree, const TEntryList *e);
155  virtual TEntryListArray* GetSubListForEntry(Long64_t entry, TTree *tree = 0);
156  virtual void Print(const Option_t* option = "") const;
157  virtual Bool_t Remove(Long64_t entry, TTree *tree, Long64_t subentry);
158  virtual Bool_t Remove(Long64_t entry, TTree *tree = 0) {
159  return Remove(entry, tree, -1);
160  };
161  virtual void Reset();
162 
163  virtual void SetTree(const char *treename, const char *filename);
164  virtual void SetTree(const TTree *tree) {
165  TEntryList::SetTree(tree); // will take treename and filename from the tree and call the method above
166  }
167  virtual void Subtract(const TEntryList *elist);
168  virtual TList* GetSubLists() const {
169  return fSubLists;
170  };
171 
172  ClassDef(TEntryListArray, 1); //A list of entries and subentries in a TTree
173 };
174 #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:37
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:129
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:297
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:43
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:42
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:521
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:34
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:78
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:25
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
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.