TMVA::DataLoader output, "Directory for all <method name> methods"


I have a question regarding the description of TMVA output directories labeled as above in quotation in the topic’s titles. The description makes me think that given a single TMVA::DataLoader object I can save multiple bookings of a method into a directory labeled with this description. How would I go about doing this? For example, say I want to save multiple bookings of the Fisher method in such a directory, running TMVA with a macro having the following lines gives me an error saying that two bookings can’t have the same name:

TMVA::DataLoader * dl = new TMVA::DataLoader("TMVAResults");

TFile TMVAOutFile("TMVAOutFile.root");

TMVA::Factory * factory = new TMVA::Factory("TMVAFactory", & TMVAOutFile, "V");

factory -> BookMethod(dl, TMVA::Types::kFisher, "Fisher");
factory -> BookMethod(dl, TMVA::Types::kFisher, "Fisher", "<options>");

Trying to refer to the TMVA Users Guide, I thought maybe if I were to instead book the above methods as “Fisher_1” and “Fisher_2” instead of both as “Fisher”, they could be saved under the same TDirectoryFile “Method_Fisher”, but instead they get saved under individual TDirectoryFiles correspondingly named “Method_Fisher_1” and “Method_Fisher_2”, both of which have the description “Directory for all Fisher methods”.


You can use the same method, which is defined in your case, by TMVA::Types::kFisher, but with different names (e.g. “Fisher_1”,“Fisher_2”, etc…)
The name (defined as a string) that is passed in BookMethod is defined by the user.
The output files then will contained two directories :
TMVAResults/Method_Fisher_1 and TMVAResults/Method_Fisher_2


Hello Lorenzo,

Thank you for your response.

Asking for further clarification, does what you are saying apply just as well with a change in index label? For example, if instead of indexing with 1, 2, 3, etc. (“Fisher_1”, “Fisher_2”, “Fisher_3”, …) we were to indeed with A, B, C, etc. (“Fisher_A”, “Fisher_B”, “Fisher_C”, …) the result would be the same in that each method would result in an individual directory?

What I am wondering about is with a set of methods of the same type, for example types “Fisher_1”, “Fisher_2”, etc. of type TMVA::Types::kFisher, is it possible to have the methods share the same directory? For example, TMVAResults/Method_Fisher/Fisher_1, TMVAResults/Method_Fisher/Fisher_2, etc?

So looking at the class reference page for TMVA::Factory, it looks like the behavior I may be looking for is with some TString field “theNameAppendix” which can be called with the third argument TString “theOption” in the function TMVA:: Factory ::BookMethod(). How is “theNameAppendix” invoked? Would it be something like

factory -> BookMethod(dl, TMVA::Types::kFisher, "Fisher", "theNameAppendix=Fisher_1::theNameAppendix=Fisher_2:Mahalanobis");

Behaviorwise, what I want to then get is a directory “Method_Fisher” with two directories inside of it named “Fisher_1” and “Fisher_2”.

The reason for wanting this is that when TMVA::TMVAGui() is called for a file written with TMVA::Factory() objects, buttons (7)-(13) don’t work with slight variances of the TString field “theMethodTitle”. For example, if I book two BDT methods with titles “BDT_1” and “BDT_2”, they are saved under separate TDirectories “Method_BDT_1/BDT_1” and “Method_BDT_2/BDT_2”. neither of which works with the button labeled"(10) Decisions Trees (BDT)". Clicking on this button with these two methods results in the error output:

+++ Could not locate directory 'Method_BDT
Could not locate directory 'Method_BDT' in file <filename.root>

I think this error could be side-stepped if the two methods could instead be saved under TDirectories “Method_BDT/1” and “Method_BDT/2”.

I still have yet to find a satisfactory answer to this. This page seems to suggest that it is doable, but the code used isn’t linked and so I can’t reference it.