void treer() { TFile f("junk.root"); TCanvas c1; Int_t first = 0; while(1) { f.ReadKeys(); TTree *ntuple = (TTree*)f.Get("ntuple"); if (first == 0) ntuple->Draw("px>>hpx","","",10000000,first); else ntuple->Draw("px>>+hpx","","",10000000,first); first = (Int_t)ntuple->GetEntries(); delete ntuple; c1.Update(); gSystem->Sleep(1000); //sleep 1 second } }