ROOT TMVA filling histogram error

Hello experts,

I’ve been having issues getting my TMVA BDT to work. Currently, there is a final fatal error due to the number of entries somehow being <=0. I’ve also been having issues where certain entries are having an input issue, which I’m not sure how to resolve. As far as I know, there should not be nan values for the BDT input variables, but other variables within the TTree may have nan values. How should these be resolved? I’ve attached a google docs link with access to the input root files and the terminal output I currently get as follows, as these files are too large to upload here.


ROOT Version: 6.26/14
Platform: Red Hat Enterprise Linux 9 v9.6
Compiler: gcc (GCC) 14.1.0


Bzptn_e_belle_tmva.C (4.8 KB)


Put the creation of the output file (where you want to write the new tree(s)) after opening other (input) files; basically, TTrees (and other ROOT objects) belong to the last TFile you have opened by the point where you create the TTree, etc.; you can change that but in this case you can simply move the lines as I mentioned:

//...
    // Activate TMVA
    TMVA::Tools::Instance();

    // Open input file
    TFile* inputFile_train = TFile::Open("SLptn_e_mix_sig_train_belle.root");
    TFile* inputFile_test = TFile::Open("SLptn_e_mix_sig_test_belle.root");


    // to get access to the GUI and all tmva macros
    //TString tmva_dir(TString(gRootDir) + "/tmva");
    //if(gSystem->Getenv("TMVASYS"))
    //    tmva_dir = TString(gSystem->Getenv("TMVASYS"));
    //gROOT->SetMacroPath(tmva_dir + "/test/:" + gROOT->GetMacroPath() );
    //gROOT->ProcessLine(".L TMVAGui.C");

    // Output file for TMVA
    TString outfileName(filename);
    TFile* outputFile = TFile::Open( outfileName, "RECREATE" );
//...

Thanks, this has worked to solve the problem!