Logo ROOT   6.16/01
Reference Guide
TFileIter.cxx
Go to the documentation of this file.
1// @(#)root/table:$Id$
2// Author: Valery Fine(fine@bnl.gov) 01/03/2001
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * Copyright (C) 2001 [BNL] Brookhaven National Laboratory. *
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///////////////////////////////////////////////////////////////////////////
14// //
15// Class to iterate (read / write ) the events written to TFile. //
16// The event is supposed to assign an unique ID in form of //
17// //
18// TKey <event Id> ::= eventName "." run_number "." event_number //
19// //
20// and stored as the TKey name of the object written //
21// //
22// /////// ////////// //////// /////// //////
23//
24// void TesTFileIter(){
25// // This macros tests the various methods of TFileIter class.
26// gSystem->Load("libTable");
27//
28// //First create simple ROOT file
29// TDataSet *ds = new TDataSet("event");
30// TObject *nextObject = 0;
31// TRandom run;
32// TRandom event;
33// {
34// TFileIter outSet("test.root","RECREATE");
35// UInt_t totalEvent = 10;
36// UInt_t runNumber = 20010301;
37// Int_t i=0;
38// Int_t j=0;
39// for (;j < 10;j++) {
40// for (i = 1;i<totalEvent;i++) {
41// outSet.NextEventPut(ds,UInt_t(i),UInt_t(runNumber+j+10*run.Rndm()-5));
42// }
43// }
44// }
45// printf(" ----------------------> TFile has been created <--------------------\n");
46// TFile *f = new TFile("test.root");
47// TFileIter readObj(f);
48// // the number of the object available directly from "MyDataSet.root"
49// Int_t size = readObj.TotalKeys();
50// printf(" The total number of the objects: %d\n",size);
51//
52// //-----------------------------------------------------------------------
53// // Loop over all objects, read them in to memory one by one
54//
55// printf(" -- > Loop over all objects, read them in to memory one by one < -- \n");
56// for( readObj = 0; int(readObj) < size; ++readObj){
57// nextObject = *readObj;
58// printf(" %d bytes of the object \"%s\" of class \"%s\" written with TKey \"%s\" has been read from file\n"
59// ,readObj.GetObjlen()
60// ,nextObject->GetName()
61// ,nextObject->IsA()->GetName()
62// ,(const char *)readObj
63// );
64// delete nextObject;
65// }
66// //-----------------------------------------------------------------------
67// // Now loop over all objects in inverse order
68// printf(" -- > Now loop over all objects in inverse order < -- \n");
69// for( readObj = size-1; (int)readObj >= 0; --readObj)
70// {
71// nextObject = *readObj;
72// if (nextObject) {
73// printf(" Object \"%s\" of class \"%s\" written with TKey \"%s\" has been read from file\n"
74// ,nextObject->GetName()
75// , nextObject->IsA()->GetName()
76// ,(const char *)readObj
77// );
78// delete nextObject;
79// } else {
80// printf("Error reading file by index\n");
81// }
82// }
83// //-----------------------------------------------------------------------
84// // Loop over the objects starting from the object with the key name "event.02.01"
85// printf(" -- > Loop over the objects starting from the object with the key name \"event.02.01\" < -- \n");
86// for( readObj = "event.02.01"; (const char *)readObj != 0; ++readObj){
87// nextObject = *readObj;
88// printf(" Object \"%s\" of class \"%s\" written with Tkey \"%s\" has been read from file\n"
89// , nextObject->GetName()
90// , nextObject->IsA()->GetName()
91// , (const char *)readObj
92// );
93// delete nextObject;
94// }
95//
96// printf(" -- > Loop over the objects starting from the 86-th object" < -- \n");
97// for( readObj = (const char *)(readObj = 86); (const char *)readObj != 0; ++readObj){
98// nextObject = *readObj;
99// printf(" Object \"%s\" of class \"%s\" written with Tkey \"%s\" has been read from file\n"
100// , nextObject->GetName()
101// , nextObject->IsA()->GetName()
102// , (const char *)readObj
103// );
104// delete nextObject;
105// }
106//
107// }
108//-----------------------------------------------------------------------
109///////////////////////////////////////////////////////////////////////////
110
111
112#include <assert.h>
113
114#include "TEnv.h"
115#include "TSystem.h"
116#include "TFile.h"
117#include "TKey.h"
118
119#include "TFileIter.h"
120#include "TDsKey.h"
121
123
124////////////////////////////////////////////////////////////////////////////////
125/// Create iterator over all objects from the TFile provided
126
127TFileIter::TFileIter(TFile *file) : fNestedIterator(0)
128 , fRootFile(file)
129 , fEventName("event"), fRunNumber(UInt_t(-1)),fEventNumber(UInt_t(-1))
130 , fCursorPosition(-1), fOwnTFile(kFALSE)
131{
132 Initialize();
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Create iterator over all objects from the TDirectory provided
137
138TFileIter::TFileIter(TDirectory *directory) : fNestedIterator(0)
139 , fRootFile(directory)
140 , fEventName("event"), fRunNumber(UInt_t(-1)),fEventNumber(UInt_t(-1))
141 , fCursorPosition(-1), fOwnTFile(kFALSE)
142{
143 Initialize();
144}
145////////////////////////////////////////////////////////////////////////////////
146/// Open ROOT TFile by the name provided;
147/// This TFile is to be deleted by the TFileIter alone
148
149TFileIter::TFileIter(const char *name, Option_t *option, const char *ftitle
150 , Int_t compress, Int_t /*netopt*/) : fNestedIterator(0)
151 ,fRootFile(0)
152 ,fEventName("event"), fRunNumber(UInt_t(-1)) ,fEventNumber(UInt_t(-1))
153 ,fCursorPosition(-1), fOwnTFile(kFALSE)
154{
155 if (name && name[0]) {
157 // Map a special file system to rfio
158 // /hpss/in2p3.fr/group/atlas/cppm/data/genz
159 // #setenv HPSSIN bnlhpss:/home/atlasgen/evgen
160 // #example for castor: /castor/cern.ch/user/p/paniccia/evgen
161 fRootFile = TFile::Open(MapName(name),option,ftitle,compress);
162 Initialize();
163 }
164}
165
166////////////////////////////////////////////////////////////////////////////////
167/// Copy ctor can be used with the "read only" files only.
168///the next statement is illegal, spotted by coverity "Dereferencing pointer "this->fRootFile". (Deref happens because this is a virtual function call.)
169///assert(!fRootFile->IsWritable());
170
172 , fNestedIterator(0)
173 ,fRootFile(dst.fRootFile),fEventName(dst.fEventName), fRunNumber(dst.fRunNumber)
174 ,fEventNumber(dst.fRunNumber),
175 fCursorPosition(-1), fOwnTFile(dst.fOwnTFile)
176{
177 if (fRootFile && fOwnTFile) {
178 // Reopen the file
180 {
181 TFile *thisFile = (TFile *)fRootFile;
185 ,thisFile->GetCompressionSettings());
186 }
187 }
188
189 Initialize();
190 // Adjust this iterator position
192}
193////////////////////////////////////////////////////////////////////////////////
194/// TFileIter dtor
195
197{
199 delete deleteit;
200 if (fRootFile && fOwnTFile ) { // delete own TFile if any
202 fRootFile->Close();
203 delete fRootFile;
204 fRootFile = 0;
205 }
206}
207
208////////////////////////////////////////////////////////////////////////////////
209///to be documented
210
212{
213 if (fRootFile) {
215 if (IsOpen()) Reset();
216 else {
217 if (fRootFile && fOwnTFile ) delete fRootFile;
218 fRootFile = 0;
219 }
220 }
221}
222////////////////////////////////////////////////////////////////////////////////
223/// Check whether the associated ROOT TFile was open
224/// and TFile object is healthy.
225
227{
228 Bool_t iOpen = kFALSE;
229 if (fRootFile && !fRootFile->IsZombie() ) {
230 iOpen = kTRUE;
231 if (fRootFile->InheritsFrom(TFile::Class()) && !((TFile*)fRootFile)->IsOpen())
232 iOpen = kFALSE;
233 }
234 return iOpen;
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// return the pointer to the current TKey
239
241{
242 return ((TFileIter*)this)->SkipObjects(0);
243}
244////////////////////////////////////////////////////////////////////////////////
245/// return the current number of the nested subdirectroies;
246/// = 0 - means there is no subdirectories
247
249{
250 return fNestedIterator ? fNestedIterator->GetDepth()+1 : 0;
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// return the name of the current TKey
255
256const char *TFileIter::GetKeyName() const
257{
258 const char *name = 0;
259 TKey *key = GetCurrentKey();
260 if (key) name = key->GetName();
261 return name;
262}
263////////////////////////////////////////////////////////////////////////////////
264/// read the object from TFile defined by the current TKey
265///
266/// ATTENTION: memory leak danger !!!
267/// ---------
268/// This method does create a new object and it is the end-user
269/// code responsibility to take care about this object
270/// to avoid memory leak.
271///
272
274{
275 return ReadObj(GetCurrentKey());
276}
277////////////////////////////////////////////////////////////////////////////////
278/// Returns the uncompressed length of the current object
279
281{
282 Int_t lenObj = 0;
283 TKey *key = GetCurrentKey();
284 if (key) lenObj = ((TKey *)key)->GetObjlen();
285 return lenObj;
286}
287////////////////////////////////////////////////////////////////////////////////
288/// The total number of the TKey keys in the current TDirectory only
289/// Usually this means the total number of different objects
290/// those can be read one by one.
291/// It does NOT count the nested sub-TDirectory.
292/// It is too costly and it can be abused.
293
295{
296 Int_t size = 0;
297 if(fList) size += fList->GetSize();
298 return size;
299}
300////////////////////////////////////////////////////////////////////////////////
301/// return the pointer to the object defined by next TKey
302/// This method is not recommended. It was done for the sake
303/// of the compatibility with TListIter
304
306{
307 SkipObjects(nSkip);
308 return GetObject();
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Remove the TKey duplication,
313/// leave the keys with highest cycle number only
314/// Sort if first
315
317{
318 assert(listOfKeys);
319 listOfKeys->Sort();
320 TObjLink *lnk = listOfKeys->FirstLink();
321 while(lnk) {
322 TKey *key = (TKey *)lnk->GetObject();
323 Short_t cycle = key->GetCycle();
324 const char *keyName = key->GetName();
325 // Check next object
326 lnk = lnk->Next();
327 if (lnk) {
328 TKey *nextkey = 0;
329 TObjLink *lnkThis = lnk;
330 while ( lnk
331 && (nextkey = (TKey *)lnk->GetObject())
332 && !strcmp(nextkey->GetName(), keyName)
333 ) {
334 // compare the cycles
335 Short_t nextCycle = nextkey->GetCycle() ;
336 //printf(" TFileIter::PurgeKeys found new cycle %s :%d : %d\n",
337 // keyName,cycle ,nextCycle);
338 assert(cycle != nextCycle);
339 TObjLink *lnkNext = lnk->Next();
340 if (cycle > nextCycle ) {
341 delete listOfKeys->Remove(lnk);
342 } else {
343 delete listOfKeys->Remove(lnkThis);
344 cycle = nextCycle;
345 lnkThis = lnk;
346 }
347 lnk = lnkNext;
348 }
349 }
350 }
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Reset the status of the iterator
355
357{
358 if (fNestedIterator) {
361 delete it;
362 }
364 if (!fRootFile->IsWritable()) {
365 TList *listOfKeys = fRootFile->GetListOfKeys();
366 if (listOfKeys) {
367 if (!listOfKeys->IsSorted()) PurgeKeys(listOfKeys);
368 fList = listOfKeys;
369 if (fDirection == kIterForward) {
370 fCursorPosition = 0;
371 fCurCursor = fList->FirstLink()->shared_from_this();
372 if (fCurCursor) fCursor = fCurCursor->NextSP();
373 } else {
375 fCurCursor = fList->LastLink()->shared_from_this();
376 if (fCurCursor) fCursor = fCurCursor->PrevSP();
377 }
378 }
379 }
380}
381////////////////////////////////////////////////////////////////////////////////
382/// Find the key by the name provided
383
384void TFileIter::SetCursorPosition(const char *keyNameToFind)
385{
386 Reset();
387 while( (*this != keyNameToFind) && SkipObjects() ) {;}
388}
389////////////////////////////////////////////////////////////////////////////////
390///
391/// Returns the TKey pointer to the nSkip TKey object from the current one
392/// nSkip = 0; the state of the iterator is not changed
393///
394/// nSkip > 0; iterator skips nSkip objects in the container.
395/// the direction of the iteration is
396/// sign(nSkip)*kIterForward
397///
398/// Returns: TKey that can be used to fetch the object from the TDirectory
399///
400
402{
403 TKey *nextObject = fNestedIterator ? fNestedIterator->SkipObjects(nSkip): 0;
404 if (!nextObject) {
405 if (fNestedIterator) {
407 fNestedIterator = 0;
408 delete it;
409 }
410 Int_t collectionSize = 0;
411 if (fList && (collectionSize = fList->GetSize()) ) {
412 if (fDirection !=kIterForward) nSkip = -nSkip;
413 Int_t newPos = fCursorPosition + nSkip;
414 if (0 <= newPos && newPos < collectionSize) {
415 do {
416 if (fCursorPosition < newPos) {
419 fCursor = fCursor->NextSP();
420 } else if (fCursorPosition > newPos) {
423 fCursor = fCursor->PrevSP();
424 }
425 } while (fCursorPosition != newPos);
426 if (fCurCursor) nextObject = dynamic_cast<TKey *>(fCurCursor->GetObject());
427 } else {
428 fCurCursor = fCursor = 0;
429 if (newPos < 0) {
430 fCursorPosition = -1;
431 if (fList) fCursor = fList->FirstLink()->shared_from_this();
432 } else {
433 fCursorPosition = collectionSize;
434 if (fList) fCursor = fList->LastLink()->shared_from_this();
435 }
436 }
437 }
438 }
439 return nextObject;
440}
441////////////////////////////////////////////////////////////////////////////////
442
443TKey *TFileIter::NextEventKey(UInt_t eventNumber, UInt_t runNumber, const char *name)
444{
445 // Return the key that name matches the "event" . "run number" . "event number" schema
446
447 Bool_t reset = kFALSE;
448 if (name && name[0] && name[0] != '*') { if (fEventName > name) reset = kTRUE; fEventName = name; }
449 if (runNumber !=UInt_t(-1) ) { if (fRunNumber > runNumber) reset = kTRUE; fRunNumber = runNumber;}
450 if (eventNumber !=UInt_t(-1) ) { if (fEventNumber > eventNumber) reset = kTRUE; fEventNumber = eventNumber;}
451
452 if (reset) Reset();
453 // TIter &nextKey = *fKeysIterator;
454 TKey *key = 0;
455 TDsKey thisKey;
456 while ( (key = SkipObjects()) ) {
458 else fCursorPosition--;
459 if ( name && name[0] != '*') {
460 thisKey.SetKey(key->GetName());
461 if (thisKey.GetName() < name) continue;
462 if (thisKey.GetName() > name) { key = 0; break; }
463 }
464 // Check "run number"
465 if (runNumber != UInt_t(-1)) {
466 UInt_t thisRunNumber = thisKey.RunNumber();
467 if (thisRunNumber < runNumber) continue;
468 if (thisRunNumber > runNumber) { key = 0; break; }
469 }
470 // Check "event number"
471 if (eventNumber != UInt_t(-1)) {
472 UInt_t thisEventNumber = thisKey.EventNumber();
473 if (thisEventNumber < eventNumber) continue;
474 if (thisEventNumber > eventNumber) {key = 0; break; }
475 }
476 break;
477 }
478 return key;
479}
480////////////////////////////////////////////////////////////////////////////////
481/// reads, creates and returns the object by TKey name that matches
482/// the "name" ."runNumber" ." eventNumber" schema
483/// Attention: This method does create a new TObject and it is the user
484/// code responsibility to take care (delete) this object to avoid
485/// memory leak.
486
487TObject *TFileIter::NextEventGet(UInt_t eventNumber, UInt_t runNumber, const char *name)
488{
489 return ReadObj(NextEventKey(eventNumber,runNumber,name));
490}
491
492////////////////////////////////////////////////////////////////////////////////
493///Read the next TObject from for the TDirectory by TKey provided
494
496{
497 TObject *obj = 0;
498 if (fNestedIterator) obj = fNestedIterator->ReadObj(key);
499 else if (key) {
500 obj = ((TKey *)key)->ReadObj();
501 if (obj && obj->InheritsFrom(TDirectory::Class()) )
502 {
503 // create the next iteration level.
504 assert(!fNestedIterator);
505 ((TFileIter*)this)->fNestedIterator = new TFileIter((TDirectory *)obj);
506 // FIXME: needs to set fDirection if needed 02/11/2007 vf
507 }
508 }
509 return obj;
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Create a special TKey name with obj provided and write it out.
514
516 , const char *name)
517{
518 Int_t wBytes = 0;
519 if (obj && IsOpen() && fRootFile->IsWritable()) {
520 TDsKey thisKey(runNumber,eventNum);
521 if (name && name[0])
522 thisKey.SetName(name);
523 else
524 thisKey.SetName(obj->GetName());
525
526 TDirectory::TContext ctxt(fRootFile); // Store the current directory, cd to fRootFile and at the end of the block restore the current directory.
527
528 wBytes = obj->Write(thisKey.GetKey());
529 if (fRootFile->InheritsFrom(TFile::Class())) ((TFile*)fRootFile)->Flush();
530 }
531 return wBytes;
532}
533////////////////////////////////////////////////////////////////////////////////
534/// --------------------------------------------------------------------------------------
535/// MapName(const char *name, const char *localSystemKey,const char *mountedFileSystemKey)
536/// --------------------------------------------------------------------------------------
537/// Substitute the logical name with the real one if any
538/// 1. add a line into system.rootrc or ~/.rootrc or ./.rootrc
539///
540/// TFileIter.ForeignFileMap mapFile // the name of the file
541/// to map the local name
542/// to the global file service
543///
544/// If this line is omitted then TFileIter class seeks for
545/// the default mapping file in the current directory "io.config"
546
547TString TFileIter::MapName(const char *name, const char *localSystemKey,const char *mountedFileSystemKey)
548{
549 // 2. If the "io.config" file found then it defines the mapping as follows:
550 //
551 // TFileIter.LocalFileSystem /castor
552 // TFileIter.MountedFileSystem rfio:/castor
553
554 // If "io.config" doesn't exist then no mapping is to be performed
555 // and all file names are treated "as is"
556
557 if ( !localSystemKey) localSystemKey = GetLocalFileNameKey();
558 if ( !mountedFileSystemKey) mountedFileSystemKey = GetForeignFileSystemKey();
559 TString newName = name;
561 const char *localName = 0;
562 const char *foreignName = 0;
563 if ( gSystem->AccessPathName(fileMap) == 0 ){
564 TEnv myMapResource(fileMap);
565 localName = myMapResource.Defined(localSystemKey) ?
566 myMapResource.GetValue(localSystemKey,"") : 0;
567 foreignName = myMapResource.Defined(mountedFileSystemKey) ?
568 myMapResource.GetValue(mountedFileSystemKey,""):0;
569 } else {
570 localName = "/castor"; // This is the default CERN name
571 foreignName = "rfio:/castor"; // and it needs "RFIO"
572 }
573 if (localName && localName[0]
574 && foreignName
575 && foreignName[0]
576 && newName.BeginsWith(localName) )
577 newName.Replace(0,strlen(localName),foreignName);
578 return newName;
579}
void Class()
Definition: Class.C:29
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
short Short_t
Definition: RtypesCore.h:35
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
const Bool_t kIterForward
Definition: TCollection.h:40
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
Describe directory structure in memory.
Definition: TDirectory.h:34
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
Definition: TDirectory.cxx:584
virtual Bool_t IsWritable() const
Definition: TDirectory.h:163
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:150
virtual Int_t Write(const char *=0, Int_t=0, Int_t=0)
Write this object to the current directory.
Definition: TDirectory.h:190
Definition: TDsKey.h:22
virtual const char * GetName() const
Definition: TDsKey.h:40
virtual UInt_t EventNumber() const
Definition: TDsKey.h:42
virtual TString GetKey() const
to be documented
Definition: TDsKey.cxx:111
virtual void SetKey(const char *key)
to be documented
Definition: TDsKey.cxx:126
virtual UInt_t RunNumber() const
Definition: TDsKey.h:43
virtual void SetName(const char *name)
Definition: TDsKey.h:39
The TEnv class reads config files, by default named .rootrc.
Definition: TEnv.h:125
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
Bool_t Defined(const char *name) const
Definition: TEnv.h:142
static void PurgeKeys(TList *listOfKeys)
Remove the TKey duplication, leave the keys with highest cycle number only Sort if first.
Definition: TFileIter.cxx:316
virtual TObject * GetObject() const
read the object from TFile defined by the current TKey
Definition: TFileIter.cxx:273
TFileIter * fNestedIterator
Definition: TFileIter.h:57
void SetCursorPosition(Int_t cursorPosition)
Definition: TFileIter.h:172
virtual ~TFileIter()
TFileIter dtor.
Definition: TFileIter.cxx:196
virtual TObject * NextEventGet(UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
reads, creates and returns the object by TKey name that matches the "name" .
Definition: TFileIter.cxx:487
static const char * GetResourceName()
Definition: TFileIter.h:136
TDirectory * fRootFile
Definition: TFileIter.h:63
virtual Bool_t IsOpen() const
Check whether the associated ROOT TFile was open and TFile object is healthy.
Definition: TFileIter.cxx:226
Int_t fCursorPosition
Definition: TFileIter.h:67
TKey * GetCurrentKey() const
return the pointer to the current TKey
Definition: TFileIter.cxx:240
virtual Int_t TotalKeys() const
The total number of the TKey keys in the current TDirectory only Usually this means the total number ...
Definition: TFileIter.cxx:294
static const char * GetLocalFileNameKey()
Definition: TFileIter.h:140
TFileIter(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Open ROOT TFile by the name provided; This TFile is to be deleted by the TFileIter alone.
Definition: TFileIter.cxx:149
UInt_t fEventNumber
Definition: TFileIter.h:66
static const char * GetForeignFileSystemKey()
Definition: TFileIter.h:142
const char * GetKeyName() const
return the name of the current TKey
Definition: TFileIter.cxx:256
virtual TKey * SkipObjects(Int_t nSkip=1)
Returns the TKey pointer to the nSkip TKey object from the current one nSkip = 0; the state of the it...
Definition: TFileIter.cxx:401
void Initialize()
to be documented
Definition: TFileIter.cxx:211
virtual void Reset()
Reset the status of the iterator.
Definition: TFileIter.cxx:356
virtual Int_t NextEventPut(TObject *obj, UInt_t eventNum, UInt_t runNumber, const char *name=0)
Create a special TKey name with obj provided and write it out.
Definition: TFileIter.cxx:515
static TString MapName(const char *name, const char *localSystemKey=0, const char *mountedFileSystemKey=0)
Definition: TFileIter.cxx:547
virtual Int_t GetDepth() const
return the current number of the nested subdirectroies; = 0 - means there is no subdirectories
Definition: TFileIter.cxx:248
TKey * NextEventKey(UInt_t eventNumber=UInt_t(-1), UInt_t runNumber=UInt_t(-1), const char *name="*")
Definition: TFileIter.cxx:443
TObject * ReadObj(const TKey *key) const
Read the next TObject from for the TDirectory by TKey provided.
Definition: TFileIter.cxx:495
UInt_t fRunNumber
Definition: TFileIter.h:65
TString fEventName
Definition: TFileIter.h:64
virtual TObject * Next()
Return next object in the list. Returns 0 when no more objects in list.
Definition: TFileIter.h:158
Int_t GetObjlen() const
Returns the uncompressed length of the current object.
Definition: TFileIter.cxx:280
static const char * GetDefaultMapFileName()
Definition: TFileIter.h:138
Bool_t fOwnTFile
Definition: TFileIter.h:68
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:48
Int_t GetCompressionSettings() const
Definition: TFile.h:391
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3975
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:24
Short_t GetCycle() const
Return cycle number associated to this key.
Definition: TKey.cxx:564
Iterator of linked list.
Definition: TList.h:200
const TList * fList
Definition: TList.h:205
TObjLinkPtr_t fCursor
Definition: TList.h:207
TObjLinkPtr_t fCurCursor
Definition: TList.h:206
void Reset()
Reset list iterator.
Definition: TList.cxx:1157
Bool_t fDirection
Definition: TList.h:208
A doubly linked list.
Definition: TList.h:44
virtual TObjLink * LastLink() const
Definition: TList.h:111
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:818
virtual TObjLink * FirstLink() const
Definition: TList.h:108
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:933
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:785
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual Option_t * GetOption() const
Definition: TObject.h:120
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:134
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual Bool_t IsSorted() const
Basic string class.
Definition: TString.h:131
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition: TString.h:677
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:610
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1286
Definition: file.py:1