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
56
59TClassRef R__RNTuple_Class("ROOT::RNTuple");
60
61static const Int_t kCpProgress = BIT(14);
62static const Int_t kCintFileNumber = 100;
63////////////////////////////////////////////////////////////////////////////////
64/// Return the maximum number of allowed opened files minus some wiggle room
65/// for CINT or at least of the standard library (stdio).
66
68{
69 int maxfiles;
70#ifdef WIN32
72#else
75 maxfiles = filelimit.rlim_cur;
76 } else {
77 // We could not get the value from getrlimit, let's return a reasonable default.
78 maxfiles = 512;
79 }
80#endif
83 } else if (maxfiles > 5) {
84 return maxfiles - 5;
85 } else {
86 return maxfiles;
87 }
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Create file merger object.
92
94 : fMaxOpenedFiles( R__GetSystemMaxOpenedFiles() ),
95 fLocal(isLocal), fHistoOneGo(histoOneGo)
96{
99
101 gROOT->GetListOfCleanups()->Add(this);
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Cleanup.
106
108{
109 {
111 gROOT->GetListOfCleanups()->Remove(this);
112 }
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Reset merger file list.
118
126
127////////////////////////////////////////////////////////////////////////////////
128/// Closes output file
129
135
136////////////////////////////////////////////////////////////////////////////////
137/// Add file to file merger.
138
140{
141 if (fPrintLevel > 0) {
142 Printf("%s Source file %d: %s", fMsgPrefix.Data(), fFileList.GetEntries() + fExcessFiles.GetEntries() + 1, url);
143 }
144
145 TFile *newfile = nullptr;
147
148 if (fFileList.GetEntries() >= (fMaxOpenedFiles-1)) {
149
152
153 urlObj = new TObjString(url);
154 urlObj->SetBit(kCpProgress);
156 return kTRUE;
157 }
158
159 // We want gDirectory untouched by anything going on here
161
162 if (fLocal) {
163 TUUID uuid;
164 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
166 Error("AddFile", "cannot get a local copy of file %s", url);
167 return kFALSE;
168 }
169 newfile = TFile::Open(localcopy, "READ");
170 } else {
171 newfile = TFile::Open(url, "READ");
172 }
173
174 // Zombie files should also be skipped
175 if (newfile && newfile->IsZombie()) {
176 delete newfile;
177 newfile = nullptr;
178 }
179
180 if (!newfile) {
181 if (fLocal)
182 Error("AddFile", "cannot open local copy %s of URL %s",
183 localcopy.Data(), url);
184 else
185 Error("AddFile", "cannot open file %s", url);
186 return kFALSE;
187 } else {
188 if (fOutputFile && fOutputFile->GetCompressionSettings() != newfile->GetCompressionSettings())
190
191 newfile->SetBit(kCanDelete);
193
196
197 return kTRUE;
198 }
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Add the TFile to this file merger and *do not* give ownership of the TFile to this
203/// object.
204///
205/// Return kTRUE if the addition was successful.
206
211
212////////////////////////////////////////////////////////////////////////////////
213/// Add the TFile to this file merger and give ownership of the TFile to this
214/// object (unless kFALSE is returned).
215///
216/// Return kTRUE if the addition was successful.
217
222
223////////////////////////////////////////////////////////////////////////////////
224/// Add the TFile to this file merger and give ownership of the TFile to this
225/// object (unless kFALSE is returned).
226///
227/// Return kTRUE if the addition was successful.
228
230{
231 if (source == 0 || source->IsZombie()) {
232 return kFALSE;
233 }
234
235 if (fPrintLevel > 0) {
236 Printf("%s Source file %d: %s",fMsgPrefix.Data(),fFileList.GetEntries()+1,source->GetName());
237 }
238
239 TFile *newfile = 0;
241
242 // We want gDirectory untouched by anything going on here
244 if (fLocal && !source->InheritsFrom(TMemFile::Class())) {
245 TUUID uuid;
246 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
247 if (!source->Cp(localcopy, cpProgress)) {
248 Error("AddFile", "cannot get a local copy of file %s", source->GetName());
249 return kFALSE;
250 }
251 newfile = TFile::Open(localcopy, "READ");
252 // Zombie files should also be skipped
253 if (newfile && newfile->IsZombie()) {
254 delete newfile;
255 newfile = 0;
256 }
257 } else {
258 newfile = source;
259 }
260
261 if (!newfile) {
262 if (fLocal)
263 Error("AddFile", "cannot open local copy %s of URL %s",
264 localcopy.Data(), source->GetName());
265 else
266 Error("AddFile", "cannot open file %s", source->GetName());
267 return kFALSE;
268 } else {
269 if (fOutputFile && fOutputFile->GetCompressionSettings() != newfile->GetCompressionSettings()) fCompressionChange = kTRUE;
270
271 if (own || newfile != source) {
272 newfile->SetBit(kCanDelete);
273 } else {
274 newfile->ResetBit(kCanDelete);
275 }
277
278 TObjString *urlObj = new TObjString(source->GetName());
280
281 if (newfile != source && own) {
282 delete source;
283 }
284 return kTRUE;
285 }
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Open merger output file.
290
295
296////////////////////////////////////////////////////////////////////////////////
297/// Open merger output file.
298
300{
301 Bool_t res = OutputFile(outputfile,(force?"RECREATE":"CREATE"),1); // 1 is the same as the default from the TFile constructor.
304 return res;
305}
306
307////////////////////////////////////////////////////////////////////////////////
308/// Open merger output file.
309///
310/// The 'mode' parameter is passed to the TFile constructor as the option, it
311/// should be one of 'NEW','CREATE','RECREATE','UPDATE'
312/// 'UPDATE' is usually used in conjunction with IncrementalMerge.
313
315{
316 // We want gDirectory untouched by anything going on here
319 return OutputFile(std::unique_ptr<TFile>(outputFile));
320
321 Error("OutputFile", "cannot open the MERGER output file %s", fOutputFilename.Data());
322 return kFALSE;
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// Set an output file opened externally by the users
327
329{
330 if (!outputfile || outputfile->IsZombie()) {
331 Error("OutputFile", "cannot open the MERGER output file %s", (outputfile) ? outputfile->GetName() : "");
332 return kFALSE;
333 }
334
335 if (!outputfile->IsWritable()) {
336 Error("OutputFile", "output file %s is not writable", outputfile->GetName());
337 return kFALSE;
338 }
339
341
343 fOutputFile = 0; // This avoids the complaint from RecursiveRemove about the file being deleted which is here
344 // spurrious. (see RecursiveRemove).
346
347 fOutputFilename = outputfile->GetName();
348 // We want gDirectory untouched by anything going on here
350 fOutputFile = outputfile.release(); // Transfer the ownership of the file.
351
352 return kTRUE;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Open merger output file. 'mode' is passed to the TFile constructor as the option, it should
357/// be one of 'NEW','CREATE','RECREATE','UPDATE'
358/// 'UPDATE' is usually used in conjunction with IncrementalMerge.
359
360Bool_t TFileMerger::OutputFile(const char *outputfile, const char *mode /* = "RECREATE" */)
361{
362 Bool_t res = OutputFile(outputfile,mode,1); // 1 is the same as the default from the TFile constructor.
364 return res;
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Print list of files being merged.
369
371{
372 fFileList.Print(options);
373 fExcessFiles.Print(options);
374}
375
376////////////////////////////////////////////////////////////////////////////////
377/// Merge the files.
378///
379/// If no output file was specified it will write into
380/// the file "FileMerger.root" in the working directory. Returns true
381/// on success, false in case of error.
382
387
388namespace {
389
391{
392 return (cl->GetMerge() || cl->InheritsFrom(TDirectory::Class()) ||
393 (cl->IsTObject() && !cl->IsLoaded() &&
394 /* If it has a dictionary and GetMerge() is nullptr then we already know the answer
395 to the next question is 'no, if we were to ask we would useless trigger
396 auto-parsing */
397 (cl->GetMethodWithPrototype("Merge", "TCollection*,TFileMergeInfo*") ||
398 cl->GetMethodWithPrototype("Merge", "TCollection*"))));
399};
400
402{
403 Bool_t status = kTRUE;
404 if (cl->InheritsFrom(TCollection::Class())) {
405 // Don't overwrite, if the object were not merged.
406 if (obj->Write(name, canBeMerged ? TObject::kSingleKey | TObject::kOverwrite : TObject::kSingleKey) <= 0) {
407 status = kFALSE;
408 }
409 ((TCollection *)obj)->SetOwner();
410 if (ownobj)
411 delete obj;
412 } else {
413 // Don't overwrite, if the object were not merged.
414 // NOTE: this is probably wrong for emulated objects.
415 if (cl->IsTObject()) {
416 if (obj->Write(name, canBeMerged ? TObject::kOverwrite : 0) <= 0) {
417 status = kFALSE;
418 }
420 } else {
421 if (target->WriteObjectAny((void *)obj, cl, name, canBeMerged ? "OverWrite" : "") <= 0) {
422 status = kFALSE;
423 }
424 }
425 if (ownobj)
426 cl->Destructor(obj); // just in case the class is not loaded.
427 }
428 return status;
429}
430
432{
433 // Recurse until we find a different name or type appear.
434 TKey *key = (TKey*)peeknextkey();
435 if (!key || name != key->GetName()) {
436 return kTRUE;
437 }
439 if (IsMergeable(cl))
440 return kTRUE;
441 // Now we can advance the real iterator
442 (void)nextkey();
444 TObject *obj = key->ReadObj();
445
446 return WriteOneAndDelete(name, cl, obj, kFALSE, kTRUE, target) && result;
447};
448
449} // anonymous namespace
450
454 TObject *obj, TIter &nextkey)
455{
456 const char *keyname = obj ? obj->GetName() : key->GetName();
457 const char *keyclassname = obj ? obj->IsA()->GetName() : key->GetClassName();
458 const char *keytitle = obj ? obj->GetTitle() : key->GetTitle();
459
460 // Keep only the highest cycle number for each key for mergeable objects. They are stored
461 // in the (hash) list consecutively and in decreasing order of cycles, so we can continue
462 // until the name changes. We flag the case here and we act consequently later.
465
466 // Read in but do not copy directly the processIds.
467 if (strcmp(keyclassname, "TProcessID") == 0 && key) {
468 key->ReadObj();
469 return kTRUE;
470 }
471
472 // If we have already seen this object [name], we already processed
473 // the whole list of files for this objects and we can just skip it
474 // and any related cycles.
475 if (allNames.FindObject(keyname)) {
477 return kTRUE;
478 }
479
481 if (!cl) {
482 Info("MergeRecursive", "cannot indentify object type (%s), name: %s title: %s",
484 return kTRUE;
485 }
486 // For mergeable objects we add the names in a local hashlist handling them
487 // again (see above)
488 if (IsMergeable(cl))
489 allNames.Add(new TObjString(keyname));
490
492 // Skip the TTree objects and any related cycles.
494 return kTRUE;
495 }
496 // Check if only the listed objects are to be merged
497 if (type & kOnlyListed) {
499 oldkeyname += " ";
502 if ((!onlyListed) && (!cl->InheritsFrom(TDirectory::Class()))) return kTRUE;
503 }
504
505 if (!(type&kResetable && type&kNonResetable)) {
506 // If neither or both are requested at the same time, we merger both types.
507 if (!(type&kResetable)) {
508 if (cl->GetResetAfterMerge()) {
509 // Skip the object with a reset after merge routine (TTree and other incrementally mergeable objects)
511 return kTRUE;
512 }
513 }
514 if (!(type&kNonResetable)) {
515 if (!cl->GetResetAfterMerge()) {
516 // Skip the object without a reset after merge routine (Histograms and other non incrementally mergeable objects)
518 return kTRUE;
519 }
520 }
521 }
522 // read object from first source file
523 if (type & kIncremental) {
524 if (!obj)
525 obj = current_sourcedir->GetList()->FindObject(keyname);
526 if (!obj && key) {
527 obj = key->ReadObj();
528 ownobj = kTRUE;
529 } else if (obj && info.fIsFirst && current_sourcedir != target
530 && !cl->InheritsFrom( TDirectory::Class() )) {
531 R__ASSERT(cl->IsTObject());
533 obj = obj->Clone();
534 ownobj = kTRUE;
535 }
536 } else if (key) {
537 obj = key->ReadObj();
538 ownobj = kTRUE;
539 }
540 if (!obj) {
541 Info("MergeRecursive", "could not read object for key {%s, %s}",
543 return kTRUE;
544 }
545 Bool_t canBeFound = (type & kIncremental) && (target->GetList()->FindObject(keyname) != nullptr);
546
547 // if (cl->IsTObject())
548 // obj->ResetBit(kMustCleanup);
549 if (cl->IsTObject() && cl != obj->IsA()) {
550 Error("MergeRecursive", "TKey and object retrieve disagree on type (%s vs %s). Continuing with %s.",
551 keyclassname, obj->IsA()->GetName(), obj->IsA()->GetName());
552 cl = obj->IsA();
553 }
555
556 std::map<std::tuple<std::string, std::string, std::string>, TDirectory*> dirtodelete;
557 auto getDirectory = [&dirtodelete](TDirectory *parent, const char *name, const TString &pathname) {
558 auto mapkey = std::make_tuple(parent->GetName(), name, pathname.Data());
559 auto result = dirtodelete.find(mapkey);
560 if (result != dirtodelete.end()) {
561 return result->second;
562 }
563
564 auto dir = dynamic_cast<TDirectory *>(parent->GetDirectory(pathname));
565 if (dir)
566 dirtodelete[mapkey] = dir;
567
568 return dir;
569 };
570
571 if ( cl->InheritsFrom( TDirectory::Class() ) ) {
572 // it's a subdirectory
573
574 target->cd();
576
577 // For incremental or already seen we may have already a directory created
578 if (type & kIncremental || alreadyseen) {
579 newdir = target->GetDirectory(obj->GetName());
580 if (!newdir) {
581 newdir = target->mkdir( obj->GetName(), obj->GetTitle() );
582 // newdir->ResetBit(kMustCleanup);
583 }
584 } else {
585 newdir = target->mkdir( obj->GetName(), obj->GetTitle() );
586 // newdir->ResetBit(kMustCleanup);
587 }
588
589 // newdir is now the starting point of another round of merging
590 // newdir still knows its depth within the target file via
591 // GetPath(), so we can still figure out where we are in the recursion
592
593 // If this folder is a onlyListed object, merge everything inside.
594 const auto mergeType = onlyListed ? type & ~kOnlyListed : type;
596
597 if ((type & kOnlyListed) && !(type & kIncremental) && !onlyListed && newdir->GetNkeys() == 0) {
598 // None of the children were merged, and the directory is not listed
599 delete newdir;
600 newdir = nullptr;
601 target->rmdir(obj->GetName());
602 }
603 // Delete newdir directory after having written it (merged)
604 if (!(type&kIncremental)) delete newdir;
606 if (!status) return kFALSE;
607 } else if (!cl->IsTObject() && cl->GetMerge()) {
608 // merge objects that don't derive from TObject
610 Warning("MergeRecursive", "Merging RNTuples is experimental");
611
612 // Collect all the data to be passed on to the merger
614 // First entry is the TKey of the ntuple
615 mergeData.Add(key);
616 // Second entry is the output file
617 mergeData.Add(target->GetFile());
618 // Remaining entries are the input files
620 while (const auto &inFile = nextFile()) {
621 mergeData.Add(inFile);
622 }
623 // Get the merge fuction and pass the data
624 ROOT::MergeFunc_t func = cl->GetMerge();
625 Long64_t result = func(obj, &mergeData, &info);
626 mergeData.Clear("nodelete");
627 if (result < 0) {
628 Error("MergeRecursive", "Could NOT merge RNTuples!");
629 return kFALSE;
630 }
631 } else {
633 Error("MergeRecursive", "Merging objects that don't inherit from TObject is unimplemented (key: %s of type %s in file %s)",
634 keyname, keyclassname, nextsource->GetName());
636 }
637 } else if (cl->IsTObject() && cl->GetMerge()) {
638 // Check if already treated
639 if (alreadyseen) return kTRUE;
640
644
645 // Loop over all source files and merge same-name object
647 if (nextsource == 0) {
648 // There is only one file in the list
649 ROOT::MergeFunc_t func = cl->GetMerge();
650 func(obj, &inputs, &info);
651 info.fIsFirst = kFALSE;
652 } else {
653 do {
654 // make sure we are at the correct directory level by cd'ing to path
655 TDirectory *ndir = getDirectory(nextsource, target->GetName(), path);
656 if (ndir) {
657 // For consistency (and persformance), we reset the MustCleanup be also for those
658 // 'key' retrieved indirectly.
659 // ndir->ResetBit(kMustCleanup);
660 ndir->cd();
661 TObject *hobj = ndir->GetList()->FindObject(keyname);
662 if (!hobj) {
663 TKey *key2 = (TKey*)ndir->GetListOfKeys()->FindObject(keyname);
664 if (key2) {
665 hobj = key2->ReadObj();
666 if (!hobj) {
667 switch (fErrBehavior) {
669 Error("MergeRecursive", "could not read object for key {%s, %s}; in file %s", keyname,
670 keytitle, nextsource->GetName());
672 return kFALSE;
674 Warning("MergeRecursive", "could not read object for key {%s, %s}; skipping file %s",
675 keyname, keytitle, nextsource->GetName());
677 return kTRUE;
678 }
679 }
680 todelete.Add(hobj);
681 }
682 }
683 if (hobj) {
684 // Set ownership for collections
685 if (hobj->InheritsFrom(TCollection::Class())) {
686 ((TCollection*)hobj)->SetOwner();
687 }
688 hobj->ResetBit(kMustCleanup);
689 inputs.Add(hobj);
690 if (!oneGo) {
691 ROOT::MergeFunc_t func = cl->GetMerge();
692 Long64_t result = func(obj, &inputs, &info);
693 info.fIsFirst = kFALSE;
694 if (result < 0) {
695 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
696 keyname, nextsource->GetName());
697 }
698 inputs.Clear();
699 todelete.Delete();
700 }
701 }
702 }
704 } while (nextsource);
705 // Merge the list, if still to be done
706 if (oneGo || info.fIsFirst) {
707 ROOT::MergeFunc_t func = cl->GetMerge();
708 func(obj, &inputs, &info);
709 info.fIsFirst = kFALSE;
710 inputs.Clear();
711 todelete.Delete();
712 }
713 }
714 } else if (cl->IsTObject()) {
715 // try synthesizing the Merge method call according to the TObject
716 TList listH;
718 if (cl->GetMethodWithPrototype("Merge", "TCollection*,TFileMergeInfo*")) {
719 listHargs.Form("(TCollection*)0x%zx,(TFileMergeInfo*)0x%zx",
720 (size_t)&listH, (size_t)&info);
721 } else if (cl->GetMethodWithPrototype("Merge", "TCollection*")) {
722 listHargs.Form("((TCollection*)0x%zx)", (size_t)&listH);
723 } else {
724 // pass unmergeable objects through to the output file
726 }
727 if (canBeMerged) {
728 if (alreadyseen) {
729 // skip already seen mergeable objects, don't skip unmergeable objects
730 return kTRUE;
731 }
732 // Loop over all source files and merge same-name object
734 if (nextsource == 0) {
735 // There is only one file in the list
736 Int_t error = 0;
737 obj->Execute("Merge", listHargs.Data(), &error);
738 info.fIsFirst = kFALSE;
739 if (error) {
740 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
741 obj->GetName(), keyname);
742 }
743 } else {
744 while (nextsource) {
745 // make sure we are at the correct directory level by cd'ing to path
746 TDirectory *ndir = getDirectory(nextsource, target->GetName(), path);
747 if (ndir) {
748 ndir->cd();
749 TKey *key2 = (TKey*)ndir->GetListOfKeys()->FindObject(keyname);
750 if (key2) {
751 TObject *hobj = key2->ReadObj();
752 if (!hobj) {
753 switch (fErrBehavior) {
755 Error("MergeRecursive", "could not read object for key {%s, %s}; in file %s", keyname,
756 keytitle, nextsource->GetName());
758 return kFALSE;
760 Warning("MergeRecursive", "could not read object for key {%s, %s}; skipping file %s",
761 keyname, keytitle, nextsource->GetName());
763 return kTRUE;
764 }
765 }
766 // Set ownership for collections
767 if (hobj->InheritsFrom(TCollection::Class())) {
768 ((TCollection*)hobj)->SetOwner();
769 }
770 hobj->ResetBit(kMustCleanup);
771 listH.Add(hobj);
772 Int_t error = 0;
773 obj->Execute("Merge", listHargs.Data(), &error);
774 info.fIsFirst = kFALSE;
775 if (error) {
776 Error("MergeRecursive", "calling Merge() on '%s' with the corresponding object in '%s'",
777 obj->GetName(), nextsource->GetName());
778 }
779 listH.Delete();
780 }
781 }
783 }
784 // Merge the list, if still to be done
785 if (info.fIsFirst) {
786 Int_t error = 0;
787 obj->Execute("Merge", listHargs.Data(), &error);
788 info.fIsFirst = kFALSE;
789 listH.Delete();
790 }
791 }
792 }
793 } else {
794 // Object is of no type that we can merge
796 }
797
798 // now write the merged histogram (which is "in" obj) to the target file
799 // note that this will just store obj in the current directory level,
800 // which is not persistent until the complete directory itself is stored
801 // by "target->SaveSelf()" below
802 target->cd();
803
805 //!!if the object is a tree, it is stored in globChain...
806 if (cl->InheritsFrom(TDirectory::Class())) {
807 // printf("cas d'une directory\n");
808
809 auto dirobj = dynamic_cast<TDirectory *>(obj);
810 TString dirpath(dirobj->GetPath());
811 // coverity[unchecked_value] 'target' is from a file so GetPath always returns path starting with filename:
812 dirpath.Remove(0, std::strlen(dirobj->GetFile()->GetPath()));
813
814 // Do not delete the directory if it is part of the output
815 // and we are in incremental mode (because it will be reused
816 // and has not been written to disk (for performance reason).
817 // coverity[var_deref_model] the IsA()->InheritsFrom guarantees that the dynamic_cast will succeed.
818 if (ownobj && (!(type & kIncremental) || dirobj->GetFile() != target)) {
819 dirobj->ResetBit(kMustCleanup);
820 delete dirobj;
821 }
822 // Let's also delete the directory from the other source (thanks to the 'allNames'
823 // mechanism above we will not process the directories when tranversing the next
824 // files).
825 for (const auto &[_, ndir] : dirtodelete) {
826 // For consistency (and performance), we reset the MustCleanup be also for those
827 // 'key' retrieved indirectly.
828 ndir->ResetBit(kMustCleanup);
829 delete ndir;
830 }
831 } else if (!canBeFound) { // object (TTree, TH1) is not yet owned by the target, thus write it
832 if (gDebug > 0)
833 Info("MergeOne", "Writing partial result of %s into target", oldkeyname.Data());
834 if (!canBeMerged) {
837 status = WriteOneAndDelete(oldkeyname, cl, obj, kFALSE, ownobj, target) && status;
838 } else {
839 status = WriteOneAndDelete(oldkeyname, cl, obj, kTRUE, ownobj, target) && status;
840 }
841 }
842 info.Reset();
843 return kTRUE;
844}
845
846////////////////////////////////////////////////////////////////////////////////
847/// Merge all objects in a directory
848///
849/// The type is defined by the bit values in TFileMerger::EPartialMergeType.
850
852{
853 Bool_t status = kTRUE;
855 if (fPrintLevel > 0) {
856 Printf("%s Target path: %s",fMsgPrefix.Data(),target->GetPath());
857 }
858
859 // Get the dir name
860 TString path(target->GetPath());
861 // coverity[unchecked_value] 'target' is from a file so GetPath always returns path starting with filename:
862 path.Remove(0, std::strlen(target->GetFile()->GetPath()));
863
864 Int_t nguess = sourcelist->GetSize()+1000;
866 allNames.SetOwner(kTRUE);
867 // If the mode is set to skipping list objects, add names to the allNames list
868 if (type & kSkipListed) {
870 arr->SetOwner(kFALSE);
871 for (Int_t iname=0; iname<arr->GetEntriesFast(); iname++)
872 allNames.Add(arr->At(iname));
873 delete arr;
874 }
875 ((THashList*)target->GetList())->Rehash(nguess);
876 ((THashList*)target->GetListOfKeys())->Rehash(nguess);
877
879 info.fIOFeatures = fIOFeatures;
880 info.fOptions = fMergeOptions;
882 info.fOptions.Append(" fast");
883 }
884
887 if (type & kIncremental) {
888 current_file = 0;
890 } else {
891 current_file = (TFile*)sourcelist->First();
892 current_sourcedir = current_file->GetDirectory(path);
893 }
895 // When current_sourcedir != 0 and current_file == 0 we are going over the target
896 // for an incremental merge.
899
900 // Loop over live objects
901 TIter nextobj( current_sourcedir->GetList() );
902 TObject *obj;
903 while ( (obj = (TKey*)nextobj())) {
905 info, oldkeyname, allNames, status, onlyListed, path,
907 nullptr, obj, nextobj);
908 if (!result)
909 return kFALSE; // Stop completely in case of error.
910 } // while ( (obj = (TKey*)nextobj()))
911
912 // loop over all keys in this directory
913 TIter nextkey( current_sourcedir->GetListOfKeys() );
914 TKey *key;
915
916 while ( (key = (TKey*)nextkey())) {
918 info, oldkeyname, allNames, status, onlyListed, path,
920 key, nullptr, nextkey);
921 if (!result)
922 return kFALSE; // Stop completely in case of error.
923 } // while ( ( TKey *key = (TKey*)nextkey() ) )
924 }
926 if (current_file) {
927 current_sourcedir = current_file->GetDirectory(path);
928 } else {
930 }
931 }
932 // save modifications to the target directory.
933 if (!(type&kIncremental)) {
934 // In case of incremental build, we will call Write on the top directory/file, so we do not need
935 // to call SaveSelf explicilty.
936 target->SaveSelf(kTRUE);
937 }
938
939 return status;
940}
941
942////////////////////////////////////////////////////////////////////////////////
943/// Merge the files. If no output file was specified it will write into
944/// the file "FileMerger.root" in the working directory. Returns true
945/// on success, false in case of error.
946/// The type is defined by the bit values in EPartialMergeType:
947///
948/// kRegular : normal merge, overwriting the output file
949/// kIncremental : merge the input file with the content of the output file (if already exising) (default)
950/// kResetable : merge only the objects with a MergeAfterReset member function.
951/// kNonResetable : merge only the objects without a MergeAfterReset member function.
952/// kDelayWrite : delay the TFile write (to reduce the number of write when reusing the file)
953/// kAll : merge all type of objects (default)
954/// kAllIncremental : merge incrementally all type of objects.
955/// kOnlyListed : merge only the objects specified in fObjectNames list
956/// kSkipListed : skip objects specified in fObjectNames list
957/// kKeepCompression: keep compression level unchanged for each input
958///
959/// If the type is not set to kIncremental, the output file is deleted at the end of this operation.
960
962{
963 if (!fOutputFile) {
965 if (outf.IsNull()) {
966 outf.Form("file:%s/FileMerger.root", gSystem->TempDirectory());
967 Info("PartialMerge", "will merge the results to the file %s\n"
968 "since you didn't specify a merge filename",
969 TUrl(outf).GetFile());
970 }
971 if (!OutputFile(outf.Data())) {
972 return kFALSE;
973 }
974 }
975
976 // Special treatment for the single file case to improve efficiency...
977 if ((fFileList.GetEntries() == 1) && !fExcessFiles.GetEntries() &&
981
982 TFile *file = (TFile *) fFileList.First();
983 if (!file || (file && file->IsZombie())) {
984 Error("PartialMerge", "one-file case: problem attaching to file");
985 return kFALSE;
986 }
988 if (!(result = file->Cp(fOutputFilename))) {
989 Error("PartialMerge", "one-file case: could not copy '%s' to '%s'",
990 file->GetPath(), fOutputFilename.Data());
991 return kFALSE;
992 }
993 if (file->TestBit(kCanDelete)) file->Close();
994
995 // Remove the temporary file
996 if (fLocal && !file->InheritsFrom(TMemFile::Class())) {
997 TUrl u(file->GetPath(), kTRUE);
998 if (gSystem->Unlink(u.GetFile()) != 0)
999 Warning("PartialMerge", "problems removing temporary local file '%s'", u.GetFile());
1000 }
1001 fFileList.Clear();
1002 return result;
1003 }
1004
1007
1009
1011 Int_t type = in_type;
1012 while (result && fFileList.GetEntries()>0) {
1014
1015 // Remove local copies if there are any
1016 TIter next(&fFileList);
1017 TFile *file;
1018 while ((file = (TFile*) next())) {
1019 // close the files
1020 if (file->TestBit(kCanDelete)) file->Close();
1021 // remove the temporary files
1022 if(fLocal && !file->InheritsFrom(TMemFile::Class())) {
1023 TString p(file->GetPath());
1024 // coverity[unchecked_value] Index is return a value with range or NPos to select the whole name.
1025 p = p(0, p.Index(':',0));
1026 gSystem->Unlink(p);
1027 }
1028 }
1029 fFileList.Clear();
1030 if (result && fExcessFiles.GetEntries() > 0) {
1031 // We merge the first set of files in the output,
1032 // we now need to open the next set and make
1033 // sure we accumulate into the output, so we
1034 // switch to incremental merging (if not already set)
1037 }
1038 }
1039 if (!result) {
1040 Error("Merge", "error during merge of your ROOT files");
1041 } else {
1042 // Close or write is required so the file is complete.
1043 if (in_type & kIncremental) {
1044 // In the case of 'kDelayWrite' the caller want to avoid having to
1045 // write the output objects once for every input file and instead
1046 // write it only once at the end of the process.
1047 if (!(in_type & kDelayWrite))
1049 } else {
1050 // If in_type is not incremental but type is incremental we are now in
1051 // the case where the user "explicitly" request a non-incremental merge
1052 // but we still have internally an incremental merge. Because the user
1053 // did not request the incremental merge they also probably do not to a
1054 // final Write of the file and thus not doing the write here would lead
1055 // to data loss ...
1056 if (type & kIncremental)
1058 gROOT->GetListOfFiles()->Remove(fOutputFile);
1059 fOutputFile->Close();
1060 }
1061 }
1062
1063 // Cleanup
1064 if (in_type & kIncremental) {
1065 Clear();
1066 } else {
1070 }
1071 return result;
1072}
1073
1074////////////////////////////////////////////////////////////////////////////////
1075/// Open up to (fMaxOpenedFiles-1) of the excess files.
1076
1078{
1079 if (fPrintLevel > 0) {
1080 Printf("%s Opening the next %d files", fMsgPrefix.Data(), std::min(fExcessFiles.GetEntries(), fMaxOpenedFiles - 1));
1081 }
1082 Int_t nfiles = 0;
1083 TIter next(&fExcessFiles);
1084 TObjString *url = 0;
1086 // We want gDirectory untouched by anything going on here
1088 while( nfiles < (fMaxOpenedFiles-1) && ( url = (TObjString*)next() ) ) {
1089 TFile *newfile = 0;
1090 if (fLocal) {
1091 TUUID uuid;
1092 localcopy.Form("file:%s/ROOTMERGE-%s.root", gSystem->TempDirectory(), uuid.AsString());
1093 if (!TFile::Cp(url->GetName(), localcopy, url->TestBit(kCpProgress))) {
1094 Error("OpenExcessFiles", "cannot get a local copy of file %s", url->GetName());
1095 return kFALSE;
1096 }
1097 newfile = TFile::Open(localcopy, "READ");
1098 } else {
1099 newfile = TFile::Open(url->GetName(), "READ");
1100 }
1101
1102 if (!newfile) {
1103 if (fLocal)
1104 Error("OpenExcessFiles", "cannot open local copy %s of URL %s",
1105 localcopy.Data(), url->GetName());
1106 else
1107 Error("OpenExcessFiles", "cannot open file %s", url->GetName());
1108 return kFALSE;
1109 } else {
1110 if (fOutputFile && fOutputFile->GetCompressionLevel() != newfile->GetCompressionLevel()) fCompressionChange = kTRUE;
1111
1112 newfile->SetBit(kCanDelete);
1114 ++nfiles;
1116 }
1117 }
1118 return kTRUE;
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Intercept the case where the output TFile is deleted!
1123
1125{
1127 Fatal("RecursiveRemove","Output file of the TFile Merger (targeting %s) has been deleted (likely due to a TTree larger than 100Gb)", fOutputFilename.Data());
1128 }
1129
1130}
1131
1132////////////////////////////////////////////////////////////////////////////////
1133/// Set a limit to the number of files that TFileMerger will open simultaneously.
1134///
1135/// This number includes both the read input files and the output file.
1136/// \param newmax if higher than the system limit, we reset it to the system limit;
1137/// if less than two, we reset it to 2 (one for the output file and one for the input file).
1138
1140{
1142 if (newmax < sysmax) {
1144 } else {
1146 }
1147 if (fMaxOpenedFiles < 2) {
1148 fMaxOpenedFiles = 2;
1149 }
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// Set the prefix to be used when printing informational message.
1154
1155void TFileMerger::SetMsgPrefix(const char *prefix)
1156{
1157 fMsgPrefix = prefix;
1158}
1159
#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
#define ClassImp(name)
Definition Rtypes.h:376
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:2510
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:4484
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition TClass.cxx:5440
ROOT::ResetAfterMergeFunc_t GetResetAfterMerge() const
Return the wrapper around Merge.
Definition TClass.cxx:7545
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Definition TClass.cxx:5955
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5981
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4902
ROOT::MergeFunc_t GetMerge() const
Return the wrapper around Merge.
Definition TClass.cxx:7537
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:2974
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.
This class provides file copy and merging services.
Definition TFileMerger.h:30
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 ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:131
Int_t GetCompressionSettings() const
Definition TFile.h:480
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:4687
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:2467
Int_t GetCompressionLevel() const
Definition TFile.h:474
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:3765
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:959
@ kCancelTTreeChangeRequest
Definition TFile.h:276
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:1524
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:400
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:657
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:458
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:243
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1058
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:378
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:965
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:865
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:544
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1072
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1100
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:502
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:1046
Basic string class.
Definition TString.h:138
void Clear()
Clear string without changing its capacity.
Definition TString.cxx:1242
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:2271
TString & Remove(Ssiz_t pos)
Definition TString.h:693
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1394
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1495
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:571
This class represents a WWW compatible URL.
Definition TUrl.h:33
Long64_t(* MergeFunc_t)(void *, TCollection *, TFileMergeInfo *)
Definition Rtypes.h:121