TMVA: Macro to plot final signal/background distributions?

I wonder is there is any macro available in TMVA package which
plot the input variables after a cut is chosen on the output variable of a particular (already trained) classifier.

TMVAGui.C is actually fantastic tool to easily access to a bunch of macros, but I really miss a button which shows these final distributions for signal and background events on the EVALUATION sample after the desired cut is applied on the classifier.

I would appreciate any advices or comment in this respect.


no I’m sorry, this option does not exist as such. BUT, the test tree that is written out by default has the
MVA-values of the different methods added for each event. Hence…

a simple loop over this ntuple with the “desired” cut on the MVA value gives exactly what you want… maybe we could think of providing a macro for that… I’ll keep it in mind…




There is no dedicated macro, but in the output-file (default name: TMVA.root) you find a “TestTree” with the input-variables and the classifier output (and the true class) for all events.

You can do something like:

root -l TMVA.root

… where myvar1 would be the variable you want to look at and 0.3 would be the cut on the classifier output you choose.


Thanks for your responses.
I know is always possible to make these plots by your own.
However, providing that we have this fantastic macro to easy inspect a bunch of features of our particular pattern recognition problem, I think that this functionality of watching final distributions after the cut is missing.
It is really easy to implement, by the way, and I think the users would appreciate that.
Take into account that is always very important to see what the cut does to the original distributions.

Let me, please, correct Peter’s piece of code. What I was looking for is actually the following:

TestTree->SetLineColor(kRed); TestTree->Draw("myvar1","LD>0.3 && class==0",""); TestTree->SetLineColor(kBlue); TestTree->Draw("myvar1","LD>0.3 && class==1","same");
which draws signal (class==0) and background (class==1) distributions for a certain cut (specified by LD>0.3).