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 = nullptr;
85 fEntry = -1;
86 fLastSubListQueried = nullptr;
87 fSubListIter = nullptr;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Default c-tor
92
93TEntryListArray::TEntryListArray() : TEntryList(), fSubLists(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
94{
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// c-tor with name and title
99
100TEntryListArray::TEntryListArray(const char *name, const char *title): TEntryList(name, title), fSubLists(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
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(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
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(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
115{
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// c-tor, which sets the tree
120
121TEntryListArray::TEntryListArray(const TTree *tree) : TEntryList(tree), fSubLists(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
122{
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Copy c-tor
127
128TEntryListArray::TEntryListArray(const TEntryListArray &elist) : TEntryList(), fSubLists(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
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(nullptr), fEntry(-1), fLastSubListQueried(nullptr), fSubListIter(nullptr)
138{
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// d-tor
143
145{
146 if (fSubLists) {
147 fSubLists->Delete();
148 delete fSubLists;
149 }
150 fSubLists = nullptr;
151 delete fSubListIter;
152 fSubListIter = nullptr;
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 = nullptr;
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 = nullptr;
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 = nullptr;
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 = nullptr;
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, nullptr, subentry);
279 }
280 return 0;
281 }
282 // tree = 0
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 = nullptr;
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 = nullptr;
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
339bool TEntryListArray::Enter(Long64_t entry, TTree *tree, Long64_t subentry)
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 result = false;
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, nullptr, 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, nullptr, 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
385bool TEntryListArray::Enter(Long64_t localentry, const char *treename, const char *filename, Long64_t subentry)
386{
387 bool result = false;
388 SetTree(treename, filename);
389 TEntryListArray *currentArray = dynamic_cast<TEntryListArray *>(fCurrent);
390 if (currentArray) {
391 if ((result = currentArray->Enter(localentry, nullptr, subentry)))
392 if (fLists)
393 ++fN;
394 }
395 return result;
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Return the list holding the subentries for the given entry or 0
400
402{
403 if (tree) {
404 Long64_t localentry = tree->LoadTree(entry);
405 SetTree(tree->GetTree());
406 if (fCurrent) {
407 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
408 if (currentArray) {
409 return currentArray->GetSubListForEntry(localentry);
410 }
411 }
412 return nullptr;
413 }
414 // tree = 0
415
416 if (!fSubLists || !fSubLists->GetEntries()) {
417 return nullptr;
418 }
419
420 if (!fSubListIter) {
423 }
424 else if (!fLastSubListQueried || entry < fLastSubListQueried->fEntry) {
425 // Restart the loop: fLastSubListQueried should point to the newest entry
426 // or where we stoped the last search
427 // (it is 0 only if we reached the end of the loop)
430 }
431
432 if (entry == fLastSubListQueried->fEntry) {
433 return fLastSubListQueried;
434 }
435
437 if (fLastSubListQueried->fEntry == entry) {
438 return fLastSubListQueried;
439 }
440 if (fLastSubListQueried->fEntry > entry) {
441 break;
442 }
443 }
444 return nullptr;
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// Print this list
449/// - option = "" - default - print the name of the tree and file
450/// - option = "all" - print all the entry numbers
451/// - option = "subentries" - print all the entry numbers and associated subentries
452
454{
455 TString opt = option;
456 opt.ToUpper();
457 bool new_line = !opt.Contains("EOL");
458
459 if (!opt.Contains("S") && new_line) {
461 return;
462 }
463
464 if (fLists) {
465 TIter next(fLists);
466 TEntryListArray *e = nullptr;
467 while ((e = (TEntryListArray*)next())) {
468 std::cout << e->fTreeName << ":" << std::endl;
469 e->Print(option);
470 }
471 return;
472 }
473
474 // Print all subentries
475 TEntryListArray *tmp = const_cast<TEntryListArray *>(this);
476 TIter next(fSubLists);
478 for (Int_t i = 0; i < tmp->fN; ++i) {
479 Long64_t entry = tmp->GetEntry(i);
480 std::cout << entry << " ";
481 if (fSubLists) {
482 std::cout << " : ";
483 }
484 if (e && e->fEntry == entry) {
485 e->Print("all,EOL");
486 e = (TEntryListArray*)next();
487 }
488 if (new_line) {
489 std::cout << std::endl;
490 }
491 }
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Remove entry \#entry (, \#subentry) from the list
496/// - When tree = 0, removes from the current list
497/// - When tree != 0, finds the list, corresponding to this tree
498/// - When tree is a chain, the entry is assumed to be global index and the local
499/// entry is recomputed from the treeoffset information of the chain
500///
501/// If subentry != -1, only the given subentry is removed
502
503bool TEntryListArray::Remove(Long64_t entry, TTree *tree, Long64_t subentry)
504{
505 bool result = false;
506
507 if (tree) {
508 Long64_t localentry = tree->LoadTree(entry);
509 SetTree(tree->GetTree());
510 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
511 if (currentArray && (result = currentArray->Remove(localentry, nullptr, subentry))) {
512 if (fLists) {
513 --fN;
514 }
515 }
516 return result;
517 }
518 if (fLists) {
520 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
521 if (currentArray && (result = currentArray->Remove(entry, nullptr, subentry)) && fLists) {
522 --fN;
523 }
524 return result;
525 }
526
527 // tree = 0 && !fLists
529 if (e) {
530 if (subentry != -1) {
531 e->TEntryList::Remove(subentry);
532 }
533 if (subentry == -1 || !e->GetN()) {
534 RemoveSubList(e, tree);
535 return TEntryList::Remove(entry);
536 }
537 } else if (subentry == -1) {
538 return TEntryList::Remove(entry);
539 }
540 return false;
541}
542
543////////////////////////////////////////////////////////////////////////////////
544/// Remove the given sublist and return true if succeeded
545
547{
548 if (!e) return false;
549 if (tree) {
550 SetTree(tree->GetTree());
551 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
552 if (currentArray) {
553 return currentArray->RemoveSubList(e);
554 }
555 }
556
557 if (!fSubLists || !fSubLists->Remove(e)) {
558 return false;
559 }
560 // fSubLists->Sort(); --> for TObjArray
561 delete e;
562 if (!fSubLists->GetEntries()) {
563 delete fSubLists;
564 fSubLists = nullptr;
565 }
566 return true;
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Remove the sublists for the given entry --> not being used...
571
573{
574 if (tree) {
575 Long64_t localentry = tree->LoadTree(entry);
576 SetTree(tree->GetTree());
577 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
578 if (currentArray) {
579 return currentArray->RemoveSubListForEntry(localentry);
580 }
581 }
582 return RemoveSubList(GetSubListForEntry(entry));
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// Reset all entries and remove all sublists
587
589{
591 if (fSubLists) {
592 if (!((TEntryListArray*)fSubLists->First())->GetDirectory()) {
593 fSubLists->Delete();
594 }
595 delete fSubLists;
596 }
597 delete fSubListIter;
598 Init();
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Create a sublist for the given entry and returns it --> should be called
603/// after calling GetSubListForEntry
604
606{
607 if (entry < 0) return nullptr;
608
609 // If tree is given, switch to the list that contains tree
610 if (tree) {
611 Long64_t localentry = tree->LoadTree(entry);
612 SetTree(tree->GetTree());
613 TEntryListArray *currentArray = dynamic_cast<TEntryListArray*>(fCurrent);
614 if (currentArray) {
615 return currentArray->SetEntry(localentry);
616 }
617 return nullptr;
618 }
619 // tree = 0
620 if (!fSubLists) {
621 fSubLists = new TList();
622 }
623 TEntryListArray *newlist = new TEntryListArray();
624 newlist->fEntry = entry;
627 fSubListIter->Reset(); // Reset the iterator to avoid missing the entry next to the new one (bug in TIter?)
628 } else {
629 fSubLists->AddLast(newlist);
630 }
631 fLastSubListQueried = newlist;
632 return newlist;
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Remove all the entries (and subentries) of this entry list that are contained
637/// in elist.
638/// If for a given entry present in both lists, one has subentries and the other
639/// does not, the whole entry is removed
640
642{
643 if (!elist) return;
644
645 if (fLists) { // This list is split
646 TEntryListArray* e = nullptr;
647 TIter next(fLists);
648 fN = 0; // reset fN to set it to the sum of fN in each list
649 while ((e = (TEntryListArray*) next())) {
650 e->Subtract(elist);
651 fN += e->GetN();
652 }
653 } else if (elist->GetLists()) { // The other list is split
654 TIter next(elist->GetLists());
655 TEntryList *e = nullptr;
656 while ((e = (TEntryList*) next())) {
657 Subtract(e);
658 }
659 } else { // None of the lists are split
660 if (strcmp(elist->GetTreeName(), fTreeName.Data()) || strcmp(elist->GetFileName(), fFileName.Data()))
661 return; // Lists are for different trees
662 const TEntryListArray *elist_array = dynamic_cast< const TEntryListArray *>(elist);
663 if (!fSubLists || !elist_array || !elist_array->GetSubLists()) { // there are no sublists in one of the lists
665 if (fSubLists) {
666 TEntryListArray *e = nullptr;
667 TIter next(fSubLists);
668 while ((e = (TEntryListArray*) next())) {
669 if (!Contains(e->fEntry))
671 }
672 }
673 } else { // Both lists have subentries, will have to loop over them
674 TEntryListArray *el1, *el2;
675 TIter next1(fSubLists);
676 TIter next2(elist_array->GetSubLists());
677 el1 = (TEntryListArray*) next1();
678 el2 = (TEntryListArray*) next2();
679
680 Long64_t n2 = elist->GetN();
681 Long64_t entry;
682 for (Int_t i = 0; i < n2; ++i) {
683 entry = (const_cast<TEntryList*>(elist))->GetEntry(i);
684 // Try to find the sublist for this entry in list
685 while (el1 && el1->fEntry < entry) { // && el2
686 el1 = (TEntryListArray*) next1();
687 }
688 while (el2 && el2->fEntry < entry) { // && el1
689 el2 = (TEntryListArray*) next2();
690 }
691
692 if (el1 && el2 && entry == el1->fEntry && entry == el2->fEntry) { // both lists have sublists for this entry
693 el1->Subtract(el2);
694 if (!el1->fN) {
695 Remove(entry);
696 }
697 } else {
698 Remove(entry);
699 }
700 }
701 }
702 }
703}
704
705////////////////////////////////////////////////////////////////////////////////
706/// If a list for a tree with such name and filename exists, sets it as the current sublist
707/// If not, creates this list and sets it as the current sublist
708
709void TEntryListArray::SetTree(const char *treename, const char *filename)
710{
711 // ! the filename is taken as provided, no extensions to full path or url !
712
713 // 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
714
715 Int_t nLists = -1;
716 if (fLists) {
717 nLists = fLists->GetEntries();
718 }
719 TEntryList::SetTree(treename, filename);
720 if (fLists && fLists->GetEntries() != nLists) { // fList was created and/or has new additions
721 if (nLists == -1) {
722 // The list has just been split (fList was created)
723 // There should be two TEntryLists in fLists:
724 // must convert both to TEntryListArray
725 // and transfer the sublists to the first one
727 }
729 }
730}
#define e(i)
Definition RSha256.hxx:103
long long Long64_t
Definition RtypesCore.h:69
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char name[80]
Definition TGX11.cxx:110
Collection abstract base class.
Definition TCollection.h:65
virtual Int_t GetEntries() const
A list of entries and subentries in a TTree or TChain.
virtual TEntryListArray * GetSubListForEntry(Long64_t entry, TTree *tree=nullptr)
Return the list holding the subentries for the given entry or 0.
virtual bool RemoveSubList(TEntryListArray *e, TTree *tree=nullptr)
Remove the given sublist and return true if succeeded.
~TEntryListArray() override
d-tor
void Print(const Option_t *option="") const override
Print this list.
void SetTree(const char *treename, const char *filename) override
If a list for a tree with such name and filename exists, sets it as the current sublist If not,...
void Reset() override
Reset all entries and remove all sublists.
void Init()
Initialize data members, called by Reset.
virtual TEntryListArray * SetEntry(Long64_t entry, TTree *tree=nullptr)
Create a sublist for the given entry and returns it --> should be called after calling GetSubListForE...
TEntryListArray * fLastSubListQueried
! last sublist checked by GetSubListForEntry
TList * fSubLists
a list of underlying entry lists for each event of a TEntryList
TEntryListArray()
Default c-tor.
virtual bool RemoveSubListForEntry(Long64_t entry, TTree *tree=nullptr)
Remove the sublists for the given entry --> not being used...
virtual void ConvertToTEntryListArray(TEntryList *e)
Create a TEntryListArray based on the given TEntryList Called by SetTree when the given list is added...
void Subtract(const TEntryList *elist) override
Remove all the entries (and subentries) of this entry list that are contained in elist.
Long64_t fEntry
the entry number, when the list is used for subentries
void Add(const TEntryList *elist) override
Add 2 entry lists.
virtual TList * GetSubLists() const
virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry)
virtual void AddEntriesAndSubLists(const TEntryList *elist)
The method that really adds two entry lists with sublists If lists are split (fLists !...
virtual bool Enter(Long64_t entry, TTree *tree, Long64_t subentry)
Add entry #entry (, #subentry) to the list.
TIter * fSubListIter
! to iterate over fSubLists and keep last one checked
virtual bool Remove(Long64_t entry, TTree *tree, Long64_t subentry)
Remove entry #entry (, #subentry) from the list.
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
virtual bool Enter(Long64_t entry, TTree *tree=nullptr)
Add entry #entry to the list.
TString fFileName
name of the file, where the tree is
Definition TEntryList.h:39
virtual TList * GetLists() const
Definition TEntryList.h:76
virtual Int_t Contains(Long64_t entry, TTree *tree=nullptr)
virtual bool Remove(Long64_t entry, TTree *tree=nullptr)
Remove entry #entry from the list.
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,...
Long64_t fN
number of entries in the list
Definition TEntryList.h:36
virtual void Reset()
Reset this list.
virtual const char * GetTreeName() const
Definition TEntryList.h:79
TEntryList * fCurrent
! currently filled entry list
Definition TEntryList.h:32
void Print(const Option_t *option="") const override
Print this list.
TList * fLists
a list of underlying entry lists for each tree of a chain
Definition TEntryList.h:31
void GetFileName(const char *filename, TString &fn, bool *=nullptr)
To be able to re-localize the entry-list we identify the file by just the name and the anchor,...
TString fTreeName
name of the tree
Definition TEntryList.h:38
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:78
TObject * Next()
void Reset()
A doubly linked list.
Definition TList.h:38
void Add(TObject *obj) override
Definition TList.h:83
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
void AddLast(TObject *obj) override
Add object at the end of the list.
Definition TList.cxx:150
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:691
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:657
void AddBefore(const TObject *before, TObject *obj) override
Insert object before object before in the list.
Definition TList.cxx:194
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:468
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
Definition TList.cxx:98
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
void ToUpper()
Change string to upper case.
Definition TString.cxx:1195
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
A TTree represents a columnar dataset.
Definition TTree.h:79