How to do both saving a root file and displaying

Dear all,

I’d like to save a histogram into a root file,
and at the same time, to display the histogram
via a x-terminal.

I attach a simple example.
When you execute it, you will see a blank canvas.
Of course, you can see the histogram from the root file.

Can I do both at the same time?test.C (208 Bytes)

Best regards,
Hide

_ROOT Version: 6.22/06
_Platform: CentOS Linux 8.3.2011
_Compiler: gcc 8.3.1


Hi Hide,

It is histograms ownership problem.
You should call:

hist->SetDirectory(nullptr);

before closing file.
See section creating histogram in TH1 docu

Regards,
Sergey

Hi Sergey,

Thanks for your quick reply !
It works GOOD for me !

Best regards,
Hide