Skip to content

Commit 733248e

Browse files
committed
[df] Avoid registering any TFile
1 parent df1474a commit 733248e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

tree/dataframe/src/RDFSnapshotHelpers.cxx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void EnsureValidSnapshotOutput(const ROOT::RDF::RSnapshotOptions &opts, const st
221221
return;
222222

223223
// output file opened in "update" mode: must check whether target object name is already present in file
224-
std::unique_ptr<TFile> outFile{TFile::Open(fileName.c_str(), "update")};
224+
std::unique_ptr<TFile> outFile{TFile::Open(fileName.c_str(), "UPDATE_WITHOUT_GLOBALREGISTRATION")};
225225
if (!outFile || outFile->IsZombie())
226226
throw std::invalid_argument("Snapshot: cannot open file \"" + fileName + "\" in update mode");
227227

@@ -508,8 +508,8 @@ void ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::SetEmptyBranches(TTree *in
508508

509509
void ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::Initialize()
510510
{
511-
fOutputFile.reset(
512-
TFile::Open(fFileName.c_str(), fOptions.fMode.c_str(), /*ftitle=*/"", GetSnapshotCompressionSettings(fOptions)));
511+
fOutputFile.reset(TFile::Open(fFileName.c_str(), (fOptions.fMode + "_WITHOUT_GLOBALREGISTRATION").c_str(),
512+
/*ftitle=*/"", GetSnapshotCompressionSettings(fOptions)));
513513
if (!fOutputFile)
514514
throw std::runtime_error("Snapshot: could not create output file " + fFileName);
515515

@@ -748,8 +748,8 @@ void ROOT::Internal::RDF::UntypedSnapshotTTreeHelperMT::SetEmptyBranches(TTree *
748748
void ROOT::Internal::RDF::UntypedSnapshotTTreeHelperMT::Initialize()
749749
{
750750
auto outFile =
751-
std::unique_ptr<TFile>{TFile::Open(fFileName.c_str(), fOptions.fMode.c_str(), /*ftitle=*/fFileName.c_str(),
752-
GetSnapshotCompressionSettings(fOptions))};
751+
std::unique_ptr<TFile>{TFile::Open(fFileName.c_str(), (fOptions.fMode + "_WITHOUT_GLOBALREGISTRATION").c_str(),
752+
/*ftitle=*/fFileName.c_str(), GetSnapshotCompressionSettings(fOptions))};
753753
if (!outFile)
754754
throw std::runtime_error("Snapshot: could not create output file " + fFileName);
755755
fOutputFile = outFile.get();
@@ -911,7 +911,7 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
911911
writeOptions.SetEnablePageChecksums(fOptions.fEnablePageChecksums);
912912
writeOptions.SetEnableSamePageMerging(fOptions.fEnableSamePageMerging);
913913

914-
fOutputFile.reset(TFile::Open(fFileName.c_str(), fOptions.fMode.c_str()));
914+
fOutputFile.reset(TFile::Open(fFileName.c_str(), (fOptions.fMode + "_WITHOUT_GLOBALREGISTRATION").c_str()));
915915
if (!fOutputFile)
916916
throw std::runtime_error("Snapshot: could not create output file " + fFileName);
917917

@@ -1125,7 +1125,8 @@ ROOT::Internal::RDF::SnapshotHelperWithVariations::SnapshotHelperWithVariations(
11251125

11261126
TDirectory::TContext fileCtxt;
11271127
fOutputHandle = std::make_shared<SnapshotOutputWriter>(
1128-
TFile::Open(filename.data(), fOptions.fMode.c_str(), /*ftitle=*/"", GetSnapshotCompressionSettings(fOptions)));
1128+
TFile::Open(filename.data(), (fOptions.fMode + "_WITHOUT_GLOBALREGISTRATION").c_str(), /*ftitle=*/"",
1129+
GetSnapshotCompressionSettings(fOptions)));
11291130
if (!fOutputHandle->fFile)
11301131
throw std::runtime_error(std::string{"Snapshot: could not create output file "} + std::string{filename});
11311132

0 commit comments

Comments
 (0)