Hello,
I have 2 root files, both containing single trees with the same name/structure,
that I’d like to merge into 1 tree in 1 root file.
The tree in file X contains 75,427 events; the tree in file Y contains
28,918.
I’d like the merged tree to contain 28,918 events from X and 28,918 events
from Y.
The following lines successfully do the merge, but I have 75,427 X +
28,918 Y (as one would expect), rather than 28,918 X + 28,918 Y:
TChain* chain = new TChain(“fitTree”);
chain->Add(“X.root”);
chain->Add(“Y.root”);
TFile* rootFile = new TFile(“XPlusYMerged.root”,“RECREATE”);
chain->Merge(“XPlusYMerged.root”);
rootFile->Write();
Now, tab completing in ROOT gives:
root [1] chain->Add(
Int_t Add(TChain* chain)
Int_t Add(const char* name, Long64_t nentries = kBigNumber)
However, having taken a look at root.cern.ch/root/html//TChain.html#TChain%3AAdd,
I’m struggling to understand exactly how to use the second argument … I’ve tried a few possibilities, but with unexpected and unwanted results. I’m not even sure whether this is the correct method/argument to use …
Could anybody offer any help?
Many thanks,
Jim.