Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEventIter.h
Go to the documentation of this file.
1// @(#)root/proofplayer:$Id$
2// Author: Maarten Ballintijn 07/01/02
3// Modified: Long Tran-Thanh 04/09/07 (Addition of TEventIterUnit)
4
5/*************************************************************************
6 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_TEventIter
14#define ROOT_TEventIter
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TEventIter //
19// //
20// Special iterator class used in TProofPlayer to iterate over events //
21// or objects in the packets. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TNamed.h"
26#include "TString.h"
27
28class TDSet;
29class TDSetElement;
30class TFile;
31class TDirectory;
32class TSelector;
33class TList;
34class TIter;
35class TTree;
36class TTreeCache;
37class TEventList;
38class TEntryList;
39
40//------------------------------------------------------------------------
41
42class TEventIter : public TObject {
43
44public:
45 enum EIterType { kData = 15}; // True if iterating over data
46
47protected:
48 TDSet *fDSet; // data set over which to iterate
49
50 TDSetElement *fElem; // Current Element
51
52 TString fFilename; // Name of the current file
53 TFile *fFile; // Current file
54 Long64_t fOldBytesRead; // last reported number of bytes read
55 TString fPath; // Path to current TDirectory
56 TDirectory *fDir; // directory containing the objects or the TTree
57 Long64_t fElemFirst; // first entry to process for this element
58 Long64_t fElemNum; // number of entries to process for this element
59 Long64_t fElemCur; // current entry for this element
60
61 TSelector *fSel; // selector to be used
62 Long64_t fFirst; // first entry to process
63 Long64_t fNum; // number of entries to process
64 Long64_t fCur; // current entry
65 Bool_t fStop; // termination of run requested
66 TEventList *fEventList; //! eventList for processing
67 Int_t fEventListPos; //! current position in the eventList
68 TEntryList *fEntryList; //! entry list for processing
69 Long64_t fEntryListPos; //! current position in the entrylist
70
71 TList *fPackets; // list of packets processed packets
72
73 Int_t LoadDir(); // Load the directory pointed to by fElem
74 virtual void PreProcessEvent(Long64_t) { }
75
76public:
77 TEventIter();
79 ~TEventIter() override;
80
81 virtual Long64_t GetCacheSize() = 0;
82 virtual Int_t GetLearnEntries() = 0;
83 virtual Long64_t GetNextEvent() = 0;
85 virtual void InvalidatePacket();
87 virtual void StopProcess(Bool_t abort);
88
89 TList *GetPackets() { return fPackets; }
90
92
93 ClassDefOverride(TEventIter,0) // Event iterator used by TProofPlayer's
94};
95
96
97//------------------------------------------------------------------------
98
99class TEventIterUnit : public TEventIter {
100
101private:
104
105
106public:
109 ~TEventIterUnit() override { }
110
111 Long64_t GetCacheSize() override {return -1;}
112 Int_t GetLearnEntries() override {return -1;}
113 Long64_t GetNextEvent() override;
114 Int_t GetNextPacket(Long64_t &first, Long64_t &num) override;
115
116 ClassDefOverride(TEventIterUnit,0) // Event iterator for objects
117};
118
119
120//------------------------------------------------------------------------
121
122class TEventIterObj : public TEventIter {
123
124private:
125 TString fClassName; // class name of objects to iterate over
126 TList *fKeys; // list of keys
127 TIter *fNextKey; // next key in directory
128 TObject *fObj; // object found
129
130protected:
131 void PreProcessEvent(Long64_t) override;
132
133public:
136 ~TEventIterObj() override;
137
138 Long64_t GetCacheSize() override {return -1;}
139 Int_t GetLearnEntries() override {return -1;}
140 Long64_t GetNextEvent() override;
141 Int_t GetNextPacket(Long64_t &first, Long64_t &num) override;
142
143 ClassDefOverride(TEventIterObj,0) // Event iterator for objects
144};
145
146
147//------------------------------------------------------------------------
149
150private:
151 TString fTreeName; // name of the tree object to iterate over
152 TTree *fTree; // tree we are iterating over
153 TTreeCache *fTreeCache; // instance of the tree cache for the tree
154 Bool_t fTreeCacheIsLearning; // Whether cache is in learning phase
155 Bool_t fUseTreeCache; // Control usage of the tree cache
156 Long64_t fCacheSize; // Cache size
157 Bool_t fUseParallelUnzip; // Control usage of parallel unzip
158 Bool_t fDontCacheFiles; // Control OS caching of read files (Mac Os X only)
159 TList *fFileTrees; // Files && Trees currently open
160
161 // Auxilliary class to keep track open files and loaded trees
162 class TFileTree : public TNamed {
163 public:
168 TFileTree(const char *name, TFile *f, Bool_t islocal);
169 ~TFileTree() override;
170 };
171
172 TTree* Load(TDSetElement *elem, Bool_t &localfile, const char *objname = 0);
174
175protected:
176 void PreProcessEvent(Long64_t ent) override;
177
178public:
181 ~TEventIterTree() override;
182
183 Long64_t GetCacheSize() override;
184 Int_t GetLearnEntries() override;
185 Long64_t GetNextEvent() override;
186 Int_t GetNextPacket(Long64_t &first, Long64_t &num) override;
187
188 ClassDefOverride(TEventIterTree,0) // Event iterator for Trees
189};
190
191#endif
#define f(i)
Definition RSha256.hxx:104
int Int_t
Definition RtypesCore.h:45
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
char name[80]
Definition TGX11.cxx:110
Manages an element of a TDSet.
Definition TDSet.h:66
This class implements a data set to be used for PROOF processing.
Definition TDSet.h:153
Describe directory structure in memory.
Definition TDirectory.h:45
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
TEventIterObj()
Default ctor.
void PreProcessEvent(Long64_t) override
To be executed before by TProofPlayer calling TSelector::Process.
TList * fKeys
Definition TEventIter.h:126
Int_t GetLearnEntries() override
Definition TEventIter.h:139
TIter * fNextKey
Definition TEventIter.h:127
Long64_t GetCacheSize() override
Definition TEventIter.h:138
Long64_t GetNextEvent() override
Get next event.
TObject * fObj
Definition TEventIter.h:128
~TEventIterObj() override
Destructor.
TString fClassName
Definition TEventIter.h:125
~TFileTree() override
Default dtor.
Bool_t fUseTreeCache
Definition TEventIter.h:155
TString fTreeName
Definition TEventIter.h:151
Bool_t fDontCacheFiles
Definition TEventIter.h:158
TTreeCache * fTreeCache
Definition TEventIter.h:153
Long64_t fCacheSize
Definition TEventIter.h:156
void PreProcessEvent(Long64_t ent) override
Actions to be done just before processing entry 'entry'.
TList * fFileTrees
Definition TEventIter.h:159
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
~TEventIterTree() override
Destructor.
TEventIterTree()
Default ctor.
Long64_t GetNextEvent() override
Get next event.
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Bool_t fTreeCacheIsLearning
Definition TEventIter.h:154
Int_t GetLearnEntries() override
Return the number of entries in the learning phase.
Bool_t fUseParallelUnzip
Definition TEventIter.h:157
Long64_t GetCacheSize() override
Return the size in bytes of the cache, if any Return -1 if not used.
TTree * GetTrees(TDSetElement *elem)
Create a Tree for the main TDSetElement and for all the friends.
Long64_t fCurrent
Definition TEventIter.h:103
Long64_t fNum
Definition TEventIter.h:102
Long64_t GetNextEvent() override
Get next event.
Long64_t GetCacheSize() override
Definition TEventIter.h:111
Int_t GetLearnEntries() override
Definition TEventIter.h:112
TEventIterUnit()
Default constructor.
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
~TEventIterUnit() override
Definition TEventIter.h:109
Special iterator class used in TProofPlayer to iterate over events or objects in the packets.
Definition TEventIter.h:42
Long64_t fEntryListPos
entry list for processing
Definition TEventIter.h:69
virtual Long64_t GetEntryNumber(Long64_t)
Long64_t fCur
Definition TEventIter.h:64
virtual Int_t GetLearnEntries()=0
TDSetElement * fElem
Definition TEventIter.h:50
Long64_t fNum
Definition TEventIter.h:63
TList * fPackets
current position in the entrylist
Definition TEventIter.h:71
TEventList * fEventList
Definition TEventIter.h:66
Long64_t fElemCur
Definition TEventIter.h:59
Long64_t fElemFirst
Definition TEventIter.h:57
TFile * fFile
Definition TEventIter.h:53
TList * GetPackets()
Definition TEventIter.h:89
virtual void StopProcess(Bool_t abort)
Set flag to stop the process.
Long64_t fFirst
Definition TEventIter.h:62
Long64_t fOldBytesRead
Definition TEventIter.h:54
virtual Long64_t GetCacheSize()=0
Int_t fEventListPos
eventList for processing
Definition TEventIter.h:67
static TEventIter * Create(TDSet *dset, TSelector *sel, Long64_t first, Long64_t num)
Create and instance of the appropriate iterator.
Bool_t fStop
Definition TEventIter.h:65
virtual Int_t GetNextPacket(Long64_t &first, Long64_t &num)=0
Int_t LoadDir()
Load directory.
TString fPath
Definition TEventIter.h:55
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
TString fFilename
Definition TEventIter.h:52
TDirectory * fDir
Definition TEventIter.h:56
TEntryList * fEntryList
current position in the eventList
Definition TEventIter.h:68
virtual void PreProcessEvent(Long64_t)
Definition TEventIter.h:74
TDSet * fDSet
Definition TEventIter.h:48
TEventIter()
Default constructor.
TSelector * fSel
Definition TEventIter.h:61
Long64_t fElemNum
Definition TEventIter.h:58
virtual Long64_t GetNextEvent()=0
~TEventIter() override
Destructor.
A TEventList object is a list of selected events (entries) in a TTree.
Definition TEventList.h:31
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
Basic string class.
Definition TString.h:139
A cache to speed-up the reading of ROOT datasets.
Definition TTreeCache.h:32
A TTree represents a columnar dataset.
Definition TTree.h:79
Definition first.py:1