Menu

#15 TChain input has entries limit?

open
General (13)
5
2010-01-20
2010-01-14
No

It seems when I set the input trees, the call of function "factory->SetInputTrees(tree,sigCut,bkgCut)" will crash if the FIRST file added to the TChain has more than 100k(?) entries. Currently my workaround is to make a dummy file with only 1 events, and always add this dummy before the real input files, with a cut to practically avoid it. Is this bug/feature awared? The release is V4.0.3 with ROOT 5.22

Discussion

  • Eckhard von Toerne

    Hi Jiahang,

    I can reproduce your problem. The root of the problem is that TMVA creates a copy of the user trees if a tree is provided with a cut condition. TMVA uses TTree::CopyTree for this.
    I the input tree is very large this might cause memory problems and generate warning messages such as:
    >>Error in <TTree::Fill>: Failed filling branch:tree.var1, nbytes=-1
    >>This error is symptomatic of a Tree created as a memory-resident Tree ...

    The feature that you observe and the difference between trees and chains is an unexpected feature of TTree::CopyTree. I reported this issue to ROOT and provided a TMVA independent example of the problem. The bug report can be found here:
    https://savannah.cern.ch/bugs/?61614

    I suggest a workaround for the problem. I think it would be better to create two file-resident trees from the original TTree and then to pass them on to TMVA via TMVA::Factory::AddTree
    This will work for trees of all sizes.

    An example on how to create file-resident copies of trees:
    TFile* dataFile = TFile::Open( "input.root");
    TTree* tree = dataFile->Get( "your TREEs NAME" );
    TFile* outFile = TFile::Open( "output.root","RECREATE");
    copyTree = tree->CopyTree("var1>0.3", "myCopy");
    outFile->Write();
    outFile->Close();

     
  • Eckhard von Toerne

    • assigned_to: nobody --> evtoerne
     

Log in to post a comment.

Monday.com Logo