Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16Special iterator class used in TProofPlayer to iterate over events
17or 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 "TRegexp.h"
40#include "TProofServ.h"
41#include "TSystem.h"
42
43#include "TError.h"
44
45#if defined(R__MACOSX)
46#include "fcntl.h"
47#endif
48
50
51////////////////////////////////////////////////////////////////////////////////
52/// Default constructor
53
55{
56 fDSet = 0;
57 fElem = 0;
58 fFile = 0;
59 fDir = 0;
60 fSel = 0;
61 fFirst = 0;
62 fCur = -1;
63 fNum = 0;
64 fStop = kFALSE;
65 fOldBytesRead = 0;
66 fEventList = 0;
67 fEventListPos = 0;
68 fEntryList = 0;
69 fEntryListPos = 0;
70 fElemFirst = 0;
71 fElemNum = 0;
72 fElemCur = -1;
74
75 if ((fPackets = new TList)) {
76 TString n("ProcessedPackets_");
79 Info("TEventIter", "fPackets list '%s' created", n.Data());
80 } else {
81 Warning("TEventIter", "fPackets list could not be created");
82 }
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Constructor
87
89 : fDSet(dset), fSel(sel)
90{
91 fElem = 0;
92 fFile = 0;
93 fDir = 0;
94 fFirst = first;
95 fCur = -1;
96 fNum = num;
97 fStop = kFALSE;
98 fEventList = 0;
99 fEventListPos = 0;
100 fEntryList = 0;
101 fEntryListPos = 0;
102 fOldBytesRead = 0;
103 fElemFirst = 0;
104 fElemNum = 0;
105 fElemCur = -1;
107
108 if ((fPackets = new TList)) {
109 TString n("ProcessedPackets_");
112 Info("TEventIter", "fPackets list '%s' created", n.Data());
113 } else {
114 Warning("TEventIter", "fPackets list could not be created");
115 }
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// Destructor
120
122{
123 if (fPackets) {
126 }
127 delete fFile;
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit
132
134{
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Set flag to stop the process
140
142{
143 fStop = kTRUE;
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Create and instance of the appropriate iterator
148
150{
151 if (dset->TestBit(TDSet::kEmpty)) {
152 return new TEventIterUnit(dset, sel, num);
153 } else if (dset->IsTree()) {
154 return new TEventIterTree(dset, sel, first, num);
155 } else {
156 return new TEventIterObj(dset, sel, first, num);
157 }
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Load directory
162
164{
165 Int_t ret = 0;
166
167 // Check Filename
168 if ( fFile == 0 || fFilename != fElem->GetFileName() ) {
169 fDir = 0;
170 delete fFile; fFile = 0;
171
173
174 TDirectory *dirsave = gDirectory;
175
176 Double_t start = 0;
177 if (gPerfStats) start = TTimeStamp();
178
179 // Take into acoount possible prefixes
181 TString fname = gEnv->GetValue("Path.Localroot","");
182 if (!fname.IsNull())
183 typ = TFile::GetType(fFilename, "", &fname);
184 if (typ != TFile::kLocal)
185 fname = fFilename;
186 fFile = TFile::Open(fname);
187
188 if (gPerfStats) {
189 gPerfStats->FileOpenEvent(fFile, fFilename, start);
190 fOldBytesRead = 0;
191 }
192
193 if (dirsave) dirsave->cd();
194
195 if (!fFile || fFile->IsZombie() ) {
196 if (fFile)
197 Error("Process","Cannot open file: %s (%s)",
198 fFilename.Data(), strerror(fFile->GetErrno()) );
199 else
200 Error("Process","Cannot open file: %s (errno unavailable)",
201 fFilename.Data());
202 // cleanup ?
203 return -1;
204 }
205 PDB(kLoop,2) Info("LoadDir","Opening file: %s", fFilename.Data() );
206 ret = 1;
207 }
208
209 // Check Directory
210 if ( fDir == 0 || fPath != fElem->GetDirectory() ) {
211 TDirectory *dirsave = gDirectory;
212
214 if ( !fFile->cd(fPath) ) {
215 Error("Process","Cannot cd to: %s",
216 fPath.Data() );
217 return -1;
218 }
219 PDB(kLoop,2) Info("Process","Cd to: %s", fPath.Data() );
221 if (dirsave) dirsave->cd();
222 ret = 1;
223 }
224
225 return ret;
226}
227
228//______________________________________________________________________________
230{
231 // Get the entry number, taking into account event/entry lists
232
233 Long64_t entry = next;
234 // Set entry number; if data iteration we may need to test the entry or event lists
236 if (fEntryList){
237 entry = fEntryList->GetEntry(next);
238 } else if (fEventList) {
239 entry = fEventList->GetEntry(next);
240 }
241 }
242 // Pre-event processing
243 PreProcessEvent(entry);
244 // Done
245 return entry;
246}
247
248//------------------------------------------------------------------------
249
250
252
253////////////////////////////////////////////////////////////////////////////////
254/// Default constructor
255
257{
258 fDSet = 0;
259 fElem = 0;
260 fSel = 0;
261 fNum = 0;
262 fCurrent = 0;
263 fStop = kFALSE;
264 fOldBytesRead = 0; // Measures the bytes written
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Main constructor
269
271{
272 fDSet = dset;
273 fElem = 0;
274 fSel = sel;
275 fNum = num;
276 fCurrent = 0;
277 fStop = kFALSE;
278 fOldBytesRead = 0; // Measures the bytes written
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Get loop range
283
285{
286 if (gPerfStats) {
287 Long64_t totBytesWritten = TFile::GetFileBytesWritten();
288 Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
289 PDB(kLoop, 2) Info("GetNextPacket", "bytes written: %lld", bytesWritten);
290 gPerfStats->SetBytesRead(bytesWritten);
291 fOldBytesRead = totBytesWritten;
292 }
293
295 if (fElem) {
296 if (fPackets) {
298 PDB(kLoop, 2)
299 Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
300 fElem = 0;
301 } else {
303 }
304 return -1;
305 } else {
306 fElem = new TDSetElement("", "", "", 0, fNum);
308 }
309 } else {
310 if (fPackets && fElem) {
312 PDB(kLoop, 2)
313 Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
314 fElem = 0;
315 } else {
317 }
318 if (!(fElem = fDSet->Next()))
319 return -1;
320 }
322
324 Error("GetNextPacket", "data element must be set to kEmtpy");
325 return -1;
326 }
327
328 // Set output
329 num = fElem->GetNum();
330 if (num == 0) return -1;
331 fst = fElem->GetFirst();
332
333 // Done
334 return 0;
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Get next event
339
341{
342 if (fStop || fNum == 0)
343 return -1;
344
346
347 while (fElem == 0 || fCurrent == 0) {
348
349 if (gPerfStats) {
350 Long64_t totBytesWritten = TFile::GetFileBytesWritten();
351 Long64_t bytesWritten = totBytesWritten - fOldBytesRead;
352 PDB(kLoop, 2) Info("GetNextEvent", "bytes written: %lld", bytesWritten);
353 gPerfStats->SetBytesRead(bytesWritten);
354 fOldBytesRead = totBytesWritten;
355 }
356
358 if (fElem) {
359 if (fPackets) {
361 PDB(kLoop, 2)
362 Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
363 fElem = 0;
364 } else {
366 }
367 return -1;
368 } else {
369 fElem = new TDSetElement("", "", "", 0, fNum);
371 }
372 } else {
373 if (fPackets && fElem) {
375 PDB(kLoop, 2)
376 Info("GetNextEvent", "packet added to list (sz: %d)", fPackets->GetSize());
377 fElem = 0;
378 } else {
380 }
381 if (!(fElem = fDSet->Next()))
382 return -1;
383 }
385
387 Error("GetNextEvent", "data element must be set to kEmtpy");
388 return -1;
389 }
390
391 fNum = fElem->GetNum();
392 if (!(fCurrent = fNum)) {
393 fNum = 0;
394 return -1;
395 }
396 fFirst = fElem->GetFirst();
397 }
398 Long64_t event = fNum - fCurrent + fFirst ;
399 --fCurrent;
400 return event;
401}
402
403//------------------------------------------------------------------------
404
405
407
408////////////////////////////////////////////////////////////////////////////////
409/// Default ctor.
410
412{
413 fKeys = 0;
414 fNextKey = 0;
415 fObj = 0;
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Constructor
420
422 : TEventIter(dset,sel,first,num)
423{
424 fClassName = dset->GetType();
425 fKeys = 0;
426 fNextKey = 0;
427 fObj = 0;
428}
429
430
431////////////////////////////////////////////////////////////////////////////////
432/// Destructor
433
435{
436 // delete fKeys ?
437 delete fNextKey;
438 delete fObj;
439}
440
441////////////////////////////////////////////////////////////////////////////////
442/// Get loop range
443
445{
447
448 if (fStop || fNum == 0) return -1;
449
450 while (fElem == 0 || fCur < fFirst-1) {
451
452 if (gPerfStats && fFile) {
453 Long64_t bytesRead = fFile->GetBytesRead();
454 gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
455 fOldBytesRead = bytesRead;
456 }
457
458 if (fElem) {
459 // Save it to the list of processed packets
460 if (fPackets) {
462 fElem = 0;
463 } else {
465 }
466 }
468 if (fElem && fElem->GetEntryList()) {
469 Error("GetNextPacket", "entry- or event-list not available");
470 return -1;
471 }
472
473 if ( fElem == 0 ) {
474 fNum = 0;
475 return -1;
476 }
478
479 Int_t r = LoadDir();
480
481 if ( r == -1 ) {
482
483 // Error has been reported
484 fNum = 0;
485 return -1;
486
487 } else if ( r == 1 ) {
488
489 // New file and/or directory
491 fNextKey = new TIter(fKeys);
492 }
493
494 // Validate values for this element
496 fElemNum = fElem->GetNum();
497 if (fElem->GetEntryList()) {
498 if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
499 fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
500 }
501 fEventListPos = 0;
502 if (fEntryList)
504 else if (fEventList)
506
507 Long64_t tnum = fKeys->GetSize();
508
509 if ( fElemFirst > tnum ) {
510 Error("GetNextPacket","First (%lld) higher then number of keys (%lld) in %s",
511 fElemFirst, tnum, fElem->GetName());
512 fNum = 0;
513 return -1;
514 }
515
516 if ( fElemNum == -1 ) {
517 fElemNum = tnum - fElemFirst;
518 } else if ( fElemFirst+fElemNum > tnum ) {
519 Error("GetNextPacket","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
521 fElemNum = tnum - fElemFirst;
522 }
523
524 // Skip this element completely?
525 if ( fCur + fElemNum < fFirst ) {
526 fCur += fElemNum;
527 continue;
528 }
529
530 // Position within this element
531 fNextKey->Reset();
532 for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
533 }
534
535 first = ++fElemCur;
536 num = fElemNum;
537
538 // Done
539 return 0;
540}
541////////////////////////////////////////////////////////////////////////////////
542/// To be executed before by TProofPlayer calling TSelector::Process
543
545{
546 --fNum;
547 ++fCur;
548 TKey *key = (TKey*) fNextKey->Next();
549 TDirectory *dirsave = gDirectory;
550 fDir->cd();
551 fObj = key->ReadObj();
552 if (dirsave) dirsave->cd();
554}
555
556////////////////////////////////////////////////////////////////////////////////
557/// Get next event
558
560{
561 if (fStop || fNum == 0) return -1;
562
564
565 while ( fElem == 0 || fElemNum == 0 || fCur < fFirst-1 ) {
566
567 if (gPerfStats && fFile) {
568 Long64_t bytesRead = fFile->GetBytesRead();
569 gPerfStats->SetBytesRead(bytesRead - fOldBytesRead);
570 fOldBytesRead = bytesRead;
571 }
572
573 if (fElem) {
574 // Save it to the list of processed packets
575 if (fPackets) {
577 fElem = 0;
578 } else {
580 }
581 }
583 if (fElem && fElem->GetEntryList()) {
584 Error("GetNextEvent", "Entry- or event-list not available");
585 return -1;
586 }
587
588 if ( fElem == 0 ) {
589 fNum = 0;
590 return -1;
591 }
593
594 Int_t r = LoadDir();
595
596 if ( r == -1 ) {
597
598 // Error has been reported
599 fNum = 0;
600 return -1;
601
602 } else if ( r == 1 ) {
603
604 // New file and/or directory
606 fNextKey = new TIter(fKeys);
607 }
608
609 // Validate values for this element
611 fElemNum = fElem->GetNum();
612 if (fElem->GetEntryList()) {
613 if (!(fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList())))
614 fEventList = dynamic_cast<TEventList *>(fElem->GetEntryList());
615 }
616 fEventListPos = 0;
617 if (fEntryList)
619 else if (fEventList)
621
622 Long64_t num = fKeys->GetSize();
623
624 if ( fElemFirst > num ) {
625 Error("GetNextEvent","First (%lld) higher then number of keys (%lld) in %s",
626 fElemFirst, num, fElem->GetName());
627 fNum = 0;
628 return -1;
629 }
630
631 if ( fElemNum == -1 ) {
632 fElemNum = num - fElemFirst;
633 } else if ( fElemFirst+fElemNum > num ) {
634 Error("GetNextEvent","Num (%lld) + First (%lld) larger then number of keys (%lld) in %s",
636 fElemNum = num - fElemFirst;
637 }
638
639 // Skip this element completely?
640 if ( fCur + fElemNum < fFirst ) {
641 fCur += fElemNum;
642 continue;
643 }
644
645 // Position within this element. TODO: more efficient?
646 fNextKey->Reset();
647 for(fElemCur = -1; fElemCur < fElemFirst-1 ; fElemCur++, fNextKey->Next()) { }
648 }
649
650 --fElemNum;
651 ++fElemCur;
652
653 // Pre-event processing
655
656 return fElemCur;
657}
658
659//------------------------------------------------------------------------
660
661////////////////////////////////////////////////////////////////////////////////
662/// Default ctor.
663
665 : TNamed(name, ""), fUsed(kFALSE), fIsLocal(islocal), fFile(f)
666{
667 fTrees = new TList;
668 fTrees->SetOwner();
669}
670////////////////////////////////////////////////////////////////////////////////
671/// Default dtor.
672
674{
675 // Avoid destroying the cache; must be placed before deleting the trees
676 TTree *tree = (TTree *)fTrees->First();
677 while (tree) {
679 tree = (TTree *)fTrees->After(tree);
680 }
681 SafeDelete(fTrees);
683}
684
686
687////////////////////////////////////////////////////////////////////////////////
688/// Default ctor.
689
691{
692 fTree = 0;
693 fTreeCache = 0;
694 fUseTreeCache = 1;
695 fCacheSize = -1;
697 fFileTrees = 0;
701}
702
703////////////////////////////////////////////////////////////////////////////////
704/// Constructor
705
707 : TEventIter(dset,sel,first,num)
708{
709 fTreeName = dset->GetObjName();
710 fTree = 0;
711 fTreeCache = 0;
713 fFileTrees = new TList;
715 fUseTreeCache = gEnv->GetValue("ProofPlayer.UseTreeCache", 1);
716 fCacheSize = gEnv->GetValue("ProofPlayer.CacheSize", -1);
717 fUseParallelUnzip = gEnv->GetValue("ProofPlayer.UseParallelUnzip", 0);
718 if (fUseParallelUnzip) {
720 } else {
722 }
723 fDontCacheFiles = gEnv->GetValue("ProofPlayer.DontCacheFiles", 0);
725}
726
727////////////////////////////////////////////////////////////////////////////////
728/// Destructor
729
731{
732 // Delete the tree cache ...
734 // ... and the remaining open files
736}
737
738////////////////////////////////////////////////////////////////////////////////
739/// Return the size in bytes of the cache, if any
740/// Return -1 if not used
741
743{
744 if (fUseTreeCache) return fCacheSize;
745 return -1;
746}
747
748////////////////////////////////////////////////////////////////////////////////
749/// Return the number of entries in the learning phase
750
752{
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Create a Tree for the main TDSetElement and for all the friends.
758/// Returns the main tree or 0 in case of an error.
759
761{
762 // Reset used flags
763 TIter nxft(fFileTrees);
764 TFileTree *ft = 0;
765 while ((ft = (TFileTree *)nxft()))
766 ft->fUsed = kFALSE;
767
768 Bool_t localfile = kFALSE;
769 TTree* main = Load(elem, localfile);
770
771 if (main && main != fTree) {
772 // Set the file cache
773 if (fUseTreeCache) {
774 TFile *curfile = main->GetCurrentFile();
775 if (curfile) {
776 if (!fTreeCache) {
777 main->SetCacheSize(fCacheSize);
778 fTreeCache = (TTreeCache *)curfile->GetCacheRead(main);
779 if (fCacheSize < 0) fCacheSize = main->GetCacheSize();
780 } else {
782 curfile->SetCacheRead(fTreeCache, 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
861TTree* 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);
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 auto tree = key->ReadObject<TTree>();
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) {
1023 rest = fElem->GetNum();
1024 if (fElemCur >= 0) rest -= (fElemCur + 1 - fElemFirst);
1025 }
1026
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 {
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) {
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
1082 // The current tree, if any, is not valid anymore
1083 fTree = 0;
1084 }
1085 }
1086
1087 // Validate values for this element
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)
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) {
1151 } else if (fEventList){
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 {
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) {
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
1258 // The current tree, if any, is not valid anymore
1259 fTree = 0;
1260 }
1261 }
1262
1263 // Validate values for this element
1265 fElemNum = fElem->GetNum();
1266 fEntryList = dynamic_cast<TEntryList *>(fElem->GetEntryList());
1268 : dynamic_cast<TEventList *>(fElem->GetEntryList());
1270 fEventListPos = 0;
1271 if (fEntryList)
1273 else if (fEventList)
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}
int main()
Definition Prototype.cxx:12
#define SafeDelete(p)
Definition RConfig.hxx:525
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:124
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
#define gDirectory
Definition TDirectory.h:384
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition TGX11.cxx:110
#define PDB(mask, level)
Definition TProofDebug.h:56
R__EXTERN TProofServ * gProofServ
Definition TProofServ.h:347
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
#define gPerfStats
void SetName(const char *name)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Manages an element of a TDSet.
Definition TDSet.h:66
const char * GetObjName() const
Definition TDSet.h:120
Long64_t GetNum() const
Definition TDSet.h:114
@ kCorrupted
Definition TDSet.h:74
@ kNewPacket
Definition TDSet.h:76
TObject * GetEntryList() const
Definition TDSet.h:131
virtual TList * GetListOfFriends() const
Definition TDSet.h:108
const char * GetDirectory() const
Return directory where to look for object.
Definition TDSet.cxx:253
const char * GetFileName() const
Definition TDSet.h:111
Long64_t GetFirst() const
Definition TDSet.h:112
This class implements a data set to be used for PROOF processing.
Definition TDSet.h:153
virtual TDSetElement * Next(Long64_t totalEntries=-1)
Returns next TDSetElement.
Definition TDSet.cxx:413
Bool_t IsTree() const
Definition TDSet.h:225
const char * GetType() const
Definition TDSet.h:228
const char * GetObjName() const
Definition TDSet.h:229
@ kEmpty
Definition TDSet.h:159
@ kIsLocal
Definition TDSet.h:163
Bool_t cd() override
Change current directory to "this" directory.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TKey * GetKey(const char *, Short_t=9999) const
Definition TDirectory.h:221
virtual TList * GetListOfKeys() const
Definition TDirectory.h:223
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
static TClass * Class()
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,...
virtual Long64_t GetEntriesToProcess() const
Definition TEntryList.h:75
virtual Long64_t GetEntry(Long64_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:491
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
TEventIterObj()
Default ctor.
void PreProcessEvent(Long64_t) override
To be executed before by TProofPlayer calling TSelector::Process.
TList * fKeys
Definition TEventIter.h:126
TIter * fNextKey
Definition TEventIter.h:127
Long64_t GetNextEvent() override
Get next event.
TObject * fObj
Definition TEventIter.h:128
~TEventIterObj() override
Destructor.
TString fClassName
Definition TEventIter.h:125
TFileTree(const char *name, TFile *f, Bool_t islocal)
Default ctor.
~TFileTree() override
Default dtor.
Bool_t fUseTreeCache
Definition TEventIter.h:155
TString fTreeName
Definition TEventIter.h:151
Bool_t fDontCacheFiles
Definition TEventIter.h:158
TTreeCache * fTreeCache
Definition TEventIter.h:153
Long64_t fCacheSize
Definition TEventIter.h:156
void PreProcessEvent(Long64_t ent) override
Actions to be done just before processing entry 'entry'.
TList * fFileTrees
Definition TEventIter.h:159
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
~TEventIterTree() override
Destructor.
TEventIterTree()
Default ctor.
Long64_t GetNextEvent() override
Get next event.
TTree * Load(TDSetElement *elem, Bool_t &localfile, const char *objname=0)
Load a tree from s TDSetElement.
Bool_t fTreeCacheIsLearning
Definition TEventIter.h:154
Int_t GetLearnEntries() override
Return the number of entries in the learning phase.
Bool_t fUseParallelUnzip
Definition TEventIter.h:157
Long64_t GetCacheSize() override
Return the size in bytes of the cache, if any Return -1 if not used.
TTree * GetTrees(TDSetElement *elem)
Create a Tree for the main TDSetElement and for all the friends.
Long64_t fCurrent
Definition TEventIter.h:103
Long64_t fNum
Definition TEventIter.h:102
Long64_t GetNextEvent() override
Get next event.
TEventIterUnit()
Default constructor.
Int_t GetNextPacket(Long64_t &first, Long64_t &num) override
Get loop range.
Special iterator class used in TProofPlayer to iterate over events or objects in the packets.
Definition TEventIter.h:42
Long64_t fEntryListPos
entry list for processing
Definition TEventIter.h:69
virtual Long64_t GetEntryNumber(Long64_t)
Long64_t fCur
Definition TEventIter.h:64
TDSetElement * fElem
Definition TEventIter.h:50
Long64_t fNum
Definition TEventIter.h:63
TList * fPackets
current position in the entrylist
Definition TEventIter.h:71
TEventList * fEventList
Definition TEventIter.h:66
Long64_t fElemCur
Definition TEventIter.h:59
Long64_t fElemFirst
Definition TEventIter.h:57
TFile * fFile
Definition TEventIter.h:53
virtual void StopProcess(Bool_t abort)
Set flag to stop the process.
Long64_t fFirst
Definition TEventIter.h:62
Long64_t fOldBytesRead
Definition TEventIter.h:54
Int_t fEventListPos
eventList for processing
Definition TEventIter.h:67
static TEventIter * Create(TDSet *dset, TSelector *sel, Long64_t first, Long64_t num)
Create and instance of the appropriate iterator.
Bool_t fStop
Definition TEventIter.h:65
Int_t LoadDir()
Load directory.
TString fPath
Definition TEventIter.h:55
virtual void InvalidatePacket()
Invalidated the current packet (if any) by setting the TDSetElement::kCorrupted bit.
TString fFilename
Definition TEventIter.h:52
TDirectory * fDir
Definition TEventIter.h:56
TEntryList * fEntryList
current position in the eventList
Definition TEventIter.h:68
virtual void PreProcessEvent(Long64_t)
Definition TEventIter.h:74
TDSet * fDSet
Definition TEventIter.h:48
TEventIter()
Default constructor.
TSelector * fSel
Definition TEventIter.h:61
Long64_t fElemNum
Definition TEventIter.h:58
~TEventIter() override
Destructor.
A TEventList object is a list of selected events (entries) in a TTree.
Definition TEventList.h:31
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
virtual Int_t GetN() const
Definition TEventList.h:56
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=nullptr, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
Definition TFile.cxx:2351
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Definition TFile.cxx:4569
virtual Long64_t GetBytesRead() const
Definition TFile.h:241
virtual Int_t GetErrno() const
Method returning errno.
Definition TFile.cxx:1232
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=nullptr)
Resolve the file type as a function of the protocol field in 'name'.
Definition TFile.cxx:4807
EFileType
File type.
Definition TFile.h:202
@ kDefault
Definition TFile.h:202
@ kLocal
Definition TFile.h:202
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:4075
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
Definition TFile.cxx:1248
A TFriendElement TF describes a TTree object TF in a file.
virtual TTree * GetTree()
Return pointer to friend TTree.
TObject * Next()
void Reset()
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
T * ReadObject()
To read an object (non deriving from TObject) from the file.
Definition TKey.h:103
virtual const char * GetClassName() const
Definition TKey.h:75
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition TKey.cxx:758
A doubly linked list.
Definition TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:578
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:822
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:153
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
void ResetBit(UInt_t f)
Definition TObject.h:198
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
const char * GetOrdinal() const
Definition TProofServ.h:253
void RestartComputeTime()
Reset the compute time.
Regular expression class.
Definition TRegexp.h:31
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
virtual void SetObject(TObject *obj)
Definition TSelector.h:65
virtual EAbort GetAbort() const
Definition TSelector.h:73
Bool_t Notify() override
This method must be overridden to handle object notification (the base implementation is no-op).
Definition TSelector.h:56
@ kAbortProcess
Definition TSelector.h:34
virtual void Init(TTree *)
Definition TSelector.h:53
virtual TList * GetOutputList() const
Definition TSelector.h:69
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:421
const char * Data() const
Definition TString.h:380
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition TString.cxx:2242
Bool_t IsNull() const
Definition TString.h:418
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:2356
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:636
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:921
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition TTimeStamp.h:45
static Int_t SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option=TTreeCacheUnzip::kEnable)
Static function that (de)activates multithreading unzipping.
A cache to speed-up the reading of ROOT datasets.
Definition TTreeCache.h:32
virtual void UpdateBranches(TTree *tree)
Update pointer to current Tree and recompute pointers to the branches in the cache.
Bool_t IsLearning() const override
Definition TTreeCache.h:152
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 void ResetCache()
This will simply clear the cache.
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
A TTree represents a columnar dataset.
Definition TTree.h:79
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5476
virtual Long64_t GetEntries() const
Definition TTree.h:463
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition TTree.cxx:6470
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition TUrl.cxx:390
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
Definition TUrl.cxx:504
void SetOptions(const char *opt)
Definition TUrl.h:87
const char * GetOptions() const
Definition TUrl.h:71
const Int_t n
Definition legend1.C:16
Definition first.py:1
Definition tree.py:1