# How to apply BDT cut value?

**URL:** <https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805>\
**Category:** TMVA\
**Created:** [March 16, 2016, 7:58am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805 "2016-03-16T07:58:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![swanski82](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@swanski82](https://root-forum.cern.ch/u/swanski82)\
**Post date:** [March 16, 2016, 7:58am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/1 "2016-03-16T07:58:15Z")

</div>

Hi all,

I am new to TMVA. So far, I define my signal and background region and prepare an output to use for TMVA. I am using BDT(boosted decision tree) method. I know how to obtain optimal cut value from the histogram I attached. In this case, I’ll cut it near at 0.0.

My question is, how to apply this BDT cut value on data, i,e. how to make a roofit histogram of mass distribution of my particle with that BDT cut? I am having hard times to figure it out since the cuts are correlated with each other so it is not possible to apply cut one after the other.  
[bdtmva.pdf](https://root-forum.cern.ch/uploads/default/original/2X/a/a6a1445c4f096469e70ec30e7fbe5eb233c09314.pdf) (237 KB)

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 31, 2016, 7:51am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/2 "2016-03-31T07:51:44Z")

</div>

Hi,

For applying the BDT cut you just need to compute the BDT value on the data and then you apply the desired cut retaining only the events that pass your chosen cut value.  
See the TMVA tutorial macro tutorials/tmva/TMVAClassificationApplication.C

Best Regards

Lorenzo

---

<div class="post-metadata">

**Author:** ![swanski82](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@swanski82](https://root-forum.cern.ch/u/swanski82)\
**Post date:** [April 19, 2016, 11:30am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/3 "2016-04-19T11:30:16Z")

</div>

Hi Lorenzo,

thanks for the reply. I have some naive questions.

> [@](#):
>
> For applying the BDT cut you just need to compute the BDT value on the data

Actually, I am not sure how. So far, what I get is, lets assume maximum S/S+B (purity) and the corresponding BDT value. Then how to apply these values i.e, on a mass spectrum ?

> [@](#):
>
> you apply the desired cut retaining only the events that pass your chosen cut value.

I checked the code and found this which could work:  
int effS = 0.6;

if (Use[“BDT”]) {  
// Cuts is a special case: give the desired signal efficiency  
Bool\_t passed = reader-\>EvaluateMVA( “BDT”, effS );  
if (passed)  
}

but I do not want to get the BDT output value distribution. I need a particle mass spectrum(which is indeed used as a variable-var1- during BDT process.)

---

<div class="post-metadata">

**Author:** ![anprodri](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@anprodri](https://root-forum.cern.ch/u/anprodri)\
**Post date:** [October 15, 2019, 7:32pm UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/4 "2019-10-15T19:32:26Z")

</div>

I’m having doubts about the prediction cut too… But I’m not sure if the training uses a default cut or something, because I’m not defining any.

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [October 16, 2019, 9:34am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/5 "2019-10-16T09:34:48Z")

</div>

Hi,

Thanks for posing a question. However, please refrain from posting to old threads, instead create a new one. This is not to be unfriendly, just to have some order on the forum 🙂

The training is not using a cut on the output, if this is what you are asking. If I misunderstood, please elaborate a bit more.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [October 17, 2019, 8:47am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/7 "2019-10-17T08:47:20Z")

</div>

Once you have done the cut, you can save the relevant branches of input variables to a root file. Please see the `TMVAClassificationApplication.C` example for details.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![swanski82](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@swanski82](https://root-forum.cern.ch/u/swanski82)\
**Post date:** [October 17, 2019, 10:02am UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/8 "2019-10-17T10:02:15Z")

</div>

thanks a lot. I think I have managed to do it via TMVAClassificationApplication.C

---

<div class="post-metadata">

**Author:** ![anprodri](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@anprodri](https://root-forum.cern.ch/u/anprodri)\
**Post date:** [October 17, 2019, 12:42pm UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/9 "2019-10-17T12:42:59Z")

</div>

> [@kialbert](#):
>
> nches of input variables

But is the training optimizing a cut (between what’s background and signal) somewhere (?).  
In another question of the forum I found the command **Method.GetSignalReferenceCut()** that you can get after the training… What exactly does this return?

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [October 21, 2019, 1:24pm UTC](https://root-forum.cern.ch/t/how-to-apply-bdt-cut-value/20805/10 "2019-10-21T13:24:43Z")

</div>

Hi anprodri,

Please ask this as a new question and I will be more than happy to elaborate!

Cheers,  
Kim
