TMVA output plots without using GUI

Hi everyone,

I trained different methods using TMVA, obtained the output and weight files, and now I want to display the results in several plots.

I know there are some macros/scripts to produce these plots (e.g. variables.cxx()), but as far as I know this macros are GUI based, meaning that, each time I run it a window pops up displaying the plot. Since I’m remotely connected to lxplus this seems to be a problem, is there any way to just run the script and only save the file without displaying it in a window? The same applies for all scripts under TMVAGui.

I also found an alternative working on SWAN, but in all the examples the plots are produced immediately after the training, and my intention is to use the output already created by the training and then create the plots separately, is that possible?

Many thanks in advance. (ROOT version 6.22/02)


@swunsch @moneta I am not sure what to suggest here, do you have something in mind?


The TMVAGUI library (libTMVAGUI) consists also of several functions defined in the namespace TMVA that you can call directly from the ROOT prompt or from a compiled program in batch.
For example you can do this for the output distribution plot obtained from the tutorial TMVAClassification.C.

root -b 
root [0] gSystem->Load("libTMVAGui");
root [1] TMVA::mvas("dataset","TMVA.root");
root [2] canvas1->SaveAs("canvas1.pdf");     // save first canvas in a file

and in a similar way you can call the other functions defined in TMVAGUI. See the tmva/tmvagui/inc/TMVA and tmva/tmvagui/src directories for the list of available functions


Hi moneta,

thanks for you reply. Actually the “-b” flag is the solution for my problem, I completely forgot that.

Thanks again!