Logo ROOT   6.12/07
Reference Guide
TEventIter.cxx
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 /** \class TEventIter
14 \ingroup proofkernel
15 
16 Special iterator class used in TProofPlayer to iterate over events
17 or objects in the packets.
18 
19 */
20 
21 #include "TEnv.h"
22 #include "TEventIter.h"
23 #include "TFriendElement.h"
24 #include "TCollection.h"
25 #include "TDSet.h"
26 #include "TFile.h"
27 #include "TKey.h"
28 #include "TProofDebug.h"
29 #include "TSelector.h"
30 #include "TTimeStamp.h"
31 #include "TTree.h"
32 #include "TTreeCache.h"
33 #include "TTreeCacheUnzip.h"
34 #include "TVirtualPerfStats.h"
35 #include "TEventList.h"
36 #include "TEntryList.h"
37 #include "TList.h"
38 #include "TMap.h"
39 #include "TObjString.h"
40 #include "TRegexp.h"
41 #include "TProofServ.h"
42 #include "TSystem.h"
43 
44 #include "TError.h"
45 
46 #if defined(R__MACOSX)
47 #include "fcntl.h"
48 #endif
49 
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// Default constructor
54 
56 {
57  fDSet = 0;
58  fElem = 0;
59  fFile = 0;
60  fDir = 0;
61  fSel = 0;
62  fFirst = 0;
63  fCur = -1;
64  fNum = 0;
65  fStop = kFALSE;
66  fOldBytesRead = 0;
67  fEventList = 0;
68  fEventListPos = 0;
69  fEntryList = 0;
70  fEntryListPos = 0;
71  fElemFirst = 0;
72  fElemNum = 0;
73  fElemCur = -1;
75 
76  if ((fPackets = new TList)) {
77  TString n("ProcessedPackets_");
78  if (gProofServ) n += gProofServ->GetOrdinal();
79  fPackets->SetName(n);
80  Info("TEventIter", "fPackets list '%s' created", n.Data());
81  } else {
82  Warning("TEventIter", "fPackets list could not be created");
83  }
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// Constructor
88 
90  : fDSet(dset), fSel(sel)
91 {
92  fElem = 0;
93  fFile = 0;
94  fDir = 0;
95  fFirst = first;
96  fCur = -1;
97  fNum = num;
98  fStop = kFALSE;
99  fEventList = 0;
100  fEventListPos = 0;
101  fEntryList = 0;
102  fEntryListPos = 0;
103  fOldBytesRead = 0;
104  fElemFirst = 0;
105  fElemNum = 0;
106  fElemCur = -1;
108 
109  if ((fPackets = new TList)) {
110  TString n("ProcessedPackets_");
111  if (gProofServ) n += gProofServ->GetOrdinal();
112  fPackets->SetName(n);
113  Info("TEventIter", "fPackets list '%s' created", n.Data());
114  } else {
115  Warning("TEventIter", "fPackets list could not be created");
116  }
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// Destructor
121 
123 {
124  if (fPackets) {
127  }
128  delete fFile;
129 }
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 /// Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit
133 
135 {
137 }
138 
139 ////////////////////////////////////////////////////////////////////////////////
140 /// Set flag to stop the process
141 
143 {
144  fStop = kTRUE;
145 }
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// Create and instance of the appropriate iterator
149 
151 {
152  if (dset->TestBit(TDSet::kEmpty)) {
153  return new TEventIterUnit(dset, sel, num);
154  } else if (dset->IsTree()) {
155  return new TEventIterTree(dset, sel, first, num);
156  } else {
157  return new TEventIterObj(dset, sel, first, num);
158  }
159 }
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// Load directory
163 
165 {
166  Int_t ret = 0;
167 
168  // Check Filename
169  if ( fFile == 0 || fFilename != fElem->GetFileName() ) {
170  fDir = 0;
171  delete fFile; fFile = 0;
172 
174 
175  TDirectory *dirsave = gDirectory;
176 
177  Double_t start = 0;
178  if (gPerfStats) start = TTimeStamp();
179 
180  // Take into acoount possible prefixes
182  TString fname = gEnv->GetValue("Path.Localroot","");
183  if (!fname.IsNull())
184  typ = TFile::GetType(fFilename, "", &fname);
185  if (typ != TFile::kLocal)
186  fname = fFilename;
187  fFile = TFile::Open(fname);
188 
189  if (gPerfStats) {
190  gPerfStats->FileOpenEvent(fFile, fFilename, start);
191  fOldBytesRead = 0;
192  }
193 
194  if (dirsave) dirsave->cd();
195 
196  if (!fFile || fFile->IsZombie() ) {
197  if (fFile)
198  Error("Process","Cannot open file: %s (%s)",
199  fFilename.Data(), strerror(fFile->GetErrno()) );
200  else
201  Error("Process","Cannot open file: %s (errno unavailable)",
202  fFilename.Data());
203  // cleanup ?
204  return -1;
205  }
206  PDB(kLoop,2) Info("LoadDir","Opening file: %s", fFilename.Data() );
207  ret = 1;
208  }
209 
210  // Check Directory
211  if ( fDir == 0 || fPath != fElem->GetDirectory() ) {
212  TDirectory *dirsave = gDirectory;
213 
214  fPath = fElem->GetDirectory();
215  if ( !fFile->cd(fPath) ) {
216  Error("Process","Cannot cd to: %s",
217  fPath.Data() );
218  return -1;
219  }
220  PDB(kLoop,2) Info("Process","Cd to: %s", fPath.Data() );
221  fDir = gDirectory;
222  if (dirsave) dirsave->cd();
223  ret = 1;
224  }
225 
226  return ret;
227 }
228 
229 //______________________________________________________________________________
231 {
232  // Get the entry number, taking into account event/entry lists
233 
234  Long64_t entry = next;
235  // Set entry number; if data iteration we may need to test the entry or event lists
236  if (TestBit(TEventIter::kData)) {
237  if (fEntryList){
238  entry = fEntryList->GetEntry(next);
239  } else if (fEventList) {
240  entry = fEventList->GetEntry(next);
241  }
242  }
243  // Pre-event processing
244  PreProcessEvent(entry);
245  // Done
246  return entry;
247 }
248 
249 //------------------------------------------------------------------------
250 
251 
253 
254 ////////////////////////////////////////////////////////////////////////////////
255 /// Default constructor
256 
258 {
259  fDSet = 0;
260  fElem = 0;
261  fSel = 0;
262  fNum = 0;
263  fCurrent = 0;
264  fStop = kFALSE;
265  fOldBytesRead = 0; // Measures the bytes written
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// Main constructor
270 
272 {
273  fDSet = dset;
274  fElem = 0;
275  fSel = sel;
276  fNum = num;
277  fCurrent = 0;
278  fStop = kFALSE;
279  fOldBytesRead = 0; // Measures the bytes written
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Get loop range
284 
286 {
287  if (gPerfStats) {
288  Long64_t totBytesWritten = TFile::GetFileBytesWritten();
289  Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
290  PDB(kLoop, 2) Info("GetNextPacket", "bytes written: %lld", bytesWritten);
291  gPerfStats->SetBytesRead(bytesWritten);
292  fOldBytesRead = totBytesWritten;
293  }
294 
295  if (fDSet->TestBit(TDSet::kIsLocal)) {
296  if (fElem) {
297  if (fPackets) {
298  fPackets->Add(fElem);
299  PDB(kLoop, 2)
300  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
301  fElem = 0;
302  } else {
303  SafeDelete(fElem);
304  }
305  return -1;
306  } else {
307  fElem = new TDSetElement("", "", "", 0, fNum);
309  }
310  } else {
311  if (fPackets && fElem) {
312  fPackets->Add(fElem);
313  PDB(kLoop, 2)
314  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
315  fElem = 0;
316  } else {
317  SafeDelete(fElem);
318  }
319  if (!(fElem = fDSet->Next()))
320  return -1;
321  }
323 
325  Error("GetNextPacket", "data element must be set to kEmtpy");
326  return -1;
327  }
328 
329  // Set output
330  num = fElem->GetNum();
331  if (num == 0) return -1;
332  fst = fElem->GetFirst();
333 
334  // Done
335  return 0;
336 }
337 
338 ////////////////////////////////////////////////////////////////////////////////
339 /// Get next event
340 
342 {
343  if (fStop || fNum == 0)
344  return -1;
345 
347 
348  while (fElem == 0 || fCurrent == 0) {
349 
350  if (gPerfStats) {
351  Long64_t totBytesWritten = TFile::GetFileBytesWritten();
352  Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
353  PDB(kLoop, 2) Info("GetNextEvent", "bytes written: %lld", bytesWritten);
354  gPerfStats->SetBytesRead(bytesWritten);
355  fOldBytesRead = totBytesWritten;
356  }
357 
358  if (fDSet->TestBit(TDSet::kIsLocal)) {
359  if (fElem) {
360  if (fPackets) {
361  fPackets->Add(fElem);
362  PDB(kLoop, 2)
363  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
364  fElem = 0;
365  } else {
366  SafeDelete(fElem);
367  }
368  return -1;
369  } else {
370  fElem = new TDSetElement("", "", "", 0, fNum);
372  }
373  } else {
374  if (fPackets && fElem) {
375  fPackets->Add(fElem);
376  PDB(kLoop, 2)
377  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
378  fElem = 0;
379  } else {
380  SafeDelete(fElem);
381  }
382  if (!(fElem = fDSet->Next()))
383  return -1;
384  }
386 
388  Error("GetNextEvent", "data element must be set to kEmtpy");
389  return -1;
390  }
391 
392  fNum = fElem->GetNum();
393  if (!(fCurrent = fNum)) {
394  fNum = 0;
395  return -1;
396  }
397  fFirst = fElem->GetFirst();
398  }
399  Long64_t event = fNum - fCurrent + fFirst ;
400  --fCurrent;
401  return event;
402 }
403 
404 //------------------------------------------------------------------------
405 
406 
408 
409 ////////////////////////////////////////////////////////////////////////////////
410 /// Default ctor.
411 
413 {
414  fKeys = 0;
415  fNextKey = 0;
416  fObj = 0;
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 /// Constructor
421 
423  : TEventIter(dset,sel,first,num)
424 {
425  fClassName = dset->GetType();
426  fKeys = 0;
427  fNextKey = 0;
428  fObj = 0;
429 }
430 
431 
432 ////////////////////////////////////////////////////////////////////////////////
433 /// Destructor
434 
436 {
437  // delete fKeys ?
438  delete fNextKey;
439  delete fObj;
440 }
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// Get loop range
444 
446 {
447  SafeDelete(fElem);
448 
449  if (fStop || fNum == 0) return -1;
450 
451  while (fElem == 0 || fCur < fFirst-1) {
452 
453  if (gPerfStats && fFile) {
454  Long64_t bytesRead = fFile->GetBytesRead();
455  gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
456  fOldBytesRead = bytesRead;
457  }
458 
459  if (fElem) {
460  // Save it to the list of processed packets
461  if (fPackets) {
462  fPackets->Add(fElem);
463  fElem = 0;
464  } else {
465  SafeDelete(fElem);
466  }
467  }
468  fElem = fDSet->Next(fKeys->GetSize());
469  if (fElem && fElem->GetEntryList()) {
470  Error("GetNextPacket", "entry- or event-list not available");
471  return -1;
472  }
473 
474  if ( fElem == 0 ) {
475  fNum = 0;
476  return -1;
477  }
479 
480  Int_t r = LoadDir();
481 
482  if ( r == -1 ) {
483 
484  // Error has been reported
485  fNum = 0;
486  return -1;
487 
488  } else if ( r == 1 ) {
489 
490  // New file and/or directory
491  fKeys = fDir->GetListOfKeys();
492  fNextKey = new TIter(fKeys);
493  }
494 
495  // Validate values for this element
497  fElemNum = fElem->GetNum();
498  if (fElem->GetEntryList()) {
499  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
500  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
501  }
502  fEventListPos = 0;
503  if (fEntryList)
505  else if (fEventList)
506  fElemNum = fEventList->GetN();
507 
508  Long64_t tnum = fKeys->GetSize();
509 
510  if ( fElemFirst > tnum ) {
511  Error("GetNextPacket","First (%lld) higher then number of keys (%lld) in %s",
512  fElemFirst, tnum, fElem->GetName());
513  fNum = 0;
514  return -1;
515  }
516 
517  if ( fElemNum == -1 ) {
518  fElemNum = tnum - fElemFirst;
519  } else if ( fElemFirst+fElemNum > tnum ) {
520  Error("GetNextPacket","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
522  fElemNum = tnum - fElemFirst;
523  }
524 
525  // Skip this element completely?
526  if ( fCur + fElemNum < fFirst ) {
527  fCur += fElemNum;
528  continue;
529  }
530 
531  // Position within this element
532  fNextKey->Reset();
533  for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
534  }
535 
536  first = ++fElemCur;
537  num = fElemNum;
538 
539  // Done
540  return 0;
541 }
542 ////////////////////////////////////////////////////////////////////////////////
543 /// To be executed before by TProofPlayer calling TSelector::Process
544 
546 {
547  --fNum;
548  ++fCur;
549  TKey *key = (TKey*) fNextKey->Next();
550  TDirectory *dirsave = gDirectory;
551  fDir->cd();
552  fObj = key->ReadObj();
553  if (dirsave) dirsave->cd();
554  fSel->SetObject(fObj);
555 }
556 
557 ////////////////////////////////////////////////////////////////////////////////
558 /// Get next event
559 
561 {
562  if (fStop || fNum == 0) return -1;
563 
565 
566  while ( fElem == 0 || fElemNum == 0 || fCur < fFirst-1 ) {
567 
568  if (gPerfStats && fFile) {
569  Long64_t bytesRead = fFile->GetBytesRead();
570  gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
571  fOldBytesRead = bytesRead;
572  }
573 
574  if (fElem) {
575  // Save it to the list of processed packets
576  if (fPackets) {
577  fPackets->Add(fElem);
578  fElem = 0;
579  } else {
580  SafeDelete(fElem);
581  }
582  }
583  fElem = fDSet->Next(fKeys->GetSize());
584  if (fElem && fElem->GetEntryList()) {
585  Error("GetNextEvent", "Entry- or event-list not available");
586  return -1;
587  }
588 
589  if ( fElem == 0 ) {
590  fNum = 0;
591  return -1;
592  }
594 
595  Int_t r = LoadDir();
596 
597  if ( r == -1 ) {
598 
599  // Error has been reported
600  fNum = 0;
601  return -1;
602 
603  } else if ( r == 1 ) {
604 
605  // New file and/or directory
606  fKeys = fDir->GetListOfKeys();
607  fNextKey = new TIter(fKeys);
608  }
609 
610  // Validate values for this element
612  fElemNum = fElem->GetNum();
613  if (fElem->GetEntryList()) {
614  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
615  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
616  }
617  fEventListPos = 0;
618  if (fEntryList)
620  else if (fEventList)
621  fElemNum = fEventList->GetN();
622 
623  Long64_t num = fKeys->GetSize();
624 
625  if ( fElemFirst > num ) {
626  Error("GetNextEvent","First (%lld) higher then number of keys (%lld) in %s",
627  fElemFirst, num, fElem->GetName());
628  fNum = 0;
629  return -1;
630  }
631 
632  if ( fElemNum == -1 ) {
633  fElemNum = num - fElemFirst;
634  } else if ( fElemFirst+fElemNum > num ) {
635  Error("GetNextEvent","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
637  fElemNum = num - fElemFirst;
638  }
639 
640  // Skip this element completely?
641  if ( fCur + fElemNum < fFirst ) {
642  fCur += fElemNum;
643  continue;
644  }
645 
646  // Position within this element. TODO: more efficient?
647  fNextKey->Reset();
648  for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
649  }
650 
651  --fElemNum;
652  ++fElemCur;
653 
654  // Pre-event processing
656 
657  return fElemCur;
658 }
659 
660 //------------------------------------------------------------------------
661 
662 ////////////////////////////////////////////////////////////////////////////////
663 /// Default ctor.
664 
666  : TNamed(name, ""), fUsed(kFALSE), fIsLocal(islocal), fFile(f)
667 {
668  fTrees = new TList;
669  fTrees->SetOwner();
670 }
671 ////////////////////////////////////////////////////////////////////////////////
672 /// Default dtor.
673 
675 {
676  // Avoid destroying the cache; must be placed before deleting the trees
677  TTree *tree = (TTree *)fTrees->First();
678  while (tree) {
679  fFile->SetCacheRead(0, tree);
680  tree = (TTree *)fTrees->After(tree);
681  }
683  SafeDelete(fFile);
684 }
685 
687 
688 ////////////////////////////////////////////////////////////////////////////////
689 /// Default ctor.
690 
692 {
693  fTree = 0;
694  fTreeCache = 0;
695  fUseTreeCache = 1;
696  fCacheSize = -1;
698  fFileTrees = 0;
699  fUseParallelUnzip = 0;
702 }
703 
704 ////////////////////////////////////////////////////////////////////////////////
705 /// Constructor
706 
708  : TEventIter(dset,sel,first,num)
709 {
710  fTreeName = dset->GetObjName();
711  fTree = 0;
712  fTreeCache = 0;
714  fFileTrees = new TList;
715  fFileTrees->SetOwner();
716  fUseTreeCache = gEnv->GetValue("ProofPlayer.UseTreeCache", 1);
717  fCacheSize = gEnv->GetValue("ProofPlayer.CacheSize", -1);
718  fUseParallelUnzip = gEnv->GetValue("ProofPlayer.UseParallelUnzip", 0);
719  if (fUseParallelUnzip) {
721  } else {
723  }
724  fDontCacheFiles = gEnv->GetValue("ProofPlayer.DontCacheFiles", 0);
726 }
727 
728 ////////////////////////////////////////////////////////////////////////////////
729 /// Destructor
730 
732 {
733  // Delete the tree cache ...
735  // ... and the remaining open files
737 }
738 
739 ////////////////////////////////////////////////////////////////////////////////
740 /// Return the size in bytes of the cache, if any
741 /// Return -1 if not used
742 
744 {
745  if (fUseTreeCache) return fCacheSize;
746  return -1;
747 }
748 
749 ////////////////////////////////////////////////////////////////////////////////
750 /// Return the number of entries in the learning phase
751 
753 {
755 }
756 
757 ////////////////////////////////////////////////////////////////////////////////
758 /// Create a Tree for the main TDSetElement and for all the friends.
759 /// Returns the main tree or 0 in case of an error.
760 
762 {
763  // Reset used flags
764  TIter nxft(fFileTrees);
765  TFileTree *ft = 0;
766  while ((ft = (TFileTree *)nxft()))
767  ft->fUsed = kFALSE;
768 
769  Bool_t localfile = kFALSE;
770  TTree* main = Load(elem, localfile);
771 
772  if (main && main != fTree) {
773  // Set the file cache
774  if (fUseTreeCache) {
775  TFile *curfile = main->GetCurrentFile();
776  if (curfile) {
777  if (!fTreeCache) {
778  main->SetCacheSize(fCacheSize);
779  fTreeCache = (TTreeCache *)curfile->GetCacheRead(main);
780  if (fCacheSize < 0) fCacheSize = main->GetCacheSize();
781  } else {
783  curfile->SetCacheRead(fTreeCache, main);
784  fTreeCache->UpdateBranches(main);
785  }
786  if (fTreeCache) {
789  Info("GetTrees","the tree cache is in learning phase");
790  }
791  } else {
792  Warning("GetTrees", "default tree does nto have a file attached: corruption? Tree cache untouched");
793  }
794  } else {
795  // Disable the cache
796  main->SetCacheSize(0);
797  }
798  }
799  Bool_t loc = kFALSE;
800  // Also the friends
801  TList *friends = elem->GetListOfFriends();
802  if (friends) {
803  TIter nxf(friends);
804  TDSetElement *dse = 0;
805  while ((dse = (TDSetElement *) nxf())) {
806  // The alias, if any, is in the element name options ('friend_alias=<alias>|')
807  TUrl uf(dse->GetName());
808  TString uo(uf.GetOptions()), alias;
809  Int_t from = kNPOS;
810  if ((from = uo.Index("friend_alias=")) != kNPOS) {
811  from += strlen("friend_alias=");
812  if (!uo.Tokenize(alias, from, "|"))
813  Warning("GetTrees", "empty 'friend_alias' found for tree friend");
814  // The options may be used for other things, so remove the internal strings once decoded
815  uo.ReplaceAll(TString::Format("friend_alias=%s|", alias.Data()), "");
816  uf.SetOptions(uo);
817  dse->SetName(uf.GetUrl());
818  }
819  TTree *friendTree = Load(dse, loc, dse->GetObjName());
820  if (friendTree && main) {
821  // Make sure it has not yet been added
822  Bool_t addfriend = kTRUE;
823  TList *frnds = main->GetListOfFriends();
824  if (frnds) {
825  TIter xnxf(frnds);
826  TFriendElement *fe = 0;
827  while ((fe = (TFriendElement *) xnxf())) {
828  if (fe->GetTree() == friendTree) {
829  addfriend = kFALSE;
830  break;
831  }
832  }
833  }
834  if (addfriend) {
835  if (alias.IsNull())
836  main->AddFriend(friendTree);
837  else
838  main->AddFriend(friendTree, alias);
839  }
840  } else {
841  return 0;
842  }
843  }
844  }
845 
846  // Remove instances not used
847  nxft.Reset();
848  while ((ft = (TFileTree *)nxft())) {
849  if (!(ft->fUsed)) {
850  fFileTrees->Remove(ft);
851  delete ft;
852  }
853  }
854 
855  // Done, successfully or not
856  return main;
857 }
858 
859 ////////////////////////////////////////////////////////////////////////////////
860 /// Load a tree from s TDSetElement
861 
862 TTree* TEventIterTree::Load(TDSetElement *e, Bool_t &localfile, const char *objname)
863 {
864  if (!e) {
865  Error("Load", "undefined element");
866  return (TTree *)0;
867  }
868 
869  const char *fn = e->GetFileName();
870  const char *dn = e->GetDirectory();
871  const char *tn = 0;
872  if (objname && strlen(objname) > 0) {
873  tn = objname;
874  } else {
875  tn = (fDSet->GetObjName() && strlen(fDSet->GetObjName()) > 0)
876  ? fDSet->GetObjName() : e->GetObjName();
877  if (!tn || (tn && strlen(tn) <= 0)) tn = "*";
878  }
879  PDB(kLoop,2)
880  Info("Load","loading: fn:'%s' dn:'%s' tn:'%s'", fn, dn, tn);
881 
882  TFile *f = 0;
883 
884  // Check if the file is already open
885  TString names(fn);
886  TString name;
887  Ssiz_t from = 0;
888  TFileTree *ft = 0;
889  while (names.Tokenize(name,from,"|")) {
890  TString key(TUrl(name).GetFileAndOptions());
891  if ((ft = (TFileTree *) fFileTrees->FindObject(key.Data()))) {
892  f = ft->fFile;
893  break;
894  }
895  }
896 
897  // Open the file, if needed
898  if (!f) {
900  TString fname = gEnv->GetValue("Path.Localroot","");
901  if (!fname.IsNull())
902  typ = TFile::GetType(fn, "", &fname);
903  if (typ != TFile::kLocal) {
904  fname = fn;
905  } else {
906  localfile = kTRUE;
907  }
908 
909  // Open the file
910  f = TFile::Open(fname);
911  if (!f) {
912  Error("Load","file '%s' ('%s') could not be open", fn, fname.Data());
913  return (TTree *)0;
914  }
915 
916 #if defined(R__MACOSX)
917  // If requested set the no cache mode
918  if (fDontCacheFiles && localfile) {
919  fcntl(f->GetFd(), F_NOCACHE, 1);
920  }
921 #endif
922 
923  // Create TFileTree instance in the list
924  ft = new TFileTree(TUrl(f->GetName()).GetFileAndOptions(), f, localfile);
925  fFileTrees->Add(ft);
926  } else {
927  // Fill locality boolean
928  localfile = ft->fIsLocal;
929  PDB(kLoop,2)
930  Info("Load","file '%s' already open (local:%d)", fn, localfile);
931  }
932 
933  // Check if the tree is already loaded
934  if (ft && ft->fTrees->GetSize() > 0) {
935  TTree *t = 0;
936  if (!strcmp(tn, "*"))
937  t = (TTree *) ft->fTrees->First();
938  else
939  t = (TTree *) ft->fTrees->FindObject(tn);
940  if (t) {
941  ft->fUsed = kTRUE;
942  return t;
943  }
944  }
945 
946  TDirectory *dd = f;
947  // Change dir, if required
948  if (dn && !(dd = f->GetDirectory(dn))) {
949  Error("Load","Cannot get to: %s", dn);
950  return (TTree *)0;
951  }
952  PDB(kLoop,2)
953  Info("Load","got directory: %s", dn);
954 
955  // If a wild card we will use the first object of the type
956  // requested compatible with the reg expression we got
957  TString on(tn);
958  TString sreg(tn);
959  if (sreg.Length() <= 0 || sreg == "" || sreg.Contains("*")) {
960  if (sreg.Contains("*"))
961  sreg.ReplaceAll("*", ".*");
962  else
963  sreg = ".*";
964  TRegexp re(sreg);
965  if (dd->GetListOfKeys()) {
966  TIter nxk(dd->GetListOfKeys());
967  TKey *k = 0;
968  while ((k = (TKey *) nxk())) {
969  if (!strcmp(k->GetClassName(), "TTree")) {
970  TString kn(k->GetName());
971  if (kn.Index(re) != kNPOS) {
972  on = kn;
973  break;
974  }
975  }
976  }
977  }
978  }
979 
980  // Point to the key
981  TKey *key = dd->GetKey(gSystem->BaseName(on));
982  if (key == 0) {
983  Error("Load", "Cannot find tree \"%s\" in %s", tn, fn);
984  return (TTree*)0;
985  }
986 
987  PDB(kLoop,2) Info("Load", "Reading: %s", tn);
988 
989  TTree *tree = dynamic_cast<TTree*> (key->ReadObj());
990  dd->cd();
991 
992  if (tree == 0) {
993  Error("Load", "Cannot <dynamic_cast> obj to tree \"%s\"", tn);
994  return (TTree*)0;
995  }
996 
997  // Add track in the cache
998  ft->fTrees->Add(tree);
999  ft->fUsed = kTRUE;
1000  PDB(kLoop,2)
1001  Info("Load","TFileTree for '%s' flagged as 'in-use' ...", ft->GetName());
1002 
1003  // Done
1004  return tree;
1005 }
1006 
1007 ////////////////////////////////////////////////////////////////////////////////
1008 /// Get loop range
1009 
1011 {
1012  if (first > -1) fEntryListPos = first;
1013 
1014  if (fStop || fNum == 0) return -1;
1015 
1016  Bool_t attach = kFALSE;
1017 
1018  // When files are aborted during processing (via TSelector::kAbortFile) the player
1019  // invalidates the element by settign this bit. We need to ask for a new packet
1020  Bool_t corrupted = kFALSE;
1021  Long64_t rest = -1;
1022  if (fElem) {
1023  corrupted = (fElem->TestBit(TDSetElement::kCorrupted)) ? kTRUE : kFALSE;
1024  rest = fElem->GetNum();
1025  if (fElemCur >= 0) rest -= (fElemCur + 1 - fElemFirst);
1026  }
1027 
1028  SafeDelete(fElem);
1029 
1030  while (fElem == 0 || fElemNum == 0 || fCur < fFirst-1) {
1031 
1032  if (gPerfStats && fTree) {
1033  Long64_t totBytesRead = fTree->GetCurrentFile()->GetBytesRead();
1034  Long64_t bytesRead = totBytesRead - fOldBytesRead;
1035  gPerfStats->SetBytesRead(bytesRead);
1036  fOldBytesRead = totBytesRead;
1037  }
1038 
1039  if (fElem) {
1040  // Save it to the list of processed packets
1041  if (fPackets) {
1042  fPackets->Add(fElem);
1043  fElem = 0;
1044  } else {
1045  SafeDelete(fElem);
1046  }
1047  }
1048  while (!fElem) {
1049  // For a corrupted/invalid file the request for a new packet is with totalEntries = -1
1050  // (the default) so that the packetizer invalidates the element
1051  if (corrupted) {
1052  fElem = fDSet->Next(rest);
1053  } else if (fTree) {
1054  fElem = fDSet->Next(fTree->GetEntries());
1055  } else {
1056  fElem = fDSet->Next();
1057  }
1058 
1059  if (!fElem) {
1060  // End of processing
1061  fNum = 0;
1062  return -1;
1063  }
1064  corrupted = kFALSE;
1067 
1068  TTree *newTree = GetTrees(fElem);
1069  if (newTree) {
1070  if (newTree != fTree) {
1071  // The old tree is owned by TFileTree and will be deleted there
1072  fTree = newTree;
1073  attach = kTRUE;
1075  }
1076  // Set range to be analysed
1077  if (fTreeCache)
1079  fElem->GetFirst() + fElem->GetNum() - 1);
1080  } else {
1081  // Could not open this element: ask for another one
1082  SafeDelete(fElem);
1083  // The current tree, if any, is not valid anymore
1084  fTree = 0;
1085  }
1086  }
1087 
1088  // Validate values for this element
1089  fElemFirst = fElem->GetFirst();
1090  fElemNum = fElem->GetNum();
1091  fEntryList = 0;
1092  fEventList = 0;
1093  if (fElem->GetEntryList()) {
1094  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
1095  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
1096  }
1098  fEventListPos = 0;
1099  if (fEntryList)
1101  else if (fEventList)
1102  fElemNum = fEventList->GetN();
1103 
1104  Long64_t tnum = (Long64_t) fTree->GetEntries();
1105 
1106  if (!fEntryList && !fEventList) {
1107  if ( fElemFirst > tnum ) {
1108  Error("GetNextPacket", "first (%lld) higher then number of entries (%lld) in %s",
1109  fElemFirst, tnum, fElem->GetObjName());
1110  fNum = 0;
1111  return -1;
1112  }
1113  if ( fElemNum == -1 ) {
1114  fElemNum = tnum - fElemFirst;
1115  } else if ( fElemFirst+fElemNum > tnum ) {
1116  Error("GetNextPacket", "num (%lld) + first (%lld) larger then number of entries (%lld) in %s",
1117  fElemNum, fElemFirst, tnum, fElem->GetName());
1118  fElemNum = tnum - fElemFirst;
1119  }
1120 
1121  // Skip this element completely?
1122  if ( fCur + fElemNum < fFirst ) {
1123  fCur += fElemNum;
1124  continue;
1125  }
1126  // Position within this element
1127  fElemCur = fElemFirst-1;
1128  }
1129  }
1130 
1131  if (attach) {
1132  PDB(kLoop,1) Info("GetNextPacket", "call Init(%p) and Notify()",fTree);
1133  fSel->Init(fTree);
1134  fSel->Notify();
1135  TIter next(fSel->GetOutputList());
1136  TEntryList *elist=0;
1137  while ((elist=(TEntryList*)next())){
1138  if (elist->InheritsFrom(TEntryList::Class()))
1139  elist->SetTree(fTree->GetName(), fElem->GetFileName());
1140  }
1142  // the error has been reported
1143  return -1;
1144  }
1145  attach = kFALSE;
1146  }
1147 
1148  // Fill the output now
1149  num = fElemNum;
1150  if (fEntryList) {
1151  first = fEntryListPos;
1152  } else if (fEventList){
1153  first = fEventListPos;
1154  } else {
1155  first = fElemFirst;
1156  }
1157 
1158  // Done
1159  return 0;
1160 }
1161 
1162 ////////////////////////////////////////////////////////////////////////////////
1163 /// Actions to be done just before processing entry 'entry'.
1164 /// Called by TProofPlayer.
1165 
1167 {
1168  if (!(fEntryList || fEventList)) {
1169  --fNum;
1170  ++fCur;
1171  }
1172 
1173  // Signal ending of learning phase
1175  if (!(fTreeCache->IsLearning())) {
1178  }
1179  }
1180 
1181  // For prefetching
1182  if (fTree->LoadTree(entry) < 0) {
1183  Warning("PreEventProcess", "problems setting entry in TTree");
1184  }
1185 }
1186 
1187 ////////////////////////////////////////////////////////////////////////////////
1188 /// Get next event
1189 
1191 {
1192  if (fStop || fNum == 0) return -1;
1193 
1194  Bool_t attach = kFALSE;
1195 
1196  // When files are aborted during processing (via TSelector::kAbortFile) the player
1197  // invalidates the element by settign this bit. We need to ask for a new packet
1199 
1201 
1202  while ( fElem == 0 || fElemNum == 0 || fCur < fFirst-1 || corrupted) {
1203 
1204  if (gPerfStats && fTree) {
1205  Long64_t totBytesRead = fTree->GetCurrentFile()->GetBytesRead();
1206  Long64_t bytesRead = totBytesRead - fOldBytesRead;
1207  gPerfStats->SetBytesRead(bytesRead);
1208  fOldBytesRead = totBytesRead;
1209  }
1210 
1211  Long64_t rest = -1;
1212  if (fElem) {
1213  rest = fElem->GetNum();
1214  if (fElemCur >= 0) rest -= (fElemCur + 1 - fElemFirst);
1215  // Save it to the list of processed packets
1216  if (fPackets) {
1217  fPackets->Add(fElem);
1218  fElem = 0;
1219  } else {
1220  SafeDelete(fElem);
1221  }
1222  }
1223 
1224  while (!fElem) {
1225  // For a corrupted/invalid file the request for a new packet is with totalEntries = -1
1226  // (the default) so that the packetizer invalidates the element
1227  if (corrupted) {
1228  fElem = fDSet->Next(rest);
1229  } else if (fTree) {
1230  fElem = fDSet->Next(fTree->GetEntries());
1231  } else {
1232  fElem = fDSet->Next();
1233  }
1234 
1235  if (!fElem) {
1236  // End of processing
1237  fNum = 0;
1238  return -1;
1239  }
1240  corrupted = kFALSE;
1243 
1244  TTree *newTree = GetTrees(fElem);
1245  if (newTree) {
1246  if (newTree != fTree) {
1247  // The old tree is owned by TFileTree and will be deleted there
1248  fTree = newTree;
1249  attach = kTRUE;
1251  }
1252  // Set range to be analysed
1253  if (fTreeCache)
1255  fElem->GetFirst() + fElem->GetNum() - 1);
1256  } else {
1257  // Could not open this element: ask for another one
1258  SafeDelete(fElem);
1259  // The current tree, if any, is not valid anymore
1260  fTree = 0;
1261  }
1262  }
1263 
1264  // Validate values for this element
1265  fElemFirst = fElem->GetFirst();
1266  fElemNum = fElem->GetNum();
1267  fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList());
1268  fEventList = (fEntryList) ? (TEventList *)0
1269  : dynamic_cast<TEventList *>(fElem->GetEntryList());
1271  fEventListPos = 0;
1272  if (fEntryList)
1274  else if (fEventList)
1275  fElemNum = fEventList->GetN();
1276 
1277  Long64_t num = (Long64_t) fTree->GetEntries();
1278 
1279  if (!fEntryList && !fEventList) {
1280  if ( fElemFirst > num ) {
1281  Error("GetNextEvent", "first (%lld) higher then number of entries (%lld) in %s",
1282  fElemFirst, num, fElem->GetObjName());
1283  fNum = 0;
1284  return -1;
1285  }
1286  if ( fElemNum == -1 ) {
1287  fElemNum = num - fElemFirst;
1288  } else if ( fElemFirst+fElemNum > num ) {
1289  Error("GetNextEvent", "num (%lld) + first (%lld) larger then number of entries (%lld) in %s",
1290  fElemNum, fElemFirst, num, fElem->GetName());
1291  fElemNum = num - fElemFirst;
1292  }
1293 
1294  // Skip this element completely?
1295  if ( fCur + fElemNum < fFirst ) {
1296  fCur += fElemNum;
1297  continue;
1298  }
1299  // Position within this element. TODO: more efficient?
1300  fElemCur = fElemFirst-1;
1301  }
1302  }
1303 
1304  if ( attach ) {
1305  PDB(kLoop,1) Info("GetNextEvent", "call Init(%p) and Notify()",fTree);
1306  fSel->Init(fTree);
1307  fSel->Notify();
1308  TIter next(fSel->GetOutputList());
1309  TEntryList *elist=0;
1310  while ((elist=(TEntryList*)next())){
1311  if (elist->InheritsFrom(TEntryList::Class()))
1312  elist->SetTree(fTree->GetName(), fElem->GetFileName());
1313  }
1315  // the error has been reported
1316  return -1;
1317  }
1318  attach = kFALSE;
1319  }
1320  Long64_t rv;
1321 
1322  if (fEntryList){
1323  --fElemNum;
1325  fEntryListPos++;
1326  } else if (fEventList) {
1327  --fElemNum;
1329  fEventListPos++;
1330  } else {
1331  --fElemNum;
1332  ++fElemCur;
1333  rv = fElemCur;
1334  }
1335 
1336  // Pre-event processing
1337  PreProcessEvent(rv);
1338 
1339  return rv;
1340 }
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:932
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:150
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
virtual TTree * GetTree()
Return pointer to friend TTree.
long long Long64_t
Definition: RtypesCore.h:69
~TEventIterObj()
Destructor.
Definition: TEventIter.cxx:435
virtual TDSetElement * Next(Long64_t totalEntries=-1)
Returns next TDSetElement.
Definition: TDSet.cxx:394
Long64_t GetCacheSize()
Return the size in bytes of the cache, if any Return -1 if not used.
Definition: TEventIter.cxx:743
Long64_t GetNextEvent()
Get next event.
Definition: TEventIter.cxx:341
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TSelector.h:58
TFile * fFile
Definition: TEventIter.h:53
TString fFilename
Definition: TEventIter.h:52
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
Definition: TFile.cxx:2242
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
This class represents a WWW compatible URL.
Definition: TUrl.h:35
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:638
This class implements a data set to be used for PROOF processing.
Definition: TDSet.h:151
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
A specialized TFileCacheRead object for a TTree.
Definition: TTreeCache.h:30
static Int_t SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option=TTreeCacheUnzip::kEnable)
Static function that (de)activates multithreading unzipping.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
TList * fKeys
Definition: TEventIter.h:126
virtual TList * GetListOfFriends() const
Definition: TTree.h:409
Long64_t fElemNum
Definition: TEventIter.h:58
Regular expression class.
Definition: TRegexp.h:31
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
Long64_t fElemFirst
Definition: TEventIter.h:57
Long64_t GetFirst() const
Definition: TDSet.h:112
Basic string class.
Definition: TString.h:125
Bool_t fStop
Definition: TEventIter.h:65
Long64_t fNum
Definition: TEventIter.h:63
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void StopProcess(Bool_t abort)
Set flag to stop the process.
Definition: TEventIter.cxx:142
virtual TList * GetListOfFriends() const
Definition: TDSet.h:108
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
Definition: TEventIter.cxx:134
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...
void Reset()
Definition: TCollection.h:250
Long64_t GetNextEvent()
Get next event.
Definition: TEventIter.cxx:560
TEventIterUnit()
Default constructor.
Definition: TEventIter.cxx:257
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
TObject * fObj
Definition: TEventIter.h:128
virtual ~TEventIter()
Destructor.
Definition: TEventIter.cxx:122
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3950
TEventIter()
Default constructor.
Definition: TEventIter.cxx:55
TTree * fTree
Definition: TEventIter.h:152
virtual Int_t GetErrno() const
Method returning errno. Is overriden in TRFIOFile.
Definition: TFile.cxx:1198
Manages an element of a TDSet.
Definition: TDSet.h:66
#define SafeDelete(p)
Definition: RConfig.h:509
virtual Long64_t GetCacheSize() const
Definition: TTree.h:372
Long64_t GetNextEvent()
Get next event.
Long64_t GetNum() const
Definition: TDSet.h:114
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2365
#define PDB(mask, level)
Definition: TProofDebug.h:56
void Class()
Definition: Class.C:29
Bool_t fUseParallelUnzip
Definition: TEventIter.h:157
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Long64_t fEntryListPos
entry list for processing
Definition: TEventIter.h:69
Long64_t fFirst
Definition: TEventIter.h:62
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition: TTree.cxx:6139
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
Definition: TEventList.cxx:222
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=0)
Resolve the file type as a function of the protocol field in &#39;name&#39;.
Definition: TFile.cxx:4665
virtual Long64_t GetEntriesToProcess() const
Definition: TEntryList.h:72
TList * fPackets
current position in the entrylist
Definition: TEventIter.h:71
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Definition: TFile.cxx:4427
virtual Int_t GetN() const
Definition: TEventList.h:56
const char * GetDirectory() const
Return directory where to look for object.
Definition: TDSet.cxx:234
int main(int argc, char **argv)
virtual void ResetCache()
This will simply clear the cache.
virtual void PreProcessEvent(Long64_t)
Definition: TEventIter.h:74
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
Definition: TTree.cxx:1234
Bool_t fDontCacheFiles
Definition: TEventIter.h:158
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:24
virtual Long64_t GetEntryNumber(Long64_t)
Definition: TEventIter.cxx:230
void PreProcessEvent(Long64_t ent)
Actions to be done just before processing entry &#39;entry&#39;.
TEventIterObj()
Default ctor.
Definition: TEventIter.cxx:412
Bool_t fTreeCacheIsLearning
Definition: TEventIter.h:154
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:134
A doubly linked list.
Definition: TList.h:44
const char * GetObjName() const
Definition: TDSet.h:120
Long64_t fCacheSize
Definition: TEventIter.h:156
Long64_t fCur
Definition: TEventIter.h:64
EFileType
File type.
Definition: TFile.h:174
virtual void SetEntryRange(Long64_t emin, Long64_t emax)
Set the minimum and maximum entry number to be processed this information helps to optimize the numbe...
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
Bool_t IsTree() const
Definition: TDSet.h:223
TIter * fNextKey
Definition: TEventIter.h:127
TTree * GetTrees(TDSetElement *elem)
Create a Tree for the main TDSetElement and for all the friends.
Definition: TEventIter.cxx:761
ROOT::R::TRInterface & r
Definition: Object.C:4
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
Long64_t fElemCur
Definition: TEventIter.h:59
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:818
Int_t fEventListPos
eventList for processing
Definition: TEventIter.h:67
TObject * Next()
Definition: TCollection.h:247
TString fTreeName
Definition: TEventIter.h:151
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5172
virtual Long64_t GetEntry(Int_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next()...
Definition: TEntryList.cxx:657
Ssiz_t Length() const
Definition: TString.h:386
TDSetElement * fElem
Definition: TEventIter.h:50
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:31
Special iterator class used in TProofPlayer to iterate over events or objects in the packets...
Definition: TEventIter.h:42
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:327
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:445
void SetName(const char *name)
Definition: TCollection.h:202
virtual TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory named "apath".
TSelector * fSel
Definition: TEventIter.h:61
virtual ~TFileTree()
Default dtor.
Definition: TEventIter.cxx:674
#define gPerfStats
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual Long64_t GetBytesRead() const
Definition: TFile.h:212
static TEventIter * Create(TDSet *dset, TSelector *sel, Long64_t first, Long64_t num)
Create and instance of the appropriate iterator.
Definition: TEventIter.cxx:150
TList * fFileTrees
Definition: TEventIter.h:159
int Ssiz_t
Definition: RtypesCore.h:63
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2251
#define ClassImp(name)
Definition: Rtypes.h:359
TObject * GetEntryList() const
Definition: TDSet.h:131
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Definition: TEventIter.cxx:862
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition: TDirectory.h:148
double Double_t
Definition: RtypesCore.h:55
~TEventIterTree()
Destructor.
Definition: TEventIter.cxx:731
void PreProcessEvent(Long64_t)
To be executed before by TProofPlayer calling TSelector::Process.
Definition: TEventIter.cxx:545
Describe directory structure in memory.
Definition: TDirectory.h:34
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition: TTimeStamp.h:71
TString fPath
Definition: TEventIter.h:55
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
TString fClassName
Definition: TEventIter.h:125
Long64_t fOldBytesRead
Definition: TEventIter.h:54
Int_t LoadDir()
Load directory.
Definition: TEventIter.cxx:164
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
const char * GetFileName() const
Definition: TDSet.h:111
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache .
Definition: TTree.cxx:8186
const char * GetType() const
Definition: TDSet.h:226
virtual void SetObject(TObject *obj)
Definition: TSelector.h:67
virtual Long64_t GetEntries() const
Definition: TTree.h:382
Bool_t IsNull() const
Definition: TString.h:383
TTreeCache * fTreeCache
Definition: TEventIter.h:153
TEventIterTree()
Default ctor.
Definition: TEventIter.cxx:691
TDirectory * fDir
Definition: TEventIter.h:56
virtual Bool_t IsLearning() const
Definition: TTreeCache.h:87
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition: TKey.cxx:722
TEntryList * fEntryList
current position in the eventList
Definition: TEventIter.h:68
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:497
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:347
virtual void Add(TObject *obj)
Definition: TList.h:87
Int_t GetLearnEntries()
Return the number of entries in the learning phase.
Definition: TEventIter.cxx:752
A TFriendElement TF describes a TTree object TF in a file.
Bool_t fUseTreeCache
Definition: TEventIter.h:155
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:285
Definition: tree.py:1
Int_t GetFd() const
Definition: TFile.h:205
TFileCacheRead * GetCacheRead(TObject *tree=0) const
Return a pointer to the current read cache.
Definition: TFile.cxx:1214
TEventList * fEventList
Definition: TEventIter.h:66
A TTree object has a header with a name and a title.
Definition: TTree.h:70
#define gDirectory
Definition: TDirectory.h:213
void ResetBit(UInt_t f)
Definition: TObject.h:171
void RestartComputeTime()
Reset the compute time.
Definition: first.py:1
virtual Int_t GetSize() const
Definition: TCollection.h:180
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
const char * GetObjName() const
Definition: TDSet.h:227
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:25
virtual void UpdateBranches(TTree *tree)
Update pointer to current Tree and recompute pointers to the branches in the cache.
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char * GetOrdinal() const
Definition: TProofServ.h:253
const Int_t n
Definition: legend1.C:16
TDSet * fDSet
Definition: TEventIter.h:48
char name[80]
Definition: TGX11.cxx:109
virtual EAbort GetAbort() const
Definition: TSelector.h:75
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
TFileTree(const char *name, TFile *f, Bool_t islocal)
Default ctor.
Definition: TEventIter.cxx:665
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual TList * GetOutputList() const
Definition: TSelector.h:71
virtual void Init(TTree *)
Definition: TSelector.h:55
const char * Data() const
Definition: TString.h:345