Using arrays of variable length in TMVA BDT

In my ntuples I have a variable that varies by event.

Int_t Nneu
Float_t NeuEnergy[10] \\[nNeu]

Where the max size of NeuEnergy is 10 but can be anywhere from 0 to 10 on an event by event basis. Is there a way to add the variable to the TMVA in a way that accounts for this?


If I interpret you correctly, that you want to have a variable amount of features per event, this is not possible with TMVA unfortunately.

What you can to is add all entries in the array separately, but then you must make sure that invalid entries are marked as such. If for example the energy is a strictly positive quantity you could put it as -999 when the value is not used. Another approach is to put the value as 0, but this has the drawback that one cannot distinguish between a valid entry with 0 energy and an invalid entry.