Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEntryListArray.cxx
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/** \class TEntryListArray
13\ingroup tree
14
15A list of entries and subentries in a TTree or TChain.
16
17TEntryListArray is an extension of TEntryList, used to hold selected entries and
18subentries (sublists) for when the user has a TTree with containers (vectors, arrays, ...).
19
20## Usage with TTree::Draw to select entries and subentries
21
22### To fill a list elist
23~~~ {.cpp}
24 tree->Draw(">> elist", "x > 0", "entrylistarray");`
25~~~
26### To use a list to select entries and subentries
27~~~ {.cpp}
28 tree->SetEntryList(elist);
29 tree->Draw("y");
30 tree->Draw("z");
31~~~
32Its main purpose is to improve the performance of a code that needs to apply
33complex cuts on TTree::Draw multiple times. After the first call above to
34TTree::Draw, a TEntryListArray is created and filled with the entries and the
35indices of the arrays that satisfied the selection cut (x > 0). In the subsequent
36calls to TTree::Draw, only these entries / subentries are used to fill histograms.
37
38## About the class
39
40The class derives from TEntryList and can be used basically in the same way.
41This same class is used to keep entries and subentries, so there are two types of
42TEntryListArray's:
43
441. The ones that only hold subentries
45 - fEntry is set to the entry# for which the subentries correspond
46 - fSubLists must be 0
472. The ones that hold entries and eventually lists with subentries in fSubLists.
48 - fEntry = -1 for those
49 - If there are no sublists for a given entry, all the subentries will be used
50 in the selection
51
52## Additions with respect to TEntryList
53
541. Data members:
55 - fSubLists: a container to hold the sublists
56 - fEntry: the entry number if the list is used to hold subentries
57 - fLastSubListQueried and fSubListIter: a pointer to the last sublist queried
58 and an iterator to resume the loop from the last sublist queried (to speed up
59 selection and insertion in TTree::Draw)
602. Public methods:
61 - Contains, Enter and Remove with subentry as argument
62 - GetSubListForEntry: to return the sublist corresponding to the given entry
633. Protected methods:
64 - AddEntriesAndSubLists: called by Add when adding two TEntryList arrays with sublists
65 - ConvertToTEntryListArray: convert TEntryList to TEntryListArray
66 - RemoveSubList: to remove the given sublist
67 - RemoveSubListForEntry: to remove the sublist corresponding to the given entry
68 - SetEntry: to get / set a sublist for the given entry
69*/
70
71#include "TEntryListArray.h"
72#include "TEntryListBlock.h"
73#include "TTree.h"
74#include "TList.h"
75#include <iostream>
76
78
79////////////////////////////////////////////////////////////////////////////////
80/// Initialize data members, called by Reset
81
83{
84 fSubLists = 0;
85 fEntry = -1;
87 fSubListIter = 0;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Default c-tor
92
93TEntryListArray::TEntryListArray() : TEntryList(), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
94{
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// c-tor with name and title
99
100TEntryListArray::TEntryListArray(const char *name, const char *title): TEntryList(name, title), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
101{
102}
103
104////////////////////////////////////////////////////////////////////////////////
105///constructor with name and title, which also sets the tree
106
107TEntryListArray::TEntryListArray(const char *name, const char *title, const TTree *tree): TEntryList(name, title, tree), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
108{
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// c-tor with name and title, which also sets the treename and the filename
113
114TEntryListArray::TEntryListArray(const char *name, const char *title, const char *treename, const char *filename): TEntryList(name, title, treename, filename), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
115{
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// c-tor, which sets the tree
120
121TEntryListArray::TEntryListArray(const TTree *tree) : TEntryList(tree), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
122{
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Copy c-tor
127
128TEntryListArray::TEntryListArray(const TEntryListArray &elist) : TEntryList(), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
129{
130 fEntry = elist.fEntry;
131 Add(&elist);
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// c-tor, from TEntryList
136
137TEntryListArray::TEntryListArray(const TEntryList& elist) : TEntryList(elist), fSubLists(0), fEntry(-1), fLastSubListQueried(0), fSubListIter(0)
138{
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// d-tor
143
145{
146 if (fSubLists) {
147 fSubLists->Delete();
148 delete fSubLists;
149 }
150 fSubLists = 0;
151 delete fSubListIter;
152 fSubListIter = 0;
153}
154
155////////////////////////////////////////////////////////////////////////////////
156/// Add 2 entry lists
157
159{
160 if (!elist) return;
161
162 if (fEntry != -1) {
163 TEntryList::Add(elist);
164 return;
165 }
166
167 // Include in this list all the trees present in elist, so the sublists can be added
168 // This would happen in any case when calling TEntryList::Add
169 if (elist->GetLists()) { // the other list has lists to hold multiple trees, add one by one
170 TIter next(elist->GetLists());
171 const TEntryList *e = 0;
172 while ((e = (const TEntryList*)next())) {
173 SetTree(e->GetTreeName(), e->GetFileName());
174 }
175 } else {
176 SetTree(elist->GetTreeName(), elist->GetFileName());
177 }
178
180}
181
182////////////////////////////////////////////////////////////////////////////////
183/// The method that really adds two entry lists with sublists
184/// If lists are split (fLists != 0), look for the ones whose trees match and call the method for those lists.
185/// Add first the sublists, and then use TEntryList::Add to deal with the entries
186
188{
189 // WARNING: cannot call TEntryList::Add in the beginning:
190 // - Need to know which entries are present in each list when adding the sublists
191 // - TEL::Add is recursive, so it will call this guy after the first iteration
192
193 // Add to the entries and sublists of this list, the ones from the other list
194 if (!elist) return;
195
196 if (fLists) { // This list is split
197 TEntryListArray* e = 0;
198 TIter next(fLists);
199 fN = 0; // reset fN to set it to the sum of fN in each list
200 // Only need to do it here and the next condition will be called only from here
201 while ((e = (TEntryListArray*) next())) {
202 e->AddEntriesAndSubLists(elist);
203 fN += e->GetN();
204 }
205 } else if (elist->GetLists()) { // The other list is split --> will be called only from the previous if
206 TIter next(elist->GetLists());
207 TEntryList *e = 0;
208 while ((e = (TEntryList*) next())) {
210 }
211 } else { // None of the lists are split
212 if (strcmp(elist->GetTreeName(), fTreeName.Data()) || strcmp(elist->GetFileName(), fFileName.Data()))
213 return; // Lists are for different trees
214 const TEntryListArray *elist_array = dynamic_cast< const TEntryListArray *>(elist);
215 if (!fSubLists && (!elist_array || !elist_array->GetSubLists())) { // no sublists in neither
216 TEntryList::Add(elist);
217 return;
218 }
219 // Deal with the sublists: Loop over both fSubLists
220 // - If the sublists are for the same entry, Add the sublists
221 // - For sublists only in this list, check if entry is in elist, and remove the sublist if so
222 // - For sublists only in the other list, insert them in fSubLists
223 if (!fSubLists && elist_array->GetSubLists()) {
224 fSubLists = new TList();
225 }
226 TEntryListArray *el1;
227 const TEntryListArray *el2;
228 TCollection *other_sublists = 0;
229 if (elist_array) {
230 other_sublists = elist_array->GetSubLists();
231 }
232 TIter next1(fSubLists);
233 TIter next2(other_sublists); // should work even if elist->fSubLists is null
234
235 for (el1 = (TEntryListArray*) next1(), el2 = (const TEntryListArray*) next2(); el1 || el2;) {
236 if (el1 && el2 && el1->fEntry == el2->fEntry) { // sublists for the same entry, Add them
237 el1->TEntryList::Add(el2);
238 el1 = (TEntryListArray*) next1();
239 el2 = (const TEntryListArray*) next2();
240 } else if (el1 && (!el2 || el1->fEntry < el2->fEntry)) { // el1->fEntry is not in elist->fSubLists
241 if ((const_cast<TEntryList*>(elist))->Contains(el1->fEntry)) {
242 RemoveSubList(el1);
243 }
244 el1 = (TEntryListArray*) next1();
245 } else { // el2->fEntry is not in fSubLists --> make a copy and add it
246 if (!Contains(el2->fEntry)) {
247 if (!el1) {
249 } else {
250 fSubLists->AddBefore(el1, new TEntryListArray(*el2));
251 }
252 }
253 el2 = (const TEntryListArray*) next2();
254 }
255 }
256 TEntryList::Add(elist);
257 }
258}
259
260////////////////////////////////////////////////////////////////////////////////
261/// - When tree = 0, returns from the current list
262/// - When tree != 0, finds the list corresponding to this tree
263/// - When tree is a chain, the entry is assumed to be global index and the local
264///
265/// entry is recomputed from the treeoffset information of the chain
266/// When subentry != -1, return true if the enter is present and not split
267/// or if the subentry list is found and contains \#subentry
268
270{
271
272
273 if (tree) {
274 Long64_t localentry = tree->LoadTree(entry);
275 SetTree(tree->GetTree());
276 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
277 if (currentArray) {
278 return currentArray->Contains(localentry, 0, subentry);
279 }
280 return 0;
281 }
282 // tree = 0
283 Int_t result = TEntryList::Contains(entry);
284 if (result && fSubLists) {
286 if (t) {
287 result = t->TEntryList::Contains(subentry);
288 }
289 }
290 return result;
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Create a TEntryListArray based on the given TEntryList
295/// Called by SetTree when the given list is added to fLists
296/// Replace it by a TEntryListArray and delete the given list
297
299{
300 // TODO: Keep the blocks and the number of entries to transfer without copying?
301 // TObjArray *blocks = e->fBlocks;
302 // Int_t NBlocks = e->fNBlocks;
303 // Long64_t N = e->fN;
304 // e->fBlocks = 0;
305 // e->fNBlocks = 0;
306 // e->fN = 0;
307
308 TEntryListArray *earray = new TEntryListArray(*e);
309// earray->fBlocks = blocks;
310// earray->fNBlocks = NBlocks;
311// earray->fN = N;
312
313 if (e == fCurrent) {
314 fCurrent = earray;
315 }
316 // If the list has just been split, earray will be the first one
317 // and must keep the current sublists
318 if (fSubLists) {
319 earray->fSubLists = fSubLists;
320 fSubLists = 0;
321 }
322 if (e == fLists->First()) {
323 fLists->AddFirst(earray);
324 } else {
325 fLists->Add(earray);
326 }
327 fLists->Remove(e);
328 delete e;
329 e = 0;
330}
331
332////////////////////////////////////////////////////////////////////////////////
333/// Add entry \#entry (, \#subentry) to the list
334/// - When tree = 0, adds to the current list
335/// - When tree != 0, finds the list corresponding to this tree (or add a new one)
336/// - When tree is a chain, the entry is assumed to be global index and the local
337/// entry is recomputed from the treeoffset information of the chain
338
340{
341 //When subentry = -1, add all subentries (remove the sublist if it exists)
342 //When subentry != -1 and the entry is not present,
343 //add only the given subentry, creating a TEntryListArray to hold the subentries for the given entry
344 //Return true only if the entry is new (not the subentry)
345
346 Bool_t result = 0;
347
348 if (tree) {
349 Long64_t localentry = tree->LoadTree(entry);
350 SetTree(tree->GetTree());
351 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
352 if (currentArray) {
353 if ((result = currentArray->Enter(localentry, 0, subentry)))
354 if (fLists) ++fN;
355 }
356 return result;
357 }
358 if (fLists) {
360 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
361 if (currentArray && (result = currentArray->Enter(entry, 0, subentry))) {
362 ++fN;
363 }
364 return result;
365 }
366 // tree = 0 && !fLists
367 // Sub entries were already present ?
369 if (t) { // Sub entries were already present
370 if (subentry != -1) {
371 t->TEntryList::Enter(subentry);
372 } else { // remove the sub entries
373 RemoveSubList(t);
374 }
375 } else {
376 result = TEntryList::Enter(entry);
377 if (subentry != -1 && result) { // a sub entry was given and the entry was not present
378 t = SetEntry(entry);
379 if (t) t->TEntryList::Enter(subentry);
380 }
381 }
382 return result;
383}
384
385////////////////////////////////////////////////////////////////////////////////
386/// Return the list holding the subentries for the given entry or 0
387
389{
390 if (tree) {
391 Long64_t localentry = tree->LoadTree(entry);
392 SetTree(tree->GetTree());
393 if (fCurrent) {
394 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
395 if (currentArray) {
396 return currentArray->GetSubListForEntry(localentry);
397 }
398 }
399 return 0;
400 }
401 // tree = 0
402
403 if (!fSubLists || !fSubLists->GetEntries()) {
404 return 0;
405 }
406
407 if (!fSubListIter) {
410 }
411 else if (!fLastSubListQueried || entry < fLastSubListQueried->fEntry) {
412 // Restart the loop: fLastSubListQueried should point to the newest entry
413 // or where we stoped the last search
414 // (it is 0 only if we reached the end of the loop)
417 }
418
419 if (entry == fLastSubListQueried->fEntry) {
420 return fLastSubListQueried;
421 }
422
424 if (fLastSubListQueried->fEntry == entry) {
425 return fLastSubListQueried;
426 }
427 if (fLastSubListQueried->fEntry > entry) {
428 break;
429 }
430 }
431 return 0;
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Print this list
436/// - option = "" - default - print the name of the tree and file
437/// - option = "all" - print all the entry numbers
438/// - option = "subentries" - print all the entry numbers and associated subentries
439
440void TEntryListArray::Print(const Option_t* option) const
441{
442 TString opt = option;
443 opt.ToUpper();
444 Bool_t new_line = !opt.Contains("EOL");
445
446 if (!opt.Contains("S") && new_line) {
447 TEntryList::Print(option);
448 return;
449 }
450
451 if (fLists) {
452 TIter next(fLists);
453 TEntryListArray *e = 0;
454 while ((e = (TEntryListArray*)next())) {
455 std::cout << e->fTreeName << ":" << std::endl;
456 e->Print(option);
457 }
458 return;
459 }
460
461 // Print all subentries
462 TEntryListArray *tmp = const_cast<TEntryListArray *>(this);
463 TIter next(fSubLists);
465 for (Int_t i = 0; i < tmp->fN; ++i) {
466 Long64_t entry = tmp->GetEntry(i);
467 std::cout << entry << " ";
468 if (fSubLists) {
469 std::cout << " : ";
470 }
471 if (e && e->fEntry == entry) {
472 e->Print("all,EOL");
473 e = (TEntryListArray*)next();
474 }
475 if (new_line) {
476 std::cout << std::endl;
477 }
478 }
479}
480
481////////////////////////////////////////////////////////////////////////////////
482/// Remove entry \#entry (, \#subentry) from the list
483/// - When tree = 0, removes from the current list
484/// - When tree != 0, finds the list, corresponding to this tree
485/// - When tree is a chain, the entry is assumed to be global index and the local
486/// entry is recomputed from the treeoffset information of the chain
487///
488/// If subentry != -1, only the given subentry is removed
489
491{
492 Bool_t result = kFALSE;
493
494 if (tree) {
495 Long64_t localentry = tree->LoadTree(entry);
496 SetTree(tree->GetTree());
497 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
498 if (currentArray && (result = currentArray->Remove(localentry, 0, subentry))) {
499 if (fLists) {
500 --fN;
501 }
502 }
503 return result;
504 }
505 if (fLists) {
507 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
508 if (currentArray && (result = currentArray->Remove(entry, 0, subentry)) && fLists) {
509 --fN;
510 }
511 return result;
512 }
513
514 // tree = 0 && !fLists
516 if (e) {
517 if (subentry != -1) {
518 e->TEntryList::Remove(subentry);
519 }
520 if (subentry == -1 || !e->GetN()) {
522 return TEntryList::Remove(entry);
523 }
524 } else if (subentry == -1) {
525 return TEntryList::Remove(entry);
526 }
527 return kFALSE;
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Remove the given sublist and return true if succeeded
532
534{
535 if (!e) return kFALSE;
536 if (tree) {
537 SetTree(tree->GetTree());
538 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
539 if (currentArray) {
540 return currentArray->RemoveSubList(e);
541 }
542 }
543
544 if (!fSubLists || !fSubLists->Remove(e)) {
545 return kFALSE;
546 }
547 // fSubLists->Sort(); --> for TObjArray
548 delete e;
549 if (!fSubLists->GetEntries()) {
550 delete fSubLists;
551 fSubLists = nullptr;
552 }
553 return kTRUE;
554}
555
556////////////////////////////////////////////////////////////////////////////////
557/// Remove the sublists for the given entry --> not being used...
558
560{
561 if (tree) {
562 Long64_t localentry = tree->LoadTree(entry);
563 SetTree(tree->GetTree());
564 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
565 if (currentArray) {
566 return currentArray->RemoveSubListForEntry(localentry);
567 }
568 }
569 return RemoveSubList(GetSubListForEntry(entry));
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Reset all entries and remove all sublists
574
576{
578 if (fSubLists) {
579 if (!((TEntryListArray*)fSubLists->First())->GetDirectory()) {
580 fSubLists->Delete();
581 }
582 delete fSubLists;
583 }
584 delete fSubListIter;
585 Init();
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Create a sublist for the given entry and returns it --> should be called
590/// after calling GetSubListForEntry
591
593{
594 if (entry < 0) return 0;
595
596 // If tree is given, switch to the list that contains tree
597 if (tree) {
598 Long64_t localentry = tree->LoadTree(entry);
599 SetTree(tree->GetTree());
600 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
601 if (currentArray) {
602 return currentArray->SetEntry(localentry);
603 }
604 return 0;
605 }
606 // tree = 0
607 if (!fSubLists) {
608 fSubLists = new TList();
609 }
610 TEntryListArray *newlist = new TEntryListArray();
611 newlist->fEntry = entry;
614 fSubListIter->Reset(); // Reset the iterator to avoid missing the entry next to the new one (bug in TIter?)
615 } else {
616 fSubLists->AddLast(newlist);
617 }
618 fLastSubListQueried = newlist;
619 return newlist;
620}
621
622////////////////////////////////////////////////////////////////////////////////
623/// Remove all the entries (and subentries) of this entry list that are contained
624/// in elist.
625/// If for a given entry present in both lists, one has subentries and the other
626/// does not, the whole entry is removed
627
629{
630 if (!elist) return;
631
632 if (fLists) { // This list is split
633 TEntryListArray* e = 0;
634 TIter next(fLists);
635 fN = 0; // reset fN to set it to the sum of fN in each list
636 while ((e = (TEntryListArray*) next())) {
637 e->Subtract(elist);
638 fN += e->GetN();
639 }
640 } else if (elist->GetLists()) { // The other list is split
641 TIter next(elist->GetLists());
642 TEntryList *e = 0;
643 while ((e = (TEntryList*) next())) {
644 Subtract(e);
645 }
646 } else { // None of the lists are split
647 if (strcmp(elist->GetTreeName(), fTreeName.Data()) || strcmp(elist->GetFileName(), fFileName.Data()))
648 return; // Lists are for different trees
649 const TEntryListArray *elist_array = dynamic_cast< const TEntryListArray *>(elist);
650 if (!fSubLists || !elist_array || !elist_array->GetSubLists()) { // there are no sublists in one of the lists
652 if (fSubLists) {
653 TEntryListArray *e = 0;
654 TIter next(fSubLists);
655 while ((e = (TEntryListArray*) next())) {
656 if (!Contains(e->fEntry))
658 }
659 }
660 } else { // Both lists have subentries, will have to loop over them
661 TEntryListArray *el1, *el2;
662 TIter next1(fSubLists);
663 TIter next2(elist_array->GetSubLists());
664 el1 = (TEntryListArray*) next1();
665 el2 = (TEntryListArray*) next2();
666
667 Long64_t n2 = elist->GetN();
668 Long64_t entry;
669 for (Int_t i = 0; i < n2; ++i) {
670 entry = (const_cast<TEntryList*>(elist))->GetEntry(i);
671 // Try to find the sublist for this entry in list
672 while (el1 && el1->fEntry < entry) { // && el2
673 el1 = (TEntryListArray*) next1();
674 }
675 while (el2 && el2->fEntry < entry) { // && el1
676 el2 = (TEntryListArray*) next2();
677 }
678
679 if (el1 && el2 && entry == el1->fEntry && entry == el2->fEntry) { // both lists have sublists for this entry
680 el1->Subtract(el2);
681 if (!el1->fN) {
682 Remove(entry);
683 }
684 } else {
685 Remove(entry);
686 }
687 }
688 }
689 }
690}
691
692////////////////////////////////////////////////////////////////////////////////
693/// If a list for a tree with such name and filename exists, sets it as the current sublist
694/// If not, creates this list and sets it as the current sublist
695
696void TEntryListArray::SetTree(const char *treename, const char *filename)
697{
698 // ! the filename is taken as provided, no extensions to full path or url !
699
700 // Uses the method from the base class: if the tree is new, the a new TEntryList will be created (and stored in fLists) and needs to be converted to a TEntryListArray
701
702 Int_t nLists = -1;
703 if (fLists) {
704 nLists = fLists->GetEntries();
705 }
706 TEntryList::SetTree(treename, filename);
707 if (fLists && fLists->GetEntries() != nLists) { // fList was created and/or has new additions
708 if (nLists == -1) {
709 // The list has just been split (fList was created)
710 // There should be two TEntryLists in fLists:
711 // must convert both to TEntryListArray
712 // and transfer the sublists to the first one
714 }
716 }
717}
#define e(i)
Definition RSha256.hxx:103
const Bool_t kFALSE
Definition RtypesCore.h:92
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
char name[80]
Definition TGX11.cxx:110
Collection abstract base class.
Definition TCollection.h:63
virtual Int_t GetEntries() const
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 Reset()
Reset all entries and remove all sublists.
void Init()
Initialize data members, called by Reset.
TEntryListArray * fLastSubListQueried
! last sublist checked by GetSubListForEntry
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 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 split (fLists !...
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
TString fFileName
name of the file, where the tree is
Definition TEntryList.h:39
virtual TList * GetLists() const
Definition TEntryList.h:73
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)
Long64_t fN
number of entries in the list
Definition TEntryList.h:36
virtual void Reset()
Reset this list.
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry #entry to the list.
virtual Long64_t GetEntry(Int_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
virtual const char * GetTreeName() const
Definition TEntryList.h:76
TEntryList * fCurrent
! currently filled entry list
Definition TEntryList.h:32
virtual void Print(const Option_t *option="") const
Print this list.
virtual Bool_t Remove(Long64_t entry, TTree *tree=0)
Remove entry #entry from the list.
TList * fLists
a list of underlying entry lists for each tree of a chain
Definition TEntryList.h:31
TString fTreeName
name of the tree
Definition TEntryList.h:38
void GetFileName(const char *filename, TString &fn, Bool_t *=0)
To be able to re-localize the entry-list we identify the file by just the name and the anchor,...
virtual void Subtract(const TEntryList *elist)
Remove all the entries of this entry list, that are contained in elist.
virtual void Add(const TEntryList *elist)
Add 2 entry lists.
virtual Long64_t GetN() const
Definition TEntryList.h:75
TObject * Next()
void Reset()
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition TList.cxx:100
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
Definition TList.cxx:196
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition TList.cxx:152
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
void ToUpper()
Change string to upper case.
Definition TString.cxx:1158
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
A TTree represents a columnar dataset.
Definition TTree.h:79
Definition tree.py:1