ROOT  6.06/09
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 //////////////////////////////////////////////////////////////////////////
14 // //
15 // TEventIter //
16 // //
17 // Special iterator class used in TProofPlayer to iterate over events //
18 // or objects in the packets. //
19 // //
20 //////////////////////////////////////////////////////////////////////////
21 
22 #include "TEnv.h"
23 #include "TEventIter.h"
24 #include "TFriendElement.h"
25 #include "TCollection.h"
26 #include "TDSet.h"
27 #include "TFile.h"
28 #include "TKey.h"
29 #include "TProofDebug.h"
30 #include "TSelector.h"
31 #include "TTimeStamp.h"
32 #include "TTree.h"
33 #include "TTreeCache.h"
34 #include "TTreeCacheUnzip.h"
35 #include "TVirtualPerfStats.h"
36 #include "TEventList.h"
37 #include "TEntryList.h"
38 #include "TList.h"
39 #include "TMap.h"
40 #include "TObjString.h"
41 #include "TRegexp.h"
42 #include "TProofServ.h"
43 #include "TSystem.h"
44 
45 #include "TError.h"
46 
47 #if defined(R__MACOSX)
48 #include "fcntl.h"
49 #endif
50 
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Default constructor
55 
57 {
58  fDSet = 0;
59  fElem = 0;
60  fFile = 0;
61  fDir = 0;
62  fSel = 0;
63  fFirst = 0;
64  fCur = -1;
65  fNum = 0;
66  fStop = kFALSE;
67  fOldBytesRead = 0;
68  fEventList = 0;
69  fEventListPos = 0;
70  fEntryList = 0;
71  fEntryListPos = 0;
72  fElemFirst = 0;
73  fElemNum = 0;
74  fElemCur = -1;
76 
77  if ((fPackets = new TList)) {
78  TString n("ProcessedPackets_");
79  if (gProofServ) n += gProofServ->GetOrdinal();
80  fPackets->SetName(n);
81  Info("TEventIter", "fPackets list '%s' created", n.Data());
82  } else {
83  Warning("TEventIter", "fPackets list could not be created");
84  }
85 }
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Constructor
89 
91  : fDSet(dset), fSel(sel)
92 {
93  fElem = 0;
94  fFile = 0;
95  fDir = 0;
96  fFirst = first;
97  fCur = -1;
98  fNum = num;
99  fStop = kFALSE;
100  fEventList = 0;
101  fEventListPos = 0;
102  fEntryList = 0;
103  fEntryListPos = 0;
104  fOldBytesRead = 0;
105  fElemFirst = 0;
106  fElemNum = 0;
107  fElemCur = -1;
109 
110  if ((fPackets = new TList)) {
111  TString n("ProcessedPackets_");
112  if (gProofServ) n += gProofServ->GetOrdinal();
113  fPackets->SetName(n);
114  Info("TEventIter", "fPackets list '%s' created", n.Data());
115  } else {
116  Warning("TEventIter", "fPackets list could not be created");
117  }
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Destructor
122 
124 {
125  if (fPackets) {
128  }
129  delete fFile;
130 }
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit
134 
136 {
138 }
139 
140 ////////////////////////////////////////////////////////////////////////////////
141 /// Set flag to stop the process
142 
144 {
145  fStop = kTRUE;
146 }
147 
148 ////////////////////////////////////////////////////////////////////////////////
149 /// Create and instance of the appropriate iterator
150 
152 {
153  if (dset->TestBit(TDSet::kEmpty)) {
154  return new TEventIterUnit(dset, sel, num);
155  } else if (dset->IsTree()) {
156  return new TEventIterTree(dset, sel, first, num);
157  } else {
158  return new TEventIterObj(dset, sel, first, num);
159  }
160 }
161 
162 ////////////////////////////////////////////////////////////////////////////////
163 /// Load directory
164 
166 {
167  Int_t ret = 0;
168 
169  // Check Filename
170  if ( fFile == 0 || fFilename != fElem->GetFileName() ) {
171  fDir = 0;
172  delete fFile; fFile = 0;
173 
175 
176  TDirectory *dirsave = gDirectory;
177 
178  Double_t start = 0;
179  if (gPerfStats) start = TTimeStamp();
180 
181  // Take into acoount possible prefixes
183  TString fname = gEnv->GetValue("Path.Localroot","");
184  if (!fname.IsNull())
185  typ = TFile::GetType(fFilename, "", &fname);
186  if (typ != TFile::kLocal)
187  fname = fFilename;
188  fFile = TFile::Open(fname);
189 
190  if (gPerfStats) {
191  gPerfStats->FileOpenEvent(fFile, fFilename, start);
192  fOldBytesRead = 0;
193  }
194 
195  if (dirsave) dirsave->cd();
196 
197  if (!fFile || fFile->IsZombie() ) {
198  if (fFile)
199  Error("Process","Cannot open file: %s (%s)",
200  fFilename.Data(), strerror(fFile->GetErrno()) );
201  else
202  Error("Process","Cannot open file: %s (errno unavailable)",
203  fFilename.Data());
204  // cleanup ?
205  return -1;
206  }
207  PDB(kLoop,2) Info("LoadDir","Opening file: %s", fFilename.Data() );
208  ret = 1;
209  }
210 
211  // Check Directory
212  if ( fDir == 0 || fPath != fElem->GetDirectory() ) {
213  TDirectory *dirsave = gDirectory;
214 
215  fPath = fElem->GetDirectory();
216  if ( !fFile->cd(fPath) ) {
217  Error("Process","Cannot cd to: %s",
218  fPath.Data() );
219  return -1;
220  }
221  PDB(kLoop,2) Info("Process","Cd to: %s", fPath.Data() );
222  fDir = gDirectory;
223  if (dirsave) dirsave->cd();
224  ret = 1;
225  }
226 
227  return ret;
228 }
229 
230 //______________________________________________________________________________
232 {
233  // Get the entry number, taking into account event/entry lists
234 
235  Long64_t entry = next;
236  // Set entry number; if data iteration we may need to test the entry or event lists
237  if (TestBit(TEventIter::kData)) {
238  if (fEntryList){
239  entry = fEntryList->GetEntry(next);
240  } else if (fEventList) {
241  entry = fEventList->GetEntry(next);
242  }
243  }
244  // Pre-event processing
245  PreProcessEvent(entry);
246  // Done
247  return entry;
248 }
249 
250 //------------------------------------------------------------------------
251 
252 
254 
255 ////////////////////////////////////////////////////////////////////////////////
256 /// Default constructor
257 
259 {
260  fDSet = 0;
261  fElem = 0;
262  fSel = 0;
263  fNum = 0;
264  fCurrent = 0;
265  fStop = kFALSE;
266  fOldBytesRead = 0; // Measures the bytes written
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Main constructor
271 
273 {
274  fDSet = dset;
275  fElem = 0;
276  fSel = sel;
277  fNum = num;
278  fCurrent = 0;
279  fStop = kFALSE;
280  fOldBytesRead = 0; // Measures the bytes written
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Get loop range
285 
287 {
288  if (gPerfStats) {
289  Long64_t totBytesWritten = TFile::GetFileBytesWritten();
290  Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
291  PDB(kLoop, 2) Info("GetNextPacket", "bytes written: %lld", bytesWritten);
292  gPerfStats->SetBytesRead(bytesWritten);
293  fOldBytesRead = totBytesWritten;
294  }
295 
296  if (fDSet->TestBit(TDSet::kIsLocal)) {
297  if (fElem) {
298  if (fPackets) {
299  fPackets->Add(fElem);
300  PDB(kLoop, 2)
301  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
302  fElem = 0;
303  } else {
304  SafeDelete(fElem);
305  }
306  return -1;
307  } else {
308  fElem = new TDSetElement("", "", "", 0, fNum);
310  }
311  } else {
312  if (fPackets && fElem) {
313  fPackets->Add(fElem);
314  PDB(kLoop, 2)
315  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
316  fElem = 0;
317  } else {
318  SafeDelete(fElem);
319  }
320  if (!(fElem = fDSet->Next()))
321  return -1;
322  }
324 
326  Error("GetNextPacket", "data element must be set to kEmtpy");
327  return -1;
328  }
329 
330  // Set output
331  num = fElem->GetNum();
332  if (num == 0) return -1;
333  fst = fElem->GetFirst();
334 
335  // Done
336  return 0;
337 }
338 
339 ////////////////////////////////////////////////////////////////////////////////
340 /// Get next event
341 
343 {
344  if (fStop || fNum == 0)
345  return -1;
346 
348 
349  while (fElem == 0 || fCurrent == 0) {
350 
351  if (gPerfStats) {
352  Long64_t totBytesWritten = TFile::GetFileBytesWritten();
353  Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
354  PDB(kLoop, 2) Info("GetNextEvent", "bytes written: %lld", bytesWritten);
355  gPerfStats->SetBytesRead(bytesWritten);
356  fOldBytesRead = totBytesWritten;
357  }
358 
359  if (fDSet->TestBit(TDSet::kIsLocal)) {
360  if (fElem) {
361  if (fPackets) {
362  fPackets->Add(fElem);
363  PDB(kLoop, 2)
364  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
365  fElem = 0;
366  } else {
367  SafeDelete(fElem);
368  }
369  return -1;
370  } else {
371  fElem = new TDSetElement("", "", "", 0, fNum);
373  }
374  } else {
375  if (fPackets && fElem) {
376  fPackets->Add(fElem);
377  PDB(kLoop, 2)
378  Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
379  fElem = 0;
380  } else {
381  SafeDelete(fElem);
382  }
383  if (!(fElem = fDSet->Next()))
384  return -1;
385  }
387 
389  Error("GetNextEvent", "data element must be set to kEmtpy");
390  return -1;
391  }
392 
393  fNum = fElem->GetNum();
394  if (!(fCurrent = fNum)) {
395  fNum = 0;
396  return -1;
397  }
398  fFirst = fElem->GetFirst();
399  }
400  Long64_t event = fNum - fCurrent + fFirst ;
401  --fCurrent;
402  return event;
403 }
404 
405 //------------------------------------------------------------------------
406 
407 
409 
410 ////////////////////////////////////////////////////////////////////////////////
411 /// Default ctor.
412 
414 {
415  fKeys = 0;
416  fNextKey = 0;
417  fObj = 0;
418 }
419 
420 ////////////////////////////////////////////////////////////////////////////////
421 /// Constructor
422 
424  : TEventIter(dset,sel,first,num)
425 {
426  fClassName = dset->GetType();
427  fKeys = 0;
428  fNextKey = 0;
429  fObj = 0;
430 }
431 
432 
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Destructor
435 
437 {
438  // delete fKeys ?
439  delete fNextKey;
440  delete fObj;
441 }
442 
443 ////////////////////////////////////////////////////////////////////////////////
444 /// Get loop range
445 
447 {
448  SafeDelete(fElem);
449 
450  if (fStop || fNum == 0) return -1;
451 
452  while (fElem == 0 || fCur < fFirst-1) {
453 
454  if (gPerfStats && fFile) {
455  Long64_t bytesRead = fFile->GetBytesRead();
456  gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
457  fOldBytesRead = bytesRead;
458  }
459 
460  if (fElem) {
461  // Save it to the list of processed packets
462  if (fPackets) {
463  fPackets->Add(fElem);
464  fElem = 0;
465  } else {
466  SafeDelete(fElem);
467  }
468  }
469  fElem = fDSet->Next(fKeys->GetSize());
470  if (fElem && fElem->GetEntryList()) {
471  Error("GetNextPacket", "entry- or event-list not available");
472  return -1;
473  }
474 
475  if ( fElem == 0 ) {
476  fNum = 0;
477  return -1;
478  }
480 
481  Int_t r = LoadDir();
482 
483  if ( r == -1 ) {
484 
485  // Error has been reported
486  fNum = 0;
487  return -1;
488 
489  } else if ( r == 1 ) {
490 
491  // New file and/or directory
492  fKeys = fDir->GetListOfKeys();
493  fNextKey = new TIter(fKeys);
494  }
495 
496  // Validate values for this element
498  fElemNum = fElem->GetNum();
499  if (fElem->GetEntryList()) {
500  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
501  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
502  }
503  fEventListPos = 0;
504  if (fEntryList)
506  else if (fEventList)
507  fElemNum = fEventList->GetN();
508 
509  Long64_t tnum = fKeys->GetSize();
510 
511  if ( fElemFirst > tnum ) {
512  Error("GetNextPacket","First (%lld) higher then number of keys (%lld) in %s",
513  fElemFirst, tnum, fElem->GetName());
514  fNum = 0;
515  return -1;
516  }
517 
518  if ( fElemNum == -1 ) {
519  fElemNum = tnum - fElemFirst;
520  } else if ( fElemFirst+fElemNum > tnum ) {
521  Error("GetNextPacket","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
523  fElemNum = tnum - fElemFirst;
524  }
525 
526  // Skip this element completely?
527  if ( fCur + fElemNum < fFirst ) {
528  fCur += fElemNum;
529  continue;
530  }
531 
532  // Position within this element
533  fNextKey->Reset();
534  for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
535  }
536 
537  first = ++fElemCur;
538  num = fElemNum;
539 
540  // Done
541  return 0;
542 }
543 ////////////////////////////////////////////////////////////////////////////////
544 /// To be executed before by TProofPlayer calling TSelector::Process
545 
547 {
548  --fNum;
549  ++fCur;
550  TKey *key = (TKey*) fNextKey->Next();
551  TDirectory *dirsave = gDirectory;
552  fDir->cd();
553  fObj = key->ReadObj();
554  if (dirsave) dirsave->cd();
555  fSel->SetObject(fObj);
556 }
557 
558 ////////////////////////////////////////////////////////////////////////////////
559 /// Get next event
560 
562 {
563  if (fStop || fNum == 0) return -1;
564 
566 
567  while ( fElem == 0 || fElemNum == 0 || fCur < fFirst-1 ) {
568 
569  if (gPerfStats && fFile) {
570  Long64_t bytesRead = fFile->GetBytesRead();
571  gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
572  fOldBytesRead = bytesRead;
573  }
574 
575  if (fElem) {
576  // Save it to the list of processed packets
577  if (fPackets) {
578  fPackets->Add(fElem);
579  fElem = 0;
580  } else {
581  SafeDelete(fElem);
582  }
583  }
584  fElem = fDSet->Next(fKeys->GetSize());
585  if (fElem && fElem->GetEntryList()) {
586  Error("GetNextEvent", "Entry- or event-list not available");
587  return -1;
588  }
589 
590  if ( fElem == 0 ) {
591  fNum = 0;
592  return -1;
593  }
595 
596  Int_t r = LoadDir();
597 
598  if ( r == -1 ) {
599 
600  // Error has been reported
601  fNum = 0;
602  return -1;
603 
604  } else if ( r == 1 ) {
605 
606  // New file and/or directory
607  fKeys = fDir->GetListOfKeys();
608  fNextKey = new TIter(fKeys);
609  }
610 
611  // Validate values for this element
613  fElemNum = fElem->GetNum();
614  if (fElem->GetEntryList()) {
615  if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
616  fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
617  }
618  fEventListPos = 0;
619  if (fEntryList)
621  else if (fEventList)
622  fElemNum = fEventList->GetN();
623 
624  Long64_t num = fKeys->GetSize();
625 
626  if ( fElemFirst > num ) {
627  Error("GetNextEvent","First (%lld) higher then number of keys (%lld) in %s",
628  fElemFirst, num, fElem->GetName());
629  fNum = 0;
630  return -1;
631  }
632 
633  if ( fElemNum == -1 ) {
634  fElemNum = num - fElemFirst;
635  } else if ( fElemFirst+fElemNum > num ) {
636  Error("GetNextEvent","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
638  fElemNum = num - fElemFirst;
639  }
640 
641  // Skip this element completely?
642  if ( fCur + fElemNum < fFirst ) {
643  fCur += fElemNum;
644  continue;
645  }
646 
647  // Position within this element. TODO: more efficient?
648  fNextKey->Reset();
649  for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
650  }
651 
652  --fElemNum;
653  ++fElemCur;
654 
655  // Pre-event processing
657 
658  return fElemCur;
659 }
660 
661 //------------------------------------------------------------------------
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Default ctor.
665 
667  : TNamed(name, ""), fUsed(kFALSE), fIsLocal(islocal), fFile(f)
668 {
669  fTrees = new TList;
670  fTrees->SetOwner();
671 }
672 ////////////////////////////////////////////////////////////////////////////////
673 /// Default dtor.
674 
676 {
677  // Avoid destroying the cache; must be placed before deleting the trees
678  TTree *tree = (TTree *)fTrees->First();
679  while (tree) {
680  fFile->SetCacheRead(0, tree);
681  tree = (TTree *)fTrees->After(tree);
682  }
683  SafeDelete(fTrees);
684  SafeDelete(fFile);
685 }
686 
688 
689 ////////////////////////////////////////////////////////////////////////////////
690 /// Default ctor.
691 
693 {
694  fTree = 0;
695  fTreeCache = 0;
696  fUseTreeCache = 1;
697  fCacheSize = -1;
699  fFileTrees = 0;
700  fUseParallelUnzip = 0;
703 }
704 
705 ////////////////////////////////////////////////////////////////////////////////
706 /// Constructor
707 
709  : TEventIter(dset,sel,first,num)
710 {
711  fTreeName = dset->GetObjName();
712  fTree = 0;
713  fTreeCache = 0;
715  fFileTrees = new TList;
716  fFileTrees->SetOwner();
717  fUseTreeCache = gEnv->GetValue("ProofPlayer.UseTreeCache", 1);
718  fCacheSize = gEnv->GetValue("ProofPlayer.CacheSize", -1);
719  fUseParallelUnzip = gEnv->GetValue("ProofPlayer.UseParallelUnzip", 0);
720  if (fUseParallelUnzip) {
722  } else {
724  }
725  fDontCacheFiles = gEnv->GetValue("ProofPlayer.DontCacheFiles", 0);
727 }
728 
729 ////////////////////////////////////////////////////////////////////////////////
730 /// Destructor
731 
733 {
734  // Delete the tree cache ...
736  // ... and the remaining open files
738 }
739 
740 ////////////////////////////////////////////////////////////////////////////////
741 /// Return the size in bytes of the cache, if any
742 /// Return -1 if not used
743 
745 {
746  if (fUseTreeCache) return fCacheSize;
747  return -1;
748 }
749 
750 ////////////////////////////////////////////////////////////////////////////////
751 /// Return the number of entries in the learning phase
752 
754 {
756 }
757 
758 ////////////////////////////////////////////////////////////////////////////////
759 /// Create a Tree for the main TDSetElement and for all the friends.
760 /// Returns the main tree or 0 in case of an error.
761 
763 {
764  // Reset used flags
765  TIter nxft(fFileTrees);
766  TFileTree *ft = 0;
767  while ((ft = (TFileTree *)nxft()))
768  ft->fUsed = kFALSE;
769 
770  Bool_t localfile = kFALSE;
771  TTree* main = Load(elem, localfile);
772 
773  if (main && main != fTree) {
774  // Set the file cache
775  if (fUseTreeCache) {
776  TFile *curfile = main->GetCurrentFile();
777  if (curfile) {
778  if (!fTreeCache) {
779  main->SetCacheSize(fCacheSize);
780  fTreeCache = (TTreeCache *)curfile->GetCacheRead(main);
781  if (fCacheSize < 0) fCacheSize = main->GetCacheSize();
782  } 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();
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();
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:928
void * fObj
virtual TTree * GetTree()
Return pointer to friend TTree.
long long Long64_t
Definition: RtypesCore.h:69
~TEventIterObj()
Destructor.
Definition: TEventIter.cxx:436
virtual TDSetElement * Next(Long64_t totalEntries=-1)
Returns next TDSetElement.
Definition: TDSet.cxx:416
Long64_t fCurrent
Definition: TEventIter.h:107
Long64_t GetCacheSize()
Return the size in bytes of the cache, if any Return -1 if not used.
Definition: TEventIter.cxx:744
Long64_t GetNextEvent()
Get next event.
Definition: TEventIter.cxx:342
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TSelector.h:64
virtual Int_t GetErrno() const
Method returning errno. Is overriden in TRFIOFile.
Definition: TFile.cxx:1180
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:155
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Ssiz_t Length() const
Definition: TString.h:390
virtual TList * GetOutputList() const
Definition: TSelector.h:76
TFile * fFile
Definition: TEventIter.h:57
TString fFilename
Definition: TEventIter.h:56
const char * GetObjName() const
Definition: TDSet.h:229
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
Definition: TFile.cxx:2177
This class represents a WWW compatible URL.
Definition: TUrl.h:41
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
#define gDirectory
Definition: TDirectory.h:218
Definition: TDSet.h:153
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
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.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
TList * fKeys
Definition: TEventIter.h:130
Long64_t fElemNum
Definition: TEventIter.h:62
Regular expression class.
Definition: TRegexp.h:35
Long64_t fElemFirst
Definition: TEventIter.h:61
Bool_t IsZombie() const
Definition: TObject.h:141
Basic string class.
Definition: TString.h:137
TList * fPackets
Definition: TPacketizer.h:46
Bool_t fStop
Definition: TEventIter.h:69
ClassImp(TEventIter) TEventIter
Default constructor.
Definition: TEventIter.cxx:51
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 TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
virtual void StopProcess(Bool_t abort)
Set flag to stop the process.
Definition: TEventIter.cxx:143
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
Definition: TEventIter.cxx:135
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5006
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:561
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
TObject * fObj
Definition: TEventIter.h:132
virtual ~TEventIter()
Destructor.
Definition: TEventIter.cxx:123
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:3851
const char * GetObjName() const
Definition: TDSet.h:122
TTree * fTree
Definition: TEventIter.h:156
virtual Int_t GetN() const
Definition: TEventList.h:58
Long64_t GetNum() const
Definition: TDSet.h:116
virtual TList * GetListOfFriends() const
Definition: TTree.h:407
const char * Data() const
Definition: TString.h:349
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition: TDirectory.h:153
TFileCacheRead * GetCacheRead(TObject *tree=0) const
Return a pointer to the current read cache.
Definition: TFile.cxx:1196
#define SafeDelete(p)
Definition: RConfig.h:436
Bool_t IsTree() const
Definition: TDSet.h:225
virtual Long64_t GetEntriesToProcess() const
Definition: TEntryList.h:74
Long64_t GetNextEvent()
Get next event.
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:2334
#define PDB(mask, level)
Definition: TProofDebug.h:58
void Class()
Definition: Class.C:29
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:5804
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=0)
Resolve the file type as a function of the protocol field in 'name'.
Definition: TFile.cxx:4566
virtual Bool_t IsLearning() const
Definition: TTreeCache.h:91
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:4328
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:1157
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 void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual Long64_t GetEntryNumber(Long64_t)
Definition: TEventIter.cxx:231
void PreProcessEvent(Long64_t ent)
Actions to be done just before processing entry 'entry'.
Long64_t fNum
Definition: TEventIter.h:106
Bool_t fTreeCacheIsLearning
Definition: TEventIter.h:158
Long64_t GetFirst() const
Definition: TDSet.h:114
A doubly linked list.
Definition: TList.h:47
Long64_t fCacheSize
Definition: TEventIter.h:160
Long64_t fCur
Definition: TEventIter.h:68
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
Definition: TEventList.cxx:220
virtual TList * GetListOfFriends() const
Definition: TDSet.h:110
EFileType
File type.
Definition: TFile.h:163
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...
Int_t GetFd() const
Definition: TFile.h:194
const char * GetFileName() const
Definition: TDSet.h:113
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:762
ROOT::R::TRInterface & r
Definition: Object.C:4
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
virtual Long64_t GetCacheSize() const
Definition: TTree.h:373
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:494
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
Int_t fEventListPos
eventList for processing
Definition: TEventIter.h:71
TObject * Next()
Definition: TCollection.h:158
TString fTreeName
Definition: TEventIter.h:155
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
TObject * GetEntryList() const
Definition: TDSet.h:133
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:653
TDSetElement * fElem
Definition: TEventIter.h:54
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:33
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:446
Bool_t IsNull() const
Definition: TString.h:387
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".
Long64_t entry
TSelector * fSel
Definition: TEventIter.h:65
virtual ~TFileTree()
Default dtor.
Definition: TEventIter.cxx:675
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2240
#define gPerfStats
static TEventIter * Create(TDSet *dset, TSelector *sel, Long64_t first, Long64_t num)
Create and instance of the appropriate iterator.
Definition: TEventIter.cxx:151
virtual Long64_t GetBytesRead() const
Definition: TFile.h:201
TList * fFileTrees
Definition: TEventIter.h:163
int Ssiz_t
Definition: RtypesCore.h:63
int main(int argc, char *argv[])
Definition: python64.c:14
virtual Int_t GetSize() const
Definition: TCollection.h:95
double f(double x)
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Definition: TEventIter.cxx:862
double Double_t
Definition: RtypesCore.h:55
~TEventIterTree()
Destructor.
Definition: TEventIter.cxx:732
virtual EAbort GetAbort() const
Definition: TSelector.h:80
void PreProcessEvent(Long64_t)
To be executed before by TProofPlayer calling TSelector::Process.
Definition: TEventIter.cxx:546
Describe directory structure in memory.
Definition: TDirectory.h:41
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
const char * GetOrdinal() const
Definition: TProofServ.h:265
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition: TTimeStamp.h:76
TString fPath
Definition: TEventIter.h:59
TString fClassName
Definition: TEventIter.h:129
Long64_t fOldBytesRead
Definition: TEventIter.h:58
Int_t LoadDir()
Load directory.
Definition: TEventIter.cxx:165
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache .
Definition: TTree.cxx:7817
virtual void SetObject(TObject *obj)
Definition: TSelector.h:72
TTreeCache * fTreeCache
Definition: TEventIter.h:157
#define name(a, b)
Definition: linkTestLib0.cpp:5
TDirectory * fDir
Definition: TEventIter.h:60
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:556
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition: TKey.cxx:727
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:433
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:359
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:753
A TFriendElement TF describes a TTree object TF in a file.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
Bool_t fUseTreeCache
Definition: TEventIter.h:159
Int_t GetNextPacket(Long64_t &first, Long64_t &num)
Get loop range.
Definition: TEventIter.cxx:286
const char * GetType() const
Definition: TDSet.h:228
TEventList * fEventList
Definition: TEventIter.h:70
virtual Long64_t GetEntries() const
Definition: TTree.h:382
A TTree object has a header with a name and a title.
Definition: TTree.h:94
void ResetBit(UInt_t f)
Definition: TObject.h:172
void RestartComputeTime()
Reset the compute time.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:39
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 Int_t n
Definition: legend1.C:16
TDSet * fDSet
Definition: TEventIter.h:52
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
Definition: TTreeCache.cxx:969
TFileTree(const char *name, TFile *f, Bool_t islocal)
Default ctor.
Definition: TEventIter.cxx:666
const char * GetDirectory() const
Return directory where to look for object.
Definition: TDSet.cxx:256
virtual void Init(TTree *)
Definition: TSelector.h:61
T1 fFirst
Definition: X11Events.mm:85
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904