{ TFile *f = TFile::Open("/tmp/tarrade/user.FabienTarrade.data10_7TeV.periodF.physics_Egamma.PhysCont.AOD.t0pro04_v01.D3PD_DILEP-09-2010_1_GRL.100908171907/user.FabienTarrade.005646.AANT._00479.root"); T = (TTree*)f->Get("physics"); TTreePerfStats *ps = new TTreePerfStats("ioperf",T); Long64_t n = T->GetEntries(); std::string name_file_histo="TEST.root"; TFile *fout=new TFile(name_file_histo.c_str(),"recreate"); //Imagine I put a lot of TH1 in file.root fout->Close(); T->Draw("el_E"); // I want to add TTreePerfStats in my previous TEST.root std::string name_file_histo="TEST.root"; TFile *fout=new TFile(name_file_histo.c_str(),"recreate"); ps->Finish(); ps->Write(); fout->Write(); fout->Close(); }