Skip to content

TEfficiency constructors not appended to current directory #9189

@DLBacher

Description

@DLBacher

The TEfficiency constructors for fixed or variable bin size are not appended to the current directory. The description of TEfficiency mentions that this should only happen for the constructor using two histograms (passed and total).

The following code does not save the TEfficiency object to the file in version 6.24

TFile* file = new TFile("test.root", "RECREATE");
TEfficiency* eff = new TEfficiency("eff", "eff", 1, 0, 1);
eff->Fill(true, 0);
file->Write();

Executing in version 6.18 (latest I have installed other than 6.24) does produce the expected behaviour. After adding eff->Write(); the TEfficiency will also be written in v6.24.

I think the problem is the use of
TDirectory::TContext ctx(nullptr);
in TEfficiency.cxx (e. g. line 733), which was, as far as I see, implemented in version 6.24. I think in the scope after TContext the current directory is nullptr which is also passed to Build(name, title); as well.

Setup:

ROOT v6.24 built from source
OS: Ubuntu 20.04

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions