Logo ROOT   6.08/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 {
782  curfile->SetCacheRead(fTreeCache, main);
783  fTreeCache->UpdateBranches(main);
784  }
785  if (fTreeCache) {
788  Info("GetTrees","the tree cache is in learning phase");
789  }
790  } else {
791  Warning("GetTrees", "default tree does nto have a file attached: corruption? Tree cache untouched");
792  }
793  } else {
794  // Disable the cache
795  main->SetCacheSize(0);
796  }
797  }
798  Bool_t loc = kFALSE;
799  // Also the friends
800  TList *friends = elem->GetListOfFriends();
801  if (friends) {
802  TIter nxf(friends);
803  TDSetElement *dse = 0;
804  while ((dse = (TDSetElement *) nxf())) {
805  // The alias, if any, is in the element name options ('friend_alias=<alias>|')
806  TUrl uf(dse->GetName());
807  TString uo(uf.GetOptions()), alias;
808  Int_t from = kNPOS;
809  if ((from = uo.Index("friend_alias=")) != kNPOS) {
810  from += strlen("friend_alias=");
811  if (!uo.Tokenize(alias, from, "|"))
812  Warning("GetTrees", "empty 'friend_alias' found for tree friend");
813  // The options may be used for other things, so remove the internal strings once decoded
814  uo.ReplaceAll(TString::Format("friend_alias=%s|", alias.Data()), "");
815  uf.SetOptions(uo);
816  dse->SetName(uf.GetUrl());
817  }
818  TTree *friendTree = Load(dse, loc, dse->GetObjName());
819  if (friendTree && main) {
820  // Make sure it has not yet been added
821  Bool_t addfriend = kTRUE;
822  TList *frnds = main->GetListOfFriends();
823  if (frnds) {
824  TIter xnxf(frnds);
825  TFriendElement *fe = 0;
826  while ((fe = (TFriendElement *) xnxf())) {
827  if (fe->GetTree() == friendTree) {
828  addfriend = kFALSE;
829  break;
830  }
831  }
832  }
833  if (addfriend) {
834  if (alias.IsNull())
835  main->AddFriend(friendTree);
836  else
837  main->AddFriend(friendTree, alias);
838  }
839  } else {
840  return 0;
841  }
842  }
843  }
844 
845  // Remove instances not used
846  nxft.Reset();
847  while ((ft = (TFileTree *)nxft())) {
848  if (!(ft->fUsed)) {
849  fFileTrees->Remove(ft);
850  delete ft;
851  }
852  }
853 
854  // Done, successfully or not
855  return main;
856 }
857 
858 ////////////////////////////////////////////////////////////////////////////////
859 /// Load a tree from s TDSetElement
860 
861 TTree* TEventIterTree::Load(TDSetElement *e, Bool_t &localfile, const char *objname)
862 {
863  if (!e) {
864  Error("Load", "undefined element");
865  return (TTree *)0;
866  }
867 
868  const char *fn = e->GetFileName();
869  const char *dn = e->GetDirectory();
870  const char *tn = 0;
871  if (objname && strlen(objname) > 0) {
872  tn = objname;
873  } else {
874  tn = (fDSet->GetObjName() && strlen(fDSet->GetObjName()) > 0)
875  ? fDSet->GetObjName() : e->GetObjName();
876  if (!tn || (tn && strlen(tn) <= 0)) tn = "*";
877  }
878  PDB(kLoop,2)
879  Info("Load","loading: fn:'%s' dn:'%s' tn:'%s'", fn, dn, tn);
880 
881  TFile *f = 0;
882 
883  // Check if the file is already open
884  TString names(fn);
885  TString name;
886  Ssiz_t from = 0;
887  TFileTree *ft = 0;
888  while (names.Tokenize(name,from,"|")) {
889  TString key(TUrl(name).GetFileAndOptions());
890  if ((ft = (TFileTree *) fFileTrees->FindObject(key.Data()))) {
891  f = ft->fFile;
892  break;
893  }
894  }
895 
896  // Open the file, if needed
897  if (!f) {
899  TString fname = gEnv->GetValue("Path.Localroot","");
900  if (!fname.IsNull())
901  typ = TFile::GetType(fn, "", &fname);
902  if (typ != TFile::kLocal) {
903  fname = fn;
904  } else {
905  localfile = kTRUE;
906  }
907 
908  // Open the file
909  f = TFile::Open(fname);
910  if (!f) {
911  Error("Load","file '%s' ('%s') could not be open", fn, fname.Data());
912  return (TTree *)0;
913  }
914 
915 #if defined(R__MACOSX)
916  // If requested set the no cache mode
917  if (fDontCacheFiles && localfile) {
918  fcntl(f->GetFd(), F_NOCACHE, 1);
919  }
920 #endif
921 
922  // Create TFileTree instance in the list
923  ft = new TFileTree(TUrl(f->GetName()).GetFileAndOptions(), f, localfile);
924  fFileTrees->Add(ft);
925  } else {
926  // Fill locality boolean
927  localfile = ft->fIsLocal;
928  PDB(kLoop,2)
929  Info("Load","file '%s' already open (local:%d)", fn, localfile);
930  }
931 
932  // Check if the tree is already loaded
933  if (ft && ft->fTrees->GetSize() > 0) {
934  TTree *t = 0;
935  if (!strcmp(tn, "*"))
936  t = (TTree *) ft->fTrees->First();
937  else
938  t = (TTree *) ft->fTrees->FindObject(tn);
939  if (t) {
940  ft->fUsed = kTRUE;
941  return t;
942  }
943  }
944 
945  TDirectory *dd = f;
946  // Change dir, if required
947  if (dn && !(dd = f->GetDirectory(dn))) {
948  Error("Load","Cannot get to: %s", dn);
949  return (TTree *)0;
950  }
951  PDB(kLoop,2)
952  Info("Load","got directory: %s", dn);
953 
954  // If a wild card we will use the first object of the type
955  // requested compatible with the reg expression we got
956  TString on(tn);
957  TString sreg(tn);
958  if (sreg.Length() <= 0 || sreg == "" || sreg.Contains("*")) {
959  if (sreg.Contains("*"))
960  sreg.ReplaceAll("*", ".*");
961  else
962  sreg = ".*";
963  TRegexp re(sreg);
964  if (dd->GetListOfKeys()) {
965  TIter nxk(dd->GetListOfKeys());
966  TKey *k = 0;
967  while ((k = (TKey *) nxk())) {
968  if (!strcmp(k->GetClassName(), "TTree")) {
969  TString kn(k->GetName());
970  if (kn.Index(re) != kNPOS) {
971  on = kn;
972  break;
973  }
974  }
975  }
976  }
977  }
978 
979  // Point to the key
980  TKey *key = dd->GetKey(gSystem->BaseName(on));
981  if (key == 0) {
982  Error("Load", "Cannot find tree \"%s\" in %s", tn, fn);
983  return (TTree*)0;
984  }
985 
986  PDB(kLoop,2) Info("Load", "Reading: %s", tn);
987 
988  TTree *tree = dynamic_cast<TTree*> (key->ReadObj());
989  dd->cd();
990 
991  if (tree == 0) {
992  Error("Load", "Cannot <dynamic_cast> obj to tree \"%s\"", tn);
993  return (TTree*)0;
994  }
995 
996  // Add track in the cache
997  ft->fTrees->Add(tree);
998  ft->fUsed = kTRUE;
999  PDB(kLoop,2)
1000  Info("Load","TFileTree for '%s' flagged as 'in-use' ...", ft->GetName());
1001 
1002  // Done
1003  return tree;
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// Get loop range
1008 
1010 {
1011  if (first > -1) fEntryListPos = first;
1012 
1013  if (fStop || fNum == 0) return -1;
1014 
1015  Bool_t attach = kFALSE;
1016 
1017  // When files are aborted during processing (via TSelector::kAbortFile) the player
1018  // invalidates the element by settign this bit. We need to ask for a new packet
1019  Bool_t corrupted = kFALSE;
1020  Long64_t rest = -1;
1021  if (fElem) {
1022  corrupted = (fElem->TestBit(TDSetElement::kCorrupted)) ? kTRUE : kFALSE;
1023  rest = fElem->GetNum();
1024  if (fElemCur >= 0) rest -= (fElemCur + 1 - fElemFirst);
1025  }
1026 
1027  SafeDelete(fElem);
1028 
1029  while (fElem == 0 || fElemNum == 0 || fCur < fFirst-1) {
1030 
1031  if (gPerfStats && fTree) {
1032  Long64_t totBytesRead = fTree->GetCurrentFile()->GetBytesRead();
1033  Long64_t bytesRead = totBytesRead - fOldBytesRead;
1034  gPerfStats->SetBytesRead(bytesRead);
1035  fOldBytesRead = totBytesRead;
1036  }
1037 
1038  if (fElem) {
1039  // Save it to the list of processed packets
1040  if (fPackets) {
1041  fPackets->Add(fElem);
1042  fElem = 0;
1043  } else {
1044  SafeDelete(fElem);
1045  }
1046  }
1047  while (!fElem) {
1048  // For a corrupted/invalid file the request for a new packet is with totalEntries = -1
1049  // (the default) so that the packetizer invalidates the element
1050  if (corrupted) {
1051  fElem = fDSet->Next(rest);
1052  } else if (fTree) {
1053  fElem = fDSet->Next(fTree->GetEntries());
1054  } else {
1055  fElem = fDSet->Next();
1056  }
1057 
1058  if (!fElem) {
1059  // End of processing
1060  fNum = 0;
1061  return -1;
1062  }
1063  corrupted = kFALSE;
1066 
1067  TTree *newTree = GetTrees(fElem);
1068  if (newTree) {
1069  if (newTree != fTree) {
1070  // The old tree is owned by TFileTree and will be deleted there
1071  fTree = newTree;
1072  attach = kTRUE;
1074  }
1075  // Set range to be analysed
1076  if (fTreeCache)
1078  fElem->GetFirst() + fElem->GetNum() - 1);
1079  } else {
1080  // Could not open this element: ask for another one
1081  SafeDelete(fElem);
1082  // The current tree, if any, is not valid anymore
1083  fTree = 0;
1084  }
1085  }
1086 
1087  // Validate values for this element
1088  fElemFirst = fElem->GetFirst();
1089  fElemNum = fElem->GetNum();
1090  fEntryList = 0;
1091  fEventList = 0;
1092  if (fElem->GetEntryList()) {
1093  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
1094  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
1095  }
1097  fEventListPos = 0;
1098  if (fEntryList)
1100  else if (fEventList)
1101  fElemNum = fEventList->GetN();
1102 
1103  Long64_t tnum = (Long64_t) fTree->GetEntries();
1104 
1105  if (!fEntryList && !fEventList) {
1106  if ( fElemFirst > tnum ) {
1107  Error("GetNextPacket", "first (%lld) higher then number of entries (%lld) in %s",
1108  fElemFirst, tnum, fElem->GetObjName());
1109  fNum = 0;
1110  return -1;
1111  }
1112  if ( fElemNum == -1 ) {
1113  fElemNum = tnum - fElemFirst;
1114  } else if ( fElemFirst+fElemNum > tnum ) {
1115  Error("GetNextPacket", "num (%lld) + first (%lld) larger then number of entries (%lld) in %s",
1116  fElemNum, fElemFirst, tnum, fElem->GetName());
1117  fElemNum = tnum - fElemFirst;
1118  }
1119 
1120  // Skip this element completely?
1121  if ( fCur + fElemNum < fFirst ) {
1122  fCur += fElemNum;
1123  continue;
1124  }
1125  // Position within this element
1126  fElemCur = fElemFirst-1;
1127  }
1128  }
1129 
1130  if (attach) {
1131  PDB(kLoop,1) Info("GetNextPacket", "call Init(%p) and Notify()",fTree);
1132  fSel->Init(fTree);
1133  fSel->Notify();
1134  TIter next(fSel->GetOutputList());
1135  TEntryList *elist=0;
1136  while ((elist=(TEntryList*)next())){
1137  if (elist->InheritsFrom(TEntryList::Class()))
1138  elist->SetTree(fTree->GetName(), fElem->GetFileName());
1139  }
1141  // the error has been reported
1142  return -1;
1143  }
1144  attach = kFALSE;
1145  }
1146 
1147  // Fill the output now
1148  num = fElemNum;
1149  if (fEntryList) {
1150  first = fEntryListPos;
1151  } else if (fEventList){
1152  first = fEventListPos;
1153  } else {
1154  first = fElemFirst;
1155  }
1156 
1157  // Done
1158  return 0;
1159 }
1160 
1161 ////////////////////////////////////////////////////////////////////////////////
1162 /// Actions to be done just before processing entry 'entry'.
1163 /// Called by TProofPlayer.
1164 
1166 {
1167  if (!(fEntryList || fEventList)) {
1168  --fNum;
1169  ++fCur;
1170  }
1171 
1172  // Signal ending of learning phase
1174  if (!(fTreeCache->IsLearning())) {
1177  }
1178  }
1179 
1180  // For prefetching
1181  if (fTree->LoadTree(entry) < 0) {
1182  Warning("PreEventProcess", "problems setting entry in TTree");
1183  }
1184 }
1185 
1186 ////////////////////////////////////////////////////////////////////////////////
1187 /// Get next event
1188 
1190 {
1191  if (fStop || fNum == 0) return -1;
1192 
1193  Bool_t attach = kFALSE;
1194 
1195  // When files are aborted during processing (via TSelector::kAbortFile) the player
1196  // invalidates the element by settign this bit. We need to ask for a new packet
1198 
1200 
1201  while ( fElem == 0 || fElemNum == 0 || fCur < fFirst-1 || corrupted) {
1202 
1203  if (gPerfStats && fTree) {
1204  Long64_t totBytesRead = fTree->GetCurrentFile()->GetBytesRead();
1205  Long64_t bytesRead = totBytesRead - fOldBytesRead;
1206  gPerfStats->SetBytesRead(bytesRead);
1207  fOldBytesRead = totBytesRead;
1208  }
1209 
1210  Long64_t rest = -1;
1211  if (fElem) {
1212  rest = fElem->GetNum();
1213  if (fElemCur >= 0) rest -= (fElemCur + 1 - fElemFirst);
1214  // Save it to the list of processed packets
1215  if (fPackets) {
1216  fPackets->Add(fElem);
1217  fElem = 0;
1218  } else {
1219  SafeDelete(fElem);
1220  }
1221  }
1222 
1223  while (!fElem) {
1224  // For a corrupted/invalid file the request for a new packet is with totalEntries = -1
1225  // (the default) so that the packetizer invalidates the element
1226  if (corrupted) {
1227  fElem = fDSet->Next(rest);
1228  } else if (fTree) {
1229  fElem = fDSet->Next(fTree->GetEntries());
1230  } else {
1231  fElem = fDSet->Next();
1232  }
1233 
1234  if (!fElem) {
1235  // End of processing
1236  fNum = 0;
1237  return -1;
1238  }
1239  corrupted = kFALSE;
1242 
1243  TTree *newTree = GetTrees(fElem);
1244  if (newTree) {
1245  if (newTree != fTree) {
1246  // The old tree is owned by TFileTree and will be deleted there
1247  fTree = newTree;
1248  attach = kTRUE;
1250  }
1251  // Set range to be analysed
1252  if (fTreeCache)
1254  fElem->GetFirst() + fElem->GetNum() - 1);
1255  } else {
1256  // Could not open this element: ask for another one
1257  SafeDelete(fElem);
1258  // The current tree, if any, is not valid anymore
1259  fTree = 0;
1260  }
1261  }
1262 
1263  // Validate values for this element
1264  fElemFirst = fElem->GetFirst();
1265  fElemNum = fElem->GetNum();
1266  fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList());
1267  fEventList = (fEntryList) ? (TEventList *)0
1268  : dynamic_cast<TEventList *>(fElem->GetEntryList());
1270  fEventListPos = 0;
1271  if (fEntryList)
1273  else if (fEventList)
1274  fElemNum = fEventList->GetN();
1275 
1276  Long64_t num = (Long64_t) fTree->GetEntries();
1277 
1278  if (!fEntryList && !fEventList) {
1279  if ( fElemFirst > num ) {
1280  Error("GetNextEvent", "first (%lld) higher then number of entries (%lld) in %s",
1281  fElemFirst, num, fElem->GetObjName());
1282  fNum = 0;
1283  return -1;
1284  }
1285  if ( fElemNum == -1 ) {
1286  fElemNum = num - fElemFirst;
1287  } else if ( fElemFirst+fElemNum > num ) {
1288  Error("GetNextEvent", "num (%lld) + first (%lld) larger then number of entries (%lld) in %s",
1289  fElemNum, fElemFirst, num, fElem->GetName());
1290  fElemNum = num - fElemFirst;
1291  }
1292 
1293  // Skip this element completely?
1294  if ( fCur + fElemNum < fFirst ) {
1295  fCur += fElemNum;
1296  continue;
1297  }
1298  // Position within this element. TODO: more efficient?
1299  fElemCur = fElemFirst-1;
1300  }
1301  }
1302 
1303  if ( attach ) {
1304  PDB(kLoop,1) Info("GetNextEvent", "call Init(%p) and Notify()",fTree);
1305  fSel->Init(fTree);
1306  fSel->Notify();
1307  TIter next(fSel->GetOutputList());
1308  TEntryList *elist=0;
1309  while ((elist=(TEntryList*)next())){
1310  if (elist->InheritsFrom(TEntryList::Class()))
1311  elist->SetTree(fTree->GetName(), fElem->GetFileName());
1312  }
1314  // the error has been reported
1315  return -1;
1316  }
1317  attach = kFALSE;
1318  }
1319  Long64_t rv;
1320 
1321  if (fEntryList){
1322  --fElemNum;
1324  fEntryListPos++;
1325  } else if (fEventList) {
1326  --fElemNum;
1328  fEventListPos++;
1329  } else {
1330  --fElemNum;
1331  ++fElemCur;
1332  rv = fElemCur;
1333  }
1334 
1335  // Pre-event processing
1336  PreProcessEvent(rv);
1337 
1338  return rv;
1339 }
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:929
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:158
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:899
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:64
TFile * fFile
Definition: TEventIter.h:57
TString fFilename
Definition: TEventIter.h:56
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
Definition: TFile.cxx:2197
This class represents a WWW compatible URL.
Definition: TUrl.h:41
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:157
This class implements a data set to be used for PROOF processing.
Definition: TDSet.h:153
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
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:34
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:50
TList * fKeys
Definition: TEventIter.h:130
virtual TList * GetListOfFriends() const
Definition: TTree.h:419
Long64_t fElemNum
Definition: TEventIter.h:62
Regular expression class.
Definition: TRegexp.h:35
Long64_t fElemFirst
Definition: TEventIter.h:61
Long64_t GetFirst() const
Definition: TDSet.h:114
Basic string class.
Definition: TString.h:137
TList * fPackets
Definition: TPacketizer.h:46
Bool_t fStop
Definition: TEventIter.h:69
Long64_t fNum
Definition: TEventIter.h:67
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void StopProcess(Bool_t abort)
Set flag to stop the process.
Definition: TEventIter.cxx:142
virtual TList * GetListOfFriends() const
Definition: TDSet.h:110
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
Definition: TEventIter.cxx:134
const char * Class
Definition: TXMLSetup.cxx:64
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:161
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:739
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:497
TObject * fObj
Definition: TEventIter.h:132
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:3907
TEventIter()
Default constructor.
Definition: TEventIter.cxx:55
TTree * fTree
Definition: TEventIter.h:156
virtual Int_t GetErrno() const
Method returning errno. Is overriden in TRFIOFile.
Definition: TFile.cxx:1186
Manages an element of a TDSet.
Definition: TDSet.h:68
#define SafeDelete(p)
Definition: RConfig.h:507
virtual Long64_t GetCacheSize() const
Definition: TTree.h:384
Long64_t GetNextEvent()
Get next event.
Long64_t GetNum() const
Definition: TDSet.h:116
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:2335
#define PDB(mask, level)
Definition: TProofDebug.h:58
Bool_t fUseParallelUnzip
Definition: TEventIter.h:161
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Long64_t fEntryListPos
entry list for processing
Definition: TEventIter.h:73
Long64_t fFirst
Definition: TEventIter.h:66
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition: TTree.cxx:6010
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:4622
virtual Long64_t GetEntriesToProcess() const
Definition: TEntryList.h:74
TList * fPackets
current position in the entrylist
Definition: TEventIter.h:75
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Definition: TFile.cxx:4384
virtual Int_t GetN() const
Definition: TEventList.h:58
const char * GetDirectory() const
Return directory where to look for object.
Definition: TDSet.cxx:234
void Info(const char *location, const char *msgfmt,...)
virtual void PreProcessEvent(Long64_t)
Definition: TEventIter.h:78
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
Definition: TTree.cxx:1185
Bool_t fDontCacheFiles
Definition: TEventIter.h:162
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:30
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:158
A doubly linked list.
Definition: TList.h:47
const char * GetObjName() const
Definition: TDSet.h:122
Long64_t fCacheSize
Definition: TEventIter.h:160
Long64_t fCur
Definition: TEventIter.h:68
EFileType
File type.
Definition: TFile.h:172
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:557
Bool_t IsTree() const
Definition: TDSet.h:225
TIter * fNextKey
Definition: TEventIter.h:131
TTree * GetTrees(TDSetElement *elem)
Create a Tree for the main TDSetElement and for all the friends.
Definition: TEventIter.cxx:761
TRandom2 r(17)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
Long64_t fElemCur
Definition: TEventIter.h:63
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:496
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:675
Int_t fEventListPos
eventList for processing
Definition: TEventIter.h:71
TObject * Next()
Definition: TCollection.h:158
TString fTreeName
Definition: TEventIter.h:155
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5053
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:655
Ssiz_t Length() const
Definition: TString.h:390
TDSetElement * fElem
Definition: TEventIter.h:54
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:33
Special iterator class used in TProofPlayer to iterate over events or objects in the packets...
Definition: TEventIter.h:46
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:289
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:445
void SetName(const char *name)
Definition: TCollection.h:116
void Warning(const char *location, const char *msgfmt,...)
virtual TDirectory * GetDirectory(const char *apath, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory named "apath".
TSelector * fSel
Definition: TEventIter.h:65
virtual ~TFileTree()
Default dtor.
Definition: TEventIter.cxx:674
#define gPerfStats
virtual Long64_t GetBytesRead() const
Definition: TFile.h:210
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:163
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:2241
#define ClassImp(name)
Definition: Rtypes.h:279
TObject * GetEntryList() const
Definition: TDSet.h:133
double f(double x)
Bool_t IsZombie() const
Definition: TObject.h:120
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Definition: TEventIter.cxx:861
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition: TDirectory.h:156
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:44
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition: TTimeStamp.h:76
TString fPath
Definition: TEventIter.h:59
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
TString fClassName
Definition: TEventIter.h:129
Long64_t fOldBytesRead
Definition: TEventIter.h:58
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:113
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache .
Definition: TTree.cxx:8048
const char * GetType() const
Definition: TDSet.h:228
virtual void SetObject(TObject *obj)
Definition: TSelector.h:72
virtual Long64_t GetEntries() const
Definition: TTree.h:393
Bool_t IsNull() const
Definition: TString.h:387
TTreeCache * fTreeCache
Definition: TEventIter.h:157
TEventIterTree()
Default ctor.
Definition: TEventIter.cxx:691
TDirectory * fDir
Definition: TEventIter.h:60
virtual Bool_t IsLearning() const
Definition: TTreeCache.h:91
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition: TKey.cxx:730
TEntryList * fEntryList
current position in the eventList
Definition: TEventIter.h:72
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:435
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:361
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
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:159
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:203
TFileCacheRead * GetCacheRead(TObject *tree=0) const
Return a pointer to the current read cache.
Definition: TFile.cxx:1202
TEventList * fEventList
Definition: TEventIter.h:70
A TTree object has a header with a name and a title.
Definition: TTree.h:98
#define gDirectory
Definition: TDirectory.h:221
void ResetBit(UInt_t f)
Definition: TObject.h:156
void RestartComputeTime()
Reset the compute time.
Definition: first.py:1
virtual Int_t GetSize() const
Definition: TCollection.h:95
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:39
const char * GetObjName() const
Definition: TDSet.h:229
const Bool_t kTRUE
Definition: Rtypes.h:91
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:27
virtual void UpdateBranches(TTree *tree)
Update pointer to current Tree and recompute pointers to the branches in the cache.
const char * GetOrdinal() const
Definition: TProofServ.h:267
const Int_t n
Definition: legend1.C:16
TDSet * fDSet
Definition: TEventIter.h:52
int main(int argc, char **argv)
char name[80]
Definition: TGX11.cxx:109
virtual EAbort GetAbort() const
Definition: TSelector.h:80
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
Definition: TTreeCache.cxx:987
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:911
virtual TList * GetOutputList() const
Definition: TSelector.h:76
virtual void Init(TTree *)
Definition: TSelector.h:61
T1 fFirst
Definition: X11Events.mm:86
const char * Data() const
Definition: TString.h:349