Re: [ROOT] Pointer address lost

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 07 2004 - 19:03:51 MET


You are hitting the typical mistake when generating the x.h file with a
Root Tree and using it with a different Tree where you have more data than in
the first tree.
In your case, you have two arrays

   Int_t           ADC_channel[83];   //[n_adc]
   Int_t           ADC_data[83];   //[n_adc]

When reading the file with problem, n_adc > 83. As a result, your overwrite
the other data members of the class, and in particular the histogram pointers.
Increase the dimension from 83 to a bigger value (eg 1000)

Rene brun

Manoel Couder wrote:
> 
> (sorry I forget to attach the files)
> 
> Hi,
> 
> I am using a the class generated by MakeClass on a TTree to loop on that TTree
> and fill some histograms. I have added 3 array of TH?I as member of the
> Class. I create them in the constructor.
> 
> When I loop on "small" (<1MB) root file I don't have any problem but with
> bigger one it seems that the address of the pointer to some histogram changed
> causing a segmentation violation.
> 
> I didn't succeed to find an error so I ask for some help.
> 
> As an example I attach 3 three file modified to fit to a particular root file.
> In that example everthings seems OK up to ientry==244476 at that moment, the
> pointer to the histogram hE[40] have change of address.
> 
> I am using ROOT4.00/08 and gcc3.3.3 on FC2 or gcc2.96 on Linux RH7.3
> 
> Thanks for your help,
> 
> Manoel.
> 
> PS: The root file  (~3.3 MB) can be found at: http://www.nd.edu/~mcouder/
> 
>   --------------------------------------------------------------------------------
>                Name: main.cxx
>    main.cxx    Type: text/x-c++src
>            Encoding: 7bit
> 
>                      Name: ph184example.h
>    ph184example.h    Type: text/x-chdr
>                  Encoding: 7bit
> 
>                      Name: ph184example.C
>    ph184example.C    Type: text/x-c++src
>                  Encoding: 7bit



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET