Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tree/dataframe/src/RDFSnapshotHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void EnsureValidSnapshotOutput(const ROOT::RDF::RSnapshotOptions &opts, const st
return;

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

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

void ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::Initialize()
{
fOutputFile.reset(
TFile::Open(fFileName.c_str(), fOptions.fMode.c_str(), /*ftitle=*/"", GetSnapshotCompressionSettings(fOptions)));
fOutputFile.reset(TFile::Open(fFileName.c_str(), (fOptions.fMode + "_WITHOUT_GLOBALREGISTRATION").c_str(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever risk appending _WITHOUT_GLOBALREGISTRATION twice? Most of the TFile code seems to cope with it fine, but not all of it (e.g.

((!strcasecmp(option, "READ") || !strcasecmp(option, "READ_WITHOUT_GLOBALREGISTRATION") || !option[0]) &&
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point

/*ftitle=*/"", GetSnapshotCompressionSettings(fOptions)));
if (!fOutputFile)
throw std::runtime_error("Snapshot: could not create output file " + fFileName);

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

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

Expand Down Expand Up @@ -1125,7 +1125,8 @@ ROOT::Internal::RDF::SnapshotHelperWithVariations::SnapshotHelperWithVariations(

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

Expand Down
Loading