Re: [ROOT] histos with different cycle

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Nov 03 2003 - 14:38:46 MET


Hi Stefano,

Your histograms having the same name, when you issue the second Get call,
the histogram named "Pedestal_1" in memory is replaced by the new histogram
with the same name. This is the default behaviour and when doing this, you
should have seen a Warning message from ROOT.
You can disable the default ROOT bookeeping system by calling
  TH1::AddDirectory(kFALSE);
After this call, histograms with the same name can cohabitate in memory,
but it is your responsability to delete the objects.
See chapter about "Object Ownership" in the Users Guide.

Rene Brun

Stefano Piano wrote:
> 
> Dear rooters,
> I would like to read from file and draw to the same canvas
> some histograms with the same name but different cycle.
> 
> root [0] TFile datafile("hpede.root")
> root [1] TH1F * histo1 = (TH1F *) datafile.Get("Pedestal_1;21")
> root [2] TH1F * histo2 = (TH1F *) datafile.Get("Pedestal_1;22")
> root [3] TH1F * histo3 = (TH1F *) datafile.Get("Pedestal_1;23")
> 
> It is clear that I cannot draw the first histogram:
> root [4] histo1->Draw()
> but I can draw the third one.
> 
> How can I save the buffer of the first and second histogram
> ( ... and later discard them without memory leakage )?
> 
> Thank you,
> cheers,
> Stefano Piano
> 
> P.S. My root version is 3.05/02 compiled by gcc 3.2.2 on
>          I32 gentoo linux with vanilla kernel 2.4.20



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET