Home | News | Documentation | Download

TMVA::mvaeffs crashes when disabling graphical output

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).

#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 and fixed here.

Analysed file: TMVA.root (2.2 MB)

Thank you in advance,
Joan

@moneta Can you help?

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.

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

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

However the issue reported in 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

Thank you for reporting this
Lorenzo

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