Re: MakeCode() and arrays in CWN

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 26 1998 - 14:27:08 MET


Scott Sampson wrote:

> I'm having a peculiar problem: I have a column-wise ntuple which I convert
> to root using h2root. When I look at the ntuple using h2->Print() I see
> entries like
>
> *Branch  :fm_isl    : fm_isl/I
> *Entries :     1000 : Total  Size =         0 bytes  File Size  =
> *Baskets :        0 : Basket Size =      8000 bytes  Compression=   1.00
> *
> .............................................................................*
> *Branch  :fm_id     : fm_id[fm_isl][200]/I
> *Entries :     1000 : Total  Size =   2357620 bytes  File Size  =
> *Baskets :      366 : Basket Size =      8000 bytes  Compression=
> *.........................................................................
>
> etc... where fm_isl define the length of the array fm_id. Now, fm_isl has
> a max value of 30. However, when I do an h2->MakeCode(), my variable
> declarations come out wrong. The macro has statements like:
>
> Int_t           fm_id[0][200];
>
> Other variable-length arrays also have screwed up indices (not
> necessarily 0, but just incorrect numbers). What's going
> on? I change the declarations to their correct values by hand.
>
> Now, I'm having a second problem. I don't know if it is related to the
> above, but in the macro I try doing something like
>
> cout << fm_id[0][0]
>
> and I get the following error:
>
> Error: No symbol fm_id[0][0] in current scope  FILE: . . . .
> *** Interpreter error recovered ***
>
>  *** Break *** segmentation violation
>
> And I have to quit root. Why does root not see the variable declared
> above?
>
> Third, any time I run this macro using the shell from MakeCode(), I
> can only run it once. The second time I get a "*** Break *** segmentation
> violation" error message, and again must quit root. Is there any solution
> to these problems? Thanks,
>
> Scott Sampson
> Columbia University

  I have fixed this problem in TTree::MakeCode. Thanks for reporting.
For the time being, edit the function automatically generated.
I cannot reproduce your problem with cout <<fm_id[0][0].
I also do not understand why you cannot run the macro twice?
Are you making other changes in the generated macro?
I assume you are using the released version 1.03/09.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET