void AddBranch() { TFile f("Fakes_Muons.root","update"); int isMuonStream; TTree *t = (TTree*)f.Get("mini"); TBranch *newBranch = t->Branch("isMuonStream",&isMuonStream,"isMuonStream/i"); //read the number of entries in the t3 int nentries = (int)t->GetEntries(); for (int i = 0; i < nentries; i++){ isMuonStream = 1; newBranch->Fill(); } t->Write("",TObject::kOverwrite); // save only the new version of the tree f.Close(); TFile f2("Fakes_Egamma.root","update"); TTree *t2 = (TTree*)f2.Get("mini"); TBranch *newBranch2 = t2->Branch("isMuonStream",&isMuonStream,"isMuonStream/i"); //read the number of entries in the t3 int nentries2 = (int)t2->GetEntries(); for (int i = 0; i < nentries2; i++){ isMuonStream = 0; newBranch2->Fill(); } t2->Write("",TObject::kOverwrite); // save only the new version of the tree }