Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFileMerger.cxx
Go to the documentation of this file.
1// @(#)root/io:$Id$
2// Author: Andreas Peters + Fons Rademakers + Rene Brun 26/5/2005
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/**
13\class TFileMerger TFileMerger.cxx
14\ingroup IO
15
16This class provides file copy and merging services.
17
18It can be used to copy files (not only ROOT files), using TFile or
19any of its remote file access plugins. It is therefore useful in
20a Grid environment where the files might be accessible only remotely.
21The merging interface allows files containing histograms and trees
22to be merged, like the standalone hadd program.
23*/
24
25#include "TFileMerger.h"
26#include "TDirectory.h"
27#include "TError.h"
28#include "TUrl.h"
29#include "TFile.h"
30#include "TUUID.h"
31#include "TSystem.h"
32#include "TKey.h"
33#include "THashList.h"
34#include "TObjString.h"
35#include "TObjArray.h"
36#include "TClass.h"
37#include "TFileMergeInfo.h"
38#include "TClassRef.h"
39#include "TROOT.h"
40#include "TMemFile.h"
41#include "TVirtualMutex.h"
42
43#ifdef WIN32
44// For _getmaxstdio
45#include <cstdio>
46#else
47// For getrlimit
48#include <sys/time.h>
49#include <sys/resource.h>
50#endif
51
52#include <cstring>
53#include <map>
54
55
58TClassRef R__RNTuple_Class("ROOT::RNTuple");
59
60static const Int_t kCpProgress = BIT(14);
61static const Int_t kCintFileNumber = 100;
62////////////////////////////////////////////////////////////////////////////////
63/// Return the maximum number of allowed opened files minus some wiggle room
64/// for CINT or at least of the standard library (stdio).
65
67{
68 int maxfiles;
69#ifdef WIN32
71#else
74 maxfiles = filelimit.rlim_cur;
75 } else {
76 // We could not get the value from getrlimit, let's return a reasonable default.
77 maxfiles = 512;
78 }
79#endif
81 // Limit the maximum number of opened files to 128 to mitigate memory
82 // consumption issues that may arise during merges with many files.
83 // For further details see analysis at:
84 // https://github.com/root-project/root/issues/21660
85 return std::min(128, maxfiles - kCintFileNumber);
86 } else if (maxfiles > 5) {
87 return maxfiles - 5;
88 } else {
89 return maxfiles;
90 }
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Create file merger object.
95
97 : fMaxOpenedFiles( R__GetSystemMaxOpenedFiles() ),
98 fLocal(isLocal), fHistoOneGo(histoOneGo)
99{
102
104 gROOT->GetListOfCleanups()->Add(this);
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Cleanup.
109
111{
112 {
114 gROOT->GetListOfCleanups()->Remove(this);
115 }
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Reset merger file list.
121
129
130////////////////////////////////////////////////////////////////////////////////
131/// Closes output file
132
138
139////////////////////////////////////////////////////////////////////////////////
140/// Add file to file merger.
141
143{
144 if (fPrintLevel > 0) {
145 Printf("%s Source file %d: %s", fMsgPrefix.Data(), fFileList.GetEntries() + fExcessFiles.GetEntries() + 1, url);
146 }
147
148 TFile *newfile = nullptr;
150
151 if (fFileList.GetEntries() >= (fMaxOpenedFiles-1)) {
152
155
156 urlObj = new TObjString(url);
157 urlObj->SetBit(kCpProgress);
159 return kTRUE;
160 }
161
162 // We want gDirectory untouched by anything going on here
164
165 if (fLocal) {
166 TUUID uuid;
167 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
169 Error("AddFile", "cannot get a local copy of file %s", url);
170 return kFALSE;
171 }
172 newfile = TFile::Open(localcopy, "READ");
173 } else {
174 newfile = TFile::Open(url, "READ");
175 }
176
177 // Zombie files should also be skipped
178 if (newfile && newfile->IsZombie()) {
179 delete newfile;
180 newfile = nullptr;
181 }
182
183 if (!newfile) {
184 if (fLocal)
185 Error("AddFile", "cannot open local copy %s of URL %s",
186 localcopy.Data(), url);
187 else
188 Error("AddFile", "cannot open file %s", url);
189 return kFALSE;
190 } else {
191 if (fOutputFile && fOutputFile->GetCompressionSettings() != newfile->GetCompressionSettings())
193
194 newfile->SetBit(kCanDelete);
196
199
200 return kTRUE;
201 }
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Add the TFile to this file merger and *do not* give ownership of the TFile to this
206/// object.
207///
208/// Return kTRUE if the addition was successful.
209
214
215////////////////////////////////////////////////////////////////////////////////
216/// Add the TFile to this file merger and give ownership of the TFile to this
217/// object (unless kFALSE is returned).
218///
219/// Return kTRUE if the addition was successful.
220
225
226////////////////////////////////////////////////////////////////////////////////
227/// Add the TFile to this file merger and give ownership of the TFile to this
228/// object (unless kFALSE is returned).
229///
230/// Return kTRUE if the addition was successful.
231
233{
234 if (source == 0 || source->IsZombie()) {
235 return kFALSE;
236 }
237
238 if (fPrintLevel > 0) {
239 Printf("%s Source file %d: %s",fMsgPrefix.Data(),fFileList.GetEntries()+1,source->GetName());
240 }
241
242 TFile *newfile = 0;
244
245 // We want gDirectory untouched by anything going on here
247 if (fLocal && !source->InheritsFrom(TMemFile::Class())) {
248 TUUID uuid;
249 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
250 if (!source->Cp(localcopy, cpProgress)) {
251 Error("AddFile", "cannot get a local copy of file %s", source->GetName());
252 return kFALSE;
253 }
254 newfile = TFile::Open(localcopy, "READ");
255 // Zombie files should also be skipped
256 if (newfile && newfile->IsZombie()) {
257 delete newfile;
258 newfile = 0;
259 }
260 } else {
261 newfile = source;
262 }
263
264 if (!newfile) {
265 if (fLocal)
266 Error("AddFile", "cannot open local copy %s of URL %s",
267 localcopy.Data(), source->GetName());
268 else
269 Error("AddFile", "cannot open file %s", source->GetName());
270 return kFALSE;
271 } else {
272 if (fOutputFile && fOutputFile->GetCompressionSettings() != newfile->GetCompressionSettings()) fCompressionChange = kTRUE;
273
274 if (own || newfile != source) {
275 newfile->SetBit(kCanDelete);
276 } else {
277 newfile->ResetBit(kCanDelete);
278 }
280
281 TObjString *urlObj = new TObjString(source->GetName());
283
284 if (newfile != source && own) {
285 delete source;
286 }
287 return kTRUE;
288 }
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Open merger output file.
293
298
299////////////////////////////////////////////////////////////////////////////////
300/// Open merger output file.
301
303{
304 Bool_t res = OutputFile(outputfile,(force?"RECREATE":"CREATE"),1); // 1 is the same as the default from the TFile constructor.
307 return res;
308}
309
310////////////////////////////////////////////////////////////////////////////////
311/// Open merger output file.
312///
313/// The 'mode' parameter is passed to the TFile constructor as the option, it
314/// should be one of 'NEW','CREATE','RECREATE','UPDATE'
315/// 'UPDATE' is usually used in conjunction with IncrementalMerge.
316
318{
319 // We want gDirectory untouched by anything going on here
322 return OutputFile(std::unique_ptr<TFile>(outputFile));
323
324 Error("OutputFile", "cannot open the MERGER output file %s", fOutputFilename.Data());
325 return kFALSE;
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Set an output file opened externally by the users
330
332{
333 if (!outputfile || outputfile->IsZombie()) {
334 Error("OutputFile", "cannot open the MERGER output file %s", (outputfile) ? outputfile->GetName() : "");
335 return kFALSE;
336 }
337
338 if (!outputfile->IsWritable()) {
339 Error("OutputFile", "output file %s is not writable", outputfile->GetName());
340 return kFALSE;
341 }
342
344
346 fOutputFile = 0; // This avoids the complaint from RecursiveRemove about the file being deleted which is here
347 // spurrious. (see RecursiveRemove).
349
350 fOutputFilename = outputfile->GetName();
351 // We want gDirectory untouched by anything going on here
353 fOutputFile = outputfile.release(); // Transfer the ownership of the file.
354
355 return kTRUE;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Open merger output file. 'mode' is passed to the TFile constructor as the option, it should
360/// be one of 'NEW','CREATE','RECREATE','UPDATE'
361/// 'UPDATE' is usually used in conjunction with IncrementalMerge.
362
363Bool_t TFileMerger::OutputFile(const char *outputfile, const char *mode /* = "RECREATE" */)
364{
365 Bool_t res = OutputFile(outputfile,mode,1); // 1 is the same as the default from the TFile constructor.
367 return res;
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Print list of files being merged.
372
374{
375 fFileList.Print(options);
376 fExcessFiles.Print(options);
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Merge the files.
381///
382/// If no output file was specified it will write into
383/// the file "FileMerger.root" in the working directory. Returns true
384/// on success, false in case of error.
385
390
391namespace {
392
394{
395 return (cl->GetMerge() || cl->InheritsFrom(TDirectory::Class()) ||
396 (cl->IsTObject() && !cl->IsLoaded() &&
397 /* If it has a dictionary and GetMerge() is nullptr then we already know the answer
398 to the next question is 'no, if we were to ask we would useless trigger
399 auto-parsing */
400 (cl->GetMethodWithPrototype("Merge", "TCollection*,TFileMergeInfo*") ||
401 cl->GetMethodWithPrototype("Merge", "TCollection*"))));
402};
403
405{
406 Bool_t status = kTRUE;
407 if (cl->InheritsFrom(TCollection::Class())) {
408 // Don't overwrite, if the object were not merged.
409 if (obj->Write(name, canBeMerged ? TObject::kSingleKey | TObject::kOverwrite : TObject::kSingleKey) <= 0) {
410 status = kFALSE;
411 }
412 ((TCollection *)obj)->SetOwner();
413 if (ownobj)
414 delete obj;
415 } else {
416 // Don't overwrite, if the object were not merged.
417 // NOTE: this is probably wrong for emulated objects.
418 if (cl->IsTObject()) {
419 if (obj->Write(name, canBeMerged ? TObject::kOverwrite : 0) <= 0) {
420 status = kFALSE;
421 }
423 } else {
424 if (target->WriteObjectAny((void *)obj, cl, name, canBeMerged ? "OverWrite" : "") <= 0) {
425 status = kFALSE;
426 }
427 }
428 if (ownobj)
429 cl->Destructor(obj); // just in case the class is not loaded.
430 }
431 return status;
432}
433
435{
436 // Recurse until we find a different name or type appear.
437 TKey *key = (TKey*)peeknextkey();
438 if (!key || name != key->GetName()) {
439 return kTRUE;
440 }
442 if (IsMergeable(cl))
443 return kTRUE;
444 // Now we can advance the real iterator
445 (void)nextkey();
447 TObject *obj = key->ReadObj();
448
449 return WriteOneAndDelete(name, cl, obj, kFALSE, kTRUE, target) && result;
450};
451
452} // anonymous namespace
453
457 TObject *obj, TIter &nextkey)
458{
459 const char *keyname = obj ? obj->GetName() : key->GetName();
460 const char *keyclassname = obj ? obj->IsA()->GetName() : key->GetClassName();
461 const char *keytitle = obj ? obj->GetTitle() : key->GetTitle();
462
463 // Keep only the highest cycle number for each key for mergeable objects. They are stored
464 // in the (hash) list consecutively and in decreasing order of cycles, so we can continue
465 // until the name changes. We flag the case here and we act consequently later.
468
469 // Read in but do not copy directly the processIds.
470 if (strcmp(keyclassname, "TProcessID") == 0 && key) {
471 key->ReadObj();
472 return kTRUE;
473 }
474
475 // If we have already seen this object [name], we already processed
476 // the whole list of files for this objects and we can just skip it
477 // and any related cycles.
478 if (allNames.FindObject(keyname)) {
480 return kTRUE;
481 }
482
484 if (!cl) {
485 Info("MergeRecursive", "cannot indentify object type (%s), name: %s title: %s",
487 return kTRUE;
488 }
489 // For mergeable objects we add the names in a local hashlist handling them
490 // again (see above)
491 if (IsMergeable(cl))
492 allNames.Add(new TObjString(keyname));
493
495 // Skip the TTree objects and any related cycles.
497 return kTRUE;
498 }
499 // Check if only the listed objects are to be merged
500 if (type & kOnlyListed) {
502 oldkeyname += " ";
505 if ((!onlyListed) && (!cl->InheritsFrom(TDirectory::Class()))) return kTRUE;
506 }
507
508 if (!(type&kResetable && type&kNonResetable)) {
509 // If neither or both are requested at the same time, we merger both types.
510 if (!(type&kResetable)) {
511 if (cl->GetResetAfterMerge()) {
512 // Skip the object with a reset after merge routine (TTree and other incrementally mergeable objects)
514 return kTRUE;
515 }
516 }
517 if (!(type&kNonResetable)) {
518 if (!cl->GetResetAfterMerge()) {
519 // Skip the object without a reset after merge routine (Histograms and other non incrementally mergeable objects)
521 return kTRUE;
522 }
523 }
524 }
525 // read object from first source file
526 if (type & kIncremental) {
527 if (!obj)
528 obj = current_sourcedir->GetList()->FindObject(keyname);
529 if (!obj && key) {
530 obj = key->ReadObj();
531 ownobj = kTRUE;
532 } else if (obj && info.fIsFirst && current_sourcedir != target
533 && !cl->InheritsFrom( TDirectory::Class() )) {
534 R__ASSERT(cl->IsTObject());
536 obj = obj->Clone();
537 ownobj = kTRUE;
538 }
539 } else if (key) {
540 obj = key->ReadObj();
541 ownobj = kTRUE;
542 }
543 if (!obj) {
544 Info("MergeRecursive", "could not read object for key {%s, %s}",
546 return kTRUE;
547 }
548 Bool_t canBeFound = (type & kIncremental) && (target->GetList()->FindObject(keyname) != nullptr);
549
550 // if (cl->IsTObject())
551 // obj->ResetBit(kMustCleanup);
552 if (cl->IsTObject() && cl != obj->IsA()) {
553 Error("MergeRecursive", "TKey and object retrieve disagree on type (%s vs %s). Continuing with %s.",
554 keyclassname, obj->IsA()->GetName(), obj->IsA()->GetName());
555 cl = obj->IsA();
556 }
558
559 std::map<std::tuple<std::string, std::string, std::string>, TDirectory*> dirtodelete;
560 auto getDirectory = [&dirtodelete](TDirectory *parent, const char *name, const TString &pathname) {
561 auto mapkey = std::make_tuple(parent->GetName(), name, pathname.Data());
562 auto result = dirtodelete.find(mapkey);
563 if (result != dirtodelete.end()) {
564 return result->second;
565 }
566
567 auto dir = dynamic_cast<TDirectory *>(parent->GetDirectory(pathname));
568 if (dir)
569 dirtodelete[mapkey] = dir;
570
571 return dir;
572 };
573
574 if ( cl->InheritsFrom( TDirectory::Class() ) ) {
575 // it's a subdirectory
576
577 target->cd();
579
580 // For incremental or already seen we may have already a directory created
581 if (type & kIncremental || alreadyseen) {
582 newdir = target->GetDirectory(obj->GetName());
583 if (!newdir) {
584 newdir = target->mkdir( obj->GetName(), obj->GetTitle() );
585 // newdir->ResetBit(kMustCleanup);
586 }
587 } else {
588 newdir = target->mkdir( obj->GetName(), obj->GetTitle() );
589 // newdir->ResetBit(kMustCleanup);
590 }
591
592 // newdir is now the starting point of another round of merging
593 // newdir still knows its depth within the target file via
594 // GetPath(), so we can still figure out where we are in the recursion
595
596 // If this folder is a onlyListed object, merge everything inside.
597 const auto mergeType = onlyListed ? type & ~kOnlyListed : type;
599
600 if ((type & kOnlyListed) && !(type & kIncremental) && !onlyListed && newdir->GetNkeys() == 0) {
601 // None of the children were merged, and the directory is not listed
602 delete newdir;
603 newdir = nullptr;
604 target->rmdir(obj->GetName());
605 }
606 // Delete newdir directory after having written it (merged)
607 if (!(type&kIncremental)) delete newdir;
609 if (!status) return kFALSE;
610 } else if (!cl->IsTObject() && cl->GetMerge()) {
611 // merge objects that don't derive from TObject
613 Warning("MergeRecursive", "Merging RNTuples is experimental");
614
615 // Collect all the data to be passed on to the merger
617 // First entry is the TKey of the ntuple
618 mergeData.Add(key);
619 // Second entry is the output file
620 mergeData.Add(target->GetFile());
621 // Remaining entries are the input files
623 while (const auto &inFile = nextFile()) {
624 mergeData.Add(inFile);
625 }
626 // Get the merge fuction and pass the data
627 ROOT::MergeFunc_t func = cl->GetMerge();
628 Long64_t result = func(obj, &mergeData, &info);
629 mergeData.Clear("nodelete");
630 if (result < 0) {
631 Error("MergeRecursive", "Could NOT merge RNTuples!");
632 return kFALSE;
633 }
634 } else {
636 Error("MergeRecursive", "Merging objects that don't inherit from TObject is unimplemented (key: %s of type %s in file %s)",
637 keyname, keyclassname, nextsource->GetName());
639 }
640 } else if (cl->IsTObject() && cl->GetMerge()) {
641 // Check if already treated
642 if (alreadyseen) return kTRUE;
643
647
648 // Loop over all source files and merge same-name object
650 if (nextsource == 0) {
651 // There is only one file in the list
652 ROOT::MergeFunc_t func = cl->GetMerge();
653 func(obj, &inputs, &info);
654 info.fIsFirst = kFALSE;
655 } else {
656 do {
657 // make sure we are at the correct directory level by cd'ing to path
658 TDirectory *ndir = getDirectory(nextsource, target->GetName(), path);
659 if (ndir) {
660 // For consistency (and persformance), we reset the MustCleanup be also for those
661 // 'key' retrieved indirectly.
662 // ndir->ResetBit(kMustCleanup);
663 ndir->cd();
664 TObject *hobj = ndir->GetList()->FindObject(keyname);
665 if (!hobj) {
666 TKey *key2 = (TKey*)ndir->GetListOfKeys()->FindObject(keyname);
667 if (key2) {
668 hobj = key2->ReadObj();
669 if (!hobj) {
670 switch (fErrBehavior) {
672 Error("MergeRecursive", "could not read object for key {%s, %s}; in file %s", keyname,
673 keytitle, nextsource->GetName());
675 return kFALSE;
677 Warning("MergeRecursive", "could not read object for key {%s, %s}; skipping file %s",
678 keyname, keytitle, nextsource->GetName());
680 return kTRUE;
681 }
682 }
683 todelete.Add(hobj);
684 }
685 }
686 if (hobj) {
687 // Set ownership for collections
688 if (hobj->InheritsFrom(TCollection::Class())) {
689 ((TCollection*)hobj)->SetOwner();
690 }
691 hobj->ResetBit(kMustCleanup);
692 inputs.Add(hobj);
693 if (!oneGo) {
694 ROOT::MergeFunc_t func = cl->GetMerge();
695 Long64_t result = func(obj, &inputs, &info);
696 info.fIsFirst = kFALSE;
697 if (result < 0) {
698 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
699 keyname, nextsource->GetName());
700 }
701 inputs.Clear();
702 todelete.Delete();
703 }
704 }
705 }
707 } while (nextsource);
708 // Merge the list, if still to be done
709 if (oneGo || info.fIsFirst) {
710 ROOT::MergeFunc_t func = cl->GetMerge();
711 func(obj, &inputs, &info);
712 info.fIsFirst = kFALSE;
713 inputs.Clear();
714 todelete.Delete();
715 }
716 }
717 } else if (cl->IsTObject()) {
718 // try synthesizing the Merge method call according to the TObject
719 TList listH;
721 if (cl->GetMethodWithPrototype("Merge", "TCollection*,TFileMergeInfo*")) {
722 listHargs.Form("(TCollection*)0x%zx,(TFileMergeInfo*)0x%zx",
723 (size_t)&listH, (size_t)&info);
724 } else if (cl->GetMethodWithPrototype("Merge", "TCollection*")) {
725 listHargs.Form("((TCollection*)0x%zx)", (size_t)&listH);
726 } else {
727 // pass unmergeable objects through to the output file
729 }
730 if (canBeMerged) {
731 if (alreadyseen) {
732 // skip already seen mergeable objects, don't skip unmergeable objects
733 return kTRUE;
734 }
735 // Loop over all source files and merge same-name object
737 if (nextsource == 0) {
738 // There is only one file in the list
739 Int_t error = 0;
740 obj->Execute("Merge", listHargs.Data(), &error);
741 info.fIsFirst = kFALSE;
742 if (error) {
743 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
744 obj->GetName(), keyname);
745 }
746 } else {
747 while (nextsource) {
748 // make sure we are at the correct directory level by cd'ing to path
749 TDirectory *ndir = getDirectory(nextsource, target->GetName(), path);
750 if (ndir) {
751 ndir->cd();
752 TKey *key2 = (TKey*)ndir->GetListOfKeys()->FindObject(keyname);
753 if (key2) {
754 TObject *hobj = key2->ReadObj();
755 if (!hobj) {
756 switch (fErrBehavior) {
758 Error("MergeRecursive", "could not read object for key {%s, %s}; in file %s", keyname,
759 keytitle, nextsource->GetName());
761 return kFALSE;
763 Warning("MergeRecursive", "could not read object for key {%s, %s}; skipping file %s",
764 keyname, keytitle, nextsource->GetName());
766 return kTRUE;
767 }
768 }
769 // Set ownership for collections
770 if (hobj->InheritsFrom(TCollection::Class())) {
771 ((TCollection*)hobj)->SetOwner();
772 }
773 hobj->ResetBit(kMustCleanup);
774 listH.Add(hobj);
775 Int_t error = 0;
776 obj->Execute("Merge", listHargs.Data(), &error);
777 info.fIsFirst = kFALSE;
778 if (error) {
779 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
780 obj->GetName(), nextsource->GetName());
781 }
782 listH.Delete();
783 }
784 }
786 }
787 // Merge the list, if still to be done
788 if (info.fIsFirst) {
789 Int_t error = 0;
790 obj->Execute("Merge", listHargs.Data(), &error);
791 info.fIsFirst = kFALSE;
792 listH.Delete();
793 }
794 }
795 }
796 } else {
797 // Object is of no type that we can merge
799 }
800
801 // now write the merged histogram (which is "in" obj) to the target file
802 // note that this will just store obj in the current directory level,
803 // which is not persistent until the complete directory itself is stored
804 // by "target->SaveSelf()" below
805 target->cd();
806
808 //!!if the object is a tree, it is stored in globChain...
809 if (cl->InheritsFrom(TDirectory::Class())) {
810 // printf("cas d'une directory\n");
811
812 auto dirobj = dynamic_cast<TDirectory *>(obj);
813 TString dirpath(dirobj->GetPath());
814 // coverity[unchecked_value] 'target' is from a file so GetPath always returns path starting with filename:
815 dirpath.Remove(0, std::strlen(dirobj->GetFile()->GetPath()));
816
817 // Do not delete the directory if it is part of the output
818 // and we are in incremental mode (because it will be reused
819 // and has not been written to disk (for performance reason).
820 // coverity[var_deref_model] the IsA()->InheritsFrom guarantees that the dynamic_cast will succeed.
821 if (ownobj && (!(type & kIncremental) || dirobj->GetFile() != target)) {
822 dirobj->ResetBit(kMustCleanup);
823 delete dirobj;
824 }
825 // Let's also delete the directory from the other source (thanks to the 'allNames'
826 // mechanism above we will not process the directories when tranversing the next
827 // files).
828 for (const auto &[_, ndir] : dirtodelete) {
829 // For consistency (and performance), we reset the MustCleanup be also for those
830 // 'key' retrieved indirectly.
831 ndir->ResetBit(kMustCleanup);
832 delete ndir;
833 }
834 } else if (!canBeFound) { // object (TTree, TH1) is not yet owned by the target, thus write it
835 if (gDebug > 0)
836 Info("MergeOne", "Writing partial result of %s into target", oldkeyname.Data());
837 if (!canBeMerged) {
840 status = WriteOneAndDelete(oldkeyname, cl, obj, kFALSE, ownobj, target) && status;
841 } else {
842 status = WriteOneAndDelete(oldkeyname, cl, obj, kTRUE, ownobj, target) && status;
843 }
844 }
845 info.Reset();
846 return kTRUE;
847}
848
849////////////////////////////////////////////////////////////////////////////////
850/// Merge all objects in a directory
851///
852/// The type is defined by the bit values in TFileMerger::EPartialMergeType.
853
855{
856 Bool_t status = kTRUE;
858 if (fPrintLevel > 0) {
859 Printf("%s Target path: %s",fMsgPrefix.Data(),target->GetPath());
860 }
861
862 // Get the dir name
863 TString path(target->GetPath());
864 // coverity[unchecked_value] 'target' is from a file so GetPath always returns path starting with filename:
865 path.Remove(0, std::strlen(target->GetFile()->GetPath()));
866
867 Int_t nguess = sourcelist->GetSize()+1000;
869 allNames.SetOwner(kTRUE);
870 // If the mode is set to skipping list objects, add names to the allNames list
871 if (type & kSkipListed) {
873 arr->SetOwner(kFALSE);
874 for (Int_t iname=0; iname<arr->GetEntriesFast(); iname++)
875 allNames.Add(arr->At(iname));
876 delete arr;
877 }
878 ((THashList*)target->GetList())->Rehash(nguess);
879 ((THashList*)target->GetListOfKeys())->Rehash(nguess);
880
882 info.fIOFeatures = fIOFeatures;
883 info.fOptions = fMergeOptions;
885 info.fOptions.Append(" fast");
886 }
887
890 if (type & kIncremental) {
891 current_file = 0;
893 } else {
894 current_file = (TFile*)sourcelist->First();
895 current_sourcedir = current_file->GetDirectory(path);
896 }
898 // When current_sourcedir != 0 and current_file == 0 we are going over the target
899 // for an incremental merge.
902
903 // Loop over live objects
904 TIter nextobj( current_sourcedir->GetList() );
905 TObject *obj;
906 while ( (obj = (TKey*)nextobj())) {
908 info, oldkeyname, allNames, status, onlyListed, path,
910 nullptr, obj, nextobj);
911 if (!result)
912 return kFALSE; // Stop completely in case of error.
913 } // while ( (obj = (TKey*)nextobj()))
914
915 // loop over all keys in this directory
916 TIter nextkey( current_sourcedir->GetListOfKeys() );
917 TKey *key;
918
919 while ( (key = (TKey*)nextkey())) {
921 info, oldkeyname, allNames, status, onlyListed, path,
923 key, nullptr, nextkey);
924 if (!result)
925 return kFALSE; // Stop completely in case of error.
926 } // while ( ( TKey *key = (TKey*)nextkey() ) )
927 }
929 if (current_file) {
930 current_sourcedir = current_file->GetDirectory(path);
931 } else {
933 }
934 }
935 // save modifications to the target directory.
936 if (!(type&kIncremental)) {
937 // In case of incremental build, we will call Write on the top directory/file, so we do not need
938 // to call SaveSelf explicilty.
939 target->SaveSelf(kTRUE);
940 }
941
942 return status;
943}
944
945////////////////////////////////////////////////////////////////////////////////
946/// Merge the files. If no output file was specified it will write into
947/// the file "FileMerger.root" in the working directory. Returns true
948/// on success, false in case of error.
949/// The type is defined by the bit values in EPartialMergeType:
950///
951/// kRegular : normal merge, overwriting the output file
952/// kIncremental : merge the input file with the content of the output file (if already exising) (default)
953/// kResetable : merge only the objects with a MergeAfterReset member function.
954/// kNonResetable : merge only the objects without a MergeAfterReset member function.
955/// kDelayWrite : delay the TFile write (to reduce the number of write when reusing the file)
956/// kAll : merge all type of objects (default)
957/// kAllIncremental : merge incrementally all type of objects.
958/// kOnlyListed : merge only the objects specified in fObjectNames list
959/// kSkipListed : skip objects specified in fObjectNames list
960/// kKeepCompression: keep compression level unchanged for each input
961///
962/// If the type is not set to kIncremental, the output file is deleted at the end of this operation.
963
965{
966 if (!fOutputFile) {
968 if (outf.IsNull()) {
969 outf.Form("file:%s/FileMerger.root", gSystem->TempDirectory());
970 Info("PartialMerge", "will merge the results to the file %s\n"
971 "since you didn't specify a merge filename",
972 TUrl(outf).GetFile());
973 }
974 if (!OutputFile(outf.Data())) {
975 return kFALSE;
976 }
977 }
978
979 // Special treatment for the single file case to improve efficiency...
980 if ((fFileList.GetEntries() == 1) && !fExcessFiles.GetEntries() &&
984
985 TFile *file = (TFile *) fFileList.First();
986 if (!file || (file && file->IsZombie())) {
987 Error("PartialMerge", "one-file case: problem attaching to file");
988 return kFALSE;
989 }
991 if (!(result = file->Cp(fOutputFilename))) {
992 Error("PartialMerge", "one-file case: could not copy '%s' to '%s'",
993 file->GetPath(), fOutputFilename.Data());
994 return kFALSE;
995 }
996 if (file->TestBit(kCanDelete)) file->Close();
997
998 // Remove the temporary file
999 if (fLocal && !file->InheritsFrom(TMemFile::Class())) {
1000 TUrl u(file->GetPath(), kTRUE);
1001 if (gSystem->Unlink(u.GetFile()) != 0)
1002 Warning("PartialMerge", "problems removing temporary local file '%s'", u.GetFile());
1003 }
1004 fFileList.Clear();
1005 return result;
1006 }
1007
1010
1012
1014 Int_t type = in_type;
1015 while (result && fFileList.GetEntries()>0) {
1017
1018 // Remove local copies if there are any
1019 TIter next(&fFileList);
1020 TFile *file;
1021 while ((file = (TFile*) next())) {
1022 // close the files
1023 if (file->TestBit(kCanDelete)) file->Close();
1024 // remove the temporary files
1025 if(fLocal && !file->InheritsFrom(TMemFile::Class())) {
1026 TString p(file->GetPath());
1027 // coverity[unchecked_value] Index is return a value with range or NPos to select the whole name.
1028 p = p(0, p.Index(':',0));
1029 gSystem->Unlink(p);
1030 }
1031 }
1032 fFileList.Clear();
1033 if (result && fExcessFiles.GetEntries() > 0) {
1034 // We merge the first set of files in the output,
1035 // we now need to open the next set and make
1036 // sure we accumulate into the output, so we
1037 // switch to incremental merging (if not already set)
1040 }
1041 }
1042 if (!result) {
1043 Error("Merge", "error during merge of your ROOT files");
1044 } else {
1045 // Close or write is required so the file is complete.
1046 if (in_type & kIncremental) {
1047 // In the case of 'kDelayWrite' the caller want to avoid having to
1048 // write the output objects once for every input file and instead
1049 // write it only once at the end of the process.
1050 if (!(in_type & kDelayWrite))
1052 } else {
1053 // If in_type is not incremental but type is incremental we are now in
1054 // the case where the user "explicitly" request a non-incremental merge
1055 // but we still have internally an incremental merge. Because the user
1056 // did not request the incremental merge they also probably do not to a
1057 // final Write of the file and thus not doing the write here would lead
1058 // to data loss ...
1059 if (type & kIncremental)
1061 gROOT->GetListOfFiles()->Remove(fOutputFile);
1062 fOutputFile->Close();
1063 }
1064 }
1065
1066 // Cleanup
1067 if (in_type & kIncremental) {
1068 Clear();
1069 } else {
1073 }
1074 return result;
1075}
1076
1077////////////////////////////////////////////////////////////////////////////////
1078/// Open up to (fMaxOpenedFiles-1) of the excess files.
1079
1081{
1082 if (fPrintLevel > 0) {
1083 Printf("%s Opening the next %d files", fMsgPrefix.Data(), std::min(fExcessFiles.GetEntries(), fMaxOpenedFiles - 1));
1084 }
1085 Int_t nfiles = 0;
1086 TIter next(&fExcessFiles);
1087 TObjString *url = 0;
1089 // We want gDirectory untouched by anything going on here
1091 while( nfiles < (fMaxOpenedFiles-1) && ( url = (TObjString*)next() ) ) {
1092 TFile *newfile = 0;
1093 if (fLocal) {
1094 TUUID uuid;
1095 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
1096 if (!TFile::Cp(url->GetName(), localcopy, url->TestBit(kCpProgress))) {
1097 Error("OpenExcessFiles", "cannot get a local copy of file %s", url->GetName());
1098 return kFALSE;
1099 }
1100 newfile = TFile::Open(localcopy, "READ");
1101 } else {
1102 newfile = TFile::Open(url->GetName(), "READ");
1103 }
1104
1105 if (!newfile) {
1106 if (fLocal)
1107 Error("OpenExcessFiles", "cannot open local copy %s of URL %s",
1108 localcopy.Data(), url->GetName());
1109 else
1110 Error("OpenExcessFiles", "cannot open file %s", url->GetName());
1111 return kFALSE;
1112 } else {
1113 if (fOutputFile && fOutputFile->GetCompressionLevel() != newfile->GetCompressionLevel()) fCompressionChange = kTRUE;
1114
1115 newfile->SetBit(kCanDelete);
1117 ++nfiles;
1119 }
1120 }
1121 return kTRUE;
1122}
1123
1124////////////////////////////////////////////////////////////////////////////////
1125/// Intercept the case where the output TFile is deleted!
1126
1128{
1130 Fatal("RecursiveRemove","Output file of the TFile Merger (targeting %s) has been deleted (likely due to a TTree larger than 100Gb)", fOutputFilename.Data());
1131 }
1132
1133}
1134
1135////////////////////////////////////////////////////////////////////////////////
1136/// Set a limit to the number of files that TFileMerger will open simultaneously.
1137///
1138/// This number includes both the read input files and the output file.
1139/// \param newmax if higher than the system limit, we reset it to the system limit;
1140/// if less than two, we reset it to 2 (one for the output file and one for the input file).
1141
1143{
1145 if (newmax < sysmax) {
1147 } else {
1149 }
1150 if (fMaxOpenedFiles < 2) {
1151 fMaxOpenedFiles = 2;
1152 }
1153}
1154
1155////////////////////////////////////////////////////////////////////////////////
1156/// Set the prefix to be used when printing informational message.
1157
1158void TFileMerger::SetMsgPrefix(const char *prefix)
1159{
1160 fMsgPrefix = prefix;
1161}
1162
#define SafeDelete(p)
Definition RConfig.hxx:533
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
TClassRef R__TH1_Class("TH1")
static Int_t R__GetSystemMaxOpenedFiles()
Return the maximum number of allowed opened files minus some wiggle room for CINT or at least of the ...
TClassRef R__RNTuple_Class("ROOT::RNTuple")
TClassRef R__TTree_Class("TTree")
static const Int_t kCpProgress
static const Int_t kCintFileNumber
winID h TVirtualViewer3D TVirtualGLPainter p
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 Atom_t target
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 result
Option_t Option_t TPoint TPoint const char mode
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 Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
@ kMustCleanup
Definition TObject.h:371
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:627
R__EXTERN TVirtualMutex * gROOTMutex
Definition TROOT.h:63
#define gROOT
Definition TROOT.h:411
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2509
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define R__LOCKGUARD(mutex)
#define _(A, B)
Definition cfortran.h:108
const_iterator end() const
TClassRef is used to implement a permanent reference to a TClass object.
Definition TClassRef.h:29
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
Definition TClass.cxx:4483
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition TClass.cxx:5439
ROOT::ResetAfterMergeFunc_t GetResetAfterMerge() const
Return the wrapper around Merge.
Definition TClass.cxx:7544
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Definition TClass.cxx:5954
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5980
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4901
ROOT::MergeFunc_t GetMerge() const
Return the wrapper around Merge.
Definition TClass.cxx:7536
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2973
Collection abstract base class.
Definition TCollection.h:65
static TClass * Class()
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
TDirectory::TContext keeps track and restore the current directory.
Definition TDirectory.h:89
Describe directory structure in memory.
Definition TDirectory.h:45
static TClass * Class()
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual const char * GetPath() const
Returns the full path of the directory.
TString fObjectNames
List of object names to be either merged exclusively or skipped.
Definition TFileMerger.h:63
virtual Bool_t OutputFile(const char *url, Bool_t force)
Open merger output file.
TList fMergeList
list of TObjString containing the name of the files need to be merged
Definition TFileMerger.h:64
virtual Bool_t AddFile(TFile *source, Bool_t own, Bool_t cpProgress)
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is re...
virtual void PrintFiles(Option_t *options)
Print list of files being merged.
Bool_t fHistoOneGo
Merger histos in one go (default is kTRUE)
Definition TFileMerger.h:62
virtual Bool_t MergeRecursive(TDirectory *target, TList *sourcelist, Int_t type=kRegular|kAll)
Merge all objects in a directory.
void RecursiveRemove(TObject *obj) override
Intercept the case where the output TFile is deleted!
TList fFileList
A list the file (TFile*) which shall be merged.
Definition TFileMerger.h:47
virtual Bool_t Merge(Bool_t=kTRUE)
Merge the files.
virtual Bool_t MergeOne(TDirectory *target, TList *sourcelist, Int_t type, TFileMergeInfo &info, TString &oldkeyname, THashList &allNames, Bool_t &status, Bool_t &onlyListed, const TString &path, TDirectory *current_sourcedir, TFile *current_file, TKey *key, TObject *obj, TIter &nextkey)
TString fOutputFilename
The name of the outputfile for merging.
Definition TFileMerger.h:49
TString fMsgPrefix
Prefix to be used when printing informational message (default TFileMerger)
Definition TFileMerger.h:57
TIOFeatures * fIOFeatures
IO features to use in the output file.
Definition TFileMerger.h:56
TFileMerger(const TFileMerger &)=delete
void SetMsgPrefix(const char *prefix)
Set the prefix to be used when printing informational message.
Bool_t fNoTrees
True if Trees should not be merged (default is kFALSE)
Definition TFileMerger.h:51
bool fOutFileWasExplicitlyClosed
! the user has called CloseOutputFile(), so we shouldn't error out in RecursiveRemove
Definition TFileMerger.h:67
@ kAll
Merge all type of objects (default)
Definition TFileMerger.h:87
@ kIncremental
Merge the input file with the content of the output file (if already existing).
Definition TFileMerger.h:82
@ kKeepCompression
Keep compression level unchanged for each input files.
Definition TFileMerger.h:92
@ kSkipListed
Skip objects specified in fObjectNames list.
Definition TFileMerger.h:91
@ kNonResetable
Only the objects without a MergeAfterReset member function.
Definition TFileMerger.h:84
@ kResetable
Only the objects with a MergeAfterReset member function.
Definition TFileMerger.h:83
@ kOnlyListed
Only the objects specified in fObjectNames list.
Definition TFileMerger.h:90
@ kRegular
Normal merge, overwriting the output file.
Definition TFileMerger.h:81
@ kDelayWrite
Delay the TFile write (to reduce the number of write when reusing the file)
Definition TFileMerger.h:85
Bool_t fExplicitCompLevel
True if the user explicitly requested a compression level change (default kFALSE)
Definition TFileMerger.h:52
Bool_t fCompressionChange
True if the output and input have different compression level (default kFALSE)
Definition TFileMerger.h:53
EErrorBehavior fErrBehavior
What to do in case of errors during merging.
Definition TFileMerger.h:58
Int_t fPrintLevel
How much information to print out at run time.
Definition TFileMerger.h:54
void SetMaxOpenedFiles(Int_t newmax)
Set a limit to the number of files that TFileMerger will open simultaneously.
TString fMergeOptions
Options (in string format) to be passed down to the Merge functions.
Definition TFileMerger.h:55
void CloseOutputFile()
Closes output file.
~TFileMerger() override
Cleanup.
@ kFailOnError
The merging process will stop and yield failure when encountering invalid objects.
@ kSkipOnError
The merging process will skip invalid objects and continue.
Bool_t OpenExcessFiles()
Open up to (fMaxOpenedFiles-1) of the excess files.
TList fExcessFiles
! List of TObjString containing the name of the files not yet added to fFileList due to user or syste...
Definition TFileMerger.h:65
TFile * fOutputFile
The outputfile for merging.
Definition TFileMerger.h:48
virtual Bool_t PartialMerge(Int_t type=kAll|kIncremental)
Merge the files.
Bool_t fLocal
Makes local copies of merging files if True (default is kTRUE)
Definition TFileMerger.h:61
virtual void Reset()
Reset merger file list.
Int_t fMaxOpenedFiles
Maximum number of files opened at the same time by the TFileMerger.
Definition TFileMerger.h:60
virtual Bool_t AddAdoptFile(TFile *source, Bool_t cpProgress=kTRUE)
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is re...
Bool_t fFastMethod
True if using Fast merging algorithm (default)
Definition TFileMerger.h:50
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
Int_t GetCompressionSettings() const
Definition TFile.h:479
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t bufsize=1000000)
Allows to copy this file to the dst URL.
Definition TFile.cxx:4708
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file.
Definition TFile.cxx:2488
Int_t GetCompressionLevel() const
Definition TFile.h:473
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:3786
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:980
@ kCancelTTreeChangeRequest
Definition TFile.h:275
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
const char * GetTitle() const override
Returns title (title can contain 32x32 xpm thumbnail/icon).
Definition TKey.cxx:1556
virtual const char * GetClassName() const
Definition TKey.h:75
virtual TObject * ReadObj()
To read a TObject* from the file.
Definition TKey.cxx:761
A doubly linked list.
Definition TList.h:38
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:399
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:819
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:656
static TClass * Class()
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
An array of TObjects.
Definition TObjArray.h:31
Collectable string class.
Definition TObjString.h:28
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Clear(Option_t *="")
Definition TObject.h:125
@ kOverwrite
overwrite existing object with same name
Definition TObject.h:98
@ kSingleKey
write collection with single key
Definition TObject.h:97
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:457
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition TObject.cxx:242
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
virtual void Execute(const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g.
Definition TObject.cxx:377
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:159
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition TObject.cxx:964
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1099
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:501
virtual TClass * IsA() const
Definition TObject.h:246
void ResetBit(UInt_t f)
Definition TObject.h:201
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:68
@ kMustCleanup
if object destructor must call RecursiveRemove()
Definition TObject.h:70
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:1045
Basic string class.
Definition TString.h:138
void Clear()
Clear string without changing its capacity.
Definition TString.cxx:1241
const char * Data() const
Definition TString.h:384
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition TString.cxx:2270
TString & Remove(Ssiz_t pos)
Definition TString.h:694
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:641
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1392
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1493
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
Definition TUUID.h:42
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
Definition TUUID.cxx:570
This class represents a WWW compatible URL.
Definition TUrl.h:33
Long64_t(* MergeFunc_t)(void *, TCollection *, TFileMergeInfo *)
Definition Rtypes.h:121