I’m trying to “horizontally” merge two TChains, keeping only some of the variables and at the same time applying a TCut.
How I do that:
0) read in data:
TChain *chain1 = new TChain(“Tree1”);
TChain *chain2 = new TChain(“Tree2”);
- I add the second TChain to the first using TFriend:
- Then using SetBranchStatus I keep only the branches I want.
- Then I copy the tree using the TCut:
TTree *newTree = chain->CopyTree(myTCut)
- I save newTree:
TFile *fout = new TFile(“outputfile.root”,“recreate”);
So here is the problem: I want to get rid of inputfile2.root, but my final newTree still “knows” about it.
(In fact, the real proble is this: When I read in newTree and I do newTree->SetAlias(“SomeNewName”, “5. * existing_branch_from_chain1”); I get error message that my inputfile2.root is missing.)
How to reproduce:
- get the attached files, put them in one directory.
- root -q macro.C
- remove inputfile2.root
- root -r macro_error.C