Home | News | Documentation | Download

TMVA problem: TMVAGui.C crashing

This is in the latest version in the SVN. TMVAClassification.C works fine (the weights folder looks ok, with all the xml files filled) but when it launches the GUI (or when I run TMVAGui.C separately) and I try clicking on any of the buttons, I get a bus error:

*** Break *** bus error



===========================================================
There was a crash (#4 0x008e7ce8 in SigHandler ()).
This is the entire stack trace of all threads:
===========================================================

Thread 1 (process 45829 thread 0x10b):
#0  0x906a5189 in wait4 ()
#1  0x906a2cd4 in system$UNIX2003 ()
#2  0x008e9638 in TUnixSystem::StackTrace ()
#3  0x008e7b7f in TUnixSystem::DispatchSignals ()
#4  0x008e7ce8 in SigHandler ()
#5  <signal handler called>
#6  0x0082e5e8 in TObject::TObject ()
#7  0x0082db77 in TNamed::TNamed ()
#8  0x00853be1 in TStyle::TStyle ()
#9  0x0096e061 in G__G__Base1_241_0_3 ()
#10 0x0100fd52 in Cint::G__ExceptionWrapper ()
#11 0x010e9161 in G__execute_call ()
#12 0x010e95f6 in G__call_cppfunc ()
#13 0x010b8440 in G__interpret_func ()
#14 0x010a9092 in G__getfunction ()
#15 0x010e24c2 in G__new_operator ()
#16 0x0107dbf6 in G__getexpr ()
#17 0x01080abf in G__getexpr ()
#18 0x0111a472 in G__exec_statement ()
#19 0x010ba329 in G__interpret_func ()
#20 0x010a9092 in G__getfunction ()
#21 0x01073ff4 in G__getitem ()
#22 0x01076474 in G__getexpr ()
#23 0x0111feb3 in G__exec_statement ()
#24 0x010ba329 in G__interpret_func ()
#25 0x010a9092 in G__getfunction ()
#26 0x01073ff4 in G__getitem ()
#27 0x01076474 in G__getexpr ()
#28 0x0111feb3 in G__exec_statement ()
#29 0x010ba329 in G__interpret_func ()
#30 0x010a8ece in G__getfunction ()
#31 0x01073ff4 in G__getitem ()
#32 0x01076474 in G__getexpr ()
#33 0x01087b62 in G__calc_internal ()
#34 0x01133c11 in G__process_cmd ()
#35 0x008a6ebc in TCint::ProcessLine ()
#36 0x008a4c9f in TCint::ProcessLineSynch ()
#37 0x00805afd in TApplication::ExecuteFile ()
#38 0x00804249 in TApplication::ProcessLine ()
#39 0x01713635 in TControlBarButton::Action ()
#40 0x02fd36e1 in TRootControlBar::ProcessMessage ()
#41 0x02f0e076 in TGFrame::HandleClientMessage ()
#42 0x02f104f7 in TGMainFrame::HandleClientMessage ()
#43 0x02f10dba in TGFrame::HandleEvent ()
#44 0x02ed7852 in TGClient::HandleEvent ()
#45 0x02ed79ac in TGClient::ProcessOneEvent ()
#46 0x02ed79fd in TGClient::HandleInput ()
#47 0x02ed7a24 in TGInputHandler::Notify ()
#48 0x008e8027 in TUnixSystem::DispatchOneEvent ()
#49 0x0085f433 in TSystem::InnerLoop ()
#50 0x00861c1b in TSystem::Run ()
#51 0x00801733 in TApplication::Run ()
#52 0x000339be in TRint::Run ()
#53 0x00001b8e in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x0082e5e8 in TObject::TObject ()
#7  0x0082db77 in TNamed::TNamed ()
#8  0x00853be1 in TStyle::TStyle ()
===========================================================

Thanks so much for your help.

I have had the same problem. Apparently for some strange reason, the default style names have changed to lowercase names. tmvaglob.C assumes the existence of style “Plain” and crashes. The style is now called “plain”. Don’t ask me why. I just noticed that it is like that.

You need to go into tmvaglob.C, look for “Plain” and change it to “plain”. You need to do the same with mvaeffs.C. That makes it work for me. Good luck.
Simon

ps. both files are in $ROOTSYS/tmva/test

So I was trying to debug this, but to no avail.

Firstly, I am running a compiled version to plot TMVA efficiencies.

The following works:

#include <string>
#include <TString.h>
#include <TMVA/Factory.h>
#include <TMVA/mvas.h>
#include <TMVA/mvaeffs.h>
#include <TMVA/efficiencies.h>
#include <TMVA/correlations.h>
#include <TMVA/variables.h>
#include <TTree.h>
#include <TFile.h>
#include <TMVA/Types.h>

void tmva_plot(std::string infilename) {

    // don't change the order of the function calls, some don't
    // work otherwise (no idea why)

    // HistType 3 is overtraining plot
    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);
    TMVA::efficiencies("dataset", infilename);
    TMVA::correlations("dataset", infilename);
    TMVA::variables("dataset", infilename);
}

int main(int argc, char const *argv[]) {
    if (argc != 2) {
        return 1;
    }
    std::string infilename(argv[1]);
    tmva_plot(infilename);
    return 0;
}

But the following doesn’t:

#include <string>
#include <TString.h>
#include <TMVA/Factory.h>
#include <TMVA/mvas.h>
#include <TMVA/mvaeffs.h>
#include <TMVA/efficiencies.h>
#include <TMVA/correlations.h>
#include <TMVA/variables.h>
#include <TTree.h>
#include <TFile.h>
#include <TMVA/Types.h>

void tmva_plot(std::string infilename) {

    // don't change the order of the function calls, some don't
    // work otherwise (no idea why)

    // HistType 3 is overtraining plot
    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);
    TMVA::efficiencies("dataset", infilename);
    TMVA::correlations("dataset", infilename);
    TMVA::variables("dataset", infilename);
}

int main(int argc, char const *argv[]) {
    if (argc != 2) {
        return 1;
    }
    std::string infilename(argv[1]);
    tmva_plot(infilename);
    return 0;
}

I tried to pull the style from gROOT with TStyle *TMVAStyle = new TStyle(*gROOT->GetStyle("Plain")); and that style does exist. If I use “plain” it returns a nullptr
I also listed the styles like so:

root [0] TSeqCollection * styles = gROOT->GetListOfStyles()
root [1] styles->GetSize()
(int) 7
root [2] styles->Print()
Collection name='Styles', class='TList', size=7
 OBJ: TStyle	Plain	Plain Style (no colors/fill areas)
 OBJ: TStyle	Bold	Bold Style
 OBJ: TStyle	Video	Style for video presentation histograms
 OBJ: TStyle	Pub	Style for Publications
 OBJ: TStyle	Classic	Classic Style
 OBJ: TStyle	Default	Equivalent to Classic
 OBJ: TStyle	Modern	Modern Style

So the style is correctly named. I also tried running with TMVA::mvaeffs("dataset", infilename, kFALSE); to switch off the TMVAStyle and the subsequent call to gROOT->GetStyle(), but I still get the segmentation fault. The problem must be somewhere, else and this is probably a bug. I am running ROOT 6.10.04.

EDIT: Forgot to post the error.
The exact error I get when I compile with -ggdb is

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fde2bccaee7 in waitpid () from /usr/lib/libc.so.6
#1  0x00007fde2bc48c3f in do_system () from /usr/lib/libc.so.6
#2  0x00007fde2cfa5b64 in TUnixSystem::StackTrace() () from /usr/lib/root/libCore.so
#3  0x00007fde2cfa829e in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/root/libCore.so
#4  <signal handler called>
#5  0x00007fde29e42cb0 in TGClient::GetRoot() const () from /usr/lib/root/libGui.so
#6  0x00007fde2c59887c in TMVA::mvaeffs(TString, TString, bool, TString) () from /usr/lib/root/libTMVAGui.so
#7  0x000055e6f6ee3b7c in tmva_plot (infilename="TMVA.root") at src/TMVAPlot.cpp:26
#8  0x000055e6f6ee3d56 in main (argc=2, argv=0x7ffcf2e369f8) at src/TMVAPlot.cpp:34
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007fde29e42cb0 in TGClient::GetRoot() const () from /usr/lib/root/libGui.so
#6  0x00007fde2c59887c in TMVA::mvaeffs(TString, TString, bool, TString) () from /usr/lib/root/libTMVAGui.so
#7  0x000055e6f6ee3b7c in tmva_plot (infilename="TMVA.root") at src/TMVAPlot.cpp:26
#8  0x000055e6f6ee3d56 in main (argc=2, argv=0x7ffcf2e369f8) at src/TMVAPlot.cpp:34
===========================================================

Unfortunately, I don’t have time to compile all of ROOT with that flag at the moment to debug further.

Hi, sorry for the late reply.

Could you post this as a new topic instead of resurrecting a 6 year old one :slight_smile:

If you could provide an input file that provokes the error that would be really helpful in debugging.

Cheers,
Kim

Hi,

I thought it would be better to continue on the issue itself rather than spam with newer and newer topics, but if you insist it’s not a problem.

What input file do you require exactly? The TMVA.root or the trained BDT files (*.xml,*.C) or something else?

Regards,
Konstantin

I need theTMVA.root to be able to debug effectively. If possible, the file should be small.

Cheers,
Kim

sorry, somehow missed this. I’m attaching the TMVA.root

Hi,

Thank you for uploading the file. I could run succesfully the TMVAGui and plot the ova efficiencies.
Can you remind me please what exactly is your problem ?

Thank you

Lorenzo

Hi,

The issue was a bug in how the TMVA GUI behaves when compiled in a stand-alone macros. In particular, when running the TMVA GUI in the ROOT environment, there is an implicit graphics context set up that is missing when running outside of the environment. A fix will be integrated in the development version of ROOT as soon as possible (available in v.6.16).

Do note that it is possible to run your program with root -l 'tmva_plot.C("filename.root")' just fine. This because the graphics context is then initialised by ROOT.

Cheers,
Kim