# TMVA Factory methods not recognized

**URL:** <https://root-forum.cern.ch/t/tmva-factory-methods-not-recognized/45219>\
**Category:** TMVA\
**Tags:** tree, tmva, root\
**Created:** [June 2, 2021, 3:05pm UTC](https://root-forum.cern.ch/t/tmva-factory-methods-not-recognized/45219 "2021-06-02T15:05:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![annacostelle](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@annacostelle](https://root-forum.cern.ch/u/annacostelle)\
**Post date:** [June 2, 2021, 3:05pm UTC](https://root-forum.cern.ch/t/tmva-factory-methods-not-recognized/45219/1 "2021-06-02T15:05:24Z")

</div>

These are the commands that I am using to register my signal and background trees with a TMVA factory:

TTree \* bkg = (TTree\*)f1-\>Get(“tree”);  
TTree \* sig = (TTree\*)f2-\>Get(“tree”);  
TFile \* outputFile = new TFile(“output.root”,“NEW”);  
TMVA::Factory \* factory = new TMVA::Factory(“etatest1”,outputFile);  
factory-\>AddSignalTree(sig,1.0);

However, I keep getting the error message:

**error: no member named ‘AddSignalTree’ in 'TMVA::Factory’**

and a similar message when I attempt to add the background tree. I am using ROOT 6.24/00 I have no idea why it is not recognizing the TMVA Factory methods and I do not know how to proceed with my analysis. Any ideas would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![oshadura](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oshadura/32/14460_2.png) [@oshadura](https://root-forum.cern.ch/u/oshadura)\
**Post date:** [June 3, 2021, 10:20am UTC](https://root-forum.cern.ch/t/tmva-factory-methods-not-recognized/45219/2 "2021-06-03T10:20:12Z")

</div>

@moneta could you please take a look? thanks!

---

<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 3, 2021, 3:03pm UTC](https://root-forum.cern.ch/t/tmva-factory-methods-not-recognized/45219/3 "2021-06-03T15:03:49Z")

</div>

Hi,

The API of the Factory has changes since few years now and one needs to use the `TMVA::DataLoader` class, as shown in the tutorial `TMVAClassification.C ( see [ROOT: tutorials/tmva/TMVAClassification.C File Reference](https://root.cern.ch/doc/master/TMVAClassification_8C.html))

```auto
 TMVA::DataLoader *dataloader=new TMVA::DataLoader("dataset");
dataloader->AddSignalTree ( signalTree, signalWeight );
dataloader->AddBackgroundTree( backgroundTree, backgroundWeight );
// and then 
 dataloader->PrepareTrainingAndTestTree( mycuts, mycutb,
                                        "nTrain_Signal=1000:nTrain_Background=1000:SplitMode=Random:NormMode=NumEvents:!V" );

```

Best Regards

Lorenzo
