Writing part of the TMVA screen output in a file

I am doing BDT analysis with multiple backgrounds and multiple points in the signal phase-space (one at a time). Currently, I am optimising the analysis with the following line


So, I wanted to know if the responses (like the one below) to the above line can be written in an ASCII file for different signal files.

Or, maybe if it is possible all the signal files be fed ad analysed and printed in a similar table with each row having info on each signal file.

Appreciate any help.



You can alway re-direct the output to a file, or alternatively you can take the original code from root/mvaeffs.cxx at master · root-project/root · GitHub
and create a similar functions, and customise as you prefer.


Thank you so much @moneta for the help.

So, I tried writing a function exactly the same as TMVA::StatDialogMVAEffs::PrintResults just with the modification that it prints in a given file instead of the screen (using cout). The first few lines are as follows:

void TMVA::StatDialogMVAEffs::WriteResults( const MethodInfo* info )
   ofstream fout;

Just wanted to know if I want to give the file name as an argument like void TMVA::StatDialogMVAEffs::WriteResults( const MethodInfo* info, TString fOut){
and want to feed it via the function TMVA::mvaeffs (adding an extra argument), how should I do this?

Could you please help me with this?

Thanks again.


You can add the string representing the fileName as a new data member of the StatDialogMVAEffs and you pass it in the constructor of the class.
For example:

void TMVA::mvaeffs(TString dataset, TString fin, Float_t nsignal, Float_t nbackground, Bool_t useTMVAStyle,TString formula, String fileOut) 
StatDialogMVAEffs* gGui = new StatDialogMVAEffs(dataset,
      (graphicsClient) ? graphicsClient->GetRoot() : nullptr, nsignal, nbackground, fileOut);

and you modiffy the class StatDialogMVAEffs to add the snew data member that can then be used in your new function WriteResults.