# Avoid using an empty variable

**URL:** <https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512>\
**Category:** TMVA\
**Created:** [May 7, 2025, 11:40am UTC](https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512 "2025-05-07T11:40:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martis](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@martis](https://root-forum.cern.ch/u/martis)\
**Post date:** [May 7, 2025, 11:40am UTC](https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512/1 "2025-05-07T11:40:00Z")

</div>

Hello,

may be this is rather basic, but I couldn’t find a suitable answer. So, let me ask it:

I want to train a BDT with a list of variable, but sometimes one of them has a flag value which means it does not have to be used. For instance, one of the variables is the transverse momentum (pt) of a jet, but in some events {~20%) there is no jet, so I set its pt=0.

Is there a way to instruct TMVA this variable should not be used for the events is 0?

Thanks  
Salva

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [May 7, 2025, 1:12pm UTC](https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512/2 "2025-05-07T13:12:42Z")

</div>

Hello @martis,

taking a look at [this tutorial](https://root.cern.ch/doc/master/TMVAClassification_8C.html), I think that you can simply define your filter on the signal as follows

```auto
   // Apply additional cuts on the signal and background samples (can be different)
   TCut mycuts = "pt>0";

```

Hope this helps.

Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![martis](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@martis](https://root-forum.cern.ch/u/martis)\
**Post date:** [May 7, 2025, 2:02pm UTC](https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512/3 "2025-05-07T14:02:22Z")

</div>

Hello Monica,

thanks for the feedback. But using the cut removes all the events failing the cut (with pt==0). What I pretend (and I am not sure it makes sense) is that for the events without jet (then I set pt=0) the pt variable is not considered, but the other variables are still valid. Is that possible?

Cheers  
Salva

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [May 8, 2025, 6:45am UTC](https://root-forum.cern.ch/t/avoid-using-an-empty-variable/63512/4 "2025-05-08T06:45:31Z")

</div>

If I well understand, you don’t want to remove all the events with pt==0, but only those without jet that you marked with pt=0. You can try setting pt=-1 in this case, and then keep all events pt\>=0.
