# TMVA tutorials can only run once?

**URL:** <https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539>\
**Category:** TMVA\
**Created:** [June 11, 2019, 8:52pm UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539 "2019-06-11T20:52:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReynLieu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@ReynLieu](https://root-forum.cern.ch/u/ReynLieu)\
**Post date:** [June 11, 2019, 8:52pm UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539/1 "2019-06-11T20:52:20Z")

</div>

Hi ROOTers,

My first question in this forum. I run the code under directory of tutorial/tmva, such as “root -l TMVAClassification.C”. After it completes, I will go into the interface of root. But when I want to run it again “.x TMVAClassification.C”, it will complain. Could anyone tell me why is that? (my ROOT is the latest version on OS.)

I’ve write a GUI so that when I press the button of “MLP”, it will run “.x TMVAClassification.C(“MLP”)”. For the reason above, I can only press the buttom once. So how can I fix that?

Cheers,  
Reyn

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 12, 2019, 7:06am UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539/2 "2019-06-12T07:06:17Z")

</div>

Macro unloading / reloading does not work in (is not supported by) ROOT 6 (as of 2019.06.12).

After the macro is loaded, you can try to execute the function again: `TMVAClassification("MLP");`

---

<div class="post-metadata">

**Author:** ![ReynLieu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@ReynLieu](https://root-forum.cern.ch/u/ReynLieu)\
**Post date:** [June 12, 2019, 7:23am UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539/3 "2019-06-12T07:23:32Z")

</div>

Thanks for reply!

So you mean that I should run “.L TMVAClassification.C” first, and then I can run “TMVAClassification(“BDT”)” whatever times I want. That really works! In this way, I should set a button in my GUI to run “.L TMVAClassification.C” as the first step if I want to use this GUI, and then press “BDT”, “MLP” and so on. Thank you very much!

Cheers,  
Reyn

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 12, 2019, 8:42am UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539/4 "2019-06-12T08:42:23Z")

</div>

Actually, for the first time, you can simply `.x TMVAClassification.C` or `.x TMVAClassification.C("BDT")` but later you must not use “.x” not “.L” for the same file again.

---

<div class="post-metadata">

**Author:** ![ReynLieu](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@ReynLieu](https://root-forum.cern.ch/u/ReynLieu)\
**Post date:** [June 12, 2019, 5:06pm UTC](https://root-forum.cern.ch/t/tmva-tutorials-can-only-run-once/34539/5 "2019-06-12T17:06:55Z")

</div>

I see. So I modified my GUI.C that I added a line “gROOT-\>ProcessLine(”.L TMVAClassification")" and then set the buttons to run like “TMVAClassification(“BDT”)”.

Thank you so much!

Reyn
