Hello, I have a problem with a histogram in memory. Even if I do a Reset("a") it stays there and is not reread from the file. In the following macro I read a histogram from a file and print it. If I do _not_ exit the interpreter the content of the bin grows. To get the correct result I can only call this histogram once. How can I force the interpreter to reread the histogram from the file? Tschuess Stefan ========================================================= // void historeload() { char *filename="reloadtest.root"; gROOT->Reset("a"); TFile *file = new TFile(filename,"READ"); file->SetName("inputfile"); if (file->IsZombie()){ TFile *file = new TFile(filename,"RECREATE"); TH1F *histo = new TH1F("histo","Histo",2,-0.5,1.5); histo->SetBinContent(2,1); histo->Print("all"); file->Write(); file->Close(); } else{ use_file(); } return; } void use_file() { TFile *file = (TFile*)gROOT->FindObject("inputfile"); TH1F *histo = (TH1F*)file->Get("histo"); histo->Print("all"); histo->SetBinContent(2,1+histo->GetBinContent(2)); histo->Print("all"); } ========================================================= ********* Stefan Stonjek ********* ***** DESY / ZEUS ***** ***** Stefan.Stonjek@desy.de ***** ********* Tel.: +49-40-8998-3159 *********
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET