# TMVA::mvaeffs crashes when disabling graphical output

**URL:** <https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198>\
**Category:** TMVA\
**Tags:** graphics\
**Created:** [July 2, 2020, 11:44am UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198 "2020-07-02T11:44:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruizvid](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jruizvid](https://root-forum.cern.ch/u/jruizvid)\
**Post date:** [July 2, 2020, 11:44am UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/1 "2020-07-02T11:44:26Z")

</div>

Dear ROOT experts,

I want to save the plots from the tmva macros without printing them out. However `TMVA::mvaeffs` triggers segmentation violation if the graphical output is disabled with `gROOT->SetBatch(kTRUE)`.

```auto
#include <TMVA/mvas.h>
#include <TMVA/mvaeffs.h>
#include <TFile.h>
#include <TMVA/Types.h> 

void tmva_plot(std::string infilename) {

    gROOT->SetBatch(kTRUE);

    TFile* myFile = TFile::Open(infilename.c_str());
    std::cout << myFile << std::endl;
    
    TMVA::mvas("dataset", infilename, static_cast<TMVA::HistType>(3));
    TMVA::mvaeffs("dataset", infilename);}

```

If I run first with graphical output and, without closing the root session, again without it, it works fine. Also if `gROOT->SetBatch(kTRUE);` is placed inbetween `mvas` and `mvaeffs` it also works.

Maybe it is related to the problem reported [here](https://root-forum.cern.ch/t/tmva-problem-tmvagui-c-crashing/12363/5) and fixed [here](https://sft.its.cern.ch/jira/browse/ROOT-9483).

Analysed file: [TMVA.root](https://root-forum.cern.ch/uploads/short-url/95fV7Zerd7nNGKAcgKyLX5hizBJ.root) (2.2 MB)

Thank you in advance,  
Joan

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [July 2, 2020, 2:16pm UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/2 "2020-07-02T14:16:13Z")

</div>

@moneta Can you help?

---

<div class="post-metadata">

**Author:** ![jruizvid](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jruizvid](https://root-forum.cern.ch/u/jruizvid)\
**Post date:** [September 25, 2020, 4:50pm UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/3 "2020-09-25T16:50:36Z")

</div>

Hi. I’m running scans in a remote machine changing the BDT parameters. It would be significantly faster if I could run in batch mode (and still create the TMVA::mvaeffs plot).

I would appreciate any suggestion to solve the problem posted above.

---

<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:** [September 28, 2020, 6:25am UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/4 "2020-09-28T06:25:29Z")

</div>

@swunsch @moneta could you please take a look again? Thanks a lot!

---

<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:** [September 28, 2020, 1:05pm UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/5 "2020-09-28T13:05:54Z")

</div>

Hi,

Sorry for the late reply. I have created a PR fixing the problem of running in batch.  
See [https://github.com/root-project/root/pull/6485](https://github.com/root-project/root/pull/6485)

However the issue reported in [https://sft.its.cern.ch/jira/browse/ROOT-9483](https://sft.its.cern.ch/jira/browse/ROOT-9483) is still present.  
I have created a new one showing the real cause : [https://github.com/root-project/root/issues/6483](https://github.com/root-project/root/issues/6483)

Thank you for reporting this  
Lorenzo

---

<div class="post-metadata">

**Author:** ![jruizvid](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@jruizvid](https://root-forum.cern.ch/u/jruizvid)\
**Post date:** [September 28, 2020, 1:38pm UTC](https://root-forum.cern.ch/t/tmva-mvaeffs-crashes-when-disabling-graphical-output/40198/6 "2020-09-28T13:38:54Z")

</div>

Hi Lorenzo,  
thank you for your time. I’m eager to get to use the version with the fix.  
Joan
