I have 2 root files with the same TTree inside (same branch, same name, etc), but with different number of entries.
I want another root file with the same structure, but with a part of entries of first file and a part of second file.
Is there a way to do it?
Thank you very much
Ciccio
sorry but is it possible to extend this method to more files?
I tried to extend to 8 files but I had some problems.
Until 3 files everything is ok, over I don’t have errors but I have an overlap of the histograms.
For example I have samples of higgs mass with different value, 100, 105, 115, 120, etc, but in the final file I have only 3 bins (100, 105, 115), and the last one is the overlap of the next samples (115 + 120 + 125 + etc).
Do you have any idea?
Regards
Ciccio
There is no inherent limitation on the number of files that can be written this way. In older version of ROOT, once a TTree reach 2Gb (by default) it switches over to a new file (closing the previous output TFile and rendering any pointer to it invalid). If this is the limit you are reaching your would see in your current file system directory file name ‘new_1.root’,‘new_2.root’,etc… and you can solve the problem by either increasing the limit:TTree::SetMaxTreeSize(200*1024*1024); // 200Mbor make sure to use the current TFile pointer when storing the TTree:T->GetCurrentFile()->Write();
delete T->GetCurrentFile(); // rather than delete f;