{ auto f = new TFile("f.root", "update"); auto t_old = (TTree*)f->Get("t"); t_old->SetName("t_old"); t_old->SetBranchStatus("a", 0); int a=0, b=0; auto t = t_old->CloneTree(0); t->SetName("t"); t->Branch("a", &a, "a/I"); a = 2; t->Fill(); delete t_old; t->Write("", TObject::kWriteDelete); f->Close(); }