# Multiple Signal And Background samples in TMVA

**URL:** <https://root-forum.cern.ch/t/multiple-signal-and-background-samples-in-tmva/50559>\
**Category:** TMVA\
**Created:** [June 27, 2022, 10:19am UTC](https://root-forum.cern.ch/t/multiple-signal-and-background-samples-in-tmva/50559 "2022-06-27T10:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annzm](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/annzm/32/34693_2.png) [@Annzm](https://root-forum.cern.ch/u/Annzm)\
**Post date:** [June 27, 2022, 10:19am UTC](https://root-forum.cern.ch/t/multiple-signal-and-background-samples-in-tmva/50559/1 "2022-06-27T10:19:08Z")

</div>

Hi Everyone,

I have 5 root files of signal and 5 root files of background process. Now I want TMVA classification but have no idea how to get started with such multiple files.  
can anybody help how to deal with this?

Best Regards

---

<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:** [June 27, 2022, 1:18pm UTC](https://root-forum.cern.ch/t/multiple-signal-and-background-samples-in-tmva/50559/2 "2022-06-27T13:18:46Z")

</div>

Hi,

If your 5 root files contains the same TTree (same name and same branches but different entries), the easiest is to create a TChain and use the TChain as a TTree and input that to TMVA in the `DataLoader::AddSignalTree` and `DataLoader::AddBackgroundTree`.  
See this simple [tutorial](https://root.cern.ch/doc/master/h1chain_8C.html) as an example how to create a [TChain](https://root.cern.ch/doc/master/classTChain.html).

Lorenzo

---

<div class="post-metadata">

**Author:** ![ampudia](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ampudia/32/32149_2.png) [@ampudia](https://root-forum.cern.ch/u/ampudia)\
**Post date:** [July 1, 2023, 4:35am UTC](https://root-forum.cern.ch/t/multiple-signal-and-background-samples-in-tmva/50559/3 "2023-07-01T04:35:50Z")

</div>

Hi,

I am in a similar position with a BDT. I have one question: should I adjust either the weight or the number of events so that all the backgrounds have the same influence on the training or is that not necessary?

For example, I have one background tree with 4000 events and another one with 40000. Can I put them directly in the dataloader or should I adjust the weight of the first one and set it equal to 10 so that each background is considered equally?

Thank you very much,  
Santiago
