Make a clone of a TChain in a TTree and filling it, in case the TChain is very big : crash

Hello. A colleagues has the following problem.
The purpose is to modify the value of a variable in a TChain.

He clones a TChain : thechain->CloneTree(0)
then he fills it.

At the end, when printing the content of the cloned tree, it crashes with :
Fatal in TBufferFile::AutoExpand: Request to expand to a negative size, likely due to an integer overflow: 0x80007cf2 for a max of 0x7ffffffe.

there is no minimum program.
The problematic part is :

  TTree* tree_reweighted_gamgam_like = chain_MC_gamgam->CloneTree(0);
  
  for (int index_entry = 0; index_entry < nb_entries; index_entry++) { 
    Long64_t centry = chain_MC_gamgam->LoadTree(index_entry);  
    if (centry < 0)
      continue;  
    
    chain_MC_gamgam->GetEntry(index_entry); 

    if (string_process != "gammagamma") 
      weight_total *= f_reweight_shape->Eval(m_yy);

    sum_weights += weight_total;

    tree_reweighted_gamgam_like->Fill(); //the tree contains the variable weight_total, that needs to be update with respect to the original value in chain_MC_gamgam
  } //end loop on entries

  tree_reweighted_gamgam_like->Print();

Thank you for any help


Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.18.00
Platform: unix
Compiler: root


Does hadd work correctly on the files in questions?
Can you try the following tweak:

  chain_MC_gamgam->GetEntry(0);
  TTree* tree_reweighted_gamgam_like = chain_MC_gamgam->CloneTree(0);

Thank you Philippe for your kind help.
Here are the answers :

  1. *The hadd commands works correctly.

  2. Adding chain_MC_gamgam->GetEntry(0);
    just before
    TTree* tree_reweighted_gamgam_like = chain_MC_gamgam->CloneTree(0);

has no consequence : the program still crashes with same error message when doing :
tree_reweighted_gamgam_like->Print();

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Alright. The next thing to try is to get more information from valgrind:

valgrind --suppressions=$ROOTSYS/etc/valgrind-root.supp your_execuable your_arguments

This topic was automatically closed after 14 days. New replies are no longer allowed.