Hi Zhou, Remove the statement: gFile->cd(); // go back to the top directory Rene Brun Zhou Zhang wrote: > > Hi rooters, > > I have a root file which contains some ntuples. Now I want to write a > macro to do some analysis on these ntuples and put the results which are > also some histograms and ntuples under a created analysis subdirectory > which are associated with the root file. My macro is such as: > { > TFile* f = new TFile("data.root"); > > f->mkdir("analysis");// make a subdirectory to hold the result > > f->cd("analysis"); // change to the created subdirectory > > TH1F* p1 = TH1F("h1","h1",100, 0., 120.); //create some result histograms > TH1F* p2 = TH1F("h2","h2",100, 0., 1000.); > TH1F* p3 = TH1F("h3","h3",100, 0., 10.); > > gFile->cd(); // go back to the top directory > nt1->Project("h1","t0"); //fill the histogram in the subdirectory > > } > > It failed because h1 is not in the current directory. But I don't know how > to specify the path for the h1. Who could tell me how to do it? > > regards, > > zhou
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET