Logo ROOT   6.16/01
Reference Guide
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 virtual ~TEventIter();
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
91 static TEventIter *Create(TDSet *dset, TSelector *sel, Long64_t first, Long64_t num);
92
93 ClassDef(TEventIter,0) // Event iterator used by TProofPlayer's
94};
95
96
97//------------------------------------------------------------------------
98
99class TEventIterUnit : public TEventIter {
100
101private:
104
105
106public:
108 TEventIterUnit(TDSet *dset, TSelector *sel, Long64_t num);
110
111 Long64_t GetCacheSize() {return -1;}
112 Int_t GetLearnEntries() {return -1;}
115
116 ClassDef(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:
132
133public:
137
138 Long64_t GetCacheSize() {return -1;}
139 Int_t GetLearnEntries() {return -1;}
142
143 ClassDef(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 virtual ~TFileTree();
170 };
171
172 TTree* Load(TDSetElement *elem, Bool_t &localfile, const char *objname = 0);
174
175protected:
176 void PreProcessEvent(Long64_t ent);
177
178public:
182
187
188 ClassDef(TEventIterTree,0) // Event iterator for Trees
189};
190
191#endif
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:69
#define ClassDef(name, id)
Definition: Rtypes.h:324
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:34
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:26
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:445
Int_t GetLearnEntries()
Definition: TEventIter.h:139
TEventIterObj()
Default ctor.
Definition: TEventIter.cxx:412
Long64_t GetNextEvent()
Get next event.
Definition: TEventIter.cxx:560
Long64_t GetCacheSize()
Definition: TEventIter.h:138
TList * fKeys
Definition: TEventIter.h:126
~TEventIterObj()
Destructor.
Definition: TEventIter.cxx:435
TIter * fNextKey
Definition: TEventIter.h:127
void PreProcessEvent(Long64_t)
To be executed before by TProofPlayer calling TSelector::Process.
Definition: TEventIter.cxx:545
TObject * fObj
Definition: TEventIter.h:128
TString fClassName
Definition: TEventIter.h:125
TFileTree(const char *name, TFile *f, Bool_t islocal)
Default ctor.
Definition: TEventIter.cxx:665
virtual ~TFileTree()
Default dtor.
Definition: TEventIter.cxx:674
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Int_t GetLearnEntries()
Return the number of entries in the learning phase.
Definition: TEventIter.cxx:752
Bool_t fUseTreeCache
Definition: TEventIter.h:155
TString fTreeName
Definition: TEventIter.h:151
Long64_t GetCacheSize()
Return the size in bytes of the cache, if any Return -1 if not used.
Definition: TEventIter.cxx:743
Bool_t fDontCacheFiles
Definition: TEventIter.h:158
Long64_t GetNextEvent()
Get next event.
TTreeCache * fTreeCache
Definition: TEventIter.h:153
Long64_t fCacheSize
Definition: TEventIter.h:156
void PreProcessEvent(Long64_t ent)
Actions to be done just before processing entry 'entry'.
TList * fFileTrees
Definition: TEventIter.h:159
TEventIterTree()
Default ctor.
Definition: TEventIter.cxx:691
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Definition: TEventIter.cxx:862
Bool_t fTreeCacheIsLearning
Definition: TEventIter.h:154
~TEventIterTree()
Destructor.
Definition: TEventIter.cxx:731
TTree * fTree
Definition: TEventIter.h:152
Bool_t fUseParallelUnzip
Definition: TEventIter.h:157
TTree * GetTrees(TDSetElement *elem)
Create a Tree for the main TDSetElement and for all the friends.
Definition: TEventIter.cxx:761
Long64_t fCurrent
Definition: TEventIter.h:103
Int_t GetLearnEntries()
Definition: TEventIter.h:112
Long64_t fNum
Definition: TEventIter.h:102
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:285
Long64_t GetNextEvent()
Get next event.
Definition: TEventIter.cxx:341
Long64_t GetCacheSize()
Definition: TEventIter.h:111
TEventIterUnit()
Default constructor.
Definition: TEventIter.cxx:257
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 ~TEventIter()
Destructor.
Definition: TEventIter.cxx:122
virtual Long64_t GetEntryNumber(Long64_t)
Definition: TEventIter.cxx:230
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.
Definition: TEventIter.cxx:142
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.
Definition: TEventIter.cxx:150
Bool_t fStop
Definition: TEventIter.h:65
virtual Int_t GetNextPacket(Long64_t &first, Long64_t &num)=0
Int_t LoadDir()
Load directory.
Definition: TEventIter.cxx:164
TString fPath
Definition: TEventIter.h:55
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
Definition: TEventIter.cxx:134
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.
Definition: TEventIter.cxx:55
TSelector * fSel
Definition: TEventIter.h:61
Long64_t fElemNum
Definition: TEventIter.h:58
virtual Long64_t GetNextEvent()=0
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:31
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:48
A doubly linked list.
Definition: TList.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
Basic string class.
Definition: TString.h:131
A TTree object has a header with a name and a title.
Definition: TTree.h:71
Definition: first.py:1