MakeCode() and arrays in CWN

Scott Sampson (scott@znev03.desy.de)
Sun, 25 Jan 1998 19:21:33 +0100 (MET)


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