Home | News | Documentation | Download

Multiple INPUT files

Dear people
I would like to know how to get multiple input files in TMVA. For example
TFile *input(0);
TString fname = “./tmva_class_example.root”;
if (!gSystem->AccessPathName( fname )) {
input = TFile::Open( fname ); // check if file in local directory exists
}
else {
TFile::SetCacheFileDir(".");
input = TFile::Open(“http://root.cern.ch/files/tmva_class_example.root”, “CACHEREAD”);
}
if (!input) {
std::cout << “ERROR: could not open data file” << std::endl;
exit(1);
}
std::cout << "— TMVAClassification : Using input file: " << input->GetName() << std::endl;

// Register the training and test trees

TTree signalTree = (TTree)input->Get(“TreeS”);
TTree background = (TTree)input->Get(“TreeB”);

Here if you see only one input file is taken i.e TMVA class example.root How to get multiple root files as input?

Regards Rithish

Hi,
please check out Posting code? Read this first to make your code snippets a bit more readable.

@moneta knows more but I think you can use a TChain to concatenate multiple TTrees and then you can pass a TChain to TMVA.

Cheers,
Enrico

Hi,

You can use the TChain, but you can also add an arbitrary number of signal and background trees when using DataLoader::AddSignalTree and DataLoader::AddBackgroundTree

Lorenzo