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