On 17 August 2010 18:25, Mohammed Mahmoud Mohammed
<mohammed.attia_at_cern.ch> wrote:
>
> Dear All,
>
> I wrote small macro to make analysis for eta curve but when I run it I got the below error:
>
>
> Warning in <TDirectoryFile::Append>: Replacing existing TH1: BinContent (Potential memory leak).
> Warning in <TDirectoryFile::Append>: Replacing existing TH1: BinContent (Potential memory leak).
>
>
> Can anyone tell me how can I solve this error?
>
for ( unsigned int i =0; i < myHist->GetNbinsX(); i++)
{ cout << myHist->GetBinContent(i); delta1 = new TH1F("BinContent", "BinContent",100,0,100); // <-- I think the problem is here delta1->Fill (myHist->GetBinContent(i)); }
You can declare the histogram outside the loop, and if you want an empty histogram just do
myhist->Reset();
> Thanks in advance
>
> Best regards
>
> Mohammed
>
Hope this helps
-- Suvayu Open source is the future. It sets us free.Received on Wed Aug 18 2010 - 04:20:03 CEST
This archive was generated by hypermail 2.2.0 : Wed Aug 18 2010 - 11:50:02 CEST