Error when running TMVAGUI.C

Hello,

I was trying to analyze test.root (a BDT), using TMVAGUI.C, and this error popped up:

--- Launch TMVA GUI to view input file: test.root
Warning in <TFile::Init>: file test.root probably not closed, trying to recover
Info in <TFile::Recover>: test.root, recovered key TH2F:CorrelationMatrixS at address 214
Info in <TFile::Recover>: test.root, recovered key TH2F:CorrelationMatrixB at address 668
Info in <TFile::Recover>: test.root, recovered key TDirectoryFile:InputVariables_Id at address 1131
Info in <TFile::Recover>: test.root, recovered key TDirectoryFile:InputVariables_Deco at address 23302
Info in <TFile::Recover>: test.root, recovered key TDirectoryFile:InputVariables_PCA at address 45522
Info in <TFile::Recover>: test.root, recovered key TDirectoryFile:InputVariables_Gauss_Deco at address 68694
Info in <TFile::Recover>: test.root, recovered key TDirectoryFile:Method_BDT at address 86288
Info in <TFile::Recover>: test.root, recovered key TTree:TestTree at address 484730
Info in <TFile::Recover>: test.root, recovered key TTree:TrainTree at address 597288
Warning in <TFile::Init>: successfully recovered 9 keys
=== Note: inactive buttons indicate classifiers that were not trained, ===
===       or functionalities that were not invoked during the training ===

test.root is from this TMVA tutorial: https://indico.scc.kit.edu/indico/event/48/session/4/contribution/35/material/slides/0.pdf

and the relevant files:
test.root (584.2 KB)
TMVAGui.C (11.6 KB)

I’ve tried to run the script from inside and outside of test.root, with no difference, and I’m not really sure whats the problem.

Hi

The problem is in the output file resulting from your previous macro where you trained and test TMVA methods.
The file was not closed properly. Maybe there were some problems before completing the macro.
You should look at its output and understand the problem. You should call

outputFile->Close();

after having called factory->EvaluateAllMethods(), as it is done in the tutorial
tmva/TMVAClassification.C

Best Regards

Lorenzo

Looking better, I see that it seems you are using the macro , trainBDT.py from
https://www.dropbox.com/sh/scualho2zcv83hh/AAAnsm-gAqRa-5lX7uPwMH3Ga?preview=trainBDT.py

you need to add this line at the end of the macro

fout.Close()

Lorenzo

1 Like

Works like a charm!

Thank you!