You need something like this : void doThePlots(myPlotName) { TObject *R2Plot = 0; TFile esigFile("plots/esigtightPlots.root"); TFile offresFile("plots/offrestightall.root"); R2Plot = esigFile->Get(myPlotName); R2Plot->Draw(); R2Plot = offresFile->Get(myPlotName); R2Plot->Draw("SAME"); } ----- Original Message ----- From: "Edward Chen" <edward@SLAC.stanford.edu> To: <roottalk@pcroot.cern.ch> Sent: Thursday, September 05, 2002 11:40 PM Subject: [ROOT] Question about accessing multiple files > Hi - I'm trying to write a macro which will automate the following > procedure: Access histograms of the same name from multiple files. > > Right now, for example, I have: > > { > TFile esigFile("plots/esigtightPlots.root"); > TFile offresFile("plots/offrestightall.root"); > esigFile.cd(); > R2Plot->Draw(); > offresFile.cd(); > R2Plot->Draw("SAME"); > > //Save to postscript > } > > Now - I'd like to do this with many different plots in the same file. > > So I'd have a macro that would look something like this: > > doThePlots(myPlotName) > > or something like that. doThePlots would encapsulate the code above, but > be general enough to account for any plot name. I'm just not sure how to > get the histogram from some directory using its name. > > How would I do this? Thanks. > > -Ed >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:08 MET