Initialising static array in Cint

From: Birger Koblitz (koblitz@mail.desy.de)
Date: Tue Nov 02 1999 - 11:21:02 MET


Hi,

I have problems with the following code:

eventsample.h:
#ifndef eventsample_h
#define eventsample_h

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <TTree.h>
#endif

class EventSample{
  Int_t           varnum;
  IEvent          *event;
 public:
  static Float_t  *minx,*maxx;
  static Char_t   *varnames[];

  EventSample(Char_t *filename=0, Char_t *obj=0);
  virtual ~EventSample();
};

Float_t *EventSample::minx=0;
Float_t *EventSample::maxx=0;

Char_t *EventSample::varnames[]={
  "xg","q2g","ptje","et","ebwj","ebnj"
};
// eventsample_h
#endif

This header included in the main-program compiles fine with
xlC/egcs/gcc2.7.2 but Cint crashes: 

root [1] .L eventsample.C
Error: array initialization FILE:./eventsample.h LINE:23
Warning: Automatic variable "q2g" allocated in global scope
FILE:./eventsample.h LINE:23
Error: Undeclared variable "q2g" FILE:./eventsample.h LINE:23
*** Interpreter error recovered ***

Is this my stupidness and wrong c++ code or does the interpreter have a
bug?
On the other hand it would not be necessary to tie in the names of the
variables if one would be able to extract them out of the file which is a
converted ntuple and I use an automatically generated event-class to
access it. I only need the variable-branches attached to the entries of a
float-Array and their names in the same sequence in a char** array. How
does one traverse the tree to figure out the number of branches and their
names?

Cheers,
  Birger
/------------------------------------------------------------\
| Birger Koblitz                    koblitz@mail.desy.de     |
| Max-Planck-Institut fuer Physik                            |
| (Werner Heisenberg-Institut)                               |
| DESY-FH1K                         Tel. (40) 8998-3971      |
| Notkestr. 85                                               |
| D-22603  HAMBURG                                           |
\------------------------------------------------------------/



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