# Changing Signal and Bkg Weights in TMVA

**URL:** <https://root-forum.cern.ch/t/changing-signal-and-bkg-weights-in-tmva/7302>\
**Category:** TMVA\
**Created:** [October 16, 2008, 3:54pm UTC](https://root-forum.cern.ch/t/changing-signal-and-bkg-weights-in-tmva/7302 "2008-10-16T15:54:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurence\_Carson](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/22d042/32.png) [@Laurence\_Carson](https://root-forum.cern.ch/u/Laurence_Carson)\
**Post date:** [October 16, 2008, 3:54pm UTC](https://root-forum.cern.ch/t/changing-signal-and-bkg-weights-in-tmva/7302/1 "2008-10-16T15:54:18Z")

</div>

Hello,

I am using TMVA to help come up with a selection for a rare B decay. I am using the default macro TMVAnalysis.C, and ROOT v5.14/00b.

I would like to change the signal and background weights to account for the different branching ratios of signal and bkg. However I am unable to get any effect by doing this.

For example if I have

TFile _f = new TFile(“Bd2PPbar\_47kevts\_WithERR.root”);  
f-\>cd(“Bd2PPbar\_47kevts\_WithERR.root:/Bd2PPbar”);  
TTree_ signal = (TTree\*)gDirectory-\>Get(“BHHTuple”);

```
   TFile *gA = new TFile("B2KK_40K.root");
    gA->cd("B2KK_40K.root:/NtupleB2PPbar");
    TTree* backgroundA = (TTree*)gDirectory->Get("B2PPbar");

```

Double\_t signalWeight = 1.0;  
Double\_t backgroundWeightA = 1.0;

factory-\>AddSignalTree ( signal, signalWeight );  
factory-\>AddBackgroundTree( backgroundA, backgroundWeightA );

And I use the Fisher discriminant method, I get (for example) an invariant mass distribution and bkg rejection vs. signal eff. plots as attached.

This is fine. BUT if I then change the weights to (for example)

Double\_t signalWeight = 1.0;  
Double\_t backgroundWeightA = 10.0;

instead, all the plots stay _exactly_ the same. How can I make TMVA weight the number of signal and bkg events to what I want?

Thanks,

Laurence  
[RejectionVsEff.ps](https://root-forum.cern.ch/uploads/default/original/2X/f/fea3be974ae56491b2dcb701f17be611b4757071.ps) (1.27 MB)  
[SignalWeightEqualsBkgWeight\_Mass.ps](https://root-forum.cern.ch/uploads/default/original/2X/c/cd785ca97ddd83149eeacc8c648a4d11c7554813.ps) (1.27 MB)

---

<div class="post-metadata">

**Author:** ![hoecker](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/ad7895/32.png) [@hoecker](https://root-forum.cern.ch/u/hoecker)\
**Post date:** [October 16, 2008, 7:35pm UTC](https://root-forum.cern.ch/t/changing-signal-and-bkg-weights-in-tmva/7302/2 "2008-10-16T19:35:36Z")

</div>

Hello Laurence,

The plots of the input variables in the GUI do not change because they are normalised independently for background and signal to allow a better shape comparison. This doesn’t mean however that TMVA would not properly take into account the weights for the variable training! You can try a simple game (here assuming the standard example):

factory-\>SetSignalWeightExpression(“abs(var4)”)

and then run the usual training. You should see that the input variable “var4” is now deformed for signal, and also the Fisher reponse distribusion should be modified, although the overall normalisation is equal for both species. BTW, Fisher ignores differences in global weights w/o event dependence (there is a renormalisation).

Cheers,  
Andreas
