Error: Non-static-const variable in array dimension

Hi,

I have some trees generated and I want to analyze them using MakeClass method.
I got .C and .h files generated from the tree. Without any editing, when I try to load the file:
“.L FullSim.C” I get the following error.

Error: Non-static-const variable in array dimension FullSim.h:37:
(cint allows this only in interactive command and special form macro which
is special extension. It is not allowed in source code. Please ignore
subsequent errors.)
*** Interpreter error recovered ***

Both the .C and .h files are attached.

Can you help me to fix this error?

Thanks in advance.
FullSim.h (29.6 KB)
FullSim.C (1.46 KB)

Hi,
Reason of this problem is simple, you tell CINT to allocate array muon_px[3][muon_size] but at this moment it don’t know what is value of muon_size.
It’s strange because as far as I know CINT should initialize size of this array based on data from first “event” e.g. munon_px[3][2130].
There are few options of fixing this problem:

  • first is writing you own class for reading but it can be quite complicated
  • second give to those arrays big size (bigger than maximal value of muon_size branch in tree) e.g.
#define large_val 10000
...
   Int_t           muon_size;
   Float_t         muon_px[3][large_val];