TEfficiency not stored via TDirectory->Write() after upgrade to 6.24.06


Dear experts,
I’ve recently upgraded from root 6.22.06 to 6.24.06. After upgrading all TEfficiency used are not stored anymore and do not appear in `TDirectory::Print().

I could not find anything related in the release notes.

Examples including outputs for both versions can be found below.

Thanks for the help,
lhuth

#include<TDirectory.h>
#include<TEfficiency.h>
#include<TFile.h>
#include<TH1D.h>

void test(){

auto file = new TFile("test.root","RECREATE");
auto dir = file->GetDirectory("test");

dir= file->mkdir("test");
dir->cd();
auto hist = new TH1D("hist","hist", 10,1,1);
auto teff = new TEfficiency("pixelEfficiencyMap_trackPos", "map", 90, 90 / 2., 90 / 2., 180, 90 / 2.,90 / 2.);
hist->Fill(4,4);
teff->Fill(0,0,1);

dir->Print();

dir->Write();
file->Close();
}

Result print for v6.22.06:

   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/06                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Nov 27 2020, 15:14:08                 |
  | From tags/v6-22-06@v6-22-06                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] .L test.c
root [1] test()
TH1.Print Name  = hist, Entries= 0, Total sum= 0
OBJ: TEfficiency	pixelEfficiencyMap_trackPos	map
root [2] 

Result print for v6.24.06

   ------------------------------------------------------------------
  | Welcome to ROOT 6.24/06                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Oct 13 2021, 11:32:00                 |
  | From tags/v6-24-06@v6-24-06                                      |
  | With                                                             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] .L test.c
root [1] test()
TH1.Print Name  = hist, Entries= 1, Total sum= 4

ROOT Version: 6.24.06
Platform: opensuse 15.2
Compiler: gcc10


Hello,

What happens if you explicitly do teff->Write();?

@pcanal can perhaps comment (pinging also @moneta so he’s aware).

Hi @etejedor,
Thanks for the reply!

Adding teff->write() in the macro leads to the plot appearing in the file, but not having any content but a frame, see screenshot below :

Cheers,
lhuth

Can this be related to:

Absolutely - I have not checked GitHub issues.

Yes, sorry, that was more a question to @moneta :slight_smile:

but not having any content but a frame, see screenshot below :

How do you assert this? (I.e. what are the exact code that leads to the empty frame?

(Note that the ‘Write is required’ part is intentional. See TEfficiency documentation, in particular " As the histograms already exist, the new TEfficiency is by default not attached to the current directory to avoid duplication of data.")

Hi @pcanal,
By using the same macro as above and adding a teff->Write(). But I observe the same behaviour for the following macro:

#include<TDirectory.h>
#include<TEfficiency.h>
#include<TFile.h>
#include<TH1D.h>

void test(){

auto file = new TFile("test.root","RECREATE");
auto teff = new TEfficiency("pixelEfficiencyMap_trackPos", "map", 90, -90 / 2., 90 / 2., 180, -90 / 2.,90 / 2.);
teff->Fill(0,0,1);

teff->Write();
file->Close();

}

Cheers,
lhuth

I don’t see the part where the histogram is ‘drawn’ (i.e. brings up the canvas) … what am I missing?

My intention is to store it to a file. To check the contents I open the file with a simple TBrowser. I just read your comment on the issue on GitHub and will give this a try

Note that the example you copy/pasted here are probably too ‘simple’ to properly check this is working.
For example entering:

auto teff = new TEfficiency("pixelEfficiencyMap_trackPos", "map", 90, -90 / 2., 90 / 2., 180, -90 / 2.,90 / 2.);
teff->Fill(0,0,1);
teff->Draw();

Will display the exact same picture you shown … i.e. the storing/restoring is “working” and shows the “original” object (which in this case does not have enough data).

Hi @pcanal,
Sorry for the late reply - being busy with other duties in between. I’ve tried it with a bit more statistics and the map is indeed stored. However, neither axis labels nor ticks or a colz as draw option have an effect.
Am I again missing something? Or should this be a new thread?
Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.