Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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// };
43 virtual bool RemoveSubList(TEntryListArray *e, TTree *tree = nullptr);
44 virtual bool RemoveSubListForEntry(Long64_t entry, TTree *tree = nullptr);
45 virtual TEntryListArray* SetEntry(Long64_t entry, TTree *tree = nullptr);
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);
53 TEntryListArray(const TTree *tree);
54 TEntryListArray(const TEntryListArray& elist);
55 TEntryListArray(const TEntryList& elist); // to convert TEL to TELA
56 ~TEntryListArray() override;
57
58 void Add(const TEntryList *elist) override;
59 virtual Int_t Contains(Long64_t entry, TTree *tree, Long64_t subentry);
60 Int_t Contains(Long64_t entry, TTree *tree = nullptr) override {
61 return TEntryList::Contains(entry, tree);
62 };
63 virtual bool Enter(Long64_t entry, TTree *tree, Long64_t subentry);
64 virtual bool Enter(Long64_t entry, const char *treename, const char *filename, Long64_t subentry);
65 bool Enter(Long64_t entry, TTree *tree = nullptr) override {
66 return Enter(entry, tree, -1);
67 };
68 bool Enter(Long64_t entry, const char *treename, const char *filename) override
69 {
70 return Enter(entry, treename, filename, -1);
71 };
72// virtual bool Enter(Long64_t entry, TTree *tree, const TEntryList *e);
73 virtual TEntryListArray* GetSubListForEntry(Long64_t entry, TTree *tree = nullptr);
74 void Print(const Option_t* option = "") const override;
75 virtual bool Remove(Long64_t entry, TTree *tree, Long64_t subentry);
76 bool Remove(Long64_t entry, TTree *tree = nullptr) override {
77 return Remove(entry, tree, -1);
78 };
79 void Reset() override;
80
81 void SetTree(const char *treename, const char *filename) override;
82 void SetTree(const TTree *tree) override {
83 TEntryList::SetTree(tree); // will take treename and filename from the tree and call the method above
84 }
85 void Subtract(const TEntryList *elist) override;
86 virtual TList* GetSubLists() const {
87 return fSubLists;
88 };
89
90 ClassDefOverride(TEntryListArray, 1); //A list of entries and subentries in a TTree
91};
92#endif
#define e(i)
Definition RSha256.hxx:103
long long Long64_t
Definition RtypesCore.h:80
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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
char name[80]
Definition TGX11.cxx:110
Collection abstract base class.
Definition TCollection.h:65
Describe directory structure in memory.
Definition TDirectory.h:45
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 SetTree(const TTree *tree) override
If a list for a tree with such name and filename exists, sets it as the current sublist If not,...
bool Remove(Long64_t entry, TTree *tree=nullptr) override
Remove entry #entry from the list.
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.
Int_t Contains(Long64_t entry, TTree *tree=nullptr) override
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
TEntryListArray & operator=(const TEntryListArray &)
bool Enter(Long64_t entry, const char *treename, const char *filename) override
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.
bool Enter(Long64_t entry, TTree *tree=nullptr) override
Add entry #entry 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 Int_t Contains(Long64_t entry, TTree *tree=nullptr)
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,...
A doubly linked list.
Definition TList.h:38
An array of TObjects.
Definition TObjArray.h:31
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79