TMVA: Can I use a variable which is not always defined?

As in any pattern recognition problem,
I have a set of N variables which are used to discriminate signal from background.
My question is the following: Is it possible to use such a variable which is not always available for every event?
I would like to exploit the discriminating power of this variable when it is defined (available), but not to play a role when it is not.
This variable range from -40. to 10., and use to be closer to 10. for signal events.
When it is not available, I am currently assigning it a dummy value: -999.
But I wonder if this is the proper way of doing this.

Thanks in advanceā€¦


The proper way to treat your case is to use the MethodCategory. With this method you can split your sample in two (or more) categories. You can define for each category the variables which TMVA should use. You would create one category for the case your variable is defined and another one when your variable is not defined (and not use the variable in that case).

You can find an example of how to use MethodCategory in :
(provided you are using a recent version of ROOT >= 5.26.00)